* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button, .select-btn, .nav-tab, .choice-btn, a {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}
#answer-input, #nickname-input {
  user-select: text;
  -webkit-user-select: text;
}

:root {
  --bg: #0c1025;
  --bg-panel: #181c36;
  --bg-panel-hi: #22274a;
  --accent: #ffd23f;
  --accent-dark: #c68a0f;
  --accent-glow: rgba(255, 210, 63, 0.35);
  --accent-2: #5ddca8;
  --danger: #ff5d6c;
  --text: #f2f3f8;
  --text-dim: #8a90a8;
  --border: #2c3050;
  --border-gold: rgba(255, 210, 63, 0.22);
}

html, body {
  height: 100%;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(90, 70, 160, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(255, 210, 63, 0.05) 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  position: relative;
}

/* 星空テクスチャ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 23%, rgba(255,255,255,0.45), transparent 50%),
    radial-gradient(1px   1px   at 42% 67%, rgba(255,210,63,0.4),  transparent 50%),
    radial-gradient(1px   1px   at 68% 18%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(1.5px 1.5px at 83% 52%, rgba(255,255,255,0.35),transparent 50%),
    radial-gradient(1px   1px   at 27% 78%, rgba(255,210,63,0.3),  transparent 50%),
    radial-gradient(1px   1px   at 55% 38%, rgba(255,255,255,0.25),transparent 50%),
    radial-gradient(1.5px 1.5px at 92% 81%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px   1px   at 8% 60%,  rgba(255,210,63,0.3),  transparent 50%),
    radial-gradient(1px   1px   at 74% 90%, rgba(255,255,255,0.2), transparent 50%);
  background-size: 700px 700px;
  background-repeat: repeat;
  opacity: 0.7;
}
#app { z-index: 1; }

#app {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-left)) 24px max(20px, env(safe-area-inset-right));
  position: relative;
  flex: 1;
}

/* 共通ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(14, 18, 32, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding:
    calc(10px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    10px max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.app-logo { justify-self: start; text-decoration: none; }
.app-nav  { justify-self: center; }
.audio-toggles { justify-self: end; display: flex; gap: 6px; }
.app-logo {
  font-family: "Cinzel", "Shippori Mincho", serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  /* 横方向の虹色グラデに白いハイライト帯を埋め込み、position を動かしてキラッと流す */
  background: linear-gradient(
    100deg,
    var(--accent-dark) 0%,
    var(--accent) 18%,
    #fff2a0 38%,
    #ffffff 50%,
    #fff2a0 62%,
    var(--accent) 82%,
    var(--accent-dark) 100%
  );
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 6px var(--accent-glow));
  animation:
    logoShine 4.5s linear infinite,
    logoGlow 3s ease-in-out infinite alternate;
}
@keyframes logoShine {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}
@keyframes logoGlow {
  from { filter: drop-shadow(0 0 4px rgba(255, 210, 63, 0.3)); }
  to   { filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.7)); }
}
.app-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 1px;
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  transition: color 0.15s, background 0.15s, border-color 0.15s, text-shadow 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-tab .nav-icon { font-size: 0.95em; }
.nav-tab .nav-label { display: inline-block; }
.nav-tab:hover {
  color: var(--text);
  background: rgba(255, 210, 63, 0.06);
  border-color: rgba(255, 210, 63, 0.18);
}
.nav-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.18) 0%, rgba(255, 210, 63, 0.04) 100%);
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.6);
  box-shadow: inset 0 -2px 0 var(--accent-dark), 0 0 14px rgba(255, 210, 63, 0.2);
}

/* 共通フッター */
.app-footer {
  padding:
    16px max(20px, env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  align-items: center;
}
.app-footer .link-btn {
  margin: 0;
  display: inline-block;
}

/* ヘッダー/フッター非表示（規約/プレイ画面） */
body.no-chrome .app-header,
body.no-chrome .app-footer {
  display: none;
}

/* ---- ミニゲーム専用ヘッダー用：ナブタブにlocked 表現 ---- */
.app-nav .nav-tab.locked {
  color: var(--text-dim);
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: none;
}
.app-nav a.nav-tab {
  text-decoration: none;
}

/* ---- フッターのリンクボタン（共通） ---- */
.app-footer .link-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 1px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.app-footer .link-btn:hover {
  color: var(--accent);
  background: rgba(255, 210, 63, 0.06);
}
.app-footer .footer-copy {
  width: 100%;
  text-align: center;
  color: var(--text-dim);
  opacity: 0.7;
  font-size: 11px;
  letter-spacing: 1px;
  margin-top: 6px;
}

/* 画面見出し（統一・RPG風装飾つき） */
.screen-heading {
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin: 12px 0 6px;
  border: none;
  padding: 0;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 210, 63, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.screen-heading::before,
.screen-heading::after {
  content: "";
  flex: 0 0 auto;
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  position: relative;
}
.screen-heading::after {
  background: linear-gradient(90deg, var(--accent), transparent);
}
.screen-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 28px;
  text-align: center;
  letter-spacing: 1px;
}
.section-heading {
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--accent-2);
  border: none;
  padding: 0 0 6px;
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(93, 220, 168, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading::before {
  content: "❖";
  color: var(--accent-2);
  font-size: 14px;
}

/* オーディオトグル（ヘッダー/規約画面 共通） */
.audio-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 20px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s, background 0.12s, opacity 0.12s;
}
.audio-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(255, 210, 63, 0.08);
}
.audio-btn.off {
  color: var(--text-dim);
  border-color: var(--border);
  opacity: 0.55;
}
/* オーディオオフ時: アイコンに斜線を重ねて視覚的に "切" を明示（SFX/BGM共通） */
.audio-btn.off .audio-icon {
  position: relative;
  display: inline-block;
}
.audio-btn.off .audio-icon::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 50%;
  height: 2px;
  background: #e06060;
  transform: translateY(-50%) rotate(-22deg);
  transform-origin: center;
  box-shadow: 0 0 3px rgba(224, 96, 96, 0.6);
  border-radius: 2px;
  pointer-events: none;
}

/* 規約画面の音声トグル */
.terms-audio-toggles {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.terms-audio-toggles .audio-btn {
  font-size: 15px;
  padding: 10px 18px;
}

/* モバイル: ヘッダーのグリッド調整 */
@media (max-width: 600px) {
  .app-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 10px 14px;
  }
  .app-logo       { grid-column: 1; grid-row: 1; }
  .audio-toggles  { grid-column: 2; grid-row: 1; }
  .app-nav        { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: 100%; gap: 3px; }
  /* モバイル: アイコン上・テキスト下の縦積みレイアウト */
  .nav-tab {
    flex: 1;
    min-width: 0;
    padding: 6px 2px;
    font-size: 11.5px;
    text-align: center;
    letter-spacing: 0.3px;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
    min-height: 50px;
  }
  .nav-tab .nav-icon {
    display: block;
    margin: 0 0 1px;
    font-size: 17px;
    line-height: 1;
  }
  .nav-tab .nav-label {
    display: block;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: break-word;
    line-height: 1.2;
  }
}

/* サブタブ (タイムアタック / ミニゲーム 画面内) */
.subtabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 18px;
  padding: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.subtabs .subtab {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.subtabs .subtab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.subtabs .subtab.active {
  color: #0c1025;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.subtab-pane {
  display: none;
}
.subtab-pane.active {
  display: block;
}

/* ランキング画面のフィルタ */
.ranking-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
  min-width: 160px;
}
.filter-label select {
  padding: 10px 12px;
  font-size: 14px;
  background: var(--bg-panel);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.filter-label select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ランキングペイン内の ranking-box 余白調整 */
#ta-ranking-pane .ranking-box,
#mg-ranking-pane .ranking-box {
  max-width: none;
  margin: 0;
}

/* 問題数表示 */
.pool-count {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 20px 0 8px;
  letter-spacing: 1px;
}
.pool-count .pool-head {
  display: block;
  margin-bottom: 10px;
}
.pool-count strong {
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 17px;
  font-weight: 700;
  margin: 0 4px;
  text-shadow: 0 0 6px rgba(255, 210, 63, 0.3);
}

/* 現在の出題範囲の進捗バー */
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px auto 8px;
  max-width: 380px;
  padding: 8px 14px;
  background: rgba(24, 28, 54, 0.5);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
}
.progress-label {
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: 0.5px;
}
.progress-icon {
  font-size: 13px;
  margin-right: 4px;
}
.progress-pct {
  color: var(--text-dim);
  font-size: 11.5px;
  margin-left: 2px;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 210, 63, 0.18);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 8px rgba(255, 210, 63, 0.4);
  transition: width 0.4s ease;
  border-radius: 999px;
}

/* 未正解のみ出題トグル */
.unsolved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px auto 2px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: 0.5px;
  user-select: none;
}
.unsolved-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.unsolved-toggle strong {
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 14px;
  font-weight: 700;
  margin: 0 2px;
}

/* ----- ミニゲーム 一覧 ----- */
.minigames-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.minigames-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 8px rgba(93, 220, 168, 0.4));
}
.minigame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 14px 0 28px;
}
.minigame-card {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 18px 14px 14px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 150px;
  text-decoration: none;
}
.minigame-card,
.minigame-card * {
  text-decoration: none !important;
}
.minigame-card ruby rt {
  color: var(--text-dim);
  font-size: 0.55em;
}
.minigame-card:hover:not(.disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 210, 63, 0.2);
}
.minigame-card.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.5);
}
.mini-icon {
  font-size: 38px;
  margin-bottom: 2px;
  filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.3));
}
.mini-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.mini-desc {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
  flex: 1;
}
.mini-play {
  font-family: "Cinzel", serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 210, 63, 0.12);
  border: 1px solid var(--border-gold);
  margin-top: 4px;
}
.mini-play.coming-badge {
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--border);
  letter-spacing: 2px;
  font-size: 11px;
}

/* ----- /minigames/ 外部リンクカード ----- */
.minigames-external-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(180deg, rgba(120, 180, 255, 0.18) 0%, rgba(60, 100, 180, 0.12) 100%);
  border: 1px solid rgba(140, 200, 255, 0.5);
  border-radius: 14px;
  padding: 20px 14px 16px;
  margin: 14px 0 24px;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  min-height: 150px;
  justify-content: center;
}
.minigames-external-card:hover {
  transform: translateY(-2px);
  border-color: #a5d0ff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 14px rgba(140, 200, 255, 0.25);
}
.minigames-external-card,
.minigames-external-card * { text-decoration: none !important; }
.minigames-external-card .mini-name { color: #b8dcff; }
.minigames-external-card .mini-play {
  color: #b8dcff;
  background: rgba(140, 200, 255, 0.14);
  border-color: rgba(140, 200, 255, 0.5);
  align-self: center;
}

/* ----- リラックス誘導バナー（ゲームオーバー画面後）----- */
.relax-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 8px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(120, 180, 255, 0.14) 0%, rgba(60, 100, 180, 0.08) 100%);
  border: 1px solid rgba(140, 200, 255, 0.45);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.relax-banner:hover {
  transform: translateY(-1px);
  border-color: #a5d0ff;
  box-shadow: 0 4px 14px rgba(140, 200, 255, 0.2);
}
.relax-banner-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(140, 200, 255, 0.3));
}
.relax-banner-body { flex: 1; text-align: left; }
.relax-banner-title {
  color: #b8dcff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.relax-banner-sub {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}
.relax-banner-arrow {
  color: #b8dcff;
  font-size: 18px;
  font-weight: 700;
}

/* ----- アナグラム ----- */
.anagram-rules-card { margin-top: 20px; }
.anagram-best-display {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 16px 0 8px;
  letter-spacing: 0.5px;
}
.anagram-best-display strong {
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0 4px;
}
.anagram-best-display .best-misses {
  font-size: 11.5px;
  margin-left: 4px;
}
.anagram-best-display .best-none {
  color: var(--text-dim);
  font-style: italic;
}

.anagram-hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.anagram-quit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.anagram-quit-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.anagram-progress {
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1.5px;
}
.anagram-misses {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}
.anagram-misses strong {
  color: var(--danger);
  font-family: "Cinzel", serif;
  font-size: 16px;
  font-weight: 700;
  margin-right: 2px;
}

.anagram-hint-box {
  background: rgba(24, 28, 54, 0.5);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 24px;
}
.anagram-hint-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.anagram-hint {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.anagram-hint ruby rt { font-size: 10px; color: var(--text-dim); }

/* スロット（答え入れる欄） */
.anagram-slots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 28px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 10px;
  transition: background 0.2s;
}
.anagram-slot {
  width: 46px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 28, 54, 0.7);
  border: 2px dashed var(--border);
  border-radius: 10px;
  font-family: "Cinzel", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}
.anagram-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.15) 0%, rgba(255, 210, 63, 0.03) 100%);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.4);
}
.anagram-slot.filled:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.anagram-slots.flash-ok {
  background: rgba(93, 220, 168, 0.15);
  animation: anagram-flash-ok 0.6s;
}
.anagram-slots.flash-ng {
  background: rgba(255, 93, 108, 0.15);
  animation: anagram-flash-ng 0.4s;
}
@keyframes anagram-flash-ok {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes anagram-flash-ng {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
/* 長い単語は小さめに */
.anagram-slots.size-7 .anagram-slot,
.anagram-slots.size-8 .anagram-slot {
  width: 40px;
  height: 48px;
  font-size: 20px;
}

/* タイル（選ぶ文字） */
.anagram-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.anagram-tile {
  width: 48px;
  height: 56px;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 2px solid var(--border-gold);
  border-radius: 10px;
  font-family: "Cinzel", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 3px 0 var(--accent-dark), 0 3px 8px rgba(0, 0, 0, 0.3);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.4);
}
.anagram-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--accent-dark), 0 5px 12px rgba(255, 210, 63, 0.3);
}
.anagram-tile:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--accent-dark), 0 1px 4px rgba(0, 0, 0, 0.3);
}
.anagram-tile.used, .anagram-tile:disabled {
  opacity: 0.25;
  cursor: default;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
}
.anagram-buttons {
  margin-top: 10px;
}

/* 結果画面 */
.anagram-result-stats { text-align: center; }
.anagram-time-row {
  margin-bottom: 18px;
}
.anagram-time-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 2px;
}
.anagram-time-value {
  font-family: "Cinzel", serif;
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 14px rgba(255, 210, 63, 0.5);
  line-height: 1;
  margin: 6px 0;
}
.new-best-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffea6e 0%, #ffb733 55%, #ff8a1f 100%);
  color: #1a0f05;
  font-family: "Cinzel", serif;
  font-size: 15px;
  font-weight: 900;
  padding: 6px 18px;
  border-radius: 999px;
  letter-spacing: 2px;
  margin-top: 8px;
  animation: new-best-pop 0.6s ease-out;
  box-shadow:
    0 0 18px rgba(255, 210, 63, 0.7),
    0 2px 6px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.45);
}
@keyframes new-best-pop {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* モバイル微調整 */
@media (max-width: 480px) {
  .anagram-slot { width: 38px; height: 46px; font-size: 20px; }
  .anagram-slots.size-7 .anagram-slot,
  .anagram-slots.size-8 .anagram-slot { width: 34px; height: 42px; font-size: 17px; }
  .anagram-tile { width: 40px; height: 48px; font-size: 22px; }
  .anagram-hint { font-size: 19px; }
  .anagram-time-value { font-size: 38px; }
}
@media (max-width: 360px) {
  .anagram-slot { width: 32px; height: 40px; font-size: 17px; }
  .anagram-slots.size-7 .anagram-slot,
  .anagram-slots.size-8 .anagram-slot { width: 28px; height: 36px; font-size: 15px; }
  .anagram-tile { width: 34px; height: 42px; font-size: 19px; }
  .minigame-grid { grid-template-columns: 1fr; }
}

/* ----- 英単語神経衰弱 ----- */
.memory-rules-card { margin-top: 20px; }

.memory-board-wrap {
  padding: 6px;
  display: flex;
  justify-content: center;
}
.memory-board {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.memory-board.size-small  { grid-template-columns: repeat(4, 1fr); }   /* 4x3 */
.memory-board.size-medium { grid-template-columns: repeat(4, 1fr); }   /* 4x4 */
.memory-board.size-large  { grid-template-columns: repeat(5, 1fr); }   /* 5x4 */

.memory-card {
  position: relative;
  aspect-ratio: 3 / 4;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  perspective: 800px;
  font-family: inherit;
  min-height: 72px;
}
.memory-card[disabled] { cursor: default; }

.memory-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(.2,.85,.3,1);
}
.memory-card.is-flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-back,
.memory-card-front {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 6px 4px;
  text-align: center;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  word-break: break-word;
}
.memory-card-back {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 210, 63, 0.22), transparent 55%),
    linear-gradient(145deg, #25305b 0%, #121733 100%);
  border: 2px solid var(--border-gold);
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 28px;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.4);
}
.memory-card-front {
  transform: rotateY(180deg);
  border: 2px solid var(--border-gold);
  background: linear-gradient(180deg, #fff 0%, #f2f4ff 100%);
  color: #1a1f3a;
  font-size: 13.5px;
}
.memory-card.face-en .memory-card-front {
  background: linear-gradient(180deg, #e8f3ff 0%, #cfe3ff 100%);
  font-family: "Cinzel", serif;
  font-size: 15.5px;
  letter-spacing: 0.5px;
}
.memory-card.face-ja .memory-card-front {
  background: linear-gradient(180deg, #fff3e6 0%, #ffe0c9 100%);
}
.memory-card.face-ja .memory-card-front ruby rt {
  font-size: 8px;
  color: #4a5070;
}

.memory-card.matched .memory-card-front {
  background: linear-gradient(180deg, rgba(93, 220, 168, 0.35) 0%, rgba(50, 170, 130, 0.25) 100%);
  border-color: rgba(93, 220, 168, 0.9);
  box-shadow: 0 0 12px rgba(93, 220, 168, 0.45);
  color: #0c1025;
}
.memory-card.just-matched .memory-card-front {
  animation: memory-match-pop 0.5s ease-out;
}
@keyframes memory-match-pop {
  0%   { transform: rotateY(180deg) scale(0.9); }
  50%  { transform: rotateY(180deg) scale(1.05); }
  100% { transform: rotateY(180deg) scale(1); }
}
.memory-card:hover:not([disabled]):not(.is-flipped) .memory-card-back {
  border-color: var(--accent);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 210, 63, 0.35);
}

/* モバイル微調整 (memory) */
@media (max-width: 560px) {
  .memory-board { max-width: 100%; gap: 8px; }
  .memory-card-back { font-size: 24px; }
  .memory-card.face-en .memory-card-front { font-size: 14px; }
  .memory-card.face-ja .memory-card-front { font-size: 12.5px; }
}
@media (max-width: 420px) {
  .memory-board { gap: 6px; }
  .memory-card-back { font-size: 20px; }
  .memory-card.face-en .memory-card-front { font-size: 12.5px; }
  .memory-card.face-ja .memory-card-front { font-size: 11.5px; }
  .memory-board.size-large { grid-template-columns: repeat(4, 1fr); }
}

/* ----- 数字順タップ ----- */
.numtap-rules-card { margin-top: 20px; }

.numtap-hud {
  grid-template-columns: auto 1fr auto;
}
.numtap-target-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.numtap-target-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
}
.numtap-target-label ruby rt { font-size: 8px; }
.numtap-target {
  font-family: "Cinzel", serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 210, 63, 0.55);
  min-width: 52px;
  text-align: center;
}
.numtap-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.numtap-timer {
  font-family: "Cinzel", serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  min-width: 82px;
  text-align: right;
}

.numtap-grid-wrap {
  display: flex;
  justify-content: center;
  padding: 6px;
}
.numtap-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.numtap-grid.size-small  { grid-template-columns: repeat(5, 1fr); }  /* 5x3 = 15 */
.numtap-grid.size-medium { grid-template-columns: repeat(5, 1fr); }  /* 5x4 = 20 */
.numtap-grid.size-large  { grid-template-columns: repeat(6, 1fr); }  /* 6x5 = 30 */

.numtap-cell {
  aspect-ratio: 1 / 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 2px solid var(--border-gold);
  border-radius: 10px;
  font-family: "Cinzel", serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.08s, background 0.2s, border-color 0.2s, box-shadow 0.15s;
  box-shadow: 0 3px 0 var(--accent-dark), 0 3px 8px rgba(0, 0, 0, 0.25);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.4);
  font-family: "Cinzel", serif;
}
.numtap-cell:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--accent-dark), 0 5px 12px rgba(255, 210, 63, 0.3);
}
.numtap-cell:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--accent-dark), 0 1px 4px rgba(0, 0, 0, 0.3);
}
.numtap-cell.done {
  background: linear-gradient(180deg, rgba(93, 220, 168, 0.35) 0%, rgba(50, 170, 130, 0.2) 100%);
  border-color: rgba(93, 220, 168, 0.75);
  color: rgba(255, 255, 255, 0.5);
  text-decoration: line-through;
  text-shadow: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  cursor: default;
  opacity: 0.75;
  transform: translateY(1px);
  animation: numtap-done-pop 0.35s ease-out;
}
@keyframes numtap-done-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.12); }
  100% { transform: translateY(1px) scale(1); }
}
.numtap-cell.miss {
  animation: numtap-miss 0.4s;
  border-color: var(--danger);
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.35) 0%, rgba(200, 40, 60, 0.2) 100%);
  color: var(--danger);
}
@keyframes numtap-miss {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* モバイル微調整 (numtap) */
@media (max-width: 560px) {
  .numtap-grid { max-width: 100%; gap: 6px; }
  .numtap-cell { font-size: 20px; min-height: 44px; }
  .numtap-target { font-size: 28px; min-width: 46px; }
  .numtap-timer { font-size: 14px; min-width: 72px; }
}
@media (max-width: 420px) {
  .numtap-grid { gap: 5px; }
  .numtap-cell { font-size: 17px; min-height: 40px; border-width: 1px; }
  .numtap-target { font-size: 24px; min-width: 40px; }
  .numtap-grid.size-large { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 360px) {
  .numtap-grid.size-medium { grid-template-columns: repeat(4, 1fr); }
  .numtap-grid.size-large  { grid-template-columns: repeat(5, 1fr); }
  .numtap-cell { font-size: 15px; min-height: 36px; }
}

/* ----- Ring Hit ----- */
.ringhit-rules-card { margin-top: 20px; }

.ringhit-score-hud {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  font-family: "Cinzel", serif;
}
.ringhit-score-hud strong {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  margin-left: 4px;
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.4);
}

.ringhit-tap-zone {
  position: relative;
  margin: 60px auto 10px;
  padding: 18px;
  max-width: 380px;
  border: 2px dashed var(--border-gold);
  border-radius: 24px;
  background: rgba(24, 28, 54, 0.35);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.ringhit-tap-zone:hover {
  border-color: var(--accent);
  background: rgba(24, 28, 54, 0.5);
}
.ringhit-tap-zone:active {
  background: rgba(255, 210, 63, 0.08);
}
.ringhit-arena {
  position: relative;
  width: min(320px, calc(100vw - 60px));
  height: min(320px, calc(100vw - 60px));
  max-width: 320px;
  max-height: 320px;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  /* verdict は arena の外にはみ出すのでここではクリップしない */
}
.ringhit-stage {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(24, 28, 54, 0.8) 0%, transparent 70%);
}
.ringhit-target {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 24px rgba(255, 210, 63, 0.5),
    inset 0 0 16px rgba(255, 210, 63, 0.25);
  pointer-events: none;
  animation: ringhit-target-pulse 1.6s ease-in-out infinite;
}
@keyframes ringhit-target-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 210, 63, 0.45), inset 0 0 16px rgba(255, 210, 63, 0.2); }
  50%      { box-shadow: 0 0 38px rgba(255, 210, 63, 0.75), inset 0 0 22px rgba(255, 210, 63, 0.35); }
}
.ringhit-moving {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 4px solid #00e6ff;
  box-shadow:
    0 0 24px rgba(0, 230, 255, 0.7),
    inset 0 0 18px rgba(0, 230, 255, 0.35);
  pointer-events: none;
  transition: border-color 0.15s, box-shadow 0.2s;
}
.ringhit-moving.locked { transition: none; }
.ringhit-moving.perfect {
  border-color: #5ddca8;
  box-shadow: 0 0 36px rgba(93, 220, 168, 0.85), inset 0 0 22px rgba(93, 220, 168, 0.45);
  animation: ringhit-perfect-pulse 0.5s ease-out;
}
.ringhit-moving.good {
  border-color: #ffd23f;
  box-shadow: 0 0 28px rgba(255, 210, 63, 0.75), inset 0 0 18px rgba(255, 210, 63, 0.35);
}
.ringhit-moving.miss {
  border-color: var(--danger);
  box-shadow: 0 0 22px rgba(255, 93, 108, 0.7), inset 0 0 14px rgba(255, 93, 108, 0.3);
  opacity: 0.7;
}
@keyframes ringhit-perfect-pulse {
  0%   { transform: translate(-50%, -50%) scale(1); }
  50%  { transform: translate(-50%, -50%) scale(1.18); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.ringhit-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Cinzel", serif;
  font-size: 22px;
  font-weight: 800;
  color: rgba(255, 210, 63, 0.85);
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
  pointer-events: none;
  z-index: 2;
}

.ringhit-verdict {
  position: absolute;
  top: -54px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Cinzel", serif;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.8);
}
.ringhit-verdict.show { animation: ringhit-verdict-pop 0.9s ease-out; }
.ringhit-verdict.perfect { color: #5ddca8; text-shadow: 0 0 18px rgba(93, 220, 168, 0.85); }
.ringhit-verdict.good    { color: #ffd23f; text-shadow: 0 0 18px rgba(255, 210, 63, 0.8); }
.ringhit-verdict.miss    { color: #ff5d6c; text-shadow: 0 0 14px rgba(255, 93, 108, 0.6); }
@keyframes ringhit-verdict-pop {
  0%   { transform: translateX(-50%) scale(0.6); opacity: 0; }
  25%  { transform: translateX(-50%) scale(1.2); opacity: 1; }
  75%  { transform: translateX(-50%) scale(1);   opacity: 1; }
  100% { transform: translateX(-50%) scale(1);   opacity: 0; }
}

.ringhit-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 8px;
}

/* モバイル微調整 (ringhit) */
@media (max-width: 560px) {
  .ringhit-tap-zone { margin-top: 50px; padding: 14px; }
  .ringhit-verdict { font-size: 28px; top: -44px; }
  .ringhit-center-label { font-size: 20px; }
}
@media (max-width: 420px) {
  .ringhit-tap-zone { margin-top: 44px; padding: 12px; border-radius: 20px; }
  .ringhit-target { border-width: 2px; }
  .ringhit-moving { border-width: 3px; }
  .ringhit-verdict { font-size: 22px; top: -36px; }
  .ringhit-center-label { font-size: 17px; letter-spacing: 2px; }
}


/* ----- 冒険の書（Profile 画面） ----- */
.profile-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.profile-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.5));
}

.profile-summary {
  margin: 18px auto 28px;
  max-width: 500px;
  padding: 22px 20px 18px;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(255, 210, 63, 0.09) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 210, 63, 0.06) inset;
  position: relative;
}
.profile-rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(255, 210, 63, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  margin-bottom: 12px;
}
.profile-rank-icon {
  font-size: 16px;
}
.profile-rank-label {
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 1px;
  font-weight: 600;
}
.profile-bignum {
  font-family: "Cinzel", serif;
  color: var(--accent);
  line-height: 1;
  margin: 4px 0 6px;
  text-shadow: 0 0 12px rgba(255, 210, 63, 0.4);
}
.profile-bignum strong {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 1px;
}
.profile-bignum-sep {
  font-size: 28px;
  opacity: 0.5;
  margin: 0 6px;
}
.profile-bignum-total {
  font-size: 22px;
  color: var(--text-dim);
}
.profile-bignum-unit {
  font-size: 16px;
  color: var(--text-dim);
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  margin-left: 4px;
}
.profile-pct {
  color: var(--text);
  font-size: 18px;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.profile-pct-sub {
  color: var(--text-dim);
  font-size: 12px;
  font-family: "Hiragino Sans", sans-serif;
  font-weight: 400;
  margin-left: 4px;
  letter-spacing: 0;
}
.progress-bar.profile-bigbar {
  height: 12px;
  max-width: 380px;
  margin: 0 auto 16px;
}
.profile-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.profile-meta-item {
  text-align: center;
}
.profile-meta-label {
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.profile-meta-value {
  color: var(--text);
  font-size: 15px;
}
.profile-meta-value strong {
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 20px;
  font-weight: 700;
  margin-right: 4px;
}

/* カテゴリ一覧 */
.profile-categories {
  max-width: 560px;
  margin: 10px auto 20px;
  padding: 14px;
  background: rgba(24, 28, 54, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* フッター（リセット） */
.profile-footer {
  max-width: 560px;
  margin: 16px auto 8px;
  text-align: center;
}
.profile-note {
  color: var(--text-dim);
  font-size: 11.5px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.danger-outline {
  border-color: rgba(255, 93, 108, 0.4) !important;
  color: var(--danger) !important;
}
.danger-outline:hover {
  background: rgba(255, 93, 108, 0.08) !important;
}

.cat-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 2fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
}
.cat-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 210, 63, 0.12);
}
.cat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.4s ease;
  border-radius: 999px;
}
.cat-count {
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: "Cinzel", serif;
  min-width: 56px;
  text-align: right;
}
.cat-row.cat-done .cat-label { color: var(--accent); font-weight: 600; }
.cat-row.cat-done .cat-count { color: var(--accent); }

/* 自己ベスト表示 */
.personal-best {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.personal-best .pb-label {
  color: var(--accent-2);
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 1px;
}
#pb-text {
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(255, 210, 63, 0.3);
  letter-spacing: 1px;
}
#pb-text.empty {
  color: var(--text-dim);
  font-size: 13px;
  text-shadow: none;
}

/* X（Twitter）シェアボタン */
#share-x-btn,
.share-x-btn {
  background: linear-gradient(180deg, #26303a 0%, #0d0d0d 100%);
  border-color: #444;
  color: #fff;
}
#share-x-btn:hover,
.share-x-btn:hover {
  background: linear-gradient(180deg, #3a4452 0%, #1a1a1a 100%);
  border-color: #fff;
}


/* 画面切替 */
.screen { display: none; }
.screen.active { display: block; }
.screen.overlay.active {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* タイトル */
.logo {
  font-size: 56px;
  text-align: center;
  margin-top: 80px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255, 210, 63, 0.4);
}
.subtitle {
  text-align: center;
  color: var(--text-dim);
  margin: 12px 0 48px;
}
.hint-footer {
  text-align: center;
  color: var(--text-dim);
  margin-top: 32px;
  font-size: 12px;
}

/* 見出し */
h2 {
  font-size: 18px;
  margin: 28px 0 12px;
  color: var(--accent-2);
  border-left: 4px solid var(--accent-2);
  padding-left: 10px;
}

/* ボタン（ファンタジーRPG風） */
.primary-btn, .secondary-btn {
  display: inline-block;
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 1.5px;
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
a.primary-btn, a.secondary-btn { text-decoration: none; }
/* 光の筋（hoverで横切る） */
.primary-btn::before, .secondary-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 45%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.22) 55%,
    transparent 100%
  );
  transform: skewX(-22deg);
  pointer-events: none;
  transition: left 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 1;
}
.primary-btn:hover::before, .secondary-btn:hover::before { left: 130%; }
.primary-btn:disabled, .secondary-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.3); }
.primary-btn:disabled::before, .secondary-btn:disabled::before { display: none; }

.primary-btn {
  background: linear-gradient(180deg, #fff0a0 0%, var(--accent) 45%, #d09518 100%);
  color: #1a1420;
  border: 1px solid var(--accent-dark);
  box-shadow:
    0 5px 0 #8a6409,
    0 8px 18px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 3px rgba(138, 100, 9, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
.primary-btn:hover:not(:disabled) {
  filter: brightness(1.1) saturate(1.12);
  transform: translateY(-1px);
  box-shadow:
    0 6px 0 #8a6409,
    0 10px 26px rgba(255, 210, 63, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 3px rgba(138, 100, 9, 0.3);
}
.primary-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #8a6409,
    0 2px 6px rgba(0, 0, 0, 0.55),
    inset 0 2px 5px rgba(138, 100, 9, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  filter: brightness(0.96);
  transition: transform 0.04s, box-shadow 0.04s, filter 0.04s;
}

.secondary-btn {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow:
    0 4px 0 #0a0d1c,
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.secondary-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #282d56 0%, #1e2240 100%);
  border-color: var(--border-gold);
  transform: translateY(-1px);
  box-shadow:
    0 5px 0 #0a0d1c,
    0 8px 18px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.secondary-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #0a0d1c,
    inset 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.04s, box-shadow 0.04s;
}

#to-setup, #start-game {
  display: block;
  margin: 24px auto 0;
  min-width: 200px;
}

.button-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

/* 難易度・方向選択 */
.grid-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.select-btn {
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1), border-color 0.12s, box-shadow 0.18s, background 0.15s;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
/* シャインスイープ（hoverで光の筋が横切る） */
.select-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 45%,
    rgba(255, 230, 130, 0.22) 50%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 100%
  );
  transform: skewX(-18deg);
  pointer-events: none;
  transition: left 0.55s ease;
  z-index: 1;
}
.select-btn:hover:not(:disabled)::before {
  left: 120%;
}
.select-btn:hover:not(:disabled) {
  border-color: var(--border-gold);
  transform: translateY(-2px) perspective(600px) rotateX(3deg);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.5),
    0 2px 0 rgba(255, 210, 63, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.select-btn:active:not(:disabled) {
  transform: translateY(1px) perspective(600px) rotateX(-1deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.06s, box-shadow 0.06s;
}
.select-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.22) 0%, rgba(255, 210, 63, 0.05) 100%);
  box-shadow:
    0 0 18px rgba(255, 210, 63, 0.3),
    0 4px 14px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.select-btn.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: radial-gradient(ellipse at top, rgba(255, 210, 63, 0.15), transparent 60%);
  pointer-events: none;
  animation: selectedShine 2.4s ease-in-out infinite alternate;
}
@keyframes selectedShine {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}
.select-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.coming {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-dim);
}

/* HUD */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  font-size: 14px;
  gap: 10px;
  background: linear-gradient(180deg, rgba(30, 34, 64, 0.7) 0%, rgba(20, 23, 46, 0.5) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.hud-left, .hud-center, .hud-right { min-width: 0; }
.hud-center { text-align: center; flex: 1; }
.lives {
  font-size: 22px;
  letter-spacing: 3px;
}
.life {
  display: inline-block;
  transition: color 0.3s, filter 0.3s, opacity 0.3s;
}
.life.alive {
  color: #ff6b9d;
  filter: drop-shadow(0 0 5px rgba(255, 107, 157, 0.65));
}
.life.lost {
  color: #ffffff;
  opacity: 0.45;
}
/* 喪失アニメ（損失瞬間のみ） */
.life.breaking {
  animation: lifeBreak 0.6s ease-out forwards;
}
@keyframes lifeBreak {
  0%   { color: #ff6b9d; filter: drop-shadow(0 0 5px rgba(255,107,157,0.7)); transform: scale(1); }
  20%  { color: #ffffff; filter: drop-shadow(0 0 14px rgba(255,255,255,0.95)); transform: scale(1.45); }
  45%  { color: #ff5d6c; filter: drop-shadow(0 0 10px rgba(255,93,108,0.9)); transform: scale(1.1) rotate(-14deg); }
  100% { color: #ffffff; filter: none; opacity: 0.4; transform: scale(0.85) rotate(0deg); }
}
/* 残機ピンチ（残1のとき）— HUDのハート群が脈動 */
.lives.critical {
  animation: livesCritical 0.75s ease-in-out infinite alternate;
}
@keyframes livesCritical {
  from { filter: drop-shadow(0 0 2px rgba(255, 93, 108, 0.3)); }
  to   { filter: drop-shadow(0 0 10px rgba(255, 93, 108, 0.95)); }
}

/* ハートの破片 */
.heart-shard {
  position: fixed;
  font-size: 14px;
  color: #ff5d6c;
  pointer-events: none;
  z-index: 99;
  text-shadow: 0 0 6px rgba(255, 93, 108, 0.8);
  animation: shardFly 0.75s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes shardFly {
  0%   { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% {
    transform:
      translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)))
      scale(0.4) rotate(var(--spin, 240deg));
    opacity: 0;
  }
}
.progress {
  color: var(--text-dim);
  font-family: "Cinzel", serif;
  letter-spacing: 2px;
  font-weight: 600;
}
.score {
  color: var(--accent);
  font-weight: bold;
  font-family: "Cinzel", serif;
  letter-spacing: 1px;
  font-size: 13px;
}
.score span {
  font-size: 18px;
  text-shadow: 0 0 6px rgba(255, 210, 63, 0.45);
}
.time-left {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-2);
  font-family: "Cinzel", serif;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(93, 220, 168, 0.4);
}
.time-left.danger {
  color: var(--danger);
  text-shadow: 0 0 8px rgba(255, 93, 108, 0.6);
}
.combo { color: var(--accent); font-weight: bold; font-size: 16px; transition: transform 0.2s; }
.combo.flame-3 {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.9), 0 0 16px rgba(255, 150, 0, 0.5);
  animation: flamePulse 0.6s ease-in-out infinite alternate;
}
.combo.flame-5 {
  color: #ff8c1a;
  text-shadow: 0 0 10px rgba(255, 140, 26, 0.9), 0 0 22px rgba(255, 60, 0, 0.6);
  animation: flamePulse 0.45s ease-in-out infinite alternate;
  font-size: 18px;
}
.combo.flame-10 {
  color: #ff5d6c;
  text-shadow: 0 0 14px rgba(255, 93, 108, 1), 0 0 28px rgba(255, 0, 50, 0.7);
  animation: flamePulse 0.3s ease-in-out infinite alternate;
  font-size: 20px;
}
@keyframes flamePulse {
  from { transform: scale(1); }
  to   { transform: scale(1.14); }
}

/* モード別 HUD 出し分け */
#time-left, #combo { display: none; }
#screen-play.mode-timeattack #lives,
#screen-play.mode-timeattack #progress { display: none; }
#screen-play.mode-timeattack #time-left,
#screen-play.mode-timeattack #combo { display: inline; }

/* モード選択ボタンの補助テキスト */
.mode-desc {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
}
.select-btn.selected .mode-desc { color: var(--text); }

/* 正誤フラッシュ（タイムアタック用） */
.prompt.flash-ok { animation: flashOk 0.5s; }
.prompt.flash-ng { animation: flashNg 0.5s; }
@keyframes flashOk {
  0%   { color: var(--text); transform: scale(1); }
  40%  { color: var(--accent-2); transform: scale(1.08); }
  100% { color: var(--text); transform: scale(1); }
}
@keyframes flashNg {
  0%   { color: var(--text); transform: scale(1); }
  40%  { color: var(--danger); transform: scale(0.95); }
  100% { color: var(--text); transform: scale(1); }
}

/* タイマー */
.timer-bar {
  width: 100%;
  height: 10px;
  background: rgba(10, 12, 28, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}
.timer-fill {
  height: 100%;
  width: 100%;
  /* 手前: 光の筋（シマー） / 奥: 本体グラデーション */
  background:
    linear-gradient(
      100deg,
      transparent 35%,
      rgba(255, 255, 255, 0.38) 48%,
      rgba(255, 255, 255, 0.55) 50%,
      rgba(255, 255, 255, 0.38) 52%,
      transparent 65%
    ),
    linear-gradient(90deg, var(--accent-2), var(--accent));
  background-size: 220% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 200% 0, 0 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(255, 210, 63, 0.4);
  animation: timerShimmer 2.4s linear infinite;
}
@keyframes timerShimmer {
  from { background-position: 220% 0, 0 0; }
  to   { background-position: -120% 0, 0 0; }
}
.timer-fill.danger {
  background:
    linear-gradient(
      100deg,
      transparent 35%,
      rgba(255, 255, 255, 0.4) 48%,
      rgba(255, 255, 255, 0.6) 50%,
      rgba(255, 255, 255, 0.4) 52%,
      transparent 65%
    ),
    linear-gradient(90deg, #ff8c1a, var(--danger));
  background-size: 220% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 200% 0, 0 0;
  animation:
    timerShimmer 1.6s linear infinite,
    dangerPulse 0.6s ease-in-out infinite alternate;
}
@keyframes dangerPulse {
  from { box-shadow: 0 0 4px rgba(255, 93, 108, 0.3); }
  to   { box-shadow: 0 0 18px rgba(255, 93, 108, 0.8); }
}

/* 出題エリアの入れ替えアニメ */
.question-area.slide-in {
  animation: questionSlideIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.question-area.slide-out {
  animation: questionSlideOut 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}
@keyframes questionSlideIn {
  0%   { transform: translateX(28px); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translateX(0);    opacity: 1; }
}
@keyframes questionSlideOut {
  0%   { transform: translateX(0);    opacity: 1; }
  100% { transform: translateX(-24px); opacity: 0; }
}
/* 選択肢も一緒にフェードイン */
.choices.slide-in {
  animation: questionSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* 出題エリア */
.question-area {
  background:
    radial-gradient(ellipse at top, rgba(255, 210, 63, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 40px rgba(255, 210, 63, 0.03);
}
/* 四隅の装飾 */
.question-area::before,
.question-area::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  opacity: 0.7;
}
.question-area::before {
  top: -1px; left: -1px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 14px;
}
.question-area::after {
  bottom: -1px; right: -1px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 14px;
}

/* パーティクル（キラキラ） */
.sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #fff 0%, var(--accent) 55%, transparent 75%);
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleMove 0.75s ease-out forwards;
  z-index: 3;
  box-shadow: 0 0 8px rgba(255, 210, 63, 0.8);
}
@keyframes sparkleMove {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  70%  { opacity: 0.8; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* 画面シェイク（不正解時） — .screen:not(.overlay).active より優先されるよう ID で特異度を上げる */
#screen-play.shake {
  animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes screenShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* コンボ大ポップアップ（3/5/10達成時） */
.combo-popup {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  font-family: "Cinzel", serif;
  font-size: 56px;
  font-weight: bold;
  color: var(--accent);
  text-shadow:
    0 0 20px rgba(255, 210, 63, 0.95),
    0 0 40px rgba(255, 140, 26, 0.6),
    0 4px 14px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  letter-spacing: 3px;
  text-align: center;
  white-space: nowrap;
}
.combo-popup.show { animation: comboPopup 0.95s cubic-bezier(0.25, 1.2, 0.5, 1) forwards; }
.combo-popup.tier-5 {
  color: #ff8c1a;
  text-shadow: 0 0 22px rgba(255,140,26,1), 0 0 44px rgba(255,60,0,0.75), 0 4px 14px rgba(0,0,0,0.7);
  font-size: 62px;
}
.combo-popup.tier-10 {
  color: #ff5d6c;
  text-shadow: 0 0 26px rgba(255,93,108,1), 0 0 52px rgba(255,0,50,0.85), 0 4px 14px rgba(0,0,0,0.75);
  font-size: 72px;
}
@keyframes comboPopup {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); opacity: 0; }
  18%  { transform: translate(-50%, -50%) scale(1.25) rotate(4deg);  opacity: 1; }
  35%  { transform: translate(-50%, -50%) scale(1.0) rotate(0deg);   opacity: 1; }
  80%  { transform: translate(-50%, -50%) scale(1.0) rotate(0deg);   opacity: 1; }
  100% { transform: translate(-50%, -95%) scale(0.85) rotate(0deg);  opacity: 0; }
}
@media (max-width: 600px) {
  .combo-popup { font-size: 40px; letter-spacing: 2px; }
  .combo-popup.tier-5 { font-size: 46px; }
  .combo-popup.tier-10 { font-size: 54px; }
}

/* 正解時の大型バースト（星・剣） */
.burst-particle {
  position: fixed;
  top: 50%;
  left: 50%;
  pointer-events: none;
  z-index: 99;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.85)) drop-shadow(0 0 12px rgba(255, 140, 0, 0.5));
  animation: burstFly 0.85s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
@keyframes burstFly {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(0deg); opacity: 0; }
  12%  { transform: translate(-50%, -50%) scale(1.1) rotate(var(--spin-mid, 60deg)); opacity: 1; }
  100% {
    transform:
      translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)))
      scale(0.55) rotate(var(--spin, 180deg));
    opacity: 0;
  }
}

/* 画面フェード遷移 */
.screen:not(.overlay).active {
  animation: screenFade 0.22s ease-out;
}
@keyframes screenFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* フッター */
.footer-sep { color: var(--text-dim); margin: 0 6px; font-size: 10px; }

/* 速答スコアポップアップ */
.score-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: bold;
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.score-popup.show {
  animation: scorePopup 0.8s ease-out;
}
@keyframes scorePopup {
  0%   { transform: translate(-50%, 10%);  opacity: 0; }
  20%  { transform: translate(-50%, -50%); opacity: 1; }
  100% { transform: translate(-50%, -130%); opacity: 0; }
}
.score-popup .speed-bonus {
  display: block;
  font-size: 16px;
  color: var(--accent-2);
  font-weight: bold;
  margin-top: 4px;
}
.prompt-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.prompt {
  font-size: 44px;
  font-weight: bold;
  letter-spacing: 2px;
  line-height: 1.6;
}
.prompt.phrase {
  font-size: 34px;
  letter-spacing: 1px;
}
.prompt ruby rt {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: normal;
  letter-spacing: 0;
}
.feedback-example-ja ruby rt,
.hint-display ruby rt {
  font-size: 10px;
  color: var(--text-dim);
}

/* 回答フォーム */
.answer-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

/* 4択 */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.choice-btn {
  padding: 18px 14px;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s, box-shadow 0.15s;
  text-align: center;
  line-height: 1.6;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.choice-btn:hover:not(:disabled):not(.eliminated) {
  border-color: var(--accent);
  background: linear-gradient(180deg, #2b305a 0%, var(--bg-panel-hi) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 210, 63, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.choice-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.choice-btn.eliminated {
  opacity: 0.3;
  text-decoration: line-through;
  cursor: not-allowed;
}
.choice-btn.correct {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(93, 220, 168, 0.35), rgba(30, 34, 64, 0.85));
  box-shadow: 0 0 28px rgba(93, 220, 168, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: choicePulseCorrect 0.75s ease-out;
  position: relative;
  z-index: 1;
}
@keyframes choicePulseCorrect {
  0%   { transform: scale(1);    box-shadow: 0 0 0 rgba(93,220,168,0); }
  30%  { transform: scale(1.06); box-shadow: 0 0 42px rgba(93,220,168,0.95), 0 0 72px rgba(93,220,168,0.45); }
  100% { transform: scale(1);    box-shadow: 0 0 28px rgba(93,220,168,0.55); }
}
.choice-btn.wrong {
  border-color: var(--danger);
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.28), rgba(30, 34, 64, 0.85));
  box-shadow: 0 0 22px rgba(255, 93, 108, 0.5);
  animation: choiceShake 0.5s cubic-bezier(.36,.07,.19,.97);
}
@keyframes choiceShake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-7px); }
  30%      { transform: translateX(6px); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(3px); }
  80%      { transform: translateX(-1px); }
}
/* 選ばなかった選択肢は薄くして正解/誤答にフォーカス */
.choice-btn:disabled:not(.correct):not(.wrong) {
  opacity: 0.42;
  filter: grayscale(0.55);
}
.choice-btn ruby rt {
  font-size: 11px;
  color: var(--text-dim);
}
@media (max-width: 480px) {
  .choices { grid-template-columns: 1fr; }
}
#answer-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
}
#answer-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ヒント */
.hints {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.hint-btn {
  padding: 8px 14px;
  background: transparent;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s, opacity 0.3s, filter 0.3s;
}
.hint-btn:hover:not(.used) {
  color: var(--text);
  border-color: var(--accent-2);
  background: rgba(93, 220, 168, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(93, 220, 168, 0.2);
}
.hint-btn:active:not(.used) {
  transform: translateY(1px);
  box-shadow: none;
  background: rgba(93, 220, 168, 0.12);
}
.hint-btn.used {
  opacity: 0.48;
  cursor: default;
  border-style: solid;
  border-color: var(--text-dim);
  color: var(--text-dim);
  filter: grayscale(0.5);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  padding-left: 22px;
  animation: hintMarkUsed 0.4s ease-out;
}
.hint-btn.used::before {
  content: "✓";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(93, 220, 168, 0.6);
  animation: hintCheckPop 0.4s cubic-bezier(0.25, 1.3, 0.5, 1) both;
}
@keyframes hintMarkUsed {
  0%   { transform: scale(1.05); filter: grayscale(0) brightness(1.2); }
  100% { transform: scale(1);    filter: grayscale(0.5) brightness(1); }
}
@keyframes hintCheckPop {
  0%   { transform: translateY(-50%) scale(0) rotate(-40deg); opacity: 0; }
  60%  { transform: translateY(-50%) scale(1.35) rotate(8deg); opacity: 1; }
  100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; }
}

.hint-display {
  min-height: 32px;
  padding: 8px 12px;
  text-align: center;
  color: var(--accent-2);
  font-size: 14px;
}
.hint-display .hint-line {
  margin: 3px 0;
  animation: hintFadeIn 0.25s ease-out;
}
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 利用規約 */
.terms-title {
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  border: none;
  padding: 0;
  margin: 20px 0 6px;
  text-align: center;
  letter-spacing: 3px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 18px rgba(255, 210, 63, 0.2);
}
.terms-subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 16px;
}
.terms-body {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 18px 20px;
  line-height: 2;
  font-size: 13px;
  max-height: 55vh;
  overflow-y: auto;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}
.terms-body p { margin-bottom: 10px; }
.terms-body ul { padding-left: 20px; margin-bottom: 10px; }
.terms-body li { margin-bottom: 10px; }
.terms-body strong { color: var(--accent); }
.terms-body ruby rt,
.terms-msg ruby rt {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: normal;
}
.terms-msg {
  text-align: center;
  color: var(--danger);
  font-size: 13px;
  margin-top: 16px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}
.terms-msg.show { opacity: 1; }

.link-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-2); }

/* ルール説明 */
.rules-card {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 12px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.rule-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.rule-row:last-child { border-bottom: none; }
.rule-label {
  color: var(--accent-2);
  font-weight: bold;
  font-size: 14px;
}
.rule-body { font-size: 14px; line-height: 1.7; }
.rule-body ul { padding-left: 18px; }
.rule-body li { margin-bottom: 4px; }
.rule-body strong { color: var(--text); }
.rule-body .accent { color: var(--accent); }
.rule-body .danger { color: var(--danger); }

@media (max-width: 480px) {
  .rule-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ギブアップ */
.play-footer {
  margin-top: 24px;
  text-align: center;
}
.give-up-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 12px;
  cursor: pointer;
}
.give-up-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* 確認モーダル */
.modal-card {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 30px 26px;
  width: min(90%, 420px);
  text-align: center;
  animation: modalPop 0.15s ease-out;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 12px;
  color: var(--text);
}
.modal-message {
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.danger-btn {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 0 #a63444;
}
.danger-btn:active {
  box-shadow: 0 2px 0 #a63444;
}

/* フィードバック */
.feedback-card {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 30px 26px;
  width: min(90%, 460px);
  text-align: center;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.feedback-result {
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.feedback-result.ok { color: var(--accent-2); }
.feedback-result.ng { color: var(--danger); }

.feedback-answer {
  font-size: 20px;
  margin-bottom: 16px;
}
.feedback-answer #feedback-answer-en { color: var(--accent); font-weight: bold; }
.feedback-answer #feedback-answer-ja { color: var(--text); font-weight: bold; }
.feedback-answer #feedback-answer-ja ruby rt { font-size: 11px; color: var(--text-dim); font-weight: normal; }
.feedback-eq {
  color: var(--text-dim);
  margin: 0 8px;
  font-weight: normal;
}

.speak-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 6px;
  font-size: 16px;
}
.speak-btn:hover { background: var(--border); }

.feedback-full-form {
  font-family: "Cinzel", Georgia, serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin: -8px 0 16px;
  padding: 8px 12px;
  background: rgba(255, 210, 63, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  text-align: left;
}
.feedback-full-form::before {
  content: "= ";
  color: var(--text-dim);
  margin-right: 4px;
}

.feedback-example {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  text-align: left;
}
.feedback-example-en { color: var(--text); margin-bottom: 6px; }
.feedback-example-ja { color: var(--text-dim); font-size: 13px; }

/* 終了画面 */
#over-title {
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-size: 44px;
  font-weight: 800;
  text-align: center;
  margin: 32px 0 20px;
  color: var(--accent);
  border: none;
  padding: 0;
  letter-spacing: 4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6), 0 0 30px rgba(255, 210, 63, 0.3);
}
.result-stats {
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  line-height: 1.8;
  font-size: 16px;
  max-width: 420px;
  margin: 0 auto 16px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.result-stats .big-score {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  letter-spacing: 2px;
}
.result-stats .big-score span {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 52px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 6px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 24px rgba(255, 210, 63, 0.3);
  letter-spacing: 2px;
}
.result-stats span { color: var(--accent); font-weight: bold; }
.stat-line { color: var(--text); position: relative; transition: color 0.3s; }

/* PB（マイベスト）更新時のハイライト */
.stat-line.pb-highlight {
  color: var(--accent);
  animation: pbGlow 1.1s ease-in-out infinite alternate;
}
.stat-line.pb-highlight::after {
  content: "✨ NEW!";
  display: inline-block;
  margin-left: 10px;
  font-family: "Cinzel", serif;
  font-size: 13px;
  color: #ff8c1a;
  text-shadow: 0 0 8px rgba(255, 140, 26, 0.9);
  animation: pbBadgePop 0.7s cubic-bezier(0.25, 1.3, 0.5, 1) both;
  letter-spacing: 1px;
  vertical-align: middle;
}
@keyframes pbGlow {
  from { text-shadow: 0 0 0 rgba(255,210,63,0); }
  to   { text-shadow: 0 0 10px rgba(255,210,63,0.7), 0 0 20px rgba(255,140,26,0.45); }
}
@keyframes pbBadgePop {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.3) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 紙吹雪 */
.confetti {
  position: fixed;
  top: -24px;
  width: 10px;
  height: 14px;
  pointer-events: none;
  z-index: 98;
  border-radius: 2px;
  opacity: 0.95;
  animation: confettiFall linear forwards;
  will-change: transform, opacity;
}
@keyframes confettiFall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% {
    transform: translate(var(--drift, 0px), 110vh) rotate(var(--spin-end, 720deg));
    opacity: 0.3;
  }
}

/* モード別表示の出し分け */
#screen-over .mode-only-ta { display: none; }
#screen-over .mode-only-normal { display: none; }
#screen-over.mode-timeattack .mode-only-ta { display: block; }
#screen-over.mode-normal .mode-only-normal { display: block; }
#screen-over.mode-timeattack .stat-line.mode-only-ta { display: block; }

/* ニックネーム入力 */
.nickname-box {
  max-width: 420px;
  margin: 0 auto 16px;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.nickname-label {
  text-align: center;
  color: var(--accent-2);
  font-weight: bold;
  margin-bottom: 12px;
  font-size: 14px;
}
.nickname-row {
  display: flex;
  gap: 8px;
}
#nickname-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #0e1220;
  color: var(--text);
}
#nickname-input:focus {
  outline: none;
  border-color: var(--accent);
}
#nickname-input:disabled {
  opacity: 0.6;
}
#submit-score-btn {
  padding: 10px 20px;
  font-size: 14px;
}
.submit-status {
  text-align: center;
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}
.submit-status.ok { color: var(--accent-2); }
.submit-status.ng { color: var(--danger); }

/* ニックネーム入力の注意書き */
.nickname-notes {
  list-style: none;
  padding: 10px 12px 0;
  margin: 10px 0 0;
  border-top: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.7;
}
.nickname-notes li {
  position: relative;
  padding-left: 14px;
  margin: 2px 0;
}
.nickname-notes li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  color: var(--danger);
  opacity: 0.85;
}
.nickname-notes li b {
  color: var(--danger);
  font-weight: 600;
}

/* ランキング */
.ranking-box {
  max-width: 520px;
  margin: 0 auto 16px;
  background: linear-gradient(180deg, var(--bg-panel-hi) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.ranking-header {
  text-align: center;
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 14px;
  font-size: 18px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.ranking-header::before,
.ranking-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  max-width: 60px;
}
.ranking-header::after { background: linear-gradient(90deg, var(--accent), transparent); }
.ranking-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.5px;
}
.ranking-loading {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 16px;
}
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ranking-table th, .ranking-table td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.ranking-table th {
  color: var(--text-dim);
  font-weight: normal;
  font-size: 11px;
}
.ranking-table td:first-child { width: 50px; color: var(--text-dim); font-family: "Cinzel", serif; font-weight: 600; }
.ranking-table td:nth-child(3) { color: var(--accent); font-weight: bold; text-align: right; width: 80px; font-family: "Cinzel", serif; }
.ranking-table td:last-child { width: 70px; text-align: right; color: var(--text-dim); font-size: 11px; }
/* TOP 3 装飾 */
.ranking-table tbody tr:nth-child(1) td {
  background: linear-gradient(90deg, rgba(255, 210, 63, 0.18) 0%, transparent 80%);
}
.ranking-table tbody tr:nth-child(1) td:first-child {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.6);
}
.ranking-table tbody tr:nth-child(1) td:first-child::before { content: "👑 "; }
.ranking-table tbody tr:nth-child(2) td {
  background: linear-gradient(90deg, rgba(200, 200, 210, 0.1) 0%, transparent 80%);
}
.ranking-table tbody tr:nth-child(2) td:first-child { color: #d8d8e0; }
.ranking-table tbody tr:nth-child(2) td:first-child::before { content: "🥈 "; }
.ranking-table tbody tr:nth-child(3) td {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, transparent 80%);
}
.ranking-table tbody tr:nth-child(3) td:first-child { color: #d9884b; }
.ranking-table tbody tr:nth-child(3) td:first-child::before { content: "🥉 "; }
/* 自分のスコア（上の背景より優先） */
.ranking-table tr.me td { background: rgba(255, 210, 63, 0.2) !important; }
.ranking-table tr.me td:first-child { color: var(--accent); font-weight: bold; }
.ranking-table tr.empty td { text-align: center; color: var(--text-dim); padding: 16px; }

/* ===== デイリーランキング ルール / カウントダウン ===== */
.ranking-rules {
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 210, 63, 0.06), rgba(124, 77, 255, 0.06));
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}
.ranking-rules .rules-title {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ranking-rules .rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ranking-rules .rules-list li {
  position: relative;
  padding-left: 14px;
  margin: 2px 0;
}
.ranking-rules .rules-list li::before {
  content: "◆";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 9px;
  opacity: 0.7;
}
.ranking-rules .rules-list li b {
  color: var(--text);
  font-weight: 600;
}
.reset-countdown {
  display: inline-block;
  min-width: 72px;
  padding: 1px 6px;
  margin-left: 2px;
  background: rgba(255, 210, 63, 0.12);
  border: 1px solid rgba(255, 210, 63, 0.3);
  border-radius: 4px;
  color: var(--accent);
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  text-align: center;
}

/* ===== モバイル対応 ===== */

/* タブレット〜中サイズ (<=600px) */
@media (max-width: 600px) {
  #app { padding-top: 18px; padding-bottom: 18px; }
  .screen-heading { font-size: 24px; gap: 10px; }
  .screen-heading::before, .screen-heading::after { width: 30px; }
  .section-heading { font-size: 16px; margin: 22px 0 10px; }
  .prompt { font-size: 36px; }
  .prompt.phrase { font-size: 28px; }
  #over-title { font-size: 38px; letter-spacing: 3px; }
  .result-stats .big-score span { font-size: 46px; }
  .feedback-result { font-size: 34px; }
  .terms-title { font-size: 22px; letter-spacing: 2px; }
  .terms-body { font-size: 12px; padding: 14px 16px; }
  .grid-buttons { grid-template-columns: 1fr; }
  .primary-btn, .secondary-btn { padding: 13px 22px; font-size: 15px; }
  .button-row { flex-wrap: wrap; }
  .button-row .primary-btn, .button-row .secondary-btn { flex: 1; min-width: 140px; }
}

/* スマートフォン (<=480px) */
@media (max-width: 480px) {
  .app-logo { font-size: 18px; letter-spacing: 2px; }
  .nav-tab { padding: 6px 2px; font-size: 11.5px; letter-spacing: 0.3px; }
  .nav-tab .nav-icon { font-size: 17px; }
  .audio-btn { font-size: 17px; padding: 7px 10px; }

  .screen-heading { font-size: 22px; letter-spacing: 1px; }
  .screen-heading::before, .screen-heading::after { width: 24px; }
  .screen-sub { font-size: 12px; margin-bottom: 20px; }

  .prompt { font-size: 32px; letter-spacing: 1px; }
  .prompt.phrase { font-size: 24px; }
  .question-area { padding: 26px 14px; }

  .hud { padding: 8px 10px; font-size: 12px; gap: 6px; }
  .hud-center { font-size: 12px; }
  .lives { font-size: 18px; letter-spacing: 2px; }
  .score { font-size: 11px; }
  .score span { font-size: 16px; }
  .time-left { font-size: 15px; }
  .combo { font-size: 14px; }

  #answer-input { font-size: 16px; padding: 12px 14px; }
  .answer-form .primary-btn { padding: 12px 18px; font-size: 14px; }

  .choice-btn { font-size: 17px; padding: 16px 10px; line-height: 1.5; }
  .choice-btn ruby rt { font-size: 9px; }

  .hint-btn { font-size: 12px; padding: 7px 12px; }
  .hint-display { font-size: 12px; min-height: 28px; }

  .feedback-result { font-size: 30px; }
  .feedback-card, .modal-card { padding: 24px 18px; }
  .feedback-answer { font-size: 17px; }
  .feedback-example { padding: 10px; font-size: 13px; }

  #over-title { font-size: 34px; letter-spacing: 2px; margin: 24px 0 16px; }
  .result-stats { padding: 18px; font-size: 15px; }
  .result-stats .big-score span { font-size: 42px; }

  .nickname-label { font-size: 13px; }
  #nickname-input { font-size: 16px; padding: 9px 10px; }
  #submit-score-btn { padding: 9px 16px; font-size: 13px; }

  .ranking-filters { flex-direction: column; gap: 8px; }
  .filter-label { min-width: 0; }
  .ranking-header { font-size: 15px; }
  .ranking-table { font-size: 12px; }
  .ranking-table th, .ranking-table td { padding: 6px 4px; }
  /* MAX COMBO 列を省略して見やすく */
  .ranking-table th:nth-child(4),
  .ranking-table td:nth-child(4) { display: none; }
  .ranking-rules { font-size: 11px; padding: 10px 12px; }
  .reset-countdown { font-size: 10px; min-width: 64px; }

  .rules-card { padding: 16px; }
  .rule-row { padding: 10px 0; }
  .rule-label { font-size: 13px; }
  .rule-body { font-size: 13px; }

  .terms-audio-toggles .audio-btn { font-size: 14px; padding: 9px 14px; }

  .select-btn, .choice-btn, .primary-btn, .secondary-btn, .audio-btn, .hint-btn { min-height: 40px; }
}

/* 小型スマホ (<=360px) */
@media (max-width: 360px) {
  .app-logo { font-size: 16px; }
  .nav-tab { padding: 5px 1px; font-size: 10.5px; letter-spacing: 0.2px; }
  .nav-tab .nav-icon { font-size: 15px; }
  .prompt { font-size: 28px; }
  .prompt.phrase { font-size: 22px; }
  .screen-heading { font-size: 20px; }
  #over-title { font-size: 30px; }
  .choice-btn { font-size: 16px; padding: 14px 8px; }
}

/* =================================
   ワードダッシュ (Runner)
   ================================= */

/* HUD */
.runner-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
}
.runner-hud-meta {
  display: flex;
  gap: 14px;
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: #e9ecf6;
  font-size: 14px;
}
.runner-hud-meta strong {
  color: #ffd23f;
  font-size: 16px;
  margin-left: 4px;
}

/* ステージ */
.runner-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: min(320px, calc(100vh - 260px));
  margin: 10px auto;
  overflow: hidden;
  border-radius: 12px;
  border: 2px solid rgba(255, 210, 63, 0.3);
  background: linear-gradient(180deg, #6bb6ff 0%, #a8d4ff 55%, #ffdaa3 85%, #f4b266 100%);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.runner-sky {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 34px 12px at 50px 40px, rgba(255, 255, 255, 0.92), transparent 72%),
    radial-gradient(ellipse 22px 9px at 130px 70px, rgba(255, 255, 255, 0.75), transparent 72%),
    radial-gradient(ellipse 40px 14px at 230px 32px, rgba(255, 255, 255, 0.9), transparent 72%),
    radial-gradient(ellipse 18px 8px at 300px 80px, rgba(255, 255, 255, 0.6), transparent 72%);
  background-size: 360px 140px;
  background-repeat: repeat-x;
  background-position: calc(var(--scroll-x, 0) * -0.15) 0;
  pointer-events: none;
}
.runner-mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 42px;
  height: 80px;
  background-image:
    linear-gradient(135deg, transparent 48%, #5a4070 48% 52%, transparent 52%),
    linear-gradient(225deg, transparent 48%, #5a4070 48% 52%, transparent 52%);
  background-size: 80px 80px, 80px 80px;
  background-position:
    calc(var(--scroll-x, 0) * -0.35) 0,
    calc(var(--scroll-x, 0) * -0.35 + 40px) 0;
  background-repeat: repeat-x, repeat-x;
  opacity: 0.55;
  pointer-events: none;
}
.runner-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  background:
    linear-gradient(180deg, #8b6333 0%, #5a3f20 40%, #3a2810 100%);
  border-top: 2px solid #b8874a;
  box-shadow: inset 0 6px 0 -2px rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.runner-ground::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.28) 0 2px,
      transparent 2px 14px,
      rgba(255, 255, 255, 0.1) 14px 15px,
      transparent 15px 28px);
  background-size: 28px 100%;
  background-repeat: repeat-x;
  background-position: calc(var(--scroll-x, 0) * -1) 0;
  opacity: 0.75;
}
.runner-ground::after {
  /* 地面の小石（ちらっと見える粒） */
  content: "";
  position: absolute;
  inset: 8px 0 0;
  background-image:
    radial-gradient(circle at 10px 14px, rgba(255, 255, 255, 0.25) 0 1.5px, transparent 2px),
    radial-gradient(circle at 45px 22px, rgba(0, 0, 0, 0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 75px 10px, rgba(255, 255, 255, 0.2) 0 1px, transparent 2px);
  background-size: 100px 32px;
  background-repeat: repeat-x;
  background-position: calc(var(--scroll-x, 0) * -1) 0;
  opacity: 0.7;
}

/* キャラの影 */
.runner-shadow {
  position: absolute;
  width: 36px;
  height: 10px;
  left: 0;
  top: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 70%);
  transform-origin: center;
  pointer-events: none;
  z-index: 4;
  will-change: transform, opacity;
}

/* キャラクター (オレンジの子ギツネ、右向き) */
.runner-char {
  position: absolute;
  width: 40px;
  height: 40px;
  left: 0;
  top: 0;
  font-size: 0;
  z-index: 5;
  transform-origin: 50% 90%;
  will-change: transform;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}
.runner-char > div { position: absolute; }

/* 体本体 */
.runner-char .char-body {
  left: 4px;
  top: 10px;
  width: 30px;
  height: 26px;
  background: linear-gradient(180deg, #ffa04a 0%, #e8711a 60%, #b54a0a 100%);
  border: 2px solid #5a2008;
  border-radius: 55% 50% 45% 50% / 60% 65% 40% 45%;
  box-shadow: inset -3px -2px 0 rgba(0, 0, 0, 0.18);
  z-index: 2;
}
/* お腹の白い模様 */
.runner-char .char-belly {
  left: 10px;
  top: 22px;
  width: 16px;
  height: 12px;
  background: #fff4d4;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  z-index: 3;
}
/* 耳（左） */
.runner-char .char-ear-l {
  left: 7px;
  top: 2px;
  width: 9px;
  height: 12px;
  background: linear-gradient(180deg, #c75a1a 0%, #8a3a0a 100%);
  border: 2px solid #5a2008;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: rotate(-10deg);
  z-index: 1;
}
/* 耳（右、前に出る） */
.runner-char .char-ear-r {
  left: 20px;
  top: 2px;
  width: 9px;
  height: 12px;
  background: linear-gradient(180deg, #ffa04a 0%, #c75a1a 100%);
  border: 2px solid #5a2008;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: rotate(8deg);
  z-index: 4;
}
/* 耳の内側の白（右耳のみ、擬似要素で） */
.runner-char .char-ear-r::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 3px;
  height: 5px;
  background: #fff4d4;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
/* しっぽ（左後ろに伸びる、白い先端） */
.runner-char .char-tail {
  left: -6px;
  top: 14px;
  width: 16px;
  height: 14px;
  background: linear-gradient(100deg, #ffb870 0%, #ff9a3a 60%, #c75a1a 100%);
  border: 2px solid #5a2008;
  border-radius: 50% 30% 60% 50% / 50% 40% 60% 50%;
  transform: rotate(-8deg);
  z-index: 1;
  animation: char-tail-wag 0.45s ease-in-out infinite alternate;
}
.runner-char .char-tail::before {
  /* しっぽ先端の白 */
  content: "";
  position: absolute;
  left: -3px;
  top: 3px;
  width: 8px;
  height: 8px;
  background: #fff4d4;
  border: 2px solid #5a2008;
  border-radius: 50%;
}
@keyframes char-tail-wag {
  from { transform: rotate(-12deg); }
  to   { transform: rotate(-2deg); }
}
/* 顔（目・鼻・口） */
.runner-char .char-face {
  right: 5px;
  top: 16px;
  width: 4px;
  height: 4px;
  background: #0c1025;
  border-radius: 50%;
  z-index: 5;
  box-shadow:
    0.5px 0.5px 0 rgba(255, 255, 255, 0.85),  /* 瞳の光 */
    -3px 6px 0 -0.5px #3a1408,                 /* ほお */
    -7px 4px 0 -1px #0c1025;                   /* 鼻 */
}
.runner-char .char-face::after {
  /* 口（笑顔の線） */
  content: "";
  position: absolute;
  left: -7px;
  top: 7px;
  width: 5px;
  height: 3px;
  border: 1.2px solid #0c1025;
  border-top: none;
  border-radius: 0 0 50% 50%;
}
.runner-char.invincible {
  animation: runner-blink 0.18s steps(2) infinite;
}
@keyframes runner-blink {
  50% { opacity: 0.25; }
}

/* ジャンプ時の砂埃 */
.runner-dust {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 8px;
  background: radial-gradient(ellipse at center, rgba(220, 200, 160, 0.75) 0%, rgba(220, 200, 160, 0) 70%);
  pointer-events: none;
  z-index: 3;
  will-change: transform, opacity;
  animation: runner-dust-puff 0.45s ease-out forwards;
}
@keyframes runner-dust-puff {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(1.8) translateX(-8px); opacity: 0; }
}

/* エンティティ共通 */
.runner-entities {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.runner-obs {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

/* 岩 */
.runner-obs.rock {
  width: 34px;
  height: 30px;
  background:
    radial-gradient(circle at 35% 30%, #a8a8a8 0 4px, transparent 5px),
    linear-gradient(180deg, #7a7a7a 0%, #4a4a4a 100%);
  border: 2px solid #2a2a2a;
  border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%;
  box-shadow: inset -3px -2px 0 rgba(0, 0, 0, 0.25);
}
.runner-obs.big-rock {
  width: 50px;
  height: 46px;
  background:
    radial-gradient(circle at 30% 25%, #a8a8a8 0 6px, transparent 7px),
    linear-gradient(180deg, #6a6a6a 0%, #3a3a3a 100%);
  border: 2px solid #1a1a1a;
  border-radius: 45% 50% 30% 35% / 60% 65% 40% 40%;
  box-shadow: inset -4px -3px 0 rgba(0, 0, 0, 0.3);
}

/* 棘 */
.runner-obs.spike {
  width: 30px;
  height: 26px;
  background: transparent;
  border: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.runner-obs.spike::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #c8c8c8 0%, #5a5a5a 100%);
  clip-path: polygon(0 100%, 15% 40%, 30% 100%, 50% 20%, 70% 100%, 85% 40%, 100% 100%);
}
.runner-obs.spike::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 4px;
  background: #3a2810;
  border-radius: 2px;
}

/* サボテン */
.runner-obs.cactus {
  width: 28px;
  height: 48px;
  background: transparent;
  border: none;
}
.runner-obs.cactus::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 12px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #4ca64c 0%, #2a6a2a 100%);
  border: 2px solid #1a4018;
  border-radius: 5px;
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.2);
}
.runner-obs.cactus::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 14px;
  width: 8px;
  height: 16px;
  background: linear-gradient(180deg, #4ca64c 0%, #2a6a2a 100%);
  border: 2px solid #1a4018;
  border-radius: 4px 4px 2px 2px;
  box-shadow:
    18px -4px 0 -2px #2a6a2a,
    18px -4px 0 0 #1a4018;
}

.runner-obs.hit-flash,
.runner-plat.hit-flash {
  animation: runner-obs-hit 0.3s ease-out;
}
@keyframes runner-obs-hit {
  0% { filter: brightness(1); }
  50% { filter: brightness(2.5) drop-shadow(0 0 8px #ff6b6b); }
  100% { filter: brightness(1); }
}

/* プラトー（段差：台形の地面） */
.runner-plat {
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(180deg,
    #8b6333 0%,
    #5a3f20 40%,
    #3a2810 100%);
  clip-path: polygon(
    var(--ri, 40px) 0,
    calc(100% - var(--ro, 40px)) 0,
    100% 100%,
    0 100%
  );
  z-index: 1;
}
.runner-plat::before {
  /* 草の上面 */
  content: "";
  position: absolute;
  top: 0;
  left: var(--ri, 40px);
  right: var(--ro, 40px);
  height: 5px;
  background: linear-gradient(180deg, #6ba84a 0%, #4a7a3a 100%);
  border-bottom: 1px solid #2a4a20;
}
.runner-plat::after {
  /* 断面の縞 */
  content: "";
  position: absolute;
  inset: 5px 0 0;
  background-image: repeating-linear-gradient(90deg,
    rgba(0, 0, 0, 0.18) 0 2px,
    transparent 2px 22px);
  background-size: 22px 100%;
  background-repeat: repeat-x;
  background-position: calc(var(--scroll-x, 0) * -1) 0;
  opacity: 0.55;
}

/* 落とし穴 (床が切れた谷間) */
.runner-pit {
  position: absolute;
  top: 0;
  left: 0;
  height: 42px;
  /* 上部は地平線色（空が見える）、下に行くほど闇 */
  background: linear-gradient(180deg,
    #f4b266 0%,
    #c78850 18%,
    #3a2810 55%,
    #0a0500 100%);
  z-index: 3;
  overflow: hidden;
}
.runner-pit::before {
  /* 左の崖（土の断面） */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: linear-gradient(180deg,
    #b8874a 0%,
    #8b6333 10%,
    #5a3f20 40%,
    #3a2810 80%,
    #1a0f05 100%);
  border-right: 1.5px solid #000;
  box-shadow:
    inset -2px 0 3px rgba(0, 0, 0, 0.5),
    inset 2px 0 0 rgba(255, 255, 255, 0.08);
}
.runner-pit::after {
  /* 右の崖 */
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: linear-gradient(180deg,
    #b8874a 0%,
    #8b6333 10%,
    #5a3f20 40%,
    #3a2810 80%,
    #1a0f05 100%);
  border-left: 1.5px solid #000;
  box-shadow:
    inset 2px 0 3px rgba(0, 0, 0, 0.5),
    inset -2px 0 0 rgba(255, 255, 255, 0.08);
}

/* コイン（金貨） */
.runner-coin {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fff6b0 0 5px, transparent 6px),
    linear-gradient(180deg, #ffd23f 0%, #c79a1a 100%);
  border: 2px solid #8a6a1a;
  box-shadow:
    inset -2px -2px 0 rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.35);
}
.runner-coin::before {
  /* 中央の★マーク代わりのハイライト */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 2px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 1px;
  transform: translate(-50%, -50%) rotate(-30deg);
  box-shadow: 0 3px 0 rgba(255, 255, 255, 0.3);
}
.runner-coin.collected {
  animation: runner-coin-collect 0.32s ease-out forwards;
}
@keyframes runner-coin-collect {
  0%   { scale: 1;   translate: 0 0;     opacity: 1; }
  100% { scale: 1.8; translate: 0 -22px; opacity: 0; }
}

/* ダメージフラッシュ */
.runner-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 80, 80, 0.5) 0%, rgba(255, 0, 0, 0) 70%);
  pointer-events: none;
  opacity: 0;
}
.runner-flash.active {
  animation: runner-flash-anim 0.35s ease-out;
}
@keyframes runner-flash-anim {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* トースト通知 */
.runner-toast {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.8);
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(12, 16, 37, 0.88);
  border: 2px solid #ffd23f;
  color: #ffd23f;
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}
.runner-toast.show {
  animation: runner-toast-pop 1.1s ease-out forwards;
}
.runner-toast.word {
  border-color: #7dd88d;
  color: #bfffc9;
  font-size: 16px;
}
@keyframes runner-toast-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); }
}

/* スタートヒント */
.runner-start-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 22px;
  background: rgba(12, 16, 37, 0.85);
  border: 2px solid #ffd23f;
  border-radius: 12px;
  color: #ffd23f;
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: 18px;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 1px;
  pointer-events: none;
  animation: runner-hint-pulse 1.2s ease-in-out infinite;
  z-index: 20;
}
.runner-start-hint.hidden {
  display: none;
}
@keyframes runner-hint-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(255, 210, 63, 0.5); }
  50% { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 18px 4px rgba(255, 210, 63, 0.55); }
}

/* ヒント */
.runner-hint {
  text-align: center;
  color: #9aa0b8;
  font-size: 12px;
  margin-top: 4px;
}

/* ベスト記録表示 */
.runner-best-display {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(12, 16, 37, 0.4);
  border: 1px solid rgba(255, 210, 63, 0.2);
  border-radius: 8px;
  font-size: 13px;
  color: #cfd4e8;
}
.runner-best-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: #ffd23f;
  margin-bottom: 6px;
  font-size: 13px;
  letter-spacing: 1px;
}
.runner-best-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.runner-best-row strong {
  color: #e9ecf6;
  font-family: "Cinzel", serif;
}

/* 小さい画面向け調整 */
@media (max-width: 380px) {
  .runner-stage { height: min(280px, calc(100vh - 240px)); }
  .runner-hud-meta { font-size: 12px; gap: 10px; }
  .runner-hud-meta strong { font-size: 14px; }
  .runner-start-hint { font-size: 16px; padding: 12px 18px; }
}

/* =================================
   ネオンウェーブ (Wave)
   ================================= */
.wave-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: min(320px, calc(100vh - 260px));
  margin: 10px auto;
  overflow: hidden;
  border-radius: 12px;
  border: 2px solid rgba(139, 233, 255, 0.35);
  box-shadow:
    0 0 24px rgba(139, 233, 255, 0.18),
    inset 0 0 18px rgba(139, 233, 255, 0.08);
  background: #0a1430;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.wave-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* スタートヒント（ネオン版） */
.wave-start-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 22px;
  background: rgba(10, 20, 48, 0.82);
  border: 2px solid #8be9ff;
  border-radius: 12px;
  color: #e0faff;
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: 18px;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 1px;
  pointer-events: none;
  animation: wave-hint-pulse 1.2s ease-in-out infinite;
  z-index: 20;
  text-shadow: 0 0 8px rgba(139, 233, 255, 0.7);
}
@keyframes wave-hint-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    box-shadow: 0 0 0 0 rgba(139, 233, 255, 0.5); }
  50%      { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 18px 4px rgba(139, 233, 255, 0.55); }
}

@media (max-width: 380px) {
  .wave-stage { height: min(280px, calc(100vh - 240px)); }
  .wave-start-hint { font-size: 16px; padding: 12px 18px; }
}
