/* ことばダッシュ — ネオン×サイバー (設計書 §2.2) */
:root {
  --bg: #0a0a0f;
  --surface: #1a1a2e;
  --surface-2: #252540;
  --accent: #00f5d4;
  --accent-2: #ff0080;
  --text: #f0f0f5;
  --text-dim: #8888a0;
  --danger: #ff3355;
  --ok: #00f5d4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(0, 245, 212, 0.08), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(255, 0, 128, 0.08), transparent 50%),
    var(--bg);
}

.hidden { display: none !important; }

/* ─── タイトル画面 ─── */
#screen-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#screen-title::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 22% 28%, rgba(0, 245, 212, 0.22), transparent 40%),
    radial-gradient(circle at 78% 70%, rgba(255, 0, 128, 0.22), transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(160, 100, 255, 0.16), transparent 55%);
  filter: blur(10px);
  z-index: 0;
  animation: title-bg-swirl 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes title-bg-swirl {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); }
  50%  { transform: translate(-2%, 1%) rotate(2deg) scale(1.06); }
  100% { transform: translate(2%, -1%) rotate(-2deg) scale(1.03); }
}
#screen-title > * { position: relative; z-index: 2; }

.title-floaters {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.title-floater {
  position: absolute;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.18);
  user-select: none;
  white-space: nowrap;
  animation: floater-drift linear infinite;
}
@keyframes floater-drift {
  0%   { transform: translateY(110vh) rotate(-6deg); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.8; }
  100% { transform: translateY(-20vh) rotate(6deg); opacity: 0; }
}

.title-logo {
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: inline-flex;
  filter: drop-shadow(0 0 26px rgba(0, 245, 212, 0.5));
}
.title-logo .logo-char {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-bounce 2.4s ease-in-out infinite;
}
.title-logo .logo-char:nth-child(1) { animation-delay: 0.0s; }
.title-logo .logo-char:nth-child(2) { animation-delay: 0.08s; }
.title-logo .logo-char:nth-child(3) { animation-delay: 0.16s; }
.title-logo .logo-char:nth-child(4) { animation-delay: 0.24s; }
.title-logo .logo-char:nth-child(5) { animation-delay: 0.32s; }
.title-logo .logo-char:nth-child(6) { animation-delay: 0.40s; }
.title-logo .logo-char:nth-child(7) { animation-delay: 0.48s; }
@keyframes logo-bounce {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(-10px); }
  60%      { transform: translateY(-4px); }
}
.title-sub {
  color: var(--text-dim);
  margin-bottom: 1.8rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.mode-select {
  display: flex;
  gap: 0.85rem;
  margin: 0 0 1.4rem;
  width: 100%;
  max-width: 380px;
}
.btn-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: #f4f4f8;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-mode:active { transform: scale(0.97); }
.btn-mode.active {
  background: rgba(0, 245, 212, 0.16);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(0, 245, 212, 0.32);
}
.btn-mode-label { font-size: 1.2rem; font-weight: 900; letter-spacing: 0.05em; }
.btn-mode-sub { font-size: 0.82rem; color: var(--text-dim); letter-spacing: 0.04em; }
.btn-mode.active .btn-mode-sub { color: rgba(244, 244, 248, 0.85); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  font-weight: 900;
  font-size: 1.5rem;
  padding: 1.2rem 3.6rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 36px rgba(0, 245, 212, 0.55), 0 10px 28px rgba(0,0,0,0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.12em;
  position: relative;
  animation: start-breath 2.2s ease-in-out infinite;
}
@keyframes start-breath {
  0%, 100% { box-shadow: 0 0 36px rgba(0, 245, 212, 0.55), 0 10px 28px rgba(0,0,0,0.45); transform: scale(1); }
  50%      { box-shadow: 0 0 52px rgba(0, 245, 212, 0.85), 0 0 24px rgba(255,0,128,0.4), 0 10px 28px rgba(0,0,0,0.45); transform: scale(1.025); }
}
.btn-primary:active { transform: scale(0.96); animation: none; }
.btn-primary:hover { box-shadow: 0 0 56px rgba(0, 245, 212, 0.72); }
.title-rules {
  margin-top: 1.3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 360px;
  text-align: center;
}

/* ─── ゲーム画面 ─── */
#screen-game {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1rem 1.2rem;
  gap: 1.15rem;
}
/* ─── HUD タイル (4等分) ─── */
.top-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.tile {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0.6rem 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.28rem;
  min-height: 5.6rem;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.tile-label {
  font-family: "Inter", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 800;
  line-height: 1;
}
.tile-value {
  font-family: "Inter", monospace;
  font-weight: 900;
  font-size: 2.05rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.tile-sub {
  font-family: "Inter", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  line-height: 1.1;
  min-height: 0.9rem;
}
.tile-sub.over {
  color: #fbf24e;
  text-shadow: 0 0 8px rgba(251, 242, 78, 0.8);
}

.tile-time .tile-value {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(0, 245, 212, 0.55);
  font-size: 2.3rem;
}
#timer.urgent { color: var(--danger); animation: pulse 0.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.tile-score .tile-value {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 245, 212, 0.4);
}
.tile-best .tile-value {
  color: #fbf24e;
  text-shadow: 0 0 8px rgba(251, 242, 78, 0.45);
  font-size: 1.85rem;
}
.tile-combo {
  background: rgba(255, 0, 128, 0.07);
  border-color: rgba(255, 0, 128, 0.28);
}
.tile-combo .tile-label { color: rgba(255, 0, 128, 0.85); }
.tile-combo .tile-value {
  color: var(--accent-2);
  text-shadow: 0 0 12px rgba(255, 0, 128, 0.6);
}
.tile-combo.hot {
  border-color: var(--gold, #fbf24e);
  background: rgba(251, 242, 78, 0.1);
  box-shadow: 0 0 18px rgba(251, 242, 78, 0.28), inset 0 0 10px rgba(251, 242, 78, 0.15);
}
.tile-combo.hot .tile-value {
  color: #fbf24e;
  text-shadow: 0 0 14px rgba(251, 242, 78, 0.85);
}
.timer-bar-wrap {
  height: 10px;
  background: var(--surface);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.6);
}
#timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00d4ff 50%, var(--accent-2));
  transition: width 0.1s linear;
  box-shadow: 0 0 10px var(--accent);
}

.word-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#word {
  display: flex;
  gap: 0.22em;
  font-size: clamp(2.8rem, 14vw, 5.4rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  max-width: 95vw;
  justify-content: center;
}
.word-char {
  color: var(--text);
  text-shadow: 0 0 14px rgba(240, 240, 245, 0.45), 0 0 28px rgba(0, 245, 212, 0.2);
}
.word-hole {
  display: inline-block;
  min-width: 1em;
  text-align: center;
  border-bottom: 4px solid var(--text-dim);
  color: var(--accent);
  position: relative;
}
.word-hole.current {
  border-bottom-color: var(--accent);
  animation: blink 0.9s ease-in-out infinite;
  background:
    linear-gradient(180deg, transparent 60%, rgba(0, 245, 212, 0.18) 100%);
}
@keyframes blink {
  0%, 100% { box-shadow: 0 4px 12px rgba(0, 245, 212, 0.55); }
  50% { box-shadow: 0 4px 28px rgba(0, 245, 212, 1), 0 4px 50px rgba(255, 0, 128, 0.4); }
}

.feedback {
  position: absolute;
  font-size: 2rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  letter-spacing: 0.1em;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(0);
}
.feedback.show {
  opacity: 1;
  transform: translateY(-20px);
}
.feedback.ok { color: var(--ok); text-shadow: 0 0 20px var(--ok); }
.feedback.combo { color: var(--accent-2); text-shadow: 0 0 20px var(--accent-2); font-size: 2.5rem; }
.feedback.wrong { color: var(--danger); text-shadow: 0 0 20px var(--danger); }

#choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  padding-bottom: 1rem;
}
@media (min-width: 480px) {
  #choices { grid-template-columns: repeat(3, 1fr); max-width: 540px; margin: 0 auto; width: 100%; }
}
.choice-btn {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  color: var(--text);
  border: 2.5px solid rgba(0, 245, 212, 0.22);
  border-radius: 20px;
  font-size: 2.6rem;
  font-weight: 900;
  padding: 1.35rem 0;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.05s ease-out, background 0.08s, border-color 0.08s, box-shadow 0.12s;
  box-shadow:
    0 5px 14px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}
.choice-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 245, 212, 0.3), transparent 60%);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.choice-btn:active {
  transform: scale(0.92);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.5),
    0 0 18px rgba(0, 245, 212, 0.4);
}
.choice-btn:active::before { opacity: 1; }
.choice-btn.correct {
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 32px var(--accent), 0 0 60px rgba(255, 0, 128, 0.5);
  animation: pop 0.25s ease-out;
}
.choice-btn.wrong {
  background: var(--danger);
  border-color: var(--danger);
  animation: shake 0.3s;
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
/* ─── カテゴリチップ (出題単語の上) ─── */
.category-chip {
  position: absolute;
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.6rem 1.4rem;
  background: rgba(255, 0, 128, 0.2);
  border: 2.5px solid rgba(255, 0, 128, 0.6);
  color: #ffd9ec;
  border-radius: 999px;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 0, 128, 0.55);
  box-shadow: 0 0 18px rgba(255, 0, 128, 0.3);
}
.category-chip .cat-icon {
  font-size: 1.85rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 0, 128, 0.5));
}
.category-chip .cat-name {
  font-size: 1.3rem;
}

/* ─── 上部 HUD ストリップ (正解/ミス/最高コンボ) ─── */
.hud-stats-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem auto 0.1rem;
  padding: 0.2rem 0.5rem;
  font-family: "Inter", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: rgba(180, 180, 200, 0.85);
  opacity: 0.7;
}
.hud-stats-row .hud-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-weight: 700;
}
.hud-stats-row .hud-label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  font-weight: 700;
}
.hud-stats-row .hud-divider {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(160, 160, 180, 0.35);
}
/* 結果画面側では大きめスタイルを維持 */
#screen-result .hud-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  padding: 0.4rem 0.95rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  min-width: 70px;
  line-height: 1.05;
}

/* ─── 結果画面 ─── */
#screen-result {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.4rem 1.2rem;
  text-align: center;
  overflow-y: auto;
}
.rank-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.5rem;
}
.rank-letter {
  font-family: "Inter", monospace;
  font-size: 5.6rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(0, 245, 212, 0.7));
  letter-spacing: 0.02em;
}
.rank-letter.rank-s { filter: drop-shadow(0 0 24px rgba(255, 230, 60, 0.9)); background: linear-gradient(135deg, #fbf24e, #ff0080); -webkit-background-clip: text; background-clip: text; }
.rank-letter.rank-a { background: linear-gradient(135deg, #00f5d4, #00d4ff); -webkit-background-clip: text; background-clip: text; }
.rank-letter.rank-b { background: linear-gradient(135deg, #00d4ff, #6acdff); -webkit-background-clip: text; background-clip: text; }
.rank-letter.rank-c { color: var(--text); background: none; -webkit-background-clip: initial; background-clip: initial; filter: none; }
.rank-letter.rank-d { color: var(--text-dim); background: none; -webkit-background-clip: initial; background-clip: initial; filter: none; }
.rank-comment {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
  text-shadow: 0 0 10px rgba(0, 245, 212, 0.45);
}
.result-title {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 0.8rem 0 0.3rem;
  letter-spacing: 0.3em;
  font-family: "Inter", monospace;
}
#result-score {
  font-size: clamp(3.2rem, 17vw, 6rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1rem;
  line-height: 1;
  filter: drop-shadow(0 0 18px rgba(0, 245, 212, 0.5));
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 0.9rem;
  width: 100%;
  max-width: 420px;
}
.result-stat {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1.5px solid rgba(0, 245, 212, 0.22);
  border-radius: 14px;
  padding: 0.9rem 0.4rem;
}
.result-stat-value {
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--accent);
  font-family: "Inter", monospace;
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.45);
  line-height: 1.05;
}
.result-stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  letter-spacing: 0.12em;
}
.result-extras {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  width: 100%;
  max-width: 420px;
}
.result-extra {
  flex: 1;
  background: rgba(0, 245, 212, 0.06);
  border: 1.5px solid rgba(0, 245, 212, 0.2);
  border-radius: 12px;
  padding: 0.7rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.result-extra-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}
.result-extra-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  font-family: "Inter", monospace;
  text-shadow: 0 0 8px rgba(0, 245, 212, 0.25);
}
.result-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  min-height: 1.6rem;
}
.result-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 0, 128, 0.12);
  border: 1px solid rgba(255, 0, 128, 0.4);
  color: #ffb1d9;
  letter-spacing: 0.05em;
}
.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  width: 100%;
}
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 0.6rem 1.8rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:active { background: var(--accent); color: var(--bg); }

/* ─── カテゴリ図鑑 (リザルト) ─── */
.zukan-section {
  width: 100%;
  margin-bottom: 1.2rem;
}
.zukan-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  padding: 0 0.2rem;
}
.zukan-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.zukan-count {
  font-family: "Inter", monospace;
  font-weight: 900;
  font-size: 1rem;
  color: var(--accent);
}
.zukan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.zukan-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.55rem 0.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.6rem;
  opacity: 0.45;
  transition: opacity 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
}
.zukan-cell.cleared {
  opacity: 1;
  background: rgba(0, 245, 212, 0.1);
  border-color: rgba(0, 245, 212, 0.55);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.25) inset;
}
.zukan-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: saturate(0.6);
}
.zukan-cell.cleared .zukan-icon {
  filter: none;
  animation: zukan-pop 0.5s ease-out;
}
.zukan-name {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.zukan-cell.cleared .zukan-name {
  color: var(--accent);
}
@keyframes zukan-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ─── 危険ゾーン (残り10秒以下) ─── */
#danger-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  opacity: 0;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(255, 51, 85, 0.22) 75%, rgba(255, 0, 60, 0.55) 100%);
  transition: opacity 0.3s ease-out;
}
body.danger #danger-vignette {
  opacity: 1;
  animation: danger-heartbeat 0.9s ease-in-out infinite;
}
@keyframes danger-heartbeat {
  0%, 100% { opacity: 0.65; }
  20% { opacity: 1; }
  40% { opacity: 0.5; }
  60% { opacity: 0.9; }
}
body.danger #timer { color: #ff3355; animation: pulse 0.32s ease-in-out infinite; }
body.danger #timer-bar { background: linear-gradient(90deg, #ff3355, #ff0080); }
/* danger 中はネオン枠を赤に塗り替え */
body.danger #neon-border {
  opacity: 1;
  border: 2px solid rgba(255, 51, 85, 0.55);
  box-shadow:
    inset 0 0 24px rgba(255, 51, 85, 0.35),
    0 0 30px rgba(255, 51, 85, 0.25);
  animation: danger-border 0.9s ease-in-out infinite;
}
@keyframes danger-border {
  0%, 100% { box-shadow: inset 0 0 18px rgba(255, 51, 85, 0.3), 0 0 20px rgba(255, 51, 85, 0.2); }
  50% { box-shadow: inset 0 0 32px rgba(255, 51, 85, 0.6), 0 0 36px rgba(255, 51, 85, 0.4); }
}

/* ─── Canvas パーティクル ─── */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

/* ─── 背景パルス (コンボ連動) ─── */
#bg-pulse {
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(0, 245, 212, 0.18), transparent 55%),
    radial-gradient(ellipse at 70% 70%, rgba(255, 0, 128, 0.18), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(255, 0, 200, 0.08), transparent 70%);
  transition: opacity 0.4s ease-out;
  will-change: transform, filter;
}
/* 文字可読性最優先: warm / hot では脈動させない。blaze のみ穏やかに点灯 */
body.combo-blaze #bg-pulse {
  opacity: 0.55;
  animation: bg-pulse-anim 1.8s ease-in-out infinite;
}
@keyframes bg-pulse-anim {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.75; }
}

/* ─── ネオン枠 ─── */
#neon-border {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  box-shadow:
    inset 0 0 24px rgba(0, 245, 212, 0.25),
    inset 0 0 60px rgba(255, 0, 128, 0.12);
  transition: opacity 0.4s, box-shadow 0.4s;
}
/* 常時表示は OFF。blaze / danger / fever (新規) の瞬間だけ点灯させる */
body.combo-blaze #neon-border {
  opacity: 1;
  box-shadow:
    inset 0 0 60px rgba(0, 245, 212, 0.75),
    inset 0 0 140px rgba(255, 0, 128, 0.45);
}

/* ─── 単語フライアップ (完成時の見せ場) ─── */
.word-flyup {
  position: absolute;
  left: 50%;
  top: 38%;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(0, 245, 212, 0.7));
  pointer-events: none;
  white-space: nowrap;
  animation: word-flyup 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.word-flyup.lv-3 { font-size: 3.6rem; }
.word-flyup.lv-4 {
  font-size: 4.2rem;
  filter: drop-shadow(0 0 24px rgba(255, 0, 128, 0.8));
}
.word-flyup.lv-5 {
  font-size: 5rem;
  filter:
    drop-shadow(0 0 24px rgba(255, 0, 128, 0.9))
    drop-shadow(0 0 40px rgba(255, 255, 255, 0.6));
  animation:
    word-flyup 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) forwards,
    word-flyup-shake 0.18s ease-in-out 3;
}
@keyframes word-flyup {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(-4deg); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.25) rotate(2deg); }
  70%  { opacity: 1; transform: translate(-50%, -130%) scale(1.45) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(1.7) rotate(0deg); }
}
@keyframes word-flyup-shake {
  0%, 100% { margin-left: 0; }
  50% { margin-left: 4px; }
}

/* ─── スコア +N ポップ ─── */
.score-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: "Inter", monospace;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent), 0 0 24px var(--accent);
  pointer-events: none;
  animation: score-pop 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.score-pop.hot { color: var(--accent-2); text-shadow: 0 0 16px var(--accent-2), 0 0 30px var(--accent-2); font-size: 1.8rem; }
@keyframes score-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -160%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -360%) scale(1); }
}

/* ─── エフェクトレイヤ ─── */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: particle-burst 0.6s ease-out forwards;
  box-shadow: 0 0 12px currentColor;
}
@keyframes particle-burst {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    opacity: 0;
  }
}

.time-bonus-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent), 0 0 24px var(--accent);
  animation: time-bonus-pop 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  pointer-events: none;
  letter-spacing: 0.05em;
}
@keyframes time-bonus-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  25% { opacity: 1; transform: translate(-50%, -120%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(1); }
}

#timer.bonus {
  animation: timer-flash 0.4s ease-out;
}
@keyframes timer-flash {
  0%, 100% { color: var(--accent); text-shadow: none; }
  50% { color: #fff; text-shadow: 0 0 24px var(--accent), 0 0 40px var(--accent); transform: scale(1.2); }
}

/* ─── 画面フラッシュ ─── */
#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  transition: opacity 0.05s ease-out;
  mix-blend-mode: screen;
}
#flash.show {
  opacity: 1;
  transition: opacity 0.15s ease-out;
}

/* ─── 画面振動 ─── */
.shake {
  animation: screen-shake 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes screen-shake {
  10%, 90% { transform: translateX(calc(var(--shake-intensity, 4px) * -0.3)); }
  20%, 80% { transform: translateX(calc(var(--shake-intensity, 4px) * 0.6)); }
  30%, 50%, 70% { transform: translateX(calc(var(--shake-intensity, 4px) * -1)); }
  40%, 60% { transform: translateX(var(--shake-intensity, 4px)); }
}

/* ─── 部分正解 (穴1つ目埋まった、まだ穴ある) ─── */
.feedback.partial {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent);
  font-size: 2.5rem;
}

/* ─── COMBO mega (10+) ─── */
.feedback.combo-mega {
  color: #fff;
  text-shadow:
    0 0 12px var(--accent-2),
    0 0 24px var(--accent-2),
    0 0 40px var(--accent);
  font-size: 3rem;
  animation: combo-mega-pulse 0.5s ease-out;
}
@keyframes combo-mega-pulse {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  50% { transform: translateY(-30px) scale(1.4); opacity: 1; }
  100% { transform: translateY(-50px) scale(1); opacity: 1; }
}

#combo.mega {
  animation: combo-mega-text 0.4s ease-in-out infinite alternate;
}
@keyframes combo-mega-text {
  0% { transform: scale(1); text-shadow: 0 0 10px var(--accent-2); }
  100% { transform: scale(1.15); text-shadow: 0 0 20px var(--accent-2), 0 0 30px var(--accent); }
}

/* ─── タイトル統計 (BEST / 累計 / プレイ) ─── */
.title-stats {
  display: flex;
  gap: 0.9rem;
  margin: 0.6rem 0 0.8rem;
  justify-content: center;
}
.title-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.6rem 1.05rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(0, 245, 212, 0.28);
  border-radius: 0.85rem;
  min-width: 5.4rem;
}
.title-stat-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.title-stat-value {
  font-family: "Inter", monospace;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 245, 212, 0.35);
}
.title-stat:first-child .title-stat-value { color: #fbf24e; text-shadow: 0 0 10px rgba(251, 242, 78, 0.4); }

.title-spark {
  width: min(82vw, 320px);
  height: 56px;
  margin: 0.2rem auto 0.7rem;
  display: block;
}

.title-tier {
  margin-top: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 1rem;
  background: rgba(255, 0, 128, 0.16);
  border: 1.5px solid rgba(255, 0, 128, 0.5);
  border-radius: 999px;
}
.title-tier-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: #ffb1d9;
  font-weight: 800;
}
.title-tier-name {
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.04em;
}

/* 階級ごとの背景進化 */
body.bg-tier-1 { background:
  radial-gradient(ellipse at 20% 10%, rgba(0, 245, 212, 0.1), transparent 55%),
  radial-gradient(ellipse at 80% 95%, rgba(255, 0, 128, 0.1), transparent 55%),
  var(--bg);
}
body.bg-tier-2 { background:
  radial-gradient(ellipse at 30% 5%, rgba(0, 212, 255, 0.18), transparent 55%),
  radial-gradient(ellipse at 70% 100%, rgba(255, 0, 200, 0.16), transparent 55%),
  var(--bg);
}
body.bg-tier-3 { background:
  radial-gradient(ellipse at 50% -10%, rgba(155, 100, 255, 0.22), transparent 55%),
  radial-gradient(ellipse at 50% 110%, rgba(255, 80, 200, 0.22), transparent 55%),
  radial-gradient(circle at 50% 50%, rgba(0, 245, 212, 0.06), transparent 70%),
  var(--bg);
}
body.bg-tier-4 { background:
  radial-gradient(ellipse at 50% 0%, rgba(255, 216, 30, 0.18), transparent 50%),
  radial-gradient(ellipse at 20% 100%, rgba(0, 245, 212, 0.2), transparent 55%),
  radial-gradient(ellipse at 80% 100%, rgba(255, 0, 128, 0.22), transparent 55%),
  var(--bg);
}

/* HUD BEST はタイル内に統合済み (.tile-best / .tile-sub) */


/* ─── 金枠 (クリティカル) ─── */
.critical-badge {
  position: absolute;
  top: -0.6rem;
  right: 50%;
  transform: translateX(50%);
  padding: 0.15rem 0.6rem;
  background: linear-gradient(135deg, #fbf24e, #ff8e1f);
  color: #1a1a2e;
  font-weight: 900;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(251, 242, 78, 0.8);
  z-index: 5;
  animation: critical-badge-pulse 0.7s ease-in-out infinite;
}
@keyframes critical-badge-pulse {
  0%, 100% { transform: translateX(50%) scale(1); }
  50% { transform: translateX(50%) scale(1.08); }
}
.word-area { position: relative; }
body.critical #word {
  text-shadow:
    0 0 10px rgba(255, 216, 30, 0.6),
    0 0 22px rgba(255, 140, 0, 0.45);
}
body.critical .word-area::before {
  content: "";
  position: absolute;
  inset: -1rem;
  border: 2px solid rgba(255, 216, 30, 0.55);
  border-radius: 1rem;
  pointer-events: none;
  animation: critical-frame 0.8s ease-in-out infinite;
}
@keyframes critical-frame {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 216, 30, 0.3); }
  50% { box-shadow: 0 0 24px rgba(255, 216, 30, 0.7), inset 0 0 14px rgba(255, 216, 30, 0.3); }
}

.score-pop.critical {
  color: #fbf24e;
  text-shadow:
    0 0 10px rgba(255, 216, 30, 0.8),
    0 0 18px rgba(255, 140, 0, 0.6);
  font-size: 1.6rem \!important;
}
.word-flyup.critical {
  color: #fbf24e \!important;
  text-shadow:
    0 0 12px rgba(255, 216, 30, 0.85),
    0 0 28px rgba(255, 140, 0, 0.6),
    0 0 40px rgba(255, 80, 0, 0.4) \!important;
}
.feedback.critical {
  color: #fbf24e;
  text-shadow: 0 0 14px rgba(255, 216, 30, 0.85);
}

/* ─── リザルト BEST 行 ─── */
.result-best-row {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  justify-content: center;
  margin: 0.3rem 0 1rem;
  padding: 0.45rem 1rem;
  background: rgba(251, 242, 78, 0.08);
  border: 1px solid rgba(251, 242, 78, 0.28);
  border-radius: 999px;
  font-family: "Inter", monospace;
}
.result-best-label {
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 800;
}
.result-best-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fbf24e;
  text-shadow: 0 0 12px rgba(251, 242, 78, 0.45);
}
.result-best-diff {
  font-size: 1.15rem;
  color: #00f5d4;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}
.result-best-diff.updated {
  color: #fbf24e;
  text-shadow: 0 0 14px rgba(251, 242, 78, 0.9);
  animation: best-diff-pulse 0.9s ease-in-out infinite;
}
@keyframes best-diff-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ─── FEVER モード ─── */
body.fever #neon-border {
  opacity: 1;
  box-shadow:
    inset 0 0 70px rgba(255, 216, 30, 0.85),
    inset 0 0 160px rgba(255, 128, 0, 0.55);
  animation: fever-border-pulse 0.6s ease-in-out infinite;
}
@keyframes fever-border-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 70px rgba(255, 216, 30, 0.85),
      inset 0 0 160px rgba(255, 128, 0, 0.55);
  }
  50% {
    box-shadow:
      inset 0 0 100px rgba(255, 216, 30, 1),
      inset 0 0 220px rgba(255, 128, 0, 0.85);
  }
}
.fever-burst {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4.2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #fbf24e, #ff8800);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 216, 30, 0.9));
  pointer-events: none;
  animation: fever-burst-anim 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  z-index: 150;
}
@keyframes fever-burst-anim {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(1.05); }
}

/* ─── コンボ切れの悔しさ表示 ─── */
.combo-lost-pop {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ff3355;
  text-shadow: 0 0 14px rgba(255, 51, 85, 0.8), 0 0 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  animation: combo-lost-anim 1.2s ease-out forwards;
  z-index: 140;
  white-space: nowrap;
}
@keyframes combo-lost-anim {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70%  { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}

/* ─── 称号アンロック (リザルト) ─── */
.unlocks-section {
  width: 100%;
  margin-bottom: 1rem;
}
.unlocks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.unlock-pill {
  padding: 0.3rem 0.7rem;
  background: linear-gradient(135deg, rgba(251, 242, 78, 0.18), rgba(255, 140, 0, 0.18));
  border: 1px solid rgba(251, 242, 78, 0.55);
  color: #fff5b0;
  font-weight: 800;
  font-size: 0.72rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
  animation: unlock-glow 1.2s ease-in-out infinite;
  position: relative;
  cursor: help;
}
.unlock-pill.has-tip .title-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(20, 20, 35, 0.96);
  color: #f4f4f8;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(251, 242, 78, 0.5);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 80vw;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
  box-shadow: 0 6px 18px rgba(0,0,0,0.55);
}
.unlock-pill.has-tip .title-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(251, 242, 78, 0.5);
}
.unlock-pill.has-tip:hover .title-tip,
.unlock-pill.has-tip:focus .title-tip,
.unlock-pill.has-tip:active .title-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@keyframes unlock-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(251, 242, 78, 0.4); }
  50% { box-shadow: 0 0 16px rgba(251, 242, 78, 0.75); }
}

/* ─── NEW RECORD オーバーレイ ─── */
#new-record-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
}
.new-record-text {
  font-family: "Inter", "Noto Sans JP", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 14vw, 3.6rem);
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, #fbf24e, #ff0080);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(251, 242, 78, 0.7);
  animation: new-record-pop 1.6s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
@keyframes new-record-pop {
  0% { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  20% { transform: scale(1.25) rotate(2deg); opacity: 1; }
  50% { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}

/* ─── コンボ猶予ゲージ (COMBO タイル下部) ─── */
.combo-window-bar {
  width: 100%;
  height: 4px;
  margin-top: 0.25rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.combo-window-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00f5d4, #fbf24e);
  border-radius: 999px;
  transition: width 0.08s linear;
  box-shadow: 0 0 6px rgba(0, 245, 212, 0.6);
}
.combo-window-bar.urgent .combo-window-fill {
  background: linear-gradient(90deg, #ff3355, #ff0080);
  animation: combo-bar-urgent 0.32s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 51, 85, 0.8);
}
@keyframes combo-bar-urgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ─── タイトル: ミッション枠 ─── */
.title-missions {
  width: min(380px, 92vw);
  margin: 1.1rem auto 0;
  padding: 0.7rem 0.9rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 216, 30, 0.25);
  border-radius: 14px;
  box-shadow: 0 0 14px rgba(255, 216, 30, 0.08) inset;
}
.title-missions-header {
  display: flex;
  justify-content: center;
  margin-bottom: 0.45rem;
}
.title-missions-label {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: #fbf24e;
  font-weight: 900;
}
.title-missions-list {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}
.title-mission {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 8px;
  font-size: 0.92rem;
  color: #f4f4f8;
}
.title-mission.done {
  color: rgba(244, 244, 248, 0.55);
  text-decoration: line-through;
}
.title-mission-mark {
  font-size: 1rem;
}

/* ─── 結果: ミッション達成 ─── */
.result-missions {
  width: 100%;
  margin: 0.6rem 0;
}
.unlock-pill.mission {
  background: rgba(255, 216, 30, 0.18);
  border-color: rgba(255, 216, 30, 0.55);
  color: #fbf24e;
}

/* ─── ミッション達成オーバーレイ (ゲーム中) ─── */
.mission-done-overlay {
  position: fixed;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.8rem 1.4rem;
  background: linear-gradient(135deg, rgba(255, 216, 30, 0.25), rgba(255, 145, 0, 0.2));
  border: 2px solid #fbf24e;
  border-radius: 14px;
  box-shadow: 0 0 26px rgba(255, 216, 30, 0.6);
  pointer-events: none;
  z-index: 50;
  animation: mission-done-pop 1.6s ease-out forwards;
}
.mission-done-tag {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fbf24e;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(255, 216, 30, 0.7);
}
.mission-done-name {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
}
@keyframes mission-done-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  82% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(0.95); }
}

/* ─── ステージ上昇バナー (控えめ・上から流れる) ─── */
.stage-up-banner {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.95rem;
  background: linear-gradient(90deg, rgba(0, 245, 212, 0.18), rgba(255, 0, 128, 0.18));
  border: 1.5px solid rgba(0, 245, 212, 0.55);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.25);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 45;
  animation: stage-up-flow 1.4s ease-out forwards;
  white-space: nowrap;
}
.stage-up-tag {
  font-family: "Inter", monospace;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 245, 212, 0.55);
}
.stage-up-name {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.04em;
}
@keyframes stage-up-flow {
  0% { opacity: 0; transform: translate(-50%, -16px); }
  18% { opacity: 1; transform: translate(-50%, 0); }
  78% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* ─── モーダル (ポーズ/設定/オンボーディング) ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 16, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
  animation: modal-fade 0.2s ease-out;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(160deg, rgba(40,40,70,0.92), rgba(20,20,40,0.95));
  border: 1.5px solid rgba(0, 245, 212, 0.4);
  border-radius: 22px;
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 28px rgba(0, 245, 212, 0.2);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
}
.modal-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0 0 0.4rem;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.05em;
}
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); border-color: var(--accent); }
.btn-secondary:active { transform: scale(0.97); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 0.55rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.btn-ghost:hover { color: var(--text); }

/* 設定モーダル */
.settings-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.2rem;
}
.settings-row.checkbox {
  cursor: pointer;
}
.settings-label {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}
.settings-val {
  font-family: "Inter", monospace;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 2.5rem;
  text-align: right;
}
.settings-row input[type=range] {
  flex: 1.6;
  accent-color: var(--accent);
}
.settings-row input[type=checkbox] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

/* オンボーディング */
.onboard-list {
  margin: 0.2rem 0 0.5rem 1.2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.onboard-list li {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  letter-spacing: 0.02em;
}
.onboard-list b { color: var(--accent); font-weight: 900; }
.hl-gold { color: #fbf24e; font-weight: 900; text-shadow: 0 0 8px rgba(251, 242, 78, 0.5); }

/* 設定ボタン (タイトル右上) */
.title-icon-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.6rem;
  height: 2.6rem;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border: 1.5px solid rgba(0, 245, 212, 0.4);
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.title-icon-btn:hover { border-color: var(--accent); background: rgba(0, 245, 212, 0.1); }
.title-icon-btn:active { transform: scale(0.92); }

/* ポーズボタン (ゲーム画面右上) */
.game-icon-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(0,0,0,0.4);
  color: var(--text);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-icon-btn:hover { border-color: var(--accent); }
.game-icon-btn:active { transform: scale(0.92); }
#screen-game { position: relative; }

/* TOP5 リスト */
.result-top5 {
  width: 100%;
  max-width: 400px;
  margin-top: 1rem;
  padding: 0.6rem 0.8rem 0.8rem;
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 12px;
  background: rgba(0, 245, 212, 0.04);
}
.top5-list {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.top5-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  font-family: "Inter", monospace;
}
.top5-row.current {
  background: linear-gradient(90deg, rgba(0,245,212,0.18), rgba(255,0,128,0.12));
  border: 1px solid rgba(0, 245, 212, 0.45);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.25);
}
.top5-rank {
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--text-dim);
  min-width: 2rem;
}
.top5-row.current .top5-rank { color: var(--accent); }
.top5-row.rank-1 .top5-rank { color: #fbf24e; text-shadow: 0 0 8px rgba(251, 242, 78, 0.6); }
.top5-value {
  font-weight: 900;
  font-size: 1.05rem;
  flex: 1;
  text-align: right;
  color: var(--text);
}

/* 演出控えめモード */
body.reduce-motion #bg-pulse,
body.reduce-motion #neon-border,
body.reduce-motion .title-floater,
body.reduce-motion #screen-title::before {
  animation: none \!important;
  display: none \!important;
}
body.reduce-motion * {
  animation-duration: 0.001ms \!important;
  transition-duration: 0.05ms \!important;
}

/* 3 ボタンの mode-select は折返し */
.mode-select { flex-wrap: wrap; }
.mode-select .btn-mode { min-width: calc(33.333% - 0.6rem); }

/* エンドレス用 ライフ表示 (TIME タイル流用) */
.tile-time .tile-value.lives {
  font-size: 1.8rem;
  letter-spacing: 0.1em;
}

/* ─── 4モード 2x2 グリッド ─── */
.mode-select-grid {
  display: grid \!important;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  max-width: 540px;
  margin: 1rem auto;
}
.mode-select-grid .btn-mode { min-width: 0; width: 100%; }

/* ─── RATING・Streak 表示 ─── */
.title-rating, .title-streak {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.35rem auto 0;
  padding: 0.3rem 0.9rem;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  width: fit-content;
}
.title-rating-label, .title-streak-text {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  font-weight: 800;
}
.title-rating-value {
  font-family: "Inter", monospace;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0,245,212,0.5);
}
.title-streak {
  background: linear-gradient(90deg, rgba(255,120,40,0.15), rgba(255,60,60,0.12));
  border: 1px solid rgba(255,120,40,0.35);
}
.title-streak-icon { font-size: 1.2rem; }
.title-streak-text {
  font-size: 0.95rem;
  font-weight: 900;
  color: #ffd66e;
  letter-spacing: 0.08em;
}

/* ─── HINT ボタン ─── */
.hint-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  background: linear-gradient(135deg, #ffd860, #ff9620);
  color: #2a1a00;
  border: 0;
  font-family: "Inter", "Noto Sans JP", sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(255,200,0,0.35), inset 0 1px 0 rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.hint-btn:hover { transform: translateY(-2px); }
.hint-btn:active { transform: translateY(1px); }
.hint-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ─── 獲得点ポップ +128 ─── */
.score-pop {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 50;
  font-family: "Inter", monospace;
  font-weight: 900;
  font-size: 4.2rem;
  color: #fff;
  text-shadow:
    0 0 12px rgba(0,245,212,0.9),
    0 0 24px rgba(0,245,212,0.5),
    0 4px 0 rgba(0,0,0,0.4);
  opacity: 0;
  letter-spacing: 0.02em;
}
.score-pop.show {
  animation: score-pop-anim 0.8s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}
.score-pop.critical {
  color: #ffe27a;
  text-shadow:
    0 0 18px rgba(255,216,30,1),
    0 0 36px rgba(255,160,30,0.8),
    0 4px 0 rgba(0,0,0,0.5);
}
.score-pop.fever {
  color: #ff70a8;
  text-shadow:
    0 0 18px rgba(255,80,160,1),
    0 0 36px rgba(255,80,160,0.6),
    0 4px 0 rgba(0,0,0,0.5);
}
@keyframes score-pop-anim {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  45%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(0.95); }
}
body.reduce-motion .score-pop.show {
  animation: score-pop-fade 0.5s ease forwards;
}
@keyframes score-pop-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── tap30 専用 進捗ヘッダ ─── */
.tap30-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin: 0.4rem auto 0.6rem;
  padding: 0.55rem 1.2rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,0,128,0.06));
  border: 1px solid rgba(255,0,128,0.3);
  border-radius: 14px;
  width: fit-content;
}
.tap30-q {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: "Inter", monospace;
  font-weight: 900;
  line-height: 1;
}
.tap30-q-label {
  font-size: 1.05rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.tap30-q-now {
  font-size: 3rem;
  color: #ff70a8;
  text-shadow:
    0 0 14px rgba(255,80,160,0.7),
    0 0 28px rgba(255,80,160,0.35);
  min-width: 2ch;
  text-align: right;
  transition: transform 0.15s ease, color 0.15s ease;
}
.tap30-q-now.bump {
  animation: tap30-bump 0.32s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes tap30-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35); color: #ffd66e; }
  100% { transform: scale(1); }
}
.tap30-q-sep {
  font-size: 1.4rem;
  color: var(--text-dim);
  opacity: 0.7;
}
.tap30-q-tot {
  font-size: 1.4rem;
  color: var(--text-dim);
}
.tap30-dots {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
  width: min(420px, 80vw);
}
.tap30-dot {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  transition: background 0.2s, transform 0.15s;
}
.tap30-dot.done {
  background: linear-gradient(90deg, #00f5d4, #ff0080);
  box-shadow: 0 0 6px rgba(255,80,160,0.5);
}
.tap30-dot.now {
  background: #ffd66e;
  transform: scaleY(1.5);
}

/* tap30 モードでは TIME/SCORE/COMBO タイルを少し縮小し、Q を主役に */
body.mode-tap30 .top-tiles {
  margin-bottom: 0.2rem;
}
body.mode-tap30 .tile-best { display: none; }
body.mode-tap30 .tile-time .tile-value,
body.mode-tap30 .tile-score .tile-value,
body.mode-tap30 .tile-combo .tile-value {
  font-size: 1.55rem;
}
body.mode-tap30 .tile-time .tile-label { color: #ffd66e; }

/* ===== 広告枠 ===== */
.ad-slot {
  width: 100%;
  max-width: 728px;
  margin: 18px auto;
  min-height: 90px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}
.ad-slot.hidden { display: none; }
.ad-slot-title { margin: 24px auto 14px; }
.ad-slot-result { margin: 28px auto 18px; }

/* ===== 同意バナー ===== */
.consent-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 60%);
  pointer-events: none;
}
.consent-banner.hidden { display: none; }
.consent-card {
  pointer-events: auto;
  width: min(560px, 100%);
  background: #15151c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.consent-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.04em;
}
.consent-text {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #b8b8c4;
}
.consent-link { color: #7cc4ff; text-decoration: underline; }
.consent-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.consent-buttons .btn-primary,
.consent-buttons .btn-ghost {
  min-width: 140px;
  padding: 10px 16px;
  font-size: 0.88rem;
}
