/* Typing Trainer - Modern Minimal Dark Theme */
:root {
  --bg-color: #0b0f19;
  --surface-color: #151d2f;
  --surface-border: #222f49;
  --text-main: #f1f5f9;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --accent-cyan: #00e5ff;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --key-bg: #1e293b;
  --key-border: #334155;
  --key-active: #0284c7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 900px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ヘッダー */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, #00e5ff, #3b82f6);
  color: #000;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-controls {
  display: flex;
  gap: 10px;
}

.btn-ctrl {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-sub);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  background: var(--surface-border);
  color: var(--text-main);
}

.btn-ctrl.muted {
  color: var(--accent-red);
}

/* 苦手キー集中バー */
.focus-bar {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.focus-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}

.focus-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge-neutral {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-weak {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-key {
  font-weight: 700;
  color: #fca5a5;
  font-size: 0.9rem;
}

.badge-count {
  font-size: 0.75rem;
  color: var(--accent-red);
}

/* リアルタイムステータス */
.stats-bar {
  display: flex;
  justify-content: space-around;
  background: rgba(21, 29, 47, 0.5);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 10px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* タイピングステージ */
.stage {
  position: relative;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 240px;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- スタート前カウントダウンオーバーレイ --- */
.countdown-overlay {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  user-select: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.countdown-overlay.hidden {
  display: none !important;
}

.countdown-overlay.go-fade {
  opacity: 0;
  transform: scale(1.12);
  pointer-events: none;
}

.countdown-number {
  font-size: 4.8rem;
  font-weight: 900;
  line-height: 1;
  color: #00e5ff;
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.65), 0 4px 12px rgba(0, 0, 0, 0.6);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 2px;
}

.countdown-number.pop {
  animation: countdown-pop 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.countdown-number.go {
  font-size: 3.8rem;
  color: #fbbf24;
  text-shadow: 0 0 32px rgba(251, 191, 36, 0.8), 0 4px 12px rgba(0, 0, 0, 0.6);
  animation: countdown-go 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.countdown-sub {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 16px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.countdown-sub:empty {
  display: none;
}

@keyframes countdown-pop {
  0% {
    transform: scale(1.65);
    opacity: 0;
  }
  25% {
    transform: scale(1);
    opacity: 1;
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.88);
    opacity: 0.65;
  }
}

@keyframes countdown-go {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }
  45% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

/* 今回の弱点克服ターゲット通知 */
.target-badge-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.target-label {
  color: var(--accent-orange);
  font-weight: 600;
}

.target-key-pill {
  background: var(--accent-orange);
  color: #000;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* テキスト表示部 */
.sentence-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sentence-text {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.3;
}

.sentence-kana {
  font-size: 1.1rem;
  color: var(--text-sub);
  letter-spacing: 1px;
}

.romaji-guide {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.5rem;
  letter-spacing: 2px;
  margin-top: 6px;
  display: flex;
  align-items: center;
}

.romaji-completed {
  color: var(--accent-cyan);
  font-weight: 600;
}

.expected-char {
  color: #ffffff;
  background: rgba(0, 229, 255, 0.25);
  border-bottom: 3px solid var(--accent-cyan);
  border-radius: 2px 2px 0 0;
  font-weight: 700;
  animation: pulse-cursor 0.9s infinite alternate;
}

.expected-char:empty {
  display: none;
}

@keyframes pulse-cursor {
  from { background: rgba(0, 229, 255, 0.15); }
  to { background: rgba(0, 229, 255, 0.45); }
}

.romaji-remaining {
  color: var(--text-muted);
}

/* キーボードUI ＆ 運指ガイド */
.keyboard-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* リアルタイム指ガイドバー */
.finger-guide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 580px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fg-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-guide-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-guide-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.finger-guide-icon {
  font-size: 1rem;
}

.finger-guide-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.finger-guide-pill {
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 12px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --- 手のビジュアルグラフィック（10本指イメージ） --- */
.hands-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 36px;
  margin-top: 14px;
  padding: 6px 0 10px 0;
  min-height: 95px;
}

.hand {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.hands-space-gap {
  width: 24px;
}

.finger {
  width: 33px;
  background: #334155;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px 16px 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 8px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  user-select: none;
  position: relative;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* 自然な指の長さの比率 */
.finger-lp, .finger-rp { height: 56px; }  /* 小指 */
.finger-lr, .finger-rr { height: 74px; }  /* 薬指 */
.finger-lm, .finger-rm { height: 84px; }  /* 中指 */
.finger-li, .finger-ri { height: 72px; }  /* 人差し指 */
.finger-thumb { height: 44px; width: 34px; } /* 親指 */

.fn-name {
  pointer-events: none;
  font-size: 0.75rem;
}

/* 指がアクティブになった時のアニメーション ＆ 発光 */
.finger.active-finger {
  background: linear-gradient(180deg, #ff9800 0%, #f57c00 100%) !important;
  border-color: #ffe082 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  transform: translateY(-8px) scale(1.06) !important;
  box-shadow: 0 0 18px rgba(255, 152, 0, 0.85), 0 0 35px rgba(255, 152, 0, 0.45) !important;
  z-index: 5;
}

.finger.active-finger .fn-name {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* 指カラー定義（バッジ用・キー下線用・凡例用） */
.finger-pill-lp, .dot-lp { color: #f472b6 !important; background-color: rgba(244, 114, 182, 0.25) !important; border: 1px solid #f472b6 !important; }
.finger-pill-lr, .dot-lr { color: #fb923c !important; background-color: rgba(251, 146, 60, 0.25) !important; border: 1px solid #fb923c !important; }
.finger-pill-lm, .dot-lm { color: #facc15 !important; background-color: rgba(250, 204, 21, 0.25) !important; border: 1px solid #facc15 !important; }
.finger-pill-li, .dot-li { color: #4ade80 !important; background-color: rgba(74, 222, 128, 0.25) !important; border: 1px solid #4ade80 !important; }
.finger-pill-ri, .dot-ri { color: #38bdf8 !important; background-color: rgba(56, 189, 248, 0.25) !important; border: 1px solid #38bdf8 !important; }
.finger-pill-rm, .dot-rm { color: #818cf8 !important; background-color: rgba(129, 140, 248, 0.25) !important; border: 1px solid #818cf8 !important; }
.finger-pill-rr, .dot-rr { color: #c084fc !important; background-color: rgba(192, 132, 252, 0.25) !important; border: 1px solid #c084fc !important; }
.finger-pill-rp, .dot-rp { color: #fb7185 !important; background-color: rgba(251, 113, 133, 0.25) !important; border: 1px solid #fb7185 !important; }

/* 指ガイド凡例 */
.finger-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-hand-label {
  font-weight: 700;
  color: var(--text-sub);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-lp { background: #f472b6 !important; border-color: #f472b6 !important; }
.dot-lr { background: #fb923c !important; border-color: #fb923c !important; }
.dot-lm { background: #facc15 !important; border-color: #facc15 !important; }
.dot-li { background: #4ade80 !important; border-color: #4ade80 !important; }
.dot-ri { background: #38bdf8 !important; border-color: #38bdf8 !important; }
.dot-rm { background: #818cf8 !important; border-color: #818cf8 !important; }
.dot-rr { background: #c084fc !important; border-color: #c084fc !important; }
.dot-rp { background: #fb7185 !important; border-color: #fb7185 !important; }

.legend-sep {
  color: rgba(255, 255, 255, 0.2);
}

.kb-row {
  display: flex;
  gap: 6px;
}

.kb-row-0 {
  padding-left: 0;
}

.kb-row-1 {
  padding-left: 20px;
}

.kb-row-2 {
  padding-left: 34px;
}

.kb-row-3 {
  padding-left: 54px;
}

.kb-key {
  width: 44px;
  height: 44px;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.9rem;
  position: relative;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.home-key .home-bump {
  width: 8px;
  height: 2px;
  background: var(--text-muted);
  position: absolute;
  bottom: 6px;
  border-radius: 1px;
}

/* キー下部の担当指ライン */
.kb-key::before {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 1px;
  opacity: 0.85;
}

/* 手のイメージモードの時はキーの色分けラインを完全に非表示にする */
.keyboard-section.mode-hands .kb-key::before {
  display: none !important;
}

.kb-key[data-finger="lp"]::before { background: #f472b6; }
.kb-key[data-finger="lr"]::before { background: #fb923c; }
.kb-key[data-finger="lm"]::before { background: #facc15; }
.kb-key[data-finger="li"]::before { background: #4ade80; }
.kb-key[data-finger="ri"]::before { background: #38bdf8; }
.kb-key[data-finger="rm"]::before { background: #818cf8; }
.kb-key[data-finger="rr"]::before { background: #c084fc; }
.kb-key[data-finger="rp"]::before { background: #fb7185; }

/* --- ヒートマップ（ミスしたキー：控えめで上品な警告表示） --- */
.kb-key.heat-low {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
  color: #cbd5e1;
}
.kb-key.heat-low::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-orange);
}

.kb-key.heat-mid {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f1f5f9;
}
.kb-key.heat-mid::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 5px #ef4444;
}

.kb-key.heat-high {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.7);
  color: #ffffff;
}
.kb-key.heat-high::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

/* --- 次に打つべきキー（最優先・圧倒的に目立たせる） --- */
.kb-key.active-next {
  background: linear-gradient(135deg, #00f2fe 0%, #00b4d8 100%) !important;
  border-color: #ffffff !important;
  color: #000000 !important;
  font-weight: 900 !important;
  z-index: 10 !important;
  animation: active-key-pulse 0.85s infinite alternate cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.kb-key.active-next::after {
  display: none !important; /* 次のキーになったら赤いドットは消す */
}

@keyframes active-key-pulse {
  0% {
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.9), 0 0 32px rgba(0, 229, 255, 0.4), inset 0 0 4px rgba(255, 255, 255, 0.8);
    transform: translateY(-5px) scale(1.1);
  }
  100% {
    box-shadow: 0 0 28px rgba(0, 229, 255, 1.0), 0 0 50px rgba(0, 229, 255, 0.65), inset 0 0 8px rgba(255, 255, 255, 1);
    transform: translateY(-6px) scale(1.16);
  }
}

.kb-key.key-hit {
  background: var(--accent-cyan) !important;
  color: #000 !important;
  transform: translateY(2px) scale(0.95);
}

.kb-key.key-miss {
  background: var(--accent-red) !important;
  color: #fff !important;
  transform: translateY(2px) scale(0.95);
}

/* ミス時の画面シェイク */
.shake-error {
  animation: shake 0.2s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ゲーム領域ラッパー（スタート画面をゲーム領域内のみに重ねて下部スクロールを可能にする） */
.game-area-wrap {
  display: grid;
  grid-template-columns: 100%;
  position: relative;
  width: 100%;
  gap: inherit;
}

.game-area-main {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: inherit;
  width: 100%;
}

/* モーダルオーバーレイ（全画面中央・背景ぼかし） */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 1000;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* スタート画面用ローカルオーバーレイ（ページ下部のスクロールを妨げない） */
.modal-overlay.start-overlay-local {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 16px;
  z-index: 50;
}

.modal-overlay.start-overlay-local.hidden {
  display: none;
}

.modal-overlay.start-overlay-local .modal-card {
  max-height: none;
  overflow-y: visible;
}

.start-sub-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.start-scroll-link {
  color: var(--text-sub);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 999px;
  transition: all 0.15s ease;
}

.start-scroll-link:hover {
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.08);
}

.guide-bottom-cta {
  margin-top: 24px;
  text-align: center;
}

.modal-card {
  background: #151d2f;
  border: 1px solid #283753;
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 720px;
  width: 100%;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 229, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from {
    transform: scale(0.94) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-card h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  font-weight: 700;
  color: #fff;
}

.modal-card p {
  color: var(--text-sub);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .modal-card {
    padding: 22px 16px;
    border-radius: 16px;
  }
  .modal-card h2 {
    font-size: 1.35rem;
    margin-bottom: 8px;
  }
  .modal-card p {
    font-size: 0.82rem;
    margin-bottom: 12px;
    line-height: 1.45;
  }
}

.btn-primary {
  background: linear-gradient(135deg, #00e5ff, #0284c7);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.45);
}

.btn-secondary {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-border);
}

/* リザルト画面専用パーツ */
.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 540px;
}

.res-stat-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 14px 10px;
}

.res-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.res-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.result-weak-section {
  width: 100%;
  max-width: 540px;
  margin-bottom: 24px;
}

.weak-title {
  font-size: 0.95rem;
  color: var(--accent-orange);
  font-weight: 600;
  margin-bottom: 10px;
}

.result-keys-list {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.result-key-card {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rk-letter {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fca5a5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.rk-detail {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.no-weakness {
  color: var(--accent-green);
  font-size: 0.95rem;
}

.result-actions {
  display: flex;
  gap: 12px;
}

/* 弱点克服演出（画面中央ポップアップ） */
.overcome-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
  border: 2px solid #34d399;
  border-radius: 16px;
  padding: 14px 28px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 35px rgba(16, 185, 129, 0.65);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  animation: overcome-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes overcome-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  25% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 1;
  }
  40% {
    transform: translate(-50%, -50%) scale(1.0);
    opacity: 1;
  }
  75% {
    transform: translate(-50%, -50%) scale(1.0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -65%) scale(0.92);
    opacity: 0;
  }
}

.overcome-icon {
  font-size: 2.2rem;
  animation: overcome-bounce 0.6s ease-out;
}

@keyframes overcome-bounce {
  0% { transform: scale(0.4) rotate(-20deg); }
  50% { transform: scale(1.3) rotate(15deg); }
  100% { transform: scale(1.0) rotate(0deg); }
}

.overcome-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.overcome-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #a7f3d0;
  font-weight: 800;
}

.overcome-main {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.overcome-pill {
  background: #ffffff;
  color: #065f46;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* キーボード上の克服発光エフェクト */
.kb-key.key-overcome {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 0 25px #10b981 !important;
  transform: translateY(-4px) scale(1.15) !important;
  transition: all 0.15s ease !important;
}

/* リザルト画面の克服セクション */
.result-overcome-section {
  width: 100%;
  max-width: 540px;
  margin-bottom: 20px;
}

.overcome-res-title {
  font-size: 0.95rem;
  color: var(--accent-green);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.result-overcome-list {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.overcome-badge-card {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.ob-key {
  font-size: 1.3rem;
  font-weight: 800;
  color: #6ee7b7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ob-label {
  font-size: 0.8rem;
  color: #a7f3d0;
  font-weight: 600;
}

/* --- モード選択カード（スタート画面） --- */
.mode-select-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin: 16px 0 16px 0;
}

@media (max-width: 640px) {
  .mode-select-container {
    grid-template-columns: 1fr;
  }
}

.mode-card {
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main);
}

.mode-card:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.mode-card.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.25);
}

.mode-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.mode-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.mode-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mode-card.active .mode-name {
  color: var(--accent-cyan);
}

.mode-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.25;
}

/* --- ボス討伐モード（ステージ選択パネル） --- */
.boss-select-panel {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 12px;
  margin-bottom: 18px;
  animation: fadeIn 0.2s ease;
  overflow: hidden;
}

.boss-panel-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.boss-roster-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.boss-card {
  flex: 0 1 calc(25% - 8px);
  min-width: 125px;
  max-width: 155px;
  box-sizing: border-box;
  background: rgba(30, 41, 59, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.boss-card:hover:not(.locked) {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(30, 41, 59, 0.95);
}

.boss-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.boss-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.boss-card-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.boss-card-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.25;
  margin-bottom: 2px;
  max-width: 100%;
}

.boss-card-wpm {
  font-size: 0.68rem;
  color: #fbbf24;
  font-weight: 800;
  margin-top: 2px;
}

.boss-badge-pill {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 6px;
  margin-top: 5px;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

.boss-badge-pill.cleared {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid #10b981;
}

.boss-badge-pill.challenging {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border: 1px solid #f59e0b;
}

.boss-badge-pill.locked {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid #475569;
}

@media (max-width: 600px) {
  .boss-card {
    flex: 0 1 calc(50% - 6px);
    max-width: none;
    min-width: 120px;
    padding: 8px 4px;
  }
}

/* 次のボス挑戦ボタン */
.btn-boss-next {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000000;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
  animation: pulse-boss-btn 1.4s infinite alternate;
}

@keyframes pulse-boss-btn {
  from { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
  to { transform: scale(1.03); box-shadow: 0 0 22px rgba(245, 158, 11, 0.7); }
}

/* --- ゴーストレーストラック（対戦レーン） --- */
.ghost-track-container {
  width: 100%;
  max-width: 620px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 16px 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.track-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.track-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.track-icon {
  font-size: 1rem;
}

.track-title {
  font-weight: 800;
  letter-spacing: 1px;
  color: #c084fc;
}

.ghost-target-wpm {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ghost-diff {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.ghost-diff.ahead {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

.ghost-diff.behind {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

.ghost-diff.neutral {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.track-actions-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-track-giveup {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-track-giveup:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-giveup {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-weight: 700;
}

.btn-giveup:hover {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* レースレーン本体 */
.track-lane {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.lane-bar {
  position: absolute;
  left: 0;
  right: 28px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.track-finish {
  position: absolute;
  right: 0;
  font-size: 1.1rem;
}

/* ランナー（自分 ＆ ゴースト） */
.runner {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.12s linear;
  z-index: 2;
  pointer-events: none;
}

.player-runner {
  z-index: 3;
}

.ghost-runner {
  opacity: 0.9;
}

.runner-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.player-runner .runner-badge {
  background: #00e5ff;
  color: #000000;
  border: 1px solid #ffffff;
}

.ghost-runner .runner-badge {
  background: #a855f7;
  color: #ffffff;
  border: 1px solid #d8b4fe;
}

/* --- リザルト画面のゴースト勝敗バナー --- */
.res-ghost-banner {
  width: 100%;
  max-width: 540px;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.res-ghost-banner.win {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
  border: 1px solid #10b981;
  color: #6ee7b7;
}

.res-ghost-banner.lose {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(126, 34, 206, 0.3));
  border: 1px solid #a855f7;
  color: #d8b4fe;
}

.res-ghost-banner.record {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35));
  border: 1px solid #f59e0b;
  color: #fde68a;
  animation: glow-record 1.5s infinite alternate;
}

@keyframes glow-record {
  from { box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
  to { box-shadow: 0 0 25px rgba(245, 158, 11, 0.7); }
}

/* --- 広告・アフィリエイトおすすめ機材枠スタイル --- */
html {
  scroll-behavior: smooth;
}

.ad-slot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px auto 0 auto;
  width: 100%;
}

.ad-badge {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-align: center;
}

.ad-result-slot {
  margin-top: 12px;
  margin-bottom: 0;
}

/* リザルト内 おすすめ機材コンパクトバナー */
.res-gear-banner {
  width: 100%;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.75));
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.res-gear-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.res-gear-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.res-gear-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.res-gear-sub {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.res-gear-links {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-gear-mini {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 6px 11px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-gear-mini:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-gear-mini.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-gear-mini.secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* --- ページ下部 おすすめ機材 ＆ 上達ガイドコラム（SEO / AdSense対応） --- */
.content-section {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 28px 28px;
  margin-top: 32px;
  text-align: left;
}

.guide-section {
  margin-top: 8px;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

.pr-badge {
  font-size: 0.7rem;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 999px;
}

.section-lead {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-sub);
  margin-bottom: 20px;
}

.section-lead strong {
  color: #e2e8f0;
}

/* おすすめ機材3カラムカード */
.gear-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.gear-card {
  background: rgba(11, 15, 25, 0.65);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.gear-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 255, 0.45);
}

.gear-card.featured {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.07), rgba(11, 15, 25, 0.75));
}

.gear-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.gear-tag.gold {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
}

.gear-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gear-emoji {
  font-size: 1.35rem;
}

.gear-card-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.35;
}

.gear-desc {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-sub);
  margin-bottom: 14px;
  flex-grow: 1;
}

.btn-gear-link {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-gear-link:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* 上達ガイド記事カード */
.guide-articles-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 26px;
}

.guide-article-card {
  background: rgba(11, 15, 25, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 16px 20px;
}

.guide-article-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.guide-article-card p {
  font-size: 0.86rem;
  line-height: 1.75;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.guide-article-card p:last-child {
  margin-bottom: 0;
}

.guide-article-card strong {
  color: #ffffff;
}

/* WPMスコア目安表 */
.sub-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.sub-desc {
  font-size: 0.84rem;
  color: var(--text-sub);
  margin-bottom: 12px;
  line-height: 1.6;
}

.wpm-table-wrap {
  margin-bottom: 26px;
}

.table-scroll {
  overflow-x: auto;
}

.wpm-guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: rgba(11, 15, 25, 0.55);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.wpm-guide-table th,
.wpm-guide-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  line-height: 1.5;
}

.wpm-guide-table th {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  font-weight: 700;
  white-space: nowrap;
}

.wpm-guide-table td {
  color: #cbd5e1;
}

.wpm-guide-table td strong {
  color: var(--accent-cyan);
  white-space: nowrap;
}

/* FAQリスト */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: rgba(11, 15, 25, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 14px 18px;
}

.faq-q {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
}

.faq-a {
  font-size: 0.83rem;
  line-height: 1.7;
  color: var(--text-sub);
}

.faq-a strong {
  color: #e2e8f0;
}

@media (max-width: 768px) {
  .gear-cards-grid {
    grid-template-columns: 1fr;
  }

  .res-gear-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .res-gear-links {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --- フッター ＆ リンク --- */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
  padding: 24px 0 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.footer-link-btn:hover {
  color: var(--accent-cyan);
}

.footer-sep {
  color: rgba(255, 255, 255, 0.2);
}

.copyright {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- プライバシーポリシー ＆ 利用規約 モーダル --- */
.policy-modal-card {
  max-width: 650px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 24px 28px;
}

.policy-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.policy-modal-header h3 {
  font-size: 1.2rem;
  color: #ffffff;
  margin: 0;
}

.policy-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.policy-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.policy-modal-body {
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-sub);
  padding-right: 8px;
}

.policy-modal-body h4 {
  color: #ffffff;
  font-size: 0.95rem;
  margin: 16px 0 6px 0;
}

.policy-modal-body p {
  margin-bottom: 12px;
}

/* =========================================================
   画面の高さ（ノートPC・拡大表示モニタ）に応じた縦方向レスポンシブ調整
   下部のキーボードや手イラスト、モーダル下部が切れないよう自動圧縮
   ========================================================= */
@media (max-height: 1080px) {
  #app {
    padding: 14px 20px;
    gap: 12px;
  }

  header {
    padding-bottom: 10px;
  }

  .focus-bar {
    padding: 8px 16px;
  }

  .stats-bar {
    padding: 6px 10px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stage {
    padding: 20px 26px;
    min-height: 185px;
    gap: 10px;
  }

  .ghost-track-container {
    padding: 8px 14px 10px 14px;
    margin-bottom: 6px;
  }

  .sentence-text {
    font-size: 1.75rem;
  }

  .romaji-guide {
    font-size: 1.35rem;
    margin-top: 2px;
  }

  .keyboard-section {
    margin-top: 2px;
    gap: 4px;
  }

  .finger-guide-bar {
    margin-bottom: 4px;
    padding: 4px 12px;
  }

  .kb-key {
    width: 42px;
    height: 40px;
  }

  .hands-container {
    margin-top: 6px;
    padding: 2px 0 4px 0;
    min-height: 76px;
  }

  .finger-lp, .finger-rp { height: 48px; }
  .finger-lr, .finger-rr { height: 62px; }
  .finger-lm, .finger-rm { height: 70px; }
  .finger-li, .finger-ri { height: 60px; }
  .finger-thumb { height: 38px; }

  footer {
    padding: 12px 0 10px 0;
  }
}

@media (max-height: 780px) {
  #app {
    padding: 8px 16px;
    gap: 8px;
  }

  header {
    padding-bottom: 6px;
  }

  h1 {
    font-size: 1.1rem;
  }

  .focus-bar {
    padding: 6px 12px;
  }

  .stats-bar {
    padding: 4px 8px;
  }

  .stat-value {
    font-size: 1.05rem;
  }

  .stage {
    padding: 14px 20px;
    min-height: 145px;
    gap: 6px;
  }

  .ghost-track-container {
    padding: 6px 12px 8px 12px;
    margin-bottom: 4px;
  }

  .sentence-text {
    font-size: 1.45rem;
  }

  .sentence-kana {
    font-size: 0.95rem;
  }

  .romaji-guide {
    font-size: 1.2rem;
    margin-top: 0;
  }

  .kb-row {
    gap: 5px;
  }

  .kb-key {
    width: 38px;
    height: 34px;
    font-size: 0.8rem;
  }

  .hands-container {
    margin-top: 4px;
    padding: 0;
    min-height: 60px;
  }

  .finger {
    width: 29px;
    padding-bottom: 5px;
  }

  .finger-lp, .finger-rp { height: 38px; }
  .finger-lr, .finger-rr { height: 50px; }
  .finger-lm, .finger-rm { height: 56px; }
  .finger-li, .finger-ri { height: 48px; }
  .finger-thumb { height: 32px; width: 30px; }

  /* ノートPC等でのモーダル高さ圧縮 */
  .modal-card {
    padding: 20px 22px;
    max-height: 94vh;
  }

  .modal-card h2 {
    font-size: 1.45rem;
    margin-bottom: 6px;
  }

  .modal-card p {
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.4;
  }

  .mode-select-container {
    margin: 8px 0 10px 0;
  }

  .mode-card {
    padding: 8px 10px;
  }

  .boss-select-panel {
    padding: 10px 10px;
    margin-bottom: 12px;
  }

  .boss-panel-title {
    margin-bottom: 8px;
  }

  .boss-card {
    padding: 6px 4px;
  }

  .boss-card-icon {
    font-size: 1.35rem;
    margin-bottom: 2px;
  }
}

/* MacBook 13インチ（Dock＋ブラウザバー表示時：高さ600〜700px）向け超コンパクト調整 */
@media (max-height: 700px) {
  #app {
    padding: 6px 16px;
    gap: 5px;
  }

  header {
    padding-bottom: 4px;
  }

  h1 {
    font-size: 1rem;
  }

  .btn-ctrl {
    padding: 4px 10px;
    font-size: 0.78rem;
  }

  .focus-bar {
    padding: 4px 12px;
  }

  .focus-title {
    font-size: 0.8rem;
  }

  .stats-bar {
    padding: 3px 8px;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .stat-value {
    font-size: 0.95rem;
  }

  .stage {
    padding: 10px 18px;
    min-height: 115px;
    gap: 4px;
  }

  .ghost-track-container {
    padding: 4px 10px 6px 10px;
    margin-bottom: 2px;
  }

  .track-header {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  .track-lane {
    height: 20px;
  }

  .sentence-text {
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .sentence-kana {
    font-size: 0.85rem;
  }

  .romaji-guide {
    font-size: 1.05rem;
    margin-top: 0;
  }

  .countdown-number {
    font-size: 3.2rem;
  }

  .countdown-sub {
    margin-top: 6px;
    font-size: 0.76rem;
    padding: 3px 12px;
  }

  .finger-guide-bar {
    padding: 3px 12px;
    margin-bottom: 2px;
  }

  .kb-row {
    gap: 4px;
  }

  .kb-key {
    width: 35px;
    height: 29px;
    font-size: 0.75rem;
    border-radius: 6px;
  }

  .hands-container {
    margin-top: 2px;
    padding: 0;
    min-height: 46px;
  }

  .finger {
    width: 26px;
    font-size: 0.65rem;
    padding-bottom: 3px;
  }

  .finger-lp, .finger-rp { height: 30px; }
  .finger-lr, .finger-rr { height: 38px; }
  .finger-lm, .finger-rm { height: 44px; }
  .finger-li, .finger-ri { height: 37px; }
  .finger-thumb { height: 26px; width: 28px; }

  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    padding: 14px 20px;
    max-height: 96vh;
  }

  .modal-card h2 {
    font-size: 1.25rem;
    margin-bottom: 4px;
  }

  .modal-card p {
    font-size: 0.78rem;
    margin-bottom: 8px;
    line-height: 1.35;
  }

  .mode-select-container {
    margin: 6px 0 8px 0;
    gap: 8px;
  }

  .mode-card {
    padding: 6px 8px;
  }

  .boss-select-panel {
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  .boss-panel-title {
    margin-bottom: 6px;
    font-size: 0.8rem;
  }

  .boss-roster-grid {
    gap: 6px;
  }

  .boss-card {
    padding: 5px 4px;
  }

  .boss-card-icon {
    font-size: 1.15rem;
    margin-bottom: 1px;
  }

  .btn-primary {
    padding: 9px 26px;
    font-size: 0.92rem;
  }
}


