/* ジャンケン魂 ITADAKI — 和×アーケード。墨・生成り・朱・金・藍。対戦者はネオン(自分=緑、相手=紫系。js/fx.js の YOU / COM と合わせる)
   文字は x8y12pxDenkiChip(12px 升目のピクセルフォント、SIL OFL)。にじませないよう font-size は 12px の倍数に丸める */
@font-face {
  font-family: 'DenkiChip';
  src: url('../fonts/x8y12pxDenkiChip.woff2') format('woff2');
  font-display: swap;
}
:root {
  --ink: #0e0d0c;
  --ink2: #1c1917;
  --paper: #efe6d2;
  --paper2: #b4a98f;
  --paper3: #7d7462;
  --shu: #d7382a;
  --gold: #e5b857;
  --ai: #6b86e6;
  --you: #39ff9a;
  --com: #b35cff;
  --hand: clamp(200px, 36vmin, 340px);
  --f-pixel: 'DenkiChip', 'Press Start 2P', monospace;
  --f-dot: 'DenkiChip', 'DotGothic16', 'Noto Sans JP', sans-serif;
  --f-body: 'DenkiChip', 'Noto Sans JP', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* 高さ: 通常は 100dvh。iOS のホーム画面起動(全画面)は表示領域が短く報告されて下に帯が残ることがあるので、index.html の先頭のスクリプトが画面の実寸を --app-h に入れる */
html, body { height: 100%; height: 100dvh; height: var(--app-h, 100dvh); }
/* つづけて押しても拡大しない(iPhone は 2 回つづけて押すと拡大して、画面が上へずれる)。画面の端で引っぱっても動かさない */
html { touch-action: manipulation; overscroll-behavior: none; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  line-height: 1.4;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
body.no-webgl { background: radial-gradient(ellipse at 50% 42%, #2b2622 0%, #0e0d0c 70%); }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; height: var(--app-h, 100dvh); display: block; z-index: 0; }
body.no-webgl #fx { display: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

#stage {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom));
}

/* HUD */
.hud { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hud-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hud-score { align-items: flex-end; text-align: right; }
.hud-row { display: flex; align-items: baseline; gap: 8px; }
.hud-label { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); letter-spacing: .05em; }
.hud-num { font-family: var(--f-pixel); font-size: 24px; line-height: 1; color: var(--paper); }
.hud-num-s { font-size: 12px; color: var(--paper2); }
.hud-name { font-family: var(--f-dot); font-size: 24px; color: var(--paper); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-habit { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); letter-spacing: .1em; }
.lamps { display: flex; gap: 6px; }
.lamps i { display: block; width: 12px; height: 12px; border: 1px solid var(--paper3); transition: background .15s, border-color .15s, transform .15s; }
.lamps-com i.on { background: var(--com); border-color: var(--com); box-shadow: 0 0 8px var(--com); }
.lamps-you i.on { background: var(--you); border-color: var(--you); box-shadow: 0 0 8px var(--you); }
.hud .lamps { margin-top: 4px; }
.lamps i.pop { transform: scale(1.6); }
.streak { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--gold); min-height: 24px; white-space: nowrap; }
/* 連勝数: 増えたら跳ねる。3 連勝から炎の色、5 連勝から稲妻の色。切れたら 灰色になって ずり落ちる(js/game.js の streakFx) */
.streak { transform-origin: 100% 50%; }
.streak.hot { color: #ff8a3a; text-shadow: 0 0 8px rgba(255,111,38,.85); }
.streak.volt { color: #eaffff; text-shadow: 0 0 6px #6ff6ff, 0 0 14px rgba(80,200,255,.75); }
.streak.pop { animation: streak-pop .42s cubic-bezier(.2,.9,.3,1.3) both; }
.streak.broke { color: var(--paper3); text-shadow: none; animation: streak-broke .75s ease-in both; }
@keyframes streak-pop { 0% { transform: scale(2.1); } 55% { transform: scale(.92); } 100% { transform: scale(1); } }
@keyframes streak-broke { 0% { transform: none; opacity: 1; } 12% { transform: translateX(-4px); } 24% { transform: translateX(4px); } 36% { transform: translateX(-3px) rotate(0deg); } 100% { transform: translateY(26px) rotate(9deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .streak.pop { animation: none; } .streak.broke { animation: none; opacity: 0; } }
/* 連勝数の下の一行(自己ベストまでの残り。js/game.js の renderStreakSub)。ベストを更新している間は金色 */
.streak-sub { font-family: var(--f-dot); font-size: 12px; line-height: 1; color: var(--paper2); min-height: 12px; white-space: nowrap; }
.streak-sub.rec { color: var(--gold); text-shadow: 0 0 6px rgba(229,184,87,.7); }
/* 自己ベストを更新した瞬間: 数字が金色に光って跳ねる(js/game.js の recordFx) */
.hud-num.rec, .streak-sub.pop { animation: rec-pop 1.3s cubic-bezier(.2,.9,.3,1.3) both; transform-origin: 100% 50%; }
@keyframes rec-pop { 0% { transform: scale(2.2); color: #fff; text-shadow: 0 0 10px #fff, 0 0 18px var(--gold); } 25% { transform: scale(1); } 100% { transform: scale(1); } }
.hud-num.rec { color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .hud-num.rec, .streak-sub.pop { animation: none; } }

/* 対戦エリア。手(WebGL)は .arena の対角の角に置いたアンカーの位置に描かれる */
.arena { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.hand-anchor { position: absolute; width: var(--hand); height: var(--hand); }
.hand-anchor-com { left: -2%; top: 2%; }
.hand-anchor-you { right: -2%; bottom: 2%; }
.mid { position: relative; width: 100%; height: clamp(120px, 28vmin, 220px); display: grid; place-items: center; }
.mid .chant, .mid .verdict { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; height: auto; }
.mid .chant { flex-direction: row; } /* 1 文字ずつの span を横に並べる */
body.no-webgl .hand-anchor { display: none; }
body:not(.no-webgl) .com-hand { display: none; }
.chant {
  font-family: var(--f-dot); line-height: 1; color: var(--paper); white-space: nowrap;
  font-size: clamp(60px, 16vmin, 120px);
  font-size: round(down, clamp(60px, 16vmin, 120px), 12px);
  text-shadow: calc(1em / 12) calc(1em / 12) 0 #000, 0 0 .3em rgba(0, 0, 0, .9);
}
.chant .ch { display: inline-block; transform-origin: 50% 100%; }
/* はじめての人の最初の 1 手のヒント(手をえらべ)。掛け声より小さく、点滅させる */
.chant.hint { font-size: 36px; animation: blink 1.4s ease-in-out infinite; }
.chant.pop .ch { animation: chant-hop .34s cubic-bezier(.3, .7, .4, 1) both; animation-delay: calc(var(--i) * 45ms); }
.chant.pop.is-pon .ch { animation: chant-slam .4s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i) * 30ms); }
.com-hand { font-family: var(--f-dot); font-size: 48px; line-height: 1; color: var(--paper); opacity: .3; transition: opacity .2s; }
.com-hand.wait { opacity: .5; animation: breathe 1s ease-in-out infinite; }
.com-hand.show { opacity: 1; animation: none; }
.com-hand .kanji { display: inline-block; }
.com-hand.show .kanji { animation: slam .16s cubic-bezier(.2, 1.3, .3, 1) both; }
.verdict {
  height: 1.3em; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; margin: 0;
  font-size: clamp(96px, 26vmin, 192px);
  font-size: round(down, clamp(96px, 26vmin, 192px), 12px);
}
.verdict.show { opacity: 1; }
.verdict .kanji { font-family: var(--f-dot); font-size: 1em; line-height: 1; display: block; }
.verdict.show .kanji { animation: verdict-slam .34s cubic-bezier(.2, 1.4, .3, 1) both; }
.verdict .en { font-family: var(--f-pixel); font-size: 24px; letter-spacing: .25em; margin-top: 6px; display: block; text-shadow: 2px 2px 0 #000; }
.verdict.show .en { animation: rise .3s .12s cubic-bezier(.2, 1, .3, 1) both; }
.verdict.win { color: var(--you); transform: scale(var(--vs, 1)); } /* 連勝ほど大きく(game.js が --vs を入れる) */
/* 連勝の稲妻(5 連勝から。game.js の zap) */
.zap { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; filter: drop-shadow(0 0 6px #6ff6ff) drop-shadow(0 0 14px rgba(80, 200, 255, .6)); }
.zap polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; opacity: 0; animation: zap-flick .5s steps(1, end) both; }
.zap .glow { stroke: rgba(120, 240, 255, .55); stroke-width: 7; }
.zap .core { stroke: #f4ffff; stroke-width: 2.4; }
@keyframes zap-flick { 0% { opacity: 1; } 14% { opacity: .15; } 24% { opacity: 1; } 44% { opacity: .3; } 54% { opacity: 1; } 100% { opacity: 0; } }
.verdict.lose { color: var(--com); }
.verdict.draw { color: #fff; }
.verdict.win .kanji { text-shadow: 0 0 .08em rgba(0, 0, 0, .9), 0 0 .2em var(--you), 0 0 .5em rgba(57, 255, 154, .55); }
.verdict.lose .kanji { text-shadow: 0 0 .08em rgba(0, 0, 0, .9), 0 0 .2em var(--com), 0 0 .5em rgba(179, 92, 255, .55); }
.verdict.draw .kanji { text-shadow: 0 0 .08em rgba(0, 0, 0, .9), 0 0 .15em rgba(255, 255, 255, .85), 0 0 .4em rgba(170, 200, 255, .5); }
/* 口上は吹き出しで、相手の側(右上。手が空ける角)に出す。角を 1 升欠いた生成りの面、相手の色の落ち影、しっぽは相手の手の側、上に名札 */
.taunt {
  --opp: var(--com); --bal: var(--paper);
  position: absolute; right: 10px; top: calc(2% + 20px); max-width: 60%; text-align: left;
  font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--ink);
  background: var(--bal); padding: 12px 12px 8px; opacity: 0; transform-origin: 0 0;
  box-shadow: 0 -4px 0 var(--bal), 0 4px 0 var(--bal), -4px 0 0 var(--bal), 4px 0 0 var(--bal), 4px 8px 0 var(--opp), 8px 4px 0 var(--opp);
}
.taunt::before {
  content: ''; position: absolute; left: -20px; top: 8px; width: 17px; height: 16px; background: var(--bal);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 75% 100%, 75% 75%, 50% 75%, 50% 50%, 25% 50%, 25% 25%, 0 25%);
}
.taunt-who {
  position: absolute; left: 4px; top: -24px; font-size: 12px; line-height: 1; white-space: nowrap;
  padding: 4px 6px; color: var(--paper); background: var(--ink); border: 2px solid var(--opp);
}
.taunt-text .off { visibility: hidden; }
.taunt.show { opacity: 1; animation: taunt-pop .2s steps(4, end) both; }
/* 場面の調子で吹き出しが変わる。取ったら押し出すように揺れ、取られたら色が沈む */
.taunt.up { animation: taunt-pop .2s steps(4, end) both, taunt-jolt .3s steps(4, end) .2s 2; }
.taunt.sunk { --bal: var(--paper2); }
/* あと 1 本・2 対 2: 朱の影が重なり、出ている間ずっと ふるえる */
.taunt.hot {
  box-shadow: 0 -4px 0 var(--bal), 0 4px 0 var(--bal), -4px 0 0 var(--bal), 4px 0 0 var(--bal), 4px 8px 0 var(--opp), 8px 4px 0 var(--opp), 8px 12px 0 var(--shu), 12px 8px 0 var(--shu);
  animation: taunt-pop .2s steps(4, end) both, taunt-tremble .18s steps(2, end) .2s infinite;
}
/* 勝ち切った: 相手の色で塗りつぶし、大きく たたきつける */
.taunt.fin {
  --bal: var(--opp); color: var(--on-opp);
  box-shadow: 0 -4px 0 var(--bal), 0 4px 0 var(--bal), -4px 0 0 var(--bal), 4px 0 0 var(--bal), 4px 8px 0 var(--paper), 8px 4px 0 var(--paper);
  animation: taunt-slam .28s steps(5, end) both, taunt-jolt .3s steps(4, end) .28s 3;
}
/* 追いつめられた: 色が沈み、小さく ふるえつづける */
.taunt.shaken { --bal: var(--paper2); animation: taunt-pop .2s steps(4, end) both, taunt-tremble .26s steps(2, end) .2s infinite; }
/* やぶれた: さらに沈んで、少し落ちる */
.taunt.down { --bal: var(--paper3); animation: taunt-pop .2s steps(4, end) both, taunt-drop .5s steps(3, end) .3s both; }
.taunt.down .taunt-who { color: var(--paper3); }
/* 審判の一言(あいこ)は吹き出しにしない */
.taunt.note { background: none; box-shadow: none; color: var(--paper); text-shadow: 2px 2px 0 #000; text-align: right; padding: 6px 4px; }
.taunt.note::before, .taunt.note .taunt-who { display: none; }
/* 決着の台詞を、撃破とゲームオーバーの画面に残す */
.say-line { font-family: var(--f-dot); font-size: 24px; line-height: 1.3; color: var(--paper2); }
.say-line:empty { display: none; }
@keyframes taunt-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes taunt-slam { 0% { transform: scale(1.9); opacity: 0; } 60% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes taunt-tremble { 0% { transform: translate(-2px, 0); } 100% { transform: translate(2px, 0); } }
@keyframes taunt-drop { 0% { transform: translate(0, 0); } 100% { transform: translate(0, 8px); } }
@keyframes taunt-jolt { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-4px, 2px); } 75% { transform: translate(4px, -2px); } }

/* 手のボタン。押しやすい大きさの丸(v2.20 で 72px 角 → 直径 --hand-h)。絵は線画の手を緑のネオンで光らせる */
:root { --hand-h: 96px; }
.controls { display: flex; justify-content: center; gap: 18px; width: 100%; }
.hand {
  position: relative; width: var(--hand-h); height: var(--hand-h); border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid rgba(57, 255, 154, .45);
  background: rgba(14, 13, 12, .88);
  color: var(--paper);
  transition: transform .08s, border-color .15s, color .15s, opacity .2s, background .15s, box-shadow .15s;
}
.hand .ico { width: 58%; height: 58%; display: block; transition: filter .15s; filter: drop-shadow(0 0 1.5px #39ff9a) drop-shadow(0 0 6px rgba(57, 255, 154, .55)); }
.hand { box-shadow: 0 0 10px rgba(57, 255, 154, .18), inset 0 0 10px rgba(57, 255, 154, .08); }
.hand:hover { border-color: var(--you); color: var(--you); background: rgba(57, 255, 154, .05); }
.hand:active { transform: translateY(2px); }
.hand.is-sel { border-color: var(--you); color: var(--you); background: rgba(57, 255, 154, .08); transform: scale(1.08); box-shadow: 0 0 18px rgba(57, 255, 154, .35), inset 0 0 14px rgba(57, 255, 154, .12); }
.hand.is-sel .ico { filter: drop-shadow(0 0 2px #39ff9a) drop-shadow(0 0 10px rgba(57, 255, 154, .9)) drop-shadow(0 0 22px rgba(57, 255, 154, .5)); }
body:not([data-round="idle"]) .hand { pointer-events: none; }
body[data-round="chant"] .hand:not(.is-sel),
body[data-round="result"] .hand:not(.is-sel) { opacity: .3; }
body.screen-title .hud, body.screen-title .arena, body.screen-title .controls,
body.screen-over .hud, body.screen-over .arena, body.screen-over .controls,
body.screen-name .hud, body.screen-name .arena, body.screen-name .controls,
body.screen-rank .hud, body.screen-rank .arena, body.screen-rank .controls,
body.screen-intro .hud, body.screen-intro .arena, body.screen-intro .controls,
body.screen-tut .hud, body.screen-tut .arena, body.screen-tut .controls { visibility: hidden; }
body[data-round="clear"] .center { visibility: hidden; }

/* 音の切替(右下の隅。スピーカーのマーク: 音ありは光る、音なしは × で暗く)。対戦中は手のボタンの右上へ上げる */
.mute { position: absolute; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 7; padding: 6px; line-height: 0; background: none; border: none; }
.mute img { width: 30px; height: 30px; display: block; image-rendering: pixelated; transition: filter .2s, opacity .2s; }
.mute[aria-pressed="false"] img { filter: drop-shadow(0 0 4px rgba(255, 214, 107, .9)) drop-shadow(0 0 10px rgba(255, 170, 60, .5)); }
.mute[aria-pressed="true"] img { opacity: .55; }
body.screen-play .mute { bottom: calc(var(--hand-h) + 24px + env(safe-area-inset-bottom)); }
body.screen-rank .mute, body.screen-intro .mute, body.screen-name .mute, body.screen-tut .mute { display: none; } /* 文字の多い画面では内容に重なるので隠す */
/* もどる(ランキング・遊び方)。画面の下の中央に浮かせ、どこまで読んでいても押せるようにする(2026-11-21 ユーザー指示。それまでは いちばん下まで送らないと押せなかった)。
   後ろを流れる文字と重なって読みにくくならないよう、下の端に暗い帯(上へ向けて消える)を敷く。帯は押しても下の画面に届く */
.back-float {
  display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; text-align: center; pointer-events: none;
  padding: 36px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(14, 13, 12, 0), rgba(14, 13, 12, .9) 55%);
}
.back-float button {
  display: none; margin: 0 auto; pointer-events: auto;
  font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper); white-space: nowrap;
  padding: 10px 28px; border: 2px solid var(--paper); background: var(--ink); text-shadow: 2px 2px 0 #000;
}
.back-float button:hover { background: var(--paper); color: var(--ink); text-shadow: none; }
body.screen-rank .back-float, body.screen-intro .back-float, body.screen-rank #btnRankBack, body.screen-intro #btnIntroOk { display: block; }

/* オーバーレイ(登場・撃破) */
.overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-content: center; text-align: center; gap: 12px;
  background: rgba(14, 13, 12, .55);
  opacity: 0; pointer-events: none; transition: opacity .18s;
  padding: 24px;
}
.overlay.show { opacity: 1; }
.intro-en { font-family: var(--f-pixel); font-size: 24px; letter-spacing: .2em; color: var(--shu); }
.intro-name {
  font-family: var(--f-dot); line-height: 1;
  font-size: clamp(72px, 20vmin, 144px);
  font-size: round(down, clamp(72px, 20vmin, 144px), 12px);
  text-shadow: calc(1em / 12) calc(1em / 12) 0 #000, calc(2em / 12) calc(2em / 12) 0 rgba(215, 56, 42, .55);
}
.overlay.show .intro-name { animation: slam .2s cubic-bezier(.2, 1.3, .3, 1) both; }
.intro-line { font-size: 24px; color: var(--paper2); }
/* 口上を読んでから押す「いざ勝負」。待っている間はオーバーレイごとタップできる */
.overlay.show.wait { pointer-events: auto; cursor: pointer; }
.fight { display: none; font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper); border: 2px solid var(--paper); padding: 10px 22px; margin: 8px auto 0; background: rgba(14, 13, 12, .7); text-shadow: 2px 2px 0 #000; }
.overlay.show.wait .fight { display: block; animation: fight-pop 1.1s ease-in-out infinite; }
.fight:hover { background: var(--paper); color: var(--ink); text-shadow: none; animation: none; }
@keyframes fight-pop { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 18px rgba(239, 230, 210, .35); } }
.clear-kanji {
  font-family: var(--f-dot); line-height: 1; color: var(--gold);
  font-size: clamp(96px, 26vmin, 192px);
  font-size: round(down, clamp(96px, 26vmin, 192px), 12px);
  text-shadow: calc(1em / 12) calc(1em / 12) 0 #000, 0 0 .3em rgba(229, 184, 87, .5);
}
.overlay.show .clear-kanji { animation: slam .2s cubic-bezier(.2, 1.3, .3, 1) both; }
.clear-line { font-size: 24px; line-height: 1.3; color: var(--paper); max-width: 100%; display: flex; flex-direction: column; gap: 6px; }
.clear-line .clear-next { color: var(--gold); }
.clear-line .clear-title { font-size: 36px; color: var(--gold); text-shadow: 3px 3px 0 #000; }
.clear-bonus { font-family: var(--f-pixel); font-size: 24px; color: var(--gold); }
/* 称号を得たとき: 暗い幕の上に 印 → 称号の名(叩きつける)→ ひとこと の順に出す */
.overlay-title { background: radial-gradient(circle at 50% 46%, rgba(60, 44, 12, .82) 0%, rgba(14, 13, 12, .9) 62%); gap: 14px; z-index: 6; }
.tt-en { font-family: var(--f-pixel); font-size: 24px; letter-spacing: .25em; color: var(--gold); }
.tt-badge { display: grid; place-items: center; }
.tt-badge .badge { width: 96px; height: 96px; filter: drop-shadow(0 0 14px rgba(229, 184, 87, .75)); }
.tt-name { font-family: var(--f-dot); font-size: 96px; line-height: 1; color: var(--gold); text-shadow: 6px 6px 0 #000, 0 0 .3em rgba(229, 184, 87, .55); white-space: nowrap; }
.tt-sub { font-family: var(--f-pixel); font-size: 12px; letter-spacing: .3em; color: var(--paper2); }
.tt-line { font-family: var(--f-dot); font-size: 24px; line-height: 1.3; color: var(--paper); }
.overlay-title.show .tt-en { animation: tt-fade .3s .05s both; }
.overlay-title.show .tt-badge { animation: tt-badge .5s .15s cubic-bezier(.2, 1.2, .3, 1) both; }
.overlay-title.show .tt-name { animation: slam .22s .55s cubic-bezier(.2, 1.3, .3, 1) both; }
.overlay-title.show .tt-sub, .overlay-title.show .tt-line { animation: tt-fade .3s .9s both; }
@keyframes tt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tt-badge { 0% { opacity: 0; transform: scale(.2) rotate(-25deg); } 100% { opacity: 1; transform: none; } }
@media (max-width: 400px) { .tt-name { font-size: 72px; } }

/* 画面(タイトル・ゲームオーバー) */
.screen {
  position: absolute; inset: 0; z-index: 6;
  display: none; place-content: center; text-align: center; gap: 16px;
  background: rgba(14, 13, 12, .42);
  padding: 24px;
}
.screen.show { display: grid; }
#screenOver { background: rgba(14, 13, 12, .6); }
/* タイトルのロゴ(階段組みの題字。文字が置かれる動きは SVG の中にあるので、ここでは動かさない)。高さが足りない画面では縮める */
.title-logo { margin: 0 auto; }
.title-logo img { display: block; width: min(86vw, 460px, 42vh); height: auto; }
/* タイトルの一言。影はロゴの側に付けたので、ここは黒の 1 升だけ */
.title-lead { font-size: 24px; color: var(--paper); max-width: 26em; margin: 0 auto; text-shadow: calc(1em / 12) calc(1em / 12) 0 #000; }
.title-ver { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); letter-spacing: .1em; }
.title-sound { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper3); }
.title-sound[hidden] { display: none; }
/* 音を出すかどうかの札 */
.sheet .sound-card { text-align: center; align-items: center; gap: 12px; padding: 22px 18px; border-color: var(--paper2); }
.sound-card h3 { font-family: var(--f-dot); font-weight: 400; font-size: 36px; line-height: 1; color: var(--gold); }
.sound-card p { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper); }
.sound-card .sound-note { color: var(--paper2); }
.sound-card .btn-row .sub { margin-top: 0; }
.title-keys { display: none; font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); letter-spacing: .1em; }
@media (hover: hover) { .title-keys { display: block; } }
.start { font-family: var(--f-dot); font-size: 36px; line-height: 1; color: var(--paper); border: 2px solid var(--paper); padding: 14px 32px; margin: 12px auto 0; animation: blink 1.4s ease-in-out infinite; text-shadow: 3px 3px 0 #000; }
.start:hover { background: var(--paper); color: var(--ink); animation: none; text-shadow: none; }
.title-best { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); line-height: 2; min-height: 1em; white-space: pre-wrap; }
.over-en {
  font-family: var(--f-pixel); color: var(--shu); letter-spacing: .1em; text-shadow: calc(1em / 12) calc(1em / 12) 0 #000;
  font-size: clamp(36px, 7vmin, 60px);
  font-size: round(down, clamp(36px, 7vmin, 60px), 12px);
}
.over-name { font-family: var(--f-dot); font-size: 24px; color: var(--paper2); }
.over-stats { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.over-group { display: flex; flex-direction: column; gap: 6px; min-width: 15em; }
.over-h { font-family: var(--f-pixel); font-size: 12px; letter-spacing: .3em; color: var(--paper3); text-align: left; padding-bottom: 4px; border-bottom: 1px solid rgba(239, 230, 210, .18); }
.over-stats dl { display: grid; grid-template-columns: auto auto; gap: 8px 20px; justify-content: space-between; font-family: var(--f-dot); font-size: 24px; text-align: left; }
.over-stats dt { color: var(--paper2); }
.over-stats dd { color: var(--paper); text-align: right; font-family: var(--f-pixel); font-size: 24px; align-self: center; }
.over-stats .new { color: var(--gold); font-size: 12px; margin-left: 6px; }
.over-rank { display: flex; flex-direction: column; gap: 6px; align-items: center; }
/* ゲームオーバーの「あと一歩」の一行(どれだけ惜しかったか。js/game.js の nearLine) */
.over-near { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.over-near:empty { display: none; }
#screenOver .btn-row [hidden] { display: none; }
.over-title { font-family: var(--f-dot); font-size: 36px; line-height: 1; color: var(--gold); text-shadow: 3px 3px 0 #000; }
.over-rankline { font-family: var(--f-dot); font-size: 24px; color: var(--paper2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: center; align-items: center; }
.btn-row .sub { margin-top: 12px; }

/* 小さめのボタンと文字リンク(番付・引き継ぎ・名無し) */
.sub { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper2); border: 1px solid var(--paper3); padding: 8px 14px; background: rgba(14, 13, 12, .6); }
.sub:hover { color: var(--paper); border-color: var(--paper); }
.screen > .sub { justify-self: center; } /* 画面のグリッドで横いっぱいに伸びないように */
.link { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper2); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.link:hover { color: var(--paper); }
.start.small { font-size: 24px; padding: 10px 20px; margin: 0; animation: none; }
.title-me { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--gold); min-height: 24px; text-shadow: 2px 2px 0 #000; }
.title-me small { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); margin-left: 10px; letter-spacing: .1em; }
.title-me.dim { color: var(--paper3); text-shadow: none; }
.title-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* 案内(初回の起動時) */
#screenIntro, #screenTut {
  background: rgba(14, 13, 12, .84); place-content: start center; grid-template-columns: min(100%, 440px); gap: 0;
  overflow-y: auto; padding: calc(28px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}
.intro-wrap { display: flex; flex-direction: column; gap: 18px; text-align: left; min-width: 0; }
.intro-wrap .name-en { text-align: center; }
.intro-h { font-family: var(--f-dot); font-weight: 400; font-size: 48px; line-height: 1; text-align: center; text-shadow: 4px 4px 0 #000; }
.intro-block { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid rgba(239, 230, 210, .25); background: rgba(14, 13, 12, .6); }
.intro-block h3 { font-family: var(--f-dot); font-weight: 400; font-size: 24px; line-height: 1; color: var(--gold); }
.intro-block p { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper2); }
.intro-block .intro-big { font-size: 36px; line-height: 1.2; color: var(--paper); text-shadow: 3px 3px 0 #000; }
.intro-block .intro-how { color: var(--paper); }
.intro-block .intro-how:empty { display: none; }
.intro-block[hidden] { display: none; }
.intro-block .intro-dim { color: var(--paper3); }
.intro-block .sub { align-self: flex-start; color: var(--paper); border-color: var(--paper2); }
/* はじめての人の案内(#screenTut): 遊び方と同じ組み。声は 2 列のボタンから選ぶ */
.tut-page { display: flex; flex-direction: column; gap: 18px; }
.tut-page[hidden] { display: none; }
#screenTut .start { align-self: center; animation: none; font-size: 24px; padding: 12px 24px; margin: 0; }
.voice-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-list .tab { padding: 12px 4px; }
@media (max-width: 600px) {
  .intro-h { font-size: 36px; }
  .intro-block .intro-big { font-size: 24px; }
}

/* 名乗り(登録・改名) */
#screenName { background: rgba(14, 13, 12, .72); }
.name-en { font-family: var(--f-pixel); font-size: 24px; letter-spacing: .2em; color: var(--shu); }
.name-h {
  font-family: var(--f-dot); font-weight: 400; line-height: 1;
  font-size: clamp(48px, 12vmin, 96px);
  font-size: round(down, clamp(48px, 12vmin, 96px), 12px);
  text-shadow: calc(1em / 12) calc(1em / 12) 0 #000;
}
.name-lead { font-size: 24px; color: var(--paper2); max-width: 22em; margin: 0 auto; white-space: pre-line; }
.name-form { display: flex; flex-direction: column; gap: 16px; align-items: center; width: min(100%, 420px); margin: 0 auto; }
.name-form input {
  width: 100%; font-family: var(--f-dot); font-size: 36px; line-height: 1; color: var(--paper); text-align: center;
  background: rgba(14, 13, 12, .85); border: 2px solid var(--paper2); padding: 12px 14px; outline: none; border-radius: 0; -webkit-appearance: none;
  user-select: text; -webkit-user-select: text;
}
.name-form input:focus { border-color: var(--you); }
.name-form input::placeholder { color: var(--paper3); font-size: 24px; }
.name-form .start { animation: none; margin-top: 0; font-size: 24px; padding: 12px 24px; }
.name-form.busy .start { opacity: .5; pointer-events: none; }
.name-err { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--shu); min-height: 24px; text-shadow: 2px 2px 0 #000; }

/* 番付(ランキング)。縦に長いので画面ごとスクロール */
#screenRank {
  background: rgba(14, 13, 12, .84); place-content: start center; grid-template-columns: min(100%, 440px); gap: 0;
  overflow-y: auto; padding: calc(24px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}
.rank-wrap { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rank-head { display: flex; align-items: baseline; justify-content: center; gap: 16px; }
.rank-h { font-family: var(--f-dot); font-weight: 400; font-size: 48px; line-height: 1; text-shadow: 4px 4px 0 #000; }
.me-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid rgba(239, 230, 210, .25); background: rgba(14, 13, 12, .6); text-align: left; }
.me-title { font-family: var(--f-dot); font-size: 48px; line-height: 1; color: var(--gold); text-shadow: 4px 4px 0 #000; }
.me-title small { font-family: var(--f-pixel); font-size: 12px; color: var(--paper3); margin-left: 10px; letter-spacing: .15em; }
.me-name { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; }
.me-note { font-family: var(--f-dot); font-size: 24px; color: var(--paper3); }
.me-next { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--paper2); }
.me-rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-family: var(--f-dot); font-size: 24px; line-height: 1; margin-top: 4px; }
.me-rows dt { color: var(--paper2); }
.me-rows dd { color: var(--paper); font-family: var(--f-pixel); text-align: right; }
.me-hall { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.me-hall span { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--gold); border: 1px solid rgba(229, 184, 87, .5); padding: 4px 8px; }
.me-hall span.crown { color: var(--ink); background: var(--gold); border-color: var(--gold); } /* 冠(1 位の表)は塗り、二つ名は枠 */
.me-card .link { align-self: flex-start; }
.me-card .start.small { align-self: flex-start; margin-top: 4px; }
.tabs { display: grid; gap: 6px; }
.tabs-axis { grid-template-columns: repeat(3, 1fr); }
.tabs-kind { grid-template-columns: repeat(5, 1fr); }
.tabs[hidden] { display: none; }
.tabs-kind .tab { font-size: 24px; padding: 6px 2px; color: var(--paper2); }
.tabs-kind .tab[aria-selected="true"] { color: var(--ink); }
/* いきおい点の説明(緑の i) */
.info { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 8px; vertical-align: 2px; border: 2px solid var(--you); color: var(--you); font-family: var(--f-pixel); font-size: 12px; line-height: 1; border-radius: 50%; box-shadow: 0 0 8px rgba(57, 255, 154, .35); }
.info:hover { background: var(--you); color: var(--ink); }
.info-pop { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid rgba(57, 255, 154, .45); background: rgba(14, 13, 12, .85); }
.info-pop[hidden] { display: none; }
.info-pop, .rules { position: relative; }
.info-pop p:first-child { padding-right: 44px; } /* × の分だけ 1 行目をあける */
/* 説明の箱を閉じる × */
.pop-x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; display: grid; place-items: center; font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper); border: 1px solid var(--paper3); background: rgba(14, 13, 12, .85); }
.pop-x:hover { color: var(--ink); background: var(--paper); border-color: var(--paper); }
/* 称号・冠・二つ名のルール */
.rules { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid rgba(229, 184, 87, .45); background: rgba(14, 13, 12, .85); text-align: left; }
.rules[hidden] { display: none; }
.rules h3 { font-family: var(--f-dot); font-weight: 400; font-size: 24px; line-height: 1; color: var(--gold); margin-top: 6px; }
.rules h3:first-of-type { margin-top: 0; min-height: 34px; display: flex; align-items: center; } /* × と高さをそろえる */
.rules p, .rules dd { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper2); }
.rules .rules-items { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.rules .rules-ladder { color: var(--paper); gap: 2px 8px; }
.rules b { font-weight: 400; color: var(--gold); }
.rules dl { display: flex; flex-direction: column; gap: 2px; }
.rules dt { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper); margin-top: 4px; }
.info-pop p { font-family: var(--f-dot); font-size: 24px; line-height: 1.25; color: var(--paper); }
.info-pop p:first-child { color: var(--you); }
.tab { font-family: var(--f-dot); font-size: 24px; line-height: 1; color: var(--paper2); border: 1px solid var(--paper3); padding: 8px 4px; background: rgba(14, 13, 12, .6); text-align: center; }
.tab:hover { color: var(--paper); border-color: var(--paper); }
.tab[aria-selected="true"] { color: var(--ink); background: var(--paper); border-color: var(--paper); }
.board-desc { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--paper2); text-align: left; }
.ph { display: inline-block; } /* 句の切れ目で折り返す(語の途中で切らない)。説明・ルール・遊び方で使う */
.board { list-style: none; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.board li {
  display: grid; grid-template-columns: 2.5em minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 8px 10px; font-family: var(--f-dot); font-size: 24px; line-height: 1; background: rgba(14, 13, 12, .5);
}
.board li:nth-child(odd) { background: rgba(239, 230, 210, .05); }
.board li.me { color: var(--you); background: rgba(57, 255, 154, .1); }
.board .rk { font-family: var(--f-pixel); color: var(--paper2); }
.board li:first-child .rk { color: var(--gold); }
.board li.me .rk { color: var(--you); }
.board .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .val { font-family: var(--f-pixel); }
/* 称号の印(js/badge.js)。表の名前の前、札の称号の前、ルール一覧 */
.badge { width: 22px; height: 22px; }
.board .nm .badge { vertical-align: -2px; margin-right: 8px; }
.me-title .badge { width: .8em; height: .8em; vertical-align: 0; margin-right: .2em; }
.rules-ladder .badge { width: 20px; height: 20px; vertical-align: -1px; margin-right: 4px; }
.board.loading { opacity: .45; } /* 読み込み中は前の表を薄く残す */
.board li[role="button"] { cursor: pointer; } /* 行を押すと その人の成績を開く */
.board li[role="button"]:hover, .board li[role="button"]:focus-visible { outline: 1px solid var(--paper3); outline-offset: -1px; }
/* ほかの人の成績(ランキングの行を押すと出る札) */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); background: rgba(14, 13, 12, .8); }
.sheet[hidden] { display: none; }
.sheet-card { position: relative; width: min(100%, 440px); max-height: 100%; overflow-y: auto; background: var(--ink); border-color: var(--paper2); }
.sheet-card .me-title { padding-right: 48px; } /* × の分をあける */
.board-note { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--paper3); min-height: 24px; }
.rank-actions { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: center; align-items: center; }
.transfer { display: flex; flex-direction: column; gap: 10px; text-align: left; padding: 14px 16px; border: 1px solid rgba(239, 230, 210, .25); background: rgba(14, 13, 12, .6); }
.transfer[hidden] { display: none; }
.transfer h3 { font-family: var(--f-dot); font-weight: 400; font-size: 24px; line-height: 1; }
.transfer p { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--paper2); }
.transfer code { display: block; font-family: var(--f-pixel); font-size: 12px; line-height: 2; letter-spacing: .05em; color: var(--paper); word-break: break-all; padding: 6px 8px; border: 1px dashed var(--paper3); user-select: text; -webkit-user-select: text; }
.transfer input { font-family: var(--f-pixel); font-size: 12px; color: var(--paper); background: rgba(14, 13, 12, .85); border: 1px solid var(--paper2); padding: 10px; width: 100%; outline: none; border-radius: 0; -webkit-appearance: none; user-select: text; -webkit-user-select: text; }
.transfer input:focus { border-color: var(--you); }
.transfer .sub { align-self: flex-start; }
.transfer-msg { font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--paper); min-height: 24px; }
@media (max-width: 600px) {
  .me-title { font-size: 36px; }
  .rank-h { font-size: 36px; }
}

/* 更新の案内(画面の上に帯)。対戦中は出さない */
.update {
  position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(calc(100% - 32px), 440px);
  padding: 8px 12px; border: 1px solid var(--gold); background: rgba(14, 13, 12, .92);
  font-family: var(--f-dot); font-size: 24px; line-height: 1.2; color: var(--gold);
}
.update span { flex: 1 1 auto; min-width: 0; }
.update[hidden], body.screen-play .update { display: none; }
.update .sub { flex: 0 0 auto; color: var(--ink); background: var(--gold); border-color: var(--gold); white-space: nowrap; }

/* ホーム画面から起動した全画面。下の余白を詰めて対戦エリアを広げる */
@media (display-mode: standalone) {
  html, body, #fx { height: var(--app-h, 100vh); }
  #stage { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .mute { bottom: calc(6px + env(safe-area-inset-bottom)); }
  @media (max-width: 600px) {
    .hand-anchor { width: clamp(200px, 34vh, 300px); height: clamp(200px, 34vh, 300px); }
    .hand-anchor-com { left: -6%; top: 1%; }
    .hand-anchor-you { right: -6%; bottom: 1%; }
  }
}

/* アニメーション */
@keyframes slam { 0% { transform: scale(2.6); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes verdict-slam { 0% { transform: scale(3.6); opacity: 0; filter: blur(8px); } 50% { transform: scale(.88); opacity: 1; filter: blur(0); } 72% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes chant-hop { 0% { transform: translateY(-.55em) scale(.8, 1.3); opacity: 0; } 30% { transform: translateY(0) scale(1.28, .72); opacity: 1; } 55% { transform: translateY(-.16em) scale(.94, 1.08); } 78% { transform: translateY(0) scale(1.06, .94); } 100% { transform: none; opacity: 1; } }
@keyframes chant-slam { 0% { transform: translateY(-.9em) scale(.7, 1.5); opacity: 0; } 28% { transform: translateY(0) scale(1.45, .6); opacity: 1; } 50% { transform: translateY(-.1em) scale(.92, 1.12); } 72% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise { 0% { transform: translateY(24px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* レスポンシブ */
@media (max-width: 600px) {
  #stage { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .controls { gap: 10px; }
  .hand-anchor { width: clamp(190px, 30vh, 270px); height: clamp(190px, 30vh, 270px); }
  .hand-anchor-com { left: -5%; top: 2%; }
  .hand-anchor-you { right: -5%; bottom: 2%; }
  .mid { height: clamp(100px, 18vh, 170px); }
  .verdict { font-size: 96px; }
  .chant { font-size: 60px; }
  .taunt { max-width: 70%; }
}
@media (max-height: 760px) {
  .hand-anchor { width: clamp(150px, 28vmin, 240px); height: clamp(150px, 28vmin, 240px); }
  .mid { height: clamp(84px, 16vmin, 140px); }
  .chant { font-size: 48px; }
  .com-hand { font-size: 36px; }
  .verdict { font-size: 72px; }
  :root { --hand-h: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
