/* ラップでいこう style.css — 構造とクラス名は docs/design.md
   シリーズ共通: ポップ・太い墨枠・押すと沈むボタン・丸ゴシック（外部フォントなし）＋夜のライブハウス */

:root {
  --c-ink: #3b2f2f;
  --c-ink-sub: #7a6a5e;
  --c-paper: #fffdf7;
  --c-cream: #fff3d8;
  --c-line: #eadcc0;

  --c-night: #1c1640;
  --c-navy: #241d55;
  --c-purple: #5a3fa8;
  --c-purple-deep: #2e2268;

  --c-pink: #ff4fa3;        /* ネオンピンク: 主ボタン・韻1 */
  --c-pink-deep: #c42a78;
  --c-pink-light: #ffd3e8;
  --c-cyan: #2fe0ff;        /* ネオンシアン: 韻2・HYPE */
  --c-cyan-deep: #1497b8;
  --c-cyan-light: #c8f6ff;
  --c-lemon: #f5f03a;       /* ネオンレモン: 韻3・母音ガイド */
  --c-lemon-deep: #c2b800;
  --c-gold: #ffc83d;        /* 星・コンボ */
  --c-gold-deep: #d99a00;
  --c-red: #ec3d3a;         /* ミス・噛んだ */
  --c-red-deep: #b5242a;
  --c-red-light: #ffd6d0;
  --c-mint: #5ad6a8;        /* 正解 */
  --c-mint-deep: #2fa57a;

  --c-sung: #c42a78;        /* カラオケ: 歌い終えた文字 */
  --c-rhyme: var(--c-pink); /* 韻ハイライト（.lyric に data-rhyme="0|1|2" で切替） */

  --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic",
    "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "SF Pro Rounded",
    ui-rounded, system-ui, sans-serif;

  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 28px;
  --btn-depth: 6px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --app-w: min(100vw, 480px);
  --choice-h: clamp(52px, 7.6dvh, 66px);

  --dur-fast: 0.15s;
  --dur-mid: 0.35s;
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-base);
  color: var(--c-ink);
  background-color: #120d2e;
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 79, 163, .16) 0 30%, transparent 31%);
  overflow: hidden;
  position: fixed;
  inset: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
canvas { display: block; }
.num { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }

.app {
  position: relative;
  width: var(--app-w);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, var(--c-navy), var(--c-night));
  box-shadow: 0 0 0 3px var(--c-ink);
}

/* ---------- 画面切替 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
}
.screen.is-active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s;
}
.screen__bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.screen > :not(.screen__bg) { position: relative; z-index: 1; }

/* ← ゲーム一覧 */
.screen--title > a.back-to-games { position: absolute !important; top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); z-index: 6; display: inline-flex; align-items: center; padding: 6px 12px 7px; font: 800 13px/1 var(--font-base); color: var(--c-ink); text-decoration: none; background: var(--c-paper); border: 3px solid var(--c-ink); border-radius: 999px; box-shadow: 0 3px 0 var(--c-ink); }
.screen--title > a.back-to-games[hidden] { display: none; }
.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }
.screen--title:has(> a.back-to-games:not([hidden])) { padding-top: calc(52px + var(--safe-top)); justify-content: safe center; }

/* ---------- ボタン ---------- */
.btn {
  --btn-bg: var(--c-pink);
  --btn-edge: var(--c-pink-deep);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px;
  padding: 12px 28px;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 20px; font-weight: 800; letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter var(--dur-fast);
}
.btn::after { content: ""; position: absolute; top: 5px; left: 18%; right: 18%; height: 6px; border-radius: 999px; background: rgba(255,255,255,.35); pointer-events: none; }
.btn:hover { filter: brightness(1.05); }
.btn:active, .btn.is-pressed { transform: translateY(var(--btn-depth)); box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink); }
.btn:focus-visible, .icon-btn:focus-visible, .choice:focus-visible, .stage-card:focus-visible { outline: 4px solid var(--c-lemon); outline-offset: 4px; }
.btn:disabled { filter: grayscale(0.8) opacity(0.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--cyan { --btn-bg: var(--c-cyan); --btn-edge: var(--c-cyan-deep); --btn-fg: var(--c-ink); }
.btn--gold { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); --btn-fg: var(--c-ink); }
.btn--ghost { --btn-bg: var(--c-paper); --btn-edge: var(--c-line); --btn-fg: var(--c-ink); }
.btn--small { min-height: 42px; padding: 6px 16px; font-size: 15px; --btn-depth: 4px; }
.btn--small::after { top: 4px; height: 4px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-paper);
  font-size: 18px; font-weight: 900; line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn::before, .icon-btn::after { content: ""; position: absolute; }
.icon-btn--pause::before { width: 6px; height: 14px; left: 10px; top: 10px; border-radius: 2px; background: var(--c-ink); box-shadow: 8px 0 0 var(--c-ink); }
.icon-btn--sound::before { width: 16px; height: 14px; left: 9px; top: 10px; background: var(--c-ink); clip-path: polygon(0 30%, 35% 30%, 75% 0, 75% 100%, 35% 70%, 0 70%); }
.icon-btn--sound.is-muted::after { width: 4px; height: 26px; left: 15px; top: 4px; border-radius: 2px; background: var(--c-red); transform: rotate(45deg); box-shadow: 0 0 0 2px var(--c-paper); }
.icon-btn--help::before { content: "?"; position: static; font: 900 18px/1 var(--font-num); }
.icon-btn--back::before { content: "←"; position: static; font: 900 18px/1 var(--font-base); }

/* ---------- 星 ---------- */
.star {
  display: inline-block; width: 18px; height: 18px;
  background: rgba(255,255,255,.25);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.star.is-on { background: var(--c-gold); }
.stars { display: inline-flex; gap: 2px; }

/* ---------- タイトル ---------- */
.screen--title { align-items: center; justify-content: center; gap: 14px; text-align: center; }
.logo { margin: 0; font-weight: 900; line-height: 1.1; }
.logo__sub {
  display: inline-block; padding: 2px 14px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-lemon); color: var(--c-ink);
  font-size: clamp(13px, 3.8vmin, 17px);
  transform: rotate(-3deg);
}
.logo__main { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-size: clamp(42px, 13vmin, 68px); }
.logo__line { display: flex; justify-content: center; width: 100%; }
.logo__char {
  display: inline-block;
  color: var(--c-paper);
  -webkit-text-stroke: 3px var(--c-ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--c-ink);
  animation: beat-hop 0.7s ease-in-out infinite;   /* 86BPM ≒ 0.7s */
  animation-delay: calc(var(--i, 0) * 0.07s);
}
.logo__char--pink { color: var(--c-pink); }
.logo__char--cyan { color: var(--c-cyan); }
.logo__char--lemon { color: var(--c-lemon); }
@keyframes beat-hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  15% { transform: translateY(2px) scale(1.06, .92); }
  45% { transform: translateY(-6px) scale(.97, 1.04); }
}
.title__art {
  width: min(70vw, 280px); aspect-ratio: 1 / 1;
  border: 4px solid var(--c-ink); border-radius: var(--radius-l);
  background: var(--c-purple-deep);
  box-shadow: 0 6px 0 var(--c-ink);
  overflow: hidden;
}
.title__art canvas { width: 100%; height: 100%; }
.title__actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(80vw, 320px); }
.title__sub { display: flex; justify-content: center; gap: 12px; }

/* ---------- モーダル（ルール・ポーズ） ---------- */
.modal {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(14, 10, 36, .72);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid), visibility 0s linear var(--dur-mid);
}
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-mid), visibility 0s; }
.card {
  width: min(100%, 400px); max-height: 100%; overflow-y: auto;
  padding: 20px 18px;
  border: 4px solid var(--c-ink); border-radius: var(--radius-l);
  background: var(--c-paper);
  box-shadow: 0 8px 0 var(--c-ink);
  text-align: center;
}
.modal.is-open .card { animation: pop-in var(--dur-mid) var(--ease-pop); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.card__title { margin: 0 0 12px; font-size: 24px; font-weight: 900; }
.card__actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.rules__list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; text-align: left; }
.rule { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: var(--c-cream); }
.rule__no { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-pink); color: #fff; font: 900 16px/1 var(--font-num); }
.rule__text { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.45; }
.rule__text b { color: var(--c-pink-deep); }
.rule__eg { display: block; margin-top: 4px; font-size: 13px; color: var(--c-ink-sub); }
.rule__eg .rhyme { padding: 0 3px; border-radius: 6px; background: var(--c-rhyme); color: var(--c-ink); }

.pause__note { margin: 0 0 4px; font-size: 14px; color: var(--c-ink-sub); }

/* ---------- ステージ選択 ---------- */
.screen--select { gap: 12px; }
.select__head { display: flex; align-items: center; gap: 10px; }
.select__title { flex: 1; margin: 0; color: var(--c-paper); font-size: 24px; font-weight: 900; text-shadow: 0 3px 0 var(--c-ink); -webkit-text-stroke: 4px var(--c-ink); paint-order: stroke fill; }
.stage-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0 0 8px; list-style: none; }
.stage-card {
  --card-accent: var(--c-pink);
  position: relative;
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
  width: 100%; min-height: 76px;
  padding: 10px 14px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper);
  text-align: left; cursor: pointer;
  box-shadow: 0 5px 0 var(--c-ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.stage-card:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-ink); }
.stage-card[data-stage="1"] { --card-accent: var(--c-cyan); }
.stage-card[data-stage="2"] { --card-accent: var(--c-pink); }
.stage-card[data-stage="3"] { --card-accent: var(--c-lemon); }
.stage-card[data-stage="4"] { --card-accent: var(--c-mint); }
.stage-card[data-stage="5"] { --card-accent: var(--c-gold); }
.stage-card__no {
  display: grid; place-items: center; width: 52px; height: 52px;
  border: 3px solid var(--c-ink); border-radius: 14px;
  background: var(--card-accent);
  font: 900 26px/1 var(--font-num);
  transform: rotate(-4deg);
}
.stage-card__body { min-width: 0; }
.stage-card__name { display: block; font-size: 18px; font-weight: 900; line-height: 1.25; }
.stage-card__meta { display: block; font-size: 12px; font-weight: 700; color: var(--c-ink-sub); }
.stage-card__meta b { color: var(--c-pink-deep); }
.stage-card__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.stage-card__best { font-size: 12px; color: var(--c-ink-sub); }
.stage-card .star { background: var(--c-line); }
.stage-card .star.is-on { background: var(--c-gold); }
.stage-card.is-locked { background: #cfc8dc; cursor: not-allowed; box-shadow: 0 5px 0 var(--c-ink); }
.stage-card.is-locked:active { transform: none; }
.stage-card.is-locked .stage-card__no { background: #9a92ab; }
.stage-card.is-locked .stage-card__name, .stage-card.is-locked .stage-card__meta { opacity: .55; }
.stage-card__lock { display: none; }
.stage-card.is-locked .stage-card__lock {
  display: block; position: relative; width: 24px; height: 20px; margin-top: 10px;
  border: 3px solid var(--c-ink); border-radius: 5px; background: var(--c-gold);
}
.stage-card.is-locked .stage-card__lock::before {
  content: ""; position: absolute; left: 2px; top: -14px; width: 14px; height: 14px;
  border: 3px solid var(--c-ink); border-bottom: 0; border-radius: 9px 9px 0 0;
}
.stage-card.is-locked .stars { display: none; }
.stage-card.is-new::after {
  content: "NEW"; position: absolute; top: -10px; right: 10px;
  padding: 1px 8px; border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-pink); color: #fff; font: 900 11px/1.4 var(--font-num);
}

/* ---------- プレイ ---------- */
.screen--play { padding: calc(8px + var(--safe-top)) calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left)); gap: 8px; overflow: hidden; }

.hud { display: flex; align-items: center; gap: 6px; flex: none; }
.hud__chip {
  display: inline-flex; align-items: baseline; gap: 3px;
  height: 36px; padding: 0 10px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-weight: 800; line-height: 30px; white-space: nowrap;
}
.hud__chip small { font-size: 11px; color: var(--c-ink-sub); }
.hud__stage { background: var(--c-purple); color: #fff; max-width: 34%; overflow: hidden; text-overflow: ellipsis; }
.hud__stage .num { color: var(--c-lemon); font-size: 16px; }
.hud__stage span { font-size: 13px; }
.hud__score { flex: 1; justify-content: flex-end; min-width: 0; }
.hud__score .num { font-size: 20px; }
.hud__score.is-up .num { animation: num-up .3s var(--ease-pop); }
@keyframes num-up { 0% { transform: scale(1); } 50% { transform: scale(1.3); color: var(--c-pink-deep); } 100% { transform: scale(1); } }
.hud__btns { display: flex; gap: 6px; }
.hud__btns .icon-btn { width: 36px; height: 36px; }
.hud__btns .icon-btn--pause::before { left: 8px; top: 8px; }
.hud__btns .icon-btn--sound::before { left: 7px; top: 8px; }
.hud__btns .icon-btn--sound.is-muted::after { left: 13px; top: 2px; }

/* HYPE ゲージ（--hype: 0〜1） */
.hype { display: flex; align-items: center; gap: 6px; flex: none; }
.hype__label { flex: none; padding: 0 8px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-cyan); font: 900 12px/22px var(--font-num); letter-spacing: .06em; }
.hype__bar { position: relative; flex: 1; height: 18px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-purple-deep); overflow: hidden; }
.hype__fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--hype, .6) * 100%);
  background: linear-gradient(90deg, var(--c-cyan), var(--c-pink));
  border-radius: 999px;
  transition: width .3s ease;
}
.hype__fill::after { content: ""; position: absolute; left: 6px; right: 6px; top: 2px; height: 3px; border-radius: 9px; background: rgba(255,255,255,.5); }
.hype.is-low .hype__fill { background: var(--c-red); animation: blink .5s steps(2) infinite; }
.hype.is-max .hype__bar { box-shadow: 0 0 10px var(--c-pink), 0 0 0 2px var(--c-lemon); }
@keyframes blink { 50% { opacity: .45; } }
.combo { flex: none; min-width: 64px; text-align: right; color: var(--c-lemon); font-weight: 900; text-shadow: 0 2px 0 var(--c-ink); -webkit-text-stroke: 3px var(--c-ink); paint-order: stroke fill; }
.combo .num { font-size: 22px; }
.combo small { font-size: 11px; color: var(--c-paper); }
.combo[hidden] { visibility: hidden; display: block; }
.combo.is-up { animation: num-up .3s var(--ease-pop); }

/* ステージ canvas（伸縮） */
.stage {
  position: relative; flex: 1 1 auto; min-height: 120px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--c-purple-deep);
}
.stage__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage__hint { position: absolute; left: 8px; bottom: 8px; }

/* 歌詞カード（白い紙・黒の太字） */
.lyric {
  --c-rhyme: var(--c-pink);
  flex: none;
  position: relative;
  padding: 8px 12px 10px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper);
  box-shadow: 0 5px 0 var(--c-ink);
}
.lyric[data-rhyme="1"] { --c-rhyme: var(--c-cyan); }
.lyric[data-rhyme="2"] { --c-rhyme: var(--c-lemon); }
.lyric__line {
  display: flex; align-items: flex-start; flex-wrap: nowrap;
  min-height: 52px;
  font-size: clamp(18px, 5.4vw, 24px); font-weight: 900; line-height: 1.3;
  white-space: nowrap;
}
.lyric__line + .lyric__line { border-top: 2px dashed var(--c-line); padding-top: 4px; }
.lyric__ch { display: inline-block; color: var(--c-ink); transition: color .08s; }
.lyric__ch.is-sung { color: var(--c-sung); }
.lyric__ch.is-now { color: var(--c-pink); transform: translateY(-3px) scale(1.12); }
/* お手本の言葉（ハイライト＋下に読み） */
.lyric__word {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  margin-left: 2px; padding: 0 4px;
  border-radius: 8px;
  background: var(--c-cream);
  box-shadow: inset 0 -6px 0 var(--c-lemon);
}
.lyric__kana { display: flex; font-size: 11px; font-weight: 800; line-height: 1.2; color: var(--c-ink-sub); letter-spacing: .04em; }
.lyric__mora { display: inline-flex; flex-direction: column; align-items: center; min-width: 1em; }
/* 母音ガイド（末尾 N 拍の読みの下） */
.lyric__vowel {
  display: block; margin-top: 1px; padding: 0 3px;
  border: 2px solid var(--c-ink); border-radius: 6px;
  background: var(--c-lemon); color: var(--c-ink);
  font-size: 10px; line-height: 1.2;
}
.lyric__mora.is-rhyme > span:first-child { color: var(--c-pink-deep); }
/* 空欄 */
.lyric__blank {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-width: 4.2em; margin-left: 4px; padding: 0 6px;
  border-bottom: 4px solid var(--c-ink);
  color: var(--c-ink-sub);
}
.lyric__blank.is-wait { animation: blank-pulse .7s ease-in-out infinite; }
@keyframes blank-pulse { 50% { border-bottom-color: var(--c-pink); background: var(--c-pink-light); } }
.lyric__blank.is-filled { color: var(--c-ink); border-bottom-color: var(--c-mint-deep); animation: pop-in .3s var(--ease-pop); }
/* 正解: 韻の部分（末尾 N 拍）がネオンに光る */
.rhyme { border-radius: 6px; }
.lyric.is-correct .rhyme,
.rhyme.is-lit {
  background: var(--c-rhyme);
  color: var(--c-ink);
  box-shadow: 0 0 0 2px var(--c-ink), 0 0 14px var(--c-rhyme);
  animation: rhyme-flash .5s ease-out 2;
}
@keyframes rhyme-flash { 0% { filter: brightness(1.6); transform: scale(1.15); } 100% { filter: none; transform: none; } }
.lyric.is-correct { box-shadow: 0 5px 0 var(--c-ink), 0 0 0 4px var(--c-rhyme); }
/* 不正解: 「噛んだ！」で文字がぐらつく */
.lyric.is-miss { background: var(--c-red-light); }
.lyric.is-miss .lyric__line:last-child .lyric__ch,
.lyric.is-miss .lyric__blank { animation: chomp .45s ease-in-out; color: var(--c-red-deep); }
.lyric.is-miss .lyric__ch:nth-child(odd) { animation-delay: .04s; }
@keyframes chomp {
  0%, 100% { transform: none; }
  20% { transform: translate(-3px, 2px) rotate(-8deg); }
  40% { transform: translate(3px, -2px) rotate(7deg); }
  60% { transform: translate(-2px, 1px) rotate(-5deg); }
  80% { transform: translate(1px, 0) rotate(3deg); }
}
.lyric__stamp {
  position: absolute; right: 10px; top: -14px;
  padding: 2px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-red); color: #fff;
  font-size: 16px; font-weight: 900;
  transform: rotate(6deg);
  animation: pop-in .3s var(--ease-pop);
}
.lyric__stamp[hidden] { display: none; }
.lyric__stamp--good { background: var(--c-mint); color: var(--c-ink); }
.lyric__stamp--quiet { background: var(--c-ink-sub); }
.lyric__answer { color: var(--c-mint-deep); }   /* 不正解時に一瞬見せる正解（空欄内） */

/* 時間ゲージ（拍のドット） */
.beats { display: flex; align-items: center; gap: 6px; flex: none; justify-content: center; }
.beats__dot {
  width: 16px; height: 16px; flex: none;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-cyan);
  transition: background .1s, transform .1s;
}
.beats__dot.is-past { background: var(--c-purple-deep); transform: scale(.75); }
.beats__dot.is-now { background: var(--c-lemon); transform: scale(1.3); }
.beats__dot.is-last { background: var(--c-red); }
.beats__dot.is-bar { margin-left: 6px; }   /* 小節の区切り */

/* 選択肢 */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.choices[data-count="3"] .choice:last-child { grid-column: 1 / -1; }
.choice {
  --c-bg: var(--c-paper);
  --c-edge: var(--c-ink);
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: var(--choice-h);
  padding: 4px 10px 6px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-bg);
  cursor: pointer;
  box-shadow: 0 var(--btn-depth) 0 var(--c-edge);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.choice:active, .choice.is-pressed { transform: translateY(var(--btn-depth)); box-shadow: 0 0 0 var(--c-edge); }
.choice__word { font-size: clamp(18px, 5.2vw, 22px); font-weight: 900; line-height: 1.15; }
.choice__kana { font-size: 11px; font-weight: 700; color: var(--c-ink-sub); line-height: 1.2; }
.choice__key {
  position: absolute; left: 6px; top: 6px;
  display: none; place-items: center;
  width: 20px; height: 20px;
  border: 2px solid var(--c-ink); border-radius: 6px;
  background: var(--c-cream);
  font: 900 12px/1 var(--font-num);
}
@media (hover: hover) and (pointer: fine) { .choice__key { display: grid; } }
.choice.is-correct { --c-bg: var(--c-mint); transform: translateY(var(--btn-depth)); box-shadow: 0 0 0 var(--c-edge), 0 0 0 4px var(--c-rhyme, var(--c-pink)); }
.choice.is-correct .choice__kana { color: var(--c-ink); }
.choice.is-wrong { --c-bg: var(--c-red-light); animation: chomp .4s ease-in-out; }
.choice.is-wrong .choice__word { color: var(--c-red-deep); text-decoration: line-through 3px; }
.choice.is-reveal { --c-bg: var(--c-cyan-light); box-shadow: 0 var(--btn-depth) 0 var(--c-edge), 0 0 0 3px var(--c-mint-deep); }
.choices.is-locked .choice { cursor: default; }
.choices.is-locked .choice:not(.is-correct):not(.is-wrong):not(.is-reveal) { opacity: .5; }

/* ヒントボタン（ステージ3以降、1回だけ） */
.hint-btn { min-height: 34px; padding: 2px 12px; font-size: 13px; --btn-depth: 3px; }
.hint-btn::after { top: 3px; height: 3px; }

/* ステージ開始カード */
.stage-intro {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; align-content: center; gap: 10px;
  background: rgba(14, 10, 36, .6);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid), visibility 0s linear var(--dur-mid);
}
.stage-intro.is-open { opacity: 1; visibility: visible; transition: opacity var(--dur-mid), visibility 0s; }
.stage-intro__plate {
  padding: 8px 24px; border: 4px solid var(--c-ink); border-radius: var(--radius-l);
  background: var(--c-pink); color: #fff; text-align: center;
  font-size: 28px; font-weight: 900; -webkit-text-stroke: 1px var(--c-ink);
  box-shadow: 0 6px 0 var(--c-ink); transform: rotate(-3deg);
}
.stage-intro.is-open .stage-intro__plate { animation: pop-in .4s var(--ease-pop); }
.stage-intro__note { margin: 0; padding: 4px 14px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-lemon); font-weight: 900; }

/* ---------- 結果 ---------- */
.screen--result { align-items: stretch; gap: 10px; text-align: center; }
.result__head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.verdict {
  margin: 0; font-size: clamp(30px, 9vw, 40px); font-weight: 900; line-height: 1.1;
  color: var(--c-lemon); -webkit-text-stroke: 2px var(--c-ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--c-ink);
}
.verdict--fail { color: var(--c-cyan-light); }
.result__title {   /* 称号 */
  display: inline-block; padding: 2px 14px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-pink); color: #fff; font-weight: 900; font-size: 15px;
  transform: rotate(-2deg);
}
.result__stars { display: flex; justify-content: center; gap: 8px; }
.result__stars .star { width: 44px; height: 44px; }
.result__stars .star.is-on { animation: star-pop .45s var(--ease-pop) both; animation-delay: calc(var(--i, 0) * .25s + .2s); }
@keyframes star-pop { from { transform: scale(0) rotate(-60deg); } to { transform: none; } }
.result__panel {
  padding: 10px 14px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper);
  box-shadow: 0 5px 0 var(--c-ink);
}
.result__score { display: flex; align-items: baseline; justify-content: center; gap: 6px; font-weight: 800; }
.result__score .num { font-size: 40px; line-height: 1.1; color: var(--c-pink-deep); }
.result__best { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: 999px; background: var(--c-gold); font-size: 12px; font-weight: 900; }
.result__best[hidden] { display: none; }
.result__stats { display: flex; justify-content: center; gap: 14px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }
.result__stats b { font: 900 18px/1 var(--font-num); color: var(--c-ink); }
.result__next { margin: 4px 0 0; font-size: 13px; font-weight: 800; color: var(--c-pink-deep); }
/* 踏んだ韻のリスト（見せ場） */
.rhymes { flex: 1 1 auto; min-height: 120px; overflow-y: auto; text-align: left; }
.rhymes__title { margin: 0 0 6px; font-size: 15px; font-weight: 900; text-align: center; }
.rhymes__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rhymes__item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border-radius: 10px; background: var(--c-cream);
  font-size: 17px; font-weight: 900;
  animation: slide-in .35s ease-out both; animation-delay: calc(var(--i, 0) * .08s + .3s);
}
.rhymes__item:nth-child(3n+2) { --c-rhyme: var(--c-cyan); }
.rhymes__item:nth-child(3n) { --c-rhyme: var(--c-lemon); }
.rhymes__item .rhyme { padding: 0 2px; background: var(--c-rhyme, var(--c-pink)); box-shadow: 0 0 0 2px var(--c-ink); }
.rhymes__arrow { color: var(--c-ink-sub); font-size: 14px; }
.rhymes__vowels { margin-left: auto; font: 800 11px/1 var(--font-num); color: var(--c-ink-sub); letter-spacing: .08em; }
.rhymes__item.is-miss { background: #ece6f2; color: var(--c-ink-sub); }
.rhymes__item.is-miss .rhymes__ans { text-decoration: line-through 2px; }
.rhymes__empty { margin: 6px 0; font-size: 13px; color: var(--c-ink-sub); text-align: center; }
@keyframes slide-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.result__actions .btn--block { grid-column: 1 / -1; }
.toast {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 30;
  padding: 6px 16px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-lemon); font-weight: 900;
  transform: translate(-50%, 0); transition: opacity .2s;
}
.toast[hidden] { display: block; opacity: 0; pointer-events: none; }

/* ---------- 縦にして遊んでね ---------- */
.rotate {
  position: fixed; inset: 0; z-index: 100;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--c-night); color: var(--c-paper);
  font-size: 20px; font-weight: 900; text-align: center;
}
.rotate__phone {
  width: 44px; height: 72px;
  border: 4px solid var(--c-paper); border-radius: 10px;
  box-shadow: inset 0 -8px 0 var(--c-pink);
  animation: rotate-hint 1.8s ease-in-out infinite;
}
@keyframes rotate-hint { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 499px) {
  .rotate { display: flex; }
}

/* ---------- 小さい画面 ---------- */
@media (max-height: 700px) {
  :root { --choice-h: 52px; }
  .screen--play { gap: 6px; }
  .lyric { padding: 6px 10px 8px; }
  .lyric__line { min-height: 46px; font-size: 18px; }
  .beats__dot { width: 13px; height: 13px; }
  .title__art { width: min(56vw, 220px); }
  .stage-card { min-height: 66px; }
}
@media (min-width: 700px) and (min-height: 860px) {
  :root { --choice-h: 66px; }
}

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .lyric.is-miss .lyric__ch, .lyric.is-miss .lyric__blank, .choice.is-wrong { animation: none !important; }
  .lyric__ch.is-now { transform: none; }
}

/* 正解時は読みも少し大きく（韻の部分が読めるように） */
.lyric.is-correct .lyric__kana { font-size: 13px; color: var(--c-ink); }
