/* ゆきんこ がっせん style.css — 構造は docs/design.md */
:root {
  --c-ink: #3b2f2f;
  --c-ink-sub: #6f6a7a;
  --c-paper: #fffdf7;
  --c-snow: #f6faff;
  --c-snow-shade: #dfeaf6;
  --c-line: #d8e2ee;
  --c-red: #e8413b;
  --c-red-deep: #b8302c;
  --c-blue: #3f86e8;
  --c-blue-deep: #2a5fb0;
  --c-sky: #bfe6ff;
  --c-green: #3fa66a;
  --c-green-deep: #2b7a4b;
  --c-gold: #ffc83d;
  --c-gold-deep: #d99a00;
  --c-lock: #a7a9b8;
  --c-night: #3c4a63;
  --c-bg: #cfe7fb;
  --c-bg-stripe: #e4f2fd;

  --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: 12px;
  --radius-m: 18px;
  --radius-l: 28px;
  --btn-depth: 6px;
  --dur-fast: 0.12s;
  --dur-mid: 0.25s;

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

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-base);
  color: var(--c-ink);
  background: var(--c-bg);
}
button { font: inherit; color: inherit; touch-action: manipulation; }

.app {
  position: fixed; inset: 0; overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.9) 0 3px, transparent 4px) 0 0 / 64px 64px,
    radial-gradient(circle at 70% 75%, rgba(255,255,255,.8) 0 2px, transparent 3px) 0 0 / 48px 48px,
    repeating-linear-gradient(135deg, var(--c-bg) 0 28px, var(--c-bg-stripe) 28px 56px);
}

/* ---------- 画面 ---------- */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  overflow-y: auto;
}
.screen.is-active { display: flex; animation: screen-in var(--dur-mid) ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--c-paper);
  border: 4px solid var(--c-ink);
  border-radius: var(--radius-l);
  box-shadow: 0 8px 0 var(--c-ink);
  padding: 20px 22px;
}

/* ---------- ボタン ---------- */
.btn {
  --btn-bg: var(--c-red);
  --btn-edge: var(--c-red-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);
  margin-bottom: var(--btn-depth);
}
.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:disabled { filter: grayscale(.8) opacity(.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--blue { --btn-bg: var(--c-blue); --btn-edge: var(--c-blue-deep); }
.btn--green { --btn-bg: var(--c-green); --btn-edge: var(--c-green-deep); }
.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: 40px; padding: 6px 16px; font-size: 15px; --btn-depth: 4px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-paper);
  font-size: 20px; font-weight: 900; line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--c-ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn--pause::before { content: ""; width: 12px; height: 14px; border-left: 4px solid var(--c-ink); border-right: 4px solid var(--c-ink); }
.icon-btn--back::before { content: "‹"; font-size: 26px; margin-top: -3px; }
.icon-btn--help::before { content: "?"; }
.icon-btn--sound::before { content: "♪"; }
.icon-btn--sound.is-off { opacity: .55; }
.btn:focus-visible, .icon-btn:focus-visible, .stage-card:focus-visible, .pad-btn:focus-visible {
  outline: 4px solid var(--c-gold); outline-offset: 4px;
}

/* ---------- 星・ハート・雪玉アイコン ---------- */
.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); }
.stars { display: inline-flex; gap: 2px; filter: drop-shadow(0 0 0 var(--c-ink)) drop-shadow(1.5px 0 0 var(--c-ink)) drop-shadow(-1.5px 0 0 var(--c-ink)) drop-shadow(0 1.5px 0 var(--c-ink)) drop-shadow(0 -1.5px 0 var(--c-ink)); }
.stars--big .star { width: 54px; height: 54px; }
.heart {
  display: inline-block; width: 22px; height: 20px;
  background: var(--c-red);
  clip-path: path("M11 19 C-2 10 1 1 6.5 1 C9 1 10.5 3 11 4.5 C11.5 3 13 1 15.5 1 C21 1 24 10 11 19 Z");
}
.heart.is-off { background: #d9d4cc; }
.hearts { display: inline-flex; gap: 3px; filter: drop-shadow(1.5px 0 0 var(--c-ink)) drop-shadow(-1.5px 0 0 var(--c-ink)) drop-shadow(0 1.5px 0 var(--c-ink)) drop-shadow(0 -1.5px 0 var(--c-ink)); }
.hearts--mini .heart { width: 11px; height: 10px; clip-path: path("M5.5 9.5 C-1 5 .5 .5 3.2 .5 C4.5 .5 5.2 1.5 5.5 2.2 C5.8 1.5 6.5 .5 7.8 .5 C10.5 .5 12 5 5.5 9.5 Z"); }
.snowball-ico {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--c-ink);
  background: radial-gradient(circle at 35% 30%, #fff 0 30%, var(--c-snow-shade) 75%);
}
.snowball-ico.is-off { background: transparent; border-style: dashed; opacity: .45; }

/* ---------- タイトル ---------- */
.screen--title { gap: 18px; text-align: center; }
.logo { margin: 0; line-height: 1.05; }
.logo__sub {
  display: inline-block; padding: 4px 16px; margin-bottom: 8px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper); font-size: 15px; font-weight: 800;
}
.logo__main {
  display: block;
  font-size: clamp(44px, 10vw, 84px); font-weight: 900; letter-spacing: .04em;
  color: #fff;
  -webkit-text-stroke: 10px var(--c-ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--c-ink);
}
.logo__main .is-red { color: var(--c-red); }
.logo__main .is-blue { color: var(--c-blue); }
.title-art { width: min(320px, 70vw); aspect-ratio: 2 / 1; }
.title-art canvas { width: 100%; height: 100%; }
.title-actions { display: flex; gap: 14px; align-items: center; }
.title-actions .btn { min-width: 200px; font-size: 24px; }

/* ---------- ルール ---------- */
.modal {
  position: absolute; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(40, 50, 70, .55);
}
.modal.is-open { display: flex; animation: screen-in var(--dur-mid) ease both; }
.rules { width: min(560px, 100%); text-align: center; }
.rules__title { margin: 0 0 10px; font-size: 22px; font-weight: 900; }
.rules__page { display: none; }
.rules__page.is-active { display: block; }
.rules__fig {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; margin-bottom: 10px;
  background: var(--c-snow); border: 3px solid var(--c-ink); border-radius: var(--radius-m);
}
.rules__fig canvas { width: 96px; height: 96px; }
.rules__arrow { font-size: 28px; font-weight: 900; color: var(--c-blue-deep); }
.rules__text { margin: 0 0 12px; font-size: 18px; font-weight: 800; line-height: 1.6; }
.rules__text b { color: var(--c-red); }
.rules__dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.rules__dots i { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--c-ink); background: var(--c-paper); }
.rules__dots i.is-on { background: var(--c-gold); }
.rules__nav { display: flex; justify-content: center; gap: 12px; }
.rotate-tip {
  position: absolute; left: 50%; top: calc(12px + var(--safe-top)); z-index: 40;
  transform: translateX(-50%);
  padding: 8px 16px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold); font-weight: 800; white-space: nowrap;
}

/* ---------- ステージ選択 ---------- */
.screen--select { justify-content: flex-start; gap: 14px; }
.select-head { display: flex; align-items: center; gap: 12px; width: min(900px, 100%); }
.select-head__title { flex: 1; margin: 0; font-size: 26px; font-weight: 900; text-align: center; }
.stage-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  width: min(900px, 100%);
}
.stage-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px 12px;
  border: 4px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper);
  box-shadow: 0 6px 0 var(--c-ink);
  cursor: pointer; text-align: center;
  transition: transform .08s ease, box-shadow .08s ease;
}
.stage-card:active { transform: translateY(6px); box-shadow: 0 0 0 var(--c-ink); }
.stage-card__no {
  position: absolute; top: -14px; left: 12px;
  min-width: 34px; height: 34px; padding: 0 8px;
  display: grid; place-items: center;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-blue); color: #fff;
  font: 900 18px var(--font-num);
}
.stage-card__pic { width: 100%; aspect-ratio: 16 / 9; border: 3px solid var(--c-ink); border-radius: var(--radius-s); background: var(--c-snow); }
.stage-card__name { font-size: 16px; font-weight: 900; }
.stage-card__vs { font-size: 12px; font-weight: 800; color: var(--c-ink-sub); }
.stage-card__best { font: 800 13px var(--font-num); color: var(--c-ink-sub); }
.stage-card.is-cleared { background: #fffbea; }
.stage-card.is-locked { cursor: not-allowed; background: #eceef3; box-shadow: 0 6px 0 var(--c-lock); border-color: var(--c-lock); }
.stage-card.is-locked:active { transform: none; box-shadow: 0 6px 0 var(--c-lock); }
.stage-card.is-locked > :not(.stage-card__lock) { opacity: .35; }
.stage-card__lock {
  position: absolute; inset: 0; display: none; place-items: center;
}
.stage-card.is-locked .stage-card__lock { display: grid; }
.stage-card__lock::before {
  content: ""; width: 34px; height: 26px; margin-top: 18px;
  border: 4px solid var(--c-ink); border-radius: 6px; background: var(--c-lock);
  box-shadow: 0 -16px 0 -6px transparent;
}
.stage-card__lock::after {
  content: ""; position: absolute; width: 22px; height: 22px; margin-top: -14px;
  border: 4px solid var(--c-ink); border-bottom: 0; border-radius: 12px 12px 0 0;
}

/* ---------- プレイ ---------- */
.screen--play { padding: 0; background: var(--c-night); }
.play-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  padding: calc(8px + 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: 8px;
  padding: 6px 12px; min-height: 40px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
  font: 900 18px var(--font-num);
}
.hud__left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hud__me .hud__face { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--c-ink); background: var(--c-red); }
.hud__balls { gap: 3px; padding: 4px 10px; min-height: 32px; }
.hud__balls .snowball-ico { width: 14px; height: 14px; border-width: 2px; }
.hud__center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud__enemies { gap: 10px; }
.hud__enemy { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud__enemy-face { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--c-ink); background: var(--c-blue); }
.hud__enemy.is-down { opacity: .35; }
.hud__enemy.is-down .hud__enemy-face { background: var(--c-lock); }
.hud__left-count::before { content: "のこり "; font: 800 12px var(--font-base); }
.boss-gauge {
  width: min(320px, 46vw); height: 18px;
  border: 3px solid var(--c-ink); border-radius: 999px; overflow: hidden;
  background: var(--c-paper); box-shadow: 0 3px 0 var(--c-ink);
}
.boss-gauge__bar { height: 100%; width: calc(var(--hp, 1) * 100%); background: linear-gradient(var(--c-blue) 0 55%, var(--c-blue-deep) 55%); transition: width var(--dur-mid) ease; }
.boss-gauge__label { font-size: 12px; font-weight: 900; color: #fff; -webkit-text-stroke: 3px var(--c-ink); paint-order: stroke fill; }
.hud__right { display: flex; justify-content: flex-end; gap: 8px; }
.hud__time::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--c-ink); background: conic-gradient(var(--c-ink) 0 25%, transparent 0); }

.banner {
  position: absolute; left: 50%; top: 22%; z-index: 8;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  padding: 12px 18px;
  border: 4px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper); box-shadow: 0 6px 0 var(--c-ink);
  font-size: 17px; font-weight: 800; line-height: 1.5; text-align: center;
}
.callout {
  position: absolute; left: 50%; top: 42%; z-index: 9;
  transform: translate(-50%, -50%);
  font-size: clamp(40px, 9vw, 72px); font-weight: 900; color: var(--c-gold);
  -webkit-text-stroke: 10px var(--c-ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--c-ink);
  white-space: nowrap; pointer-events: none;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); } to { transform: translate(-50%, -50%) scale(1); } }
.toast {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 50;
  transform: translateX(-50%);
  padding: 10px 18px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-ink); color: #fff; font-weight: 800;
}

/* ---------- スマホ操作 ---------- */
.pad { display: none; position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.app.is-touch .pad { display: block; }
.stick-zone { position: absolute; left: 0; top: 30%; bottom: 0; width: 45%; pointer-events: auto; }
.stick {
  --sx: 0; --sy: 0;
  position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  left: calc(96px + var(--safe-left)); top: calc(100% - 96px - var(--safe-bottom));
  border: 4px solid var(--c-ink); border-radius: 50%;
  background: rgba(255,255,255,.45);
  opacity: .7;
}
.stick.is-active { opacity: 1; }
.stick::before { content: ""; position: absolute; inset: 18px; border: 3px dashed rgba(59,47,47,.35); border-radius: 50%; }
.stick__knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border: 4px solid var(--c-ink); border-radius: 50%;
  background: var(--c-paper); box-shadow: 0 4px 0 var(--c-ink);
  transform: translate(calc(var(--sx) * 30px), calc(var(--sy) * 30px));
}
.stick.is-active .stick__knob { background: var(--c-gold); }

.pad-btn {
  position: absolute; pointer-events: auto;
  display: grid; place-items: center;
  border: 4px solid var(--c-ink); border-radius: 50%;
  color: #fff; font-weight: 900; line-height: 1.1; text-align: center;
  -webkit-text-stroke: 4px var(--c-ink); paint-order: stroke fill;
  box-shadow: 0 6px 0 var(--edge), 0 6px 0 4px var(--c-ink);
  transition: transform .06s ease, box-shadow .06s ease;
}
.pad-btn.is-pressed, .pad-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--edge), 0 0 0 4px var(--c-ink); }
.pad-btn--throw {
  --edge: var(--c-red-deep);
  width: 88px; height: 88px;
  right: calc(24px + var(--safe-right)); bottom: calc(24px + var(--safe-bottom));
  background: radial-gradient(circle at 35% 30%, #ff7a72, var(--c-red) 60%);
  font-size: 19px;
}
.pad-btn--throw.is-empty { filter: grayscale(.7) brightness(.95); }
.pad-btn--roll {
  --edge: var(--c-blue-deep);
  --p: 0;
  width: 72px; height: 72px;
  right: calc(24px + 44px + 96px - 36px + var(--safe-right));
  bottom: calc(24px + 44px + 40px - 36px + var(--safe-bottom));
  background: radial-gradient(circle at 35% 30%, #8fc0ff, var(--c-blue) 60%);
  font-size: 14px;
}
/* 長押しの進捗リング: JS で --p (0..1) を更新 */
.pad-btn--roll::before {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  background: conic-gradient(var(--c-gold) calc(var(--p) * 360deg), rgba(255,255,255,.55) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  outline: 3px solid var(--c-ink); outline-offset: -1px;
  z-index: -1;
}
.pad-btn--roll.is-full::before { background: var(--c-lock); }
.pad-btn--roll.is-full { filter: grayscale(.6); }
.pad-btn--roll.is-nosnow { filter: grayscale(1) opacity(.7); }
.pad-balls {
  position: absolute; right: calc(24px + var(--safe-right)); bottom: calc(24px + 88px + 14px + var(--safe-bottom));
  width: 88px;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 2px;
  padding: 3px 4px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper);
  pointer-events: none;
}
.pad-balls .snowball-ico { width: 12px; height: 12px; border-width: 2px; }
.pause-btn { position: absolute; right: calc(10px + var(--safe-right)); top: calc(56px + var(--safe-top)); z-index: 7; }

/* ---------- ポーズ ---------- */
.pause { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.pause__title { margin: 0 0 6px; font-size: 26px; font-weight: 900; }
.pause__keys { margin: 6px 0 0; font-size: 13px; color: var(--c-ink-sub); line-height: 1.6; }
.pause__keys kbd { display: inline-block; min-width: 22px; padding: 0 5px; border: 2px solid var(--c-ink); border-radius: 6px; background: #fff; font: 800 12px var(--font-num); }

/* ---------- 結果 ---------- */
.screen--result { background: rgba(40, 50, 70, .55); }
.result { width: min(460px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.result__title {
  margin: -46px 0 0; font-size: 48px; font-weight: 900; color: var(--c-gold);
  -webkit-text-stroke: 9px var(--c-ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--c-ink);
}
.result.is-lose .result__title { color: var(--c-sky); }
.result__art { width: 150px; height: 110px; }
.result__stars .star { animation: star-in .4s cubic-bezier(.2, 1.6, .4, 1) both; }
.result__stars .star:nth-child(2) { animation-delay: .15s; }
.result__stars .star:nth-child(3) { animation-delay: .3s; }
@keyframes star-in { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
.result__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 0; }
.result__stat { padding: 8px 4px; border: 3px solid var(--c-ink); border-radius: var(--radius-s); background: var(--c-snow); }
.result__stat dt { font-size: 12px; font-weight: 800; color: var(--c-ink-sub); }
.result__stat dd { margin: 2px 0 0; font: 900 22px var(--font-num); }
.result__stat.is-good { background: #fff3c4; }
.result__new { padding: 2px 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-red); color: #fff; font-weight: 900; transform: rotate(-4deg); }
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.result__actions .btn { padding: 10px 12px; font-size: 18px; }
.result__actions .btn--wide { grid-column: 1 / -1; }

/* ---------- レスポンシブ ---------- */
@media (orientation: portrait) {
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
  .screen--play .pad { top: auto; height: 34%; }
  .screen--play .stick-zone { top: 0; width: 50%; }
  .stick { top: 55%; }
  .hud { grid-template-columns: 1fr auto; }
  .hud__center { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-height: 460px) {
  .screen { padding-top: calc(8px + var(--safe-top)); padding-bottom: calc(8px + var(--safe-bottom)); }
  .logo__main { font-size: 48px; -webkit-text-stroke-width: 8px; }
  .title-art { width: 220px; }
  .stage-grid { grid-template-columns: repeat(6, 1fr); gap: 10px; }
  .stage-card { padding: 12px 6px 8px; }
  .stage-card__name { font-size: 13px; }
  .stage-card__vs { display: none; }
  .card { padding: 14px 16px; }
  .result { gap: 6px; }
  .result__title { margin-top: -30px; font-size: 36px; }
  .result__art { display: none; }
  .stars--big .star { width: 40px; height: 40px; }
  .result__actions { grid-template-columns: repeat(4, 1fr); }
  .result__actions .btn--wide { grid-column: auto; }
  .rules__fig canvas { width: 72px; height: 72px; }
}
@media (max-width: 380px) {
  .stage-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .btn { font-size: 17px; padding: 10px 18px; }
  .result__stat dd { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
}

/* ---------- エンジニア追記（不具合修正） ---------- */
[hidden] { display: none !important; }
@media (max-width: 420px) { .logo__main { font-size: 38px; -webkit-text-stroke-width: 8px; } }
@media (max-height: 460px) {
  .result__actions .btn { min-height: 46px; padding: 8px 6px; font-size: 15px; white-space: nowrap; }
}
.pad-balls { width: 112px; right: calc(24px + var(--safe-right) - 12px); gap: 3px; padding: 4px 6px; }
.pad-balls .snowball-ico { width: 16px; height: 16px; border-width: 2.5px; }
.screen--play .hud__center { position: relative; }
/* QA 対応: 鍵はサムネの上に置いて名前に重ねない、名前は語の途中で折り返さない */
.stage-card__lock { inset: 14px 10px auto 10px; aspect-ratio: 16 / 9; }
.stage-card__name { word-break: keep-all; overflow-wrap: anywhere; }
.result__note { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; }
.result__badge { padding: 2px 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); font-weight: 900; font-size: 15px; }
.result__left { display: inline-flex; align-items: center; gap: 4px; padding: 4px 14px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-weight: 900; font-size: 16px; }
.result__left .heart { width: 18px; height: 16px; }
.result__title { white-space: nowrap; font-size: clamp(30px, 10vw, 48px); }
.result__actions .btn { white-space: nowrap; }
@media (max-width: 420px) { .result__actions .btn { font-size: 16px; padding: 10px 8px; } }
@media (max-height: 460px) { .result__actions .btn--wide { grid-column: span 2; } }

/* ---------- ゲーム一覧へ戻る ---------- */
.screen--title > a.back-to-games {
  position: absolute; 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; }
@media (max-height: 460px) {
  .screen--title:has(> a.back-to-games:not([hidden])) { gap: 10px; padding-top: calc(10px + var(--safe-top)); }
}
