/* ポキ丼バスケ style.css — 構造とクラス名は docs/design.md
   シリーズ共通: ポップ・太い墨枠・押すと沈むボタン・丸ゴシック（外部フォントなし） */

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

  --c-teal: #3cc6c0;
  --c-teal-deep: #1f9a97;
  --c-teal-light: #a8ece6;
  --c-hibiscus: #f0466e;
  --c-hibiscus-deep: #c22d54;
  --c-coral: #ff8a5c;
  --c-gold: #ffc83d;
  --c-gold-deep: #d99a00;
  --c-leaf: #4cb86b;
  --c-leaf-deep: #2e8a4e;
  --c-wood: #d99b5e;
  --c-wood-light: #f0c48a;
  --c-wood-deep: #a8683a;
  --c-red: #e8413b;

  --c-shake-0: #4cc26e;
  --c-shake-1: #ffc83d;
  --c-shake-2: #ff8a5c;
  --c-shake-3: #f0466e;

  --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);
  --hud-h: 56px;
  --tray-h: 112px;

  --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: #1f9a97;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,.08) 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, #5ad6cd, var(--c-teal) 55%, var(--c-teal-deep));
  box-shadow: 0 0 0 3px var(--c-ink);
}
/* ゆれ演出: JS が --sx/--sy(px) を入れる */
.app.is-shaking .play-canvas { transform: translate(var(--sx, 0px), var(--sy, 0px)) scale(1.03); }

/* ---------- 画面切替 ---------- */
.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;
}

/* ← ゲーム一覧（santa-fly-high と同じ） */
.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-hibiscus);
  --btn-edge: var(--c-hibiscus-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, 0.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 { outline: 4px solid var(--c-gold); outline-offset: 4px; }
.btn:disabled { filter: grayscale(0.8) opacity(0.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--teal { --btn-bg: var(--c-teal); --btn-edge: var(--c-teal-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: 44px;
  height: 44px;
  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; }
/* 音（スピーカー）: OFF は .is-off */
.icon-btn--sound::before {
  width: 18px; height: 16px; left: 9px; top: 11px;
  background: var(--c-ink);
  clip-path: polygon(0 30%, 35% 30%, 75% 0, 75% 100%, 35% 70%, 0 70%);
}
.icon-btn--sound::after {
  width: 10px; height: 14px; left: 22px; top: 12px;
  border: 3px solid var(--c-ink); border-left: 0; border-radius: 0 10px 10px 0;
}
.icon-btn--sound.is-off::after {
  width: 3px; height: 26px; left: 18px; top: 6px; border: 0; border-radius: 2px;
  background: var(--c-hibiscus); transform: rotate(-45deg); box-shadow: 0 0 0 1.5px var(--c-paper);
}
/* ポーズ（二本線） */
.icon-btn--pause::before { width: 6px; height: 16px; left: 12px; top: 11px; border-radius: 2px; background: var(--c-ink); box-shadow: 10px 0 0 var(--c-ink); }
/* ？ */
.icon-btn--help::before { content: "?"; position: static; font: 900 20px/1 var(--font-num); }
/* 戻る（三角） */
.icon-btn--back::before { width: 14px; height: 16px; left: 11px; top: 11px; background: var(--c-ink); clip-path: polygon(100% 0, 0 50%, 100% 100%); }

/* ---------- 星 ---------- */
.star {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--c-line);
  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); }

/* ---------- タイトル ---------- */
.screen--title { align-items: center; justify-content: center; gap: 14px; text-align: center; }
.screen__bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.logo { position: relative; 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-hibiscus);
  color: #fff;
  font-size: clamp(14px, 4vmin, 18px);
  transform: rotate(-3deg);
}
.logo__main { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-size: clamp(38px, 12vmin, 64px); }
.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: shoot-hop 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.logo__char--gold { color: var(--c-gold); }
.logo__char--coral { color: var(--c-coral); }
.logo__char--leaf { color: #9bdc6a; }
/* 1文字ずつ山なりに跳ねて、すとんと着地 */
@keyframes shoot-hop {
  0%, 55%, 100% { transform: translate(0, 0); }
  65% { transform: translate(0, -14px) rotate(-6deg); }
  75% { transform: translate(0, 2px) scale(1.08, 0.9); }
  85% { transform: translate(0, 0); }
}

.title__art {
  position: relative;
  width: min(74vw, 300px);
  aspect-ratio: 4 / 3;
  border: 4px solid var(--c-ink);
  border-radius: var(--radius-l);
  background: var(--c-cream);
  box-shadow: 0 6px 0 var(--c-ink);
  overflow: hidden;
}
.title__art canvas { width: 100%; height: 100%; }
.title__best {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 14px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-size: 14px; font-weight: 800;
}
.title__best b { font: 900 20px/1 var(--font-num); color: var(--c-hibiscus-deep); }
.title__best[hidden] { display: none; }
.title__actions { position: relative; 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(20, 60, 60, 0.55);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
}
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-mid) ease, visibility 0s; }
.card {
  position: relative;
  width: min(100%, 380px);
  padding: 20px 18px 18px;
  border: 4px solid var(--c-ink);
  border-radius: var(--radius-l);
  background: var(--c-paper);
  box-shadow: 0 7px 0 var(--c-ink);
}
.modal.is-open .card { animation: card-in var(--dur-mid) var(--ease-pop) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(20px) scale(0.92); } to { opacity: 1; transform: none; } }
.card__title {
  margin: -36px auto 12px;
  width: fit-content;
  padding: 4px 22px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-teal);
  font-size: 20px; font-weight: 900;
  box-shadow: 0 4px 0 var(--c-ink);
}

/* ルール（初回は自動で出す） */
.rules__list { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: rule; }
.rule {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  background: var(--c-cream);
  counter-increment: rule;
  animation: card-in var(--dur-mid) var(--ease-pop) both;
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.rule::before {
  content: counter(rule);
  position: absolute; top: -10px; left: -8px;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-gold);
  font: 900 14px/1 var(--font-num);
}
.rule__pic { width: 76px; height: 76px; border: 3px solid var(--c-ink); border-radius: 14px; background: var(--c-teal-light); }
.rule__text { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.45; }
.rule__text b { color: var(--c-hibiscus-deep); }
.rule__sub { display: block; margin-top: 2px; color: var(--c-ink-sub); font-size: 12px; font-weight: 700; }
/* 採点の4軸を小さなチップで */
.rules__axes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.axis-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-size: 12px; font-weight: 800;
}
.axis-chip i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c-ink); background: var(--axis, var(--c-teal)); }

/* ポーズ */
.pause { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.pause__note { margin: 0; color: var(--c-ink-sub); font-size: 13px; font-weight: 700; }

/* ---------- プレイ ---------- */
.screen--play { padding: 0; overflow: hidden; touch-action: none; }
.play-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  height: calc(var(--hud-h) + var(--safe-top));
  padding: var(--safe-top) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud__chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
  font-weight: 900; white-space: nowrap;
}
.hud__chip small { font-size: 11px; font-weight: 800; color: var(--c-ink-sub); }

/* ゆれメーター: data-lv="0..3"、--shake(0..1) は現在のゆれ量 */
.shake { flex: 1; min-width: 0; }
.shake__label { flex: none; font-size: 12px; }
.shake__bar {
  position: relative; flex: 1; min-width: 40px; height: 14px;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: repeating-linear-gradient(90deg, #efe6d2 0 calc(25% - 1px), var(--c-ink) calc(25% - 1px) 25%);
  overflow: hidden;
}
.shake__bar i {
  position: absolute; inset: 0 auto 0 0;
  width: calc(var(--shake, 0) * 100%);
  background: var(--shake-c, var(--c-shake-0));
  border-right: 2px solid var(--c-ink);
  transition: width 0.3s ease, background var(--dur-mid);
}
.shake[data-lv="1"] { --shake-c: var(--c-shake-1); }
.shake[data-lv="2"] { --shake-c: var(--c-shake-2); }
.shake[data-lv="3"] { --shake-c: var(--c-shake-3); }
.shake__lv { flex: none; font: 900 14px/1 var(--font-num); }
.shake[data-lv="2"] .shake__lv, .shake[data-lv="3"] .shake__lv { color: var(--c-hibiscus-deep); }
.shake.is-up { animation: wobble 0.5s ease; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } 75% { transform: rotate(-1.5deg); } }

.hud__left .num { font-size: 20px; line-height: 1; }
.hud__left.is-low .num { color: var(--c-hibiscus-deep); }

/* 下: 次の具材（いま投げる）と、その次 */
.tray {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  height: calc(var(--tray-h) + var(--safe-bottom));
  padding: 0 16px calc(20px + var(--safe-bottom));
  pointer-events: none;   /* フリックは canvas が受ける */
}
.tray__slot {
  position: relative;
  display: grid; place-items: center;
  border: 3px solid var(--c-ink);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff, var(--c-cream) 70%);
  box-shadow: 0 5px 0 var(--c-ink);
}
.tray__slot .ing-ico { pointer-events: none; }
.tray__now { width: 88px; height: 88px; border-width: 4px; background: radial-gradient(circle at 50% 40%, #fff, var(--c-teal-light) 75%); }
.tray__now.is-held .ing-ico { visibility: hidden; }   /* 持ち上げ中は canvas が描く */
.tray__now.is-new .ing-ico { animation: pop-in 0.3s var(--ease-pop) both; }
.tray__after { width: 56px; height: 56px; margin-bottom: 6px; opacity: 0.9; }
.tray__label {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  padding: 0 8px;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-size: 11px; font-weight: 900; white-space: nowrap;
}
.tray__now .tray__label { background: var(--c-gold); font-size: 12px; }
.tray__name { position: absolute; bottom: -17px; font-size: 11px; font-weight: 900; color: var(--c-paper); -webkit-text-stroke: 3px var(--c-ink); paint-order: stroke fill; white-space: nowrap; }
.tray__slot.is-yolk { box-shadow: 0 5px 0 var(--c-ink), 0 0 0 6px rgba(255, 200, 61, 0.6); }
.tray__after.is-empty { opacity: 0.35; }

.hint {
  position: absolute; left: 50%; z-index: 6;
  bottom: calc(var(--tray-h) + var(--safe-bottom) + 14px);
  transform: translateX(-50%);
  padding: 6px 16px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 4px 0 var(--c-ink);
  font-size: 16px; font-weight: 900; white-space: nowrap;
  pointer-events: none;
  animation: hint-bob 1.2s ease-in-out infinite;
}
.hint b { color: var(--c-hibiscus-deep); }
.hint::after {
  content: ""; position: absolute; left: 50%; bottom: -11px; margin-left: -8px;
  border: 8px solid transparent; border-top-color: var(--c-ink); border-bottom: 0;
}
.hint[hidden] { display: none; }
@keyframes hint-bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }

/* 投げた結果の吹き出し（ぽすっ！/ カン！/ もったいない…） (x,y) は style で left/top */
.callout {
  position: absolute; z-index: 6;
  transform: translate(-50%, -100%);
  font-size: 22px; font-weight: 900; white-space: nowrap;
  color: var(--c-paper);
  -webkit-text-stroke: 4px var(--c-ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--c-ink);
  pointer-events: none;
  animation: callout 0.9s ease both;
}
.callout--in { color: var(--c-gold); }
.callout--rim { color: #fff; font-size: 18px; }
.callout--miss { color: #c6b6ff; font-size: 18px; }
.callout small { display: block; font-size: 13px; text-align: center; }
/* 外れた理由: 読める白地の札（1.4秒、ほぼ不透明のまま） */
.callout--why {
  padding: 4px 12px;
  border: 3px solid var(--c-ink); border-radius: 12px;
  background: #fffaf0;
  color: #e2335b; font-size: 20px; font-weight: 900;
  -webkit-text-stroke: 0; text-shadow: none;
  box-shadow: 0 3px 0 var(--c-ink);
  transform: translate(-50%, -50%);
  animation-name: callout-why;
}
@keyframes callout-why {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  18% { transform: translate(-50%, -50%) scale(1); }
  88% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}
/* なぎ（今投げどき） */
.shake.is-calm { --shake-c: var(--c-shake-0); }
.shake.is-calm .shake__lv { color: var(--c-leaf-deep); }
@keyframes callout {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -100%) scale(1.15); }
  35% { transform: translate(-50%, -100%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -150%); }
}

/* ---------- 採点演出 ---------- */
.scoring {
  position: absolute; inset: 0; z-index: 15;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(20, 60, 60, 0.6);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid), visibility 0s linear var(--dur-mid);
}
.scoring.is-open { opacity: 1; visibility: visible; transition: opacity var(--dur-mid), visibility 0s; }
.scoring__ribbon {
  padding: 6px 26px;
  border: 4px solid var(--c-ink); border-radius: 14px;
  background: var(--c-gold);
  box-shadow: 0 5px 0 var(--c-ink);
  font-size: 24px; font-weight: 900;
  animation: pop-in 0.4s var(--ease-pop) both;
}
.scoring__bowl { width: min(70vw, 300px, 42dvh); aspect-ratio: 1; }
.scoring__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 340px; margin: 0; padding: 0; list-style: none; }
.scoring__item {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-size: 15px; font-weight: 900;
  opacity: 0; transform: scale(0.6);
}
.scoring__item b { font: 900 20px/1 var(--font-num); color: var(--c-teal-deep); }
.scoring__item.is-on { animation: pop-in 0.35s var(--ease-pop) both; opacity: 1; transform: none; }
.scoring__item.is-bad b { color: var(--c-hibiscus-deep); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }

/* ---------- 結果 ---------- */
.screen--result { align-items: center; gap: 10px; background: linear-gradient(180deg, #5ad6cd, var(--c-teal-deep)); }
.screen--result > * { flex: none; }
.result-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.result-art {
  position: relative;
  width: min(78vw, 320px, 34dvh);
  aspect-ratio: 1;
  margin-top: 4px;
  animation: bowl-in 0.6s var(--ease-pop) both;
}
.result-art canvas { width: 100%; height: 100%; }
.result-art__recipe {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%) rotate(-2deg);
  padding: 2px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-size: 13px; font-weight: 900; white-space: nowrap;
}
@keyframes bowl-in { from { opacity: 0; transform: translateY(-30px) scale(0.8) rotate(-8deg); } to { opacity: 1; transform: none; } }

.result { width: min(100%, 380px); padding: 14px 16px 12px; text-align: center; }
.result__head { display: flex; align-items: center; justify-content: center; gap: 10px; }
.result__rank {
  margin: 0;
  padding: 2px 14px;
  border: 3px solid var(--c-ink); border-radius: 10px;
  background: var(--c-hibiscus); color: #fff;
  font-size: 18px; font-weight: 900;
  transform: rotate(-2deg);
}
.result__stars { display: inline-flex; gap: 4px; }
.result__stars .star { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 var(--c-ink)); }
.result__stars .star.is-on { animation: star-pop 0.4s var(--ease-pop) both; animation-delay: calc(0.5s + var(--i, 0) * 0.18s); }
@keyframes star-pop { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.result__score { margin: 2px 0 4px; font: 900 44px/1.1 var(--font-num); }
.result__score small { margin-left: 2px; font: 900 16px var(--font-base); }
.result__score.is-best { color: var(--c-hibiscus-deep); }

.result__axes { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; text-align: left; }
/* --v: 0..1、--axis: 軸の色 */
.axis { display: grid; grid-template-columns: 5.2em 1fr 3.4em; align-items: center; gap: 8px; font-size: 13px; font-weight: 900; }
.axis__bar { position: relative; height: 14px; border: 2px solid var(--c-ink); border-radius: 999px; background: #efe6d2; overflow: hidden; }
.axis__bar i {
  position: absolute; inset: 0 auto 0 0;
  width: calc(var(--v, 0) * 100%);
  background: var(--axis, var(--c-teal));
  border-right: 2px solid var(--c-ink);
  transform-origin: left;
  animation: bar-in 0.7s ease-out both;
  animation-delay: calc(0.2s + var(--i, 0) * 0.12s);
}
@keyframes bar-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.axis__pts { text-align: right; font: 900 14px/1 var(--font-num); }
.axis__pts small { font: 800 10px var(--font-base); color: var(--c-ink-sub); }
.axis--matome { --axis: var(--c-hibiscus); }
.axis--balance { --axis: var(--c-teal); }
.axis--irodori { --axis: var(--c-gold); }
.axis--center { --axis: var(--c-coral); }
.axis--miss { --axis: #b9a8e8; }
.axis--miss .axis__pts { color: var(--c-hibiscus-deep); }

.result__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }
.result__meta b { color: var(--c-ink); font-family: var(--font-num); }
.result__new {
  padding: 0 8px; border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold); color: var(--c-ink);
  animation: pop-in 0.4s var(--ease-pop) 1s both;
}
.result__new[hidden] { display: none; }
.result__near {
  margin: 8px 0 0; padding: 6px 10px;
  border: 2px dashed var(--c-ink); border-radius: 12px;
  background: var(--c-cream);
  font-size: 14px; font-weight: 800;
}
.result__near b { color: var(--c-hibiscus-deep); }
.result-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(100%, 380px); padding-bottom: 4px; }
.result-actions__sub { display: flex; gap: 10px; }

/* ---------- トースト ---------- */
.toast {
  position: absolute; left: 50%; top: 30%; z-index: 18;
  max-width: calc(100% - 40px);
  margin: 0; padding: 8px 18px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 4px 0 var(--c-ink);
  font-size: 17px; font-weight: 900; white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  animation: toast 1.4s ease both;
}
.toast--warn { background: var(--c-gold); }
.toast--bad { background: var(--c-hibiscus); color: #fff; }
.toast--good { background: var(--c-leaf); color: #fff; }
.toast[hidden] { display: none; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  25% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}

/* ---------- 横向き警告 ---------- */
.rotate {
  position: fixed; inset: 0; z-index: 1000;
  touch-action: none;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--c-teal-deep);
  color: var(--c-paper);
  text-align: center;
}
.rotate__phone {
  width: 56px; height: 92px;
  border: 4px solid var(--c-paper); border-radius: 12px;
  box-shadow: 0 0 0 3px var(--c-ink);
  animation: turn 2s ease-in-out infinite;
}
.rotate__text { margin: 0; font-size: 20px; font-weight: 900; -webkit-text-stroke: 3px var(--c-ink); paint-order: stroke fill; }
@keyframes turn { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 499px) {
  .rotate { display: flex; }
}

/* ---------- 小さい画面（360x640 など） ---------- */
@media (max-height: 700px) {
  :root { --hud-h: 50px; --tray-h: 96px; }
  .screen { padding-top: calc(10px + var(--safe-top)); padding-bottom: calc(10px + var(--safe-bottom)); }
  .screen--title { gap: 10px; }
  .title__art { width: min(58vw, 220px); }
  .logo__main { font-size: clamp(32px, 10vmin, 46px); }
  .btn { min-height: 50px; font-size: 18px; }
  .btn--small { min-height: 40px; font-size: 14px; }
  .hud__chip { height: 36px; padding: 0 10px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn--sound::before { left: 7px; top: 9px; }
  .icon-btn--sound::after { left: 20px; top: 10px; }
  .icon-btn--sound.is-off::after { left: 16px; top: 4px; }
  .icon-btn--pause::before { left: 10px; top: 9px; }
  .icon-btn--back::before { left: 9px; top: 9px; }
  .tray__now { width: 76px; height: 76px; }
  .tray__after { width: 48px; height: 48px; }
  .rule { grid-template-columns: 60px 1fr; }
  .rule__pic { width: 60px; height: 60px; }
  .rule__text { font-size: 14px; }
  .screen--result { gap: 6px; }
  .result-art { width: min(52vw, 190px, 24dvh); }
  .result-actions { gap: 6px; }
  .result__meta { margin-top: 4px; }
  .result__axes { gap: 3px; }
  .result { padding: 10px 14px; }
  .result__score { font-size: 36px; }
  .result__stars .star { width: 24px; height: 24px; }
  .axis { font-size: 12px; }
  .axis__bar { height: 12px; }
  .result__near { margin-top: 6px; font-size: 13px; }
}
@media (max-width: 370px) {
  .hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .shake__label { display: none; }
  .hud__left small { display: none; }
  .hint { font-size: 14px; }
}

/* ---------- 動きをへらす ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .logo__char, .hint, .rotate__phone { animation: none !important; }
  .app.is-shaking .play-canvas { transform: none; }
  .shake.is-up { outline: 3px solid var(--c-paper); outline-offset: 1px; }
}
