/* ボルダリング サンタ style.css — 構造とクラス名は docs/design.md を参照 */

:root {
  --c-ink: #3b2f2f;
  --c-ink-sub: #7a6a5e;
  --c-paper: #fffdf7;
  --c-line: #eadcc0;
  --c-red: #e8413b;
  --c-red-deep: #b8302c;
  --c-green: #3fa66a;
  --c-green-deep: #2b7a4b;
  --c-fir: #2f9e5e;
  --c-gold: #ffc83d;
  --c-gold-deep: #d99a00;
  --c-night: #1b2960;
  --c-night-deep: #0b1438;
  --c-night-soft: #34488a;
  --c-snow: #f4f9ff;
  --c-heart: #ff5a6e;
  --c-lock: #8a90ad;
  --c-ok: #46c07a;
  --c-warn: #ffb52e;
  --c-bad: #f0483e;

  --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-m: 18px;
  --radius-l: 28px;
  --btn-depth: 6px;
  --play-w: min(100vw, 480px);

  --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);

  --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; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-base);
  color: var(--c-ink);
  background: var(--c-night-deep);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; }
.num { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }

.app {
  position: relative; width: 100%; height: 100dvh; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--c-night-soft), var(--c-night) 55%, var(--c-night-deep));
}

/* ---------- 画面切替 ---------- */
.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%; z-index: 0; pointer-events: none; }
.screen:not(.screen--play) > :not(.screen__bg) { position: relative; z-index: 1; }

/* ---------- ボタン（押すと沈む） ---------- */
.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);
}
.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:disabled { filter: grayscale(0.8) opacity(0.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.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: 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--pause::before {
  content: ""; width: 12px; height: 14px;
  border-left: 4px solid var(--c-ink); border-right: 4px solid var(--c-ink);
}
.btn:focus-visible, .icon-btn:focus-visible, .course-card:focus-visible {
  outline: 4px solid var(--c-gold); outline-offset: 4px;
}

/* ---------- 星（評価） ---------- */
.star {
  display: inline-block; width: 18px; height: 18px;
  background: rgba(255, 255, 255, 0.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); }

/* ---------- タイトル ---------- */
.screen--title { align-items: center; justify-content: center; gap: 16px; text-align: center; }
.logo { margin: 0; font-weight: 900; line-height: 1.05; }
.logo__sub {
  display: inline-block; padding: 2px 14px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-green); color: #fff;
  font-size: clamp(15px, 4vmin, 20px);
  transform: rotate(-3deg);
}
.logo__main {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 8px;
  font-size: clamp(38px, 11vmin, 64px);
}
.logo__row { display: flex; gap: 2px; }
.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: hop 2.2s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.logo__char--red { color: var(--c-red); }
.logo__char--green { color: #5fd18a; }
.logo__char--gold { color: var(--c-gold); }
/* 1 文字ずつ、しゃがんで跳ぶ */
@keyframes hop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  62% { transform: translateY(2px) scale(1.08, 0.9); }
  72% { transform: translateY(-12px) scale(0.95, 1.06); }
  84% { transform: translateY(0) scale(1.05, 0.95); }
}
.title__scene { width: min(76vw, 320px); height: auto; aspect-ratio: 3 / 4; }
.title__actions { display: flex; flex-direction: column; gap: 12px; width: min(80vw, 320px); }
.title__best { margin: 0; color: var(--c-paper); font-size: 13px; text-shadow: 0 1px 0 var(--c-night-deep), 0 0 6px var(--c-night-deep); }

/* ---------- モーダル（ルール説明・ポーズ） ---------- */
.modal {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(11, 20, 56, 0.72);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
}
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-mid) ease, visibility 0s; }
.card {
  width: min(100%, 360px);
  padding: 20px 18px 22px;
  border: 3px 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) both; }
@keyframes pop-in { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.card__title { margin: 0 0 12px; font-size: 22px; font-weight: 900; }
.card__sub { margin: -6px 0 14px; color: var(--c-ink-sub); font-size: 13px; }
.card__actions { display: flex; flex-direction: column; gap: 12px; }
.card--pause .card__title { font-size: 26px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 14px; font-weight: 800; }

.rules { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; text-align: left; }
.rules__item {
  display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: #fff;
}
.rules__pic { width: 64px; height: 64px; border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-night); }
.rules__text { margin: 0; font-size: 14px; font-weight: 700; }
.rules__text b { color: var(--c-red); }
.rules__key {
  display: inline-block; padding: 0 8px; border: 2px solid var(--c-ink); border-radius: 8px;
  background: var(--c-gold); font-size: 12px; font-weight: 900;
}

/* ---------- コース選択 ---------- */
.screen--courses { gap: 14px; }
.courses__head { display: flex; align-items: center; gap: 10px; }
.courses__title { flex: 1; margin: 0; color: var(--c-paper); font-size: 18px; font-weight: 900; white-space: nowrap; }
.courses__total {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper);
}
.courses__total .star { background: var(--c-gold); }
.courses__list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; padding: 0 0 12px; list-style: none; }
.courses__item--wide { grid-column: 1 / -1; }
.course-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%;
  padding: 10px 8px 12px;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  cursor: pointer;
  box-shadow: 0 5px 0 var(--c-ink);
  animation: card-in var(--dur-mid) var(--ease-pop) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.course-card:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-ink); }
.course-card__pic {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  border: 3px solid var(--c-ink); border-radius: 12px; background: var(--c-night);
}
.course-card__num {
  display: inline-grid; place-items: center; flex: none;
  min-width: 24px; height: 24px; margin-right: 5px; padding: 0 4px;
  border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-red); color: #fff; font-size: 13px;
}
.course-card.is-cleared .course-card__num { background: var(--c-gold); color: var(--c-ink); }
.course-card__name { display: inline-flex; align-items: center; font-size: 14px; font-weight: 900; line-height: 1.3; white-space: nowrap; }
.course-card__meta { color: var(--c-ink-sub); font-size: 12px; }
.course-card__stars { display: flex; gap: 2px; }
.course-card__stars .star:not(.is-on) { background: var(--c-line); }
.course-card.is-locked { background: #c9cde0; border-color: var(--c-lock); box-shadow: 0 5px 0 var(--c-lock); cursor: not-allowed; }
.course-card.is-locked:active { transform: none; box-shadow: 0 5px 0 var(--c-lock); }
.course-card.is-locked .course-card__pic { border-color: var(--c-lock); }
.course-card.is-locked .course-card__num { background: var(--c-lock); color: #fff; border-color: var(--c-lock); }
.course-card.is-locked .course-card__name, .course-card.is-locked .course-card__meta { color: #565c7c; }
.course-card.is-locked .course-card__stars { visibility: hidden; }
.course-card--endless { flex-direction: row; justify-content: center; gap: 12px; background: linear-gradient(180deg, #2a3a86, var(--c-night)); color: var(--c-paper); }
.course-card--endless .course-card__num { width: 48px; height: 48px; margin: 0; font-size: 26px; border-width: 3px; }
.course-card--endless .course-card__name { color: var(--c-paper); font-size: 17px; }
.course-card--endless .course-card__meta { color: #c8d0ef; }
.course-card--endless.is-locked { background: #c9cde0; }
.course-card__text { display: flex; flex-direction: column; align-items: flex-start; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@media (min-width: 700px) {
  .courses__list { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- プレイ ---------- */
.screen--play { padding: 0; overflow: hidden; background: var(--c-night-deep); touch-action: none; }
.play__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.play__canvas.is-shake { animation: shake 0.35s linear; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, 2px); }
  80% { transform: translate(2px, -1px); }
}
.hud {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  width: min(100%, 540px); margin: 0 auto;
}
.hud__btns { position: absolute; top: calc(10px + var(--safe-top)); right: calc(10px + var(--safe-right)); display: flex; gap: 8px; pointer-events: auto; }
.icon-btn.is-off { color: #b8aca0; background: #e8e2d8; text-decoration: line-through; }
.hud__stamina {
  --lv: var(--c-ok);
  position: absolute; top: calc(10px + var(--safe-top)); left: calc(10px + var(--safe-left)); right: calc(116px + var(--safe-right));
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); box-shadow: 0 4px 0 var(--c-ink);
}
.hud .is-warn, .hud.is-warn { --lv: var(--c-warn); }
.hud .is-bad { --lv: var(--c-bad); }
.hud .is-ok { --lv: var(--c-ok); }
.hud__stamina-label { flex: none; font-size: 12px; font-weight: 900; }
.hud__stamina-num { flex: none; min-width: 28px; text-align: right; font-size: 18px; }
.hud__bar { position: relative; flex: 1; height: 20px; border: 3px solid var(--c-ink); border-radius: 999px; background: #54475a; overflow: hidden; }
.hud__bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 1)); }
.hud__bar-ghost { background: #fff; opacity: 0.75; transition: transform 0.6s ease 0.15s; }
.hud__bar-fill { background: linear-gradient(180deg, rgba(255,255,255,.45) 0 35%, transparent 36%), var(--lv); transition: background-color 0.2s; }
.hud__stamina.is-bad { animation: throb 0.5s ease-in-out infinite alternate; }
.hud__stamina.is-hit { animation: shake 0.3s linear; }
@keyframes throb { from { transform: none; } to { transform: scale(1.03); } }
.hud__posture {
  --lv: var(--c-ok);
  position: absolute; top: calc(64px + var(--safe-top)); left: calc(10px + var(--safe-left));
  display: flex; align-items: center; gap: 6px; min-height: 34px; max-width: 58%; padding: 2px 12px 2px 4px;
  border: 3px solid var(--c-ink); border-radius: 999px; background: var(--lv); box-shadow: 0 3px 0 var(--c-ink);
  font-size: 13px; font-weight: 900; line-height: 1.2; transition: background-color 0.2s;
}
.hud__posture.is-bad { color: #fff; }
.hud__posture-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud__face {
  position: relative; flex: none; width: 24px; height: 24px; border: 2px solid var(--c-ink); border-radius: 50%;
  background: radial-gradient(circle at 32% 40%, var(--c-ink) 0 2px, transparent 2.6px), radial-gradient(circle at 68% 40%, var(--c-ink) 0 2px, transparent 2.6px), var(--c-paper);
}
.hud__face::after { content: ""; position: absolute; left: 6px; top: 10px; width: 8px; height: 5px; border-bottom: 2.5px solid var(--c-ink); border-radius: 0 0 8px 8px; }
.is-warn > .hud__face::after { top: 12px; height: 1px; border-radius: 0; }
.is-bad > .hud__face::after { top: 13px; border: 0; border-top: 2.5px solid var(--c-ink); border-radius: 8px 8px 0 0; }
.hud__rhythm {
  position: absolute; top: calc(106px + var(--safe-top)); left: calc(12px + var(--safe-left));
  padding: 1px 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-gold);
  font-size: 13px; font-weight: 900; transform: rotate(-4deg) scale(0); opacity: 0; transition: transform var(--dur-mid) var(--ease-pop), opacity 0.15s;
}
.hud__rhythm.is-on { transform: rotate(-4deg); opacity: 1; }
.hud__rhythm.is-bump { animation: bump 0.35s var(--ease-pop); }
@keyframes bump { 40% { transform: rotate(3deg) scale(1.25); } }
.hud__height {
  position: absolute; right: calc(8px + var(--safe-right)); top: calc(92px + var(--safe-top)); height: min(34vh, 260px); width: 14px;
  border: 3px solid var(--c-ink); border-radius: 999px; background: rgba(255, 253, 247, 0.85);
}
.hud__height-fill { position: absolute; inset: 0; border-radius: 999px; overflow: hidden; background: linear-gradient(0deg, var(--c-red) calc(var(--p, 0) * 100%), transparent 0); }
.hud__height-best { position: absolute; left: -7px; right: -7px; bottom: calc(var(--p, 0) * 100%); height: 4px; margin-bottom: -2px; background: var(--c-gold); border: 1px solid var(--c-ink); }
.hud__height-me { position: absolute; left: 50%; bottom: calc(var(--p, 0) * 100%); width: 20px; height: 20px; margin: 0 0 -10px -10px; border: 3px solid var(--c-ink); border-radius: 50%; background: radial-gradient(circle at 50% 100%, #fff 45%, var(--c-red) 47%); }
.hud__height::before { content: ""; position: absolute; top: -15px; left: -4px; width: 16px; height: 12px; border: 3px solid var(--c-ink); border-radius: 3px; background: var(--c-red); border-top: 5px solid #fff; outline: 2px solid var(--c-ink); outline-offset: -1px; }
.hud__height-num { position: absolute; right: -2px; bottom: -32px; padding: 0 7px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-size: 13px; white-space: nowrap; }
.ring {
  position: absolute; right: 10px; bottom: calc(14px + var(--safe-bottom)); width: 48px; height: 48px; border: 3px solid var(--c-ink); border-radius: 50%;
  background: radial-gradient(circle, var(--c-paper) 52%, transparent 54%), conic-gradient(var(--c-ok) calc(var(--k, 1) * 1turn), #54475a 0);
}
.ring.is-over { background: radial-gradient(circle, var(--c-paper) 52%, transparent 54%), var(--c-bad); animation: throb 0.2s infinite alternate; }
.play__hint {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 3; margin: 0; padding: 8px 20px;
  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; transform: translateX(-50%); pointer-events: none; transition: opacity 0.3s;
  animation: hint 1s ease-in-out infinite alternate;
}
@keyframes hint { to { transform: translate(-50%, -6px); } }
.play__hint.is-hidden { opacity: 0; }
.play__toast {
  position: absolute; left: 50%; top: 24%; z-index: 3; margin: 0; padding: 4px 18px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold); font-size: 17px; font-weight: 900; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translate(-50%, 8px) scale(0.8); transition: opacity 0.15s, transform 0.25s var(--ease-pop);
}
.play__toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 結果 ---------- */
.screen--result { align-items: center; justify-content: safe center; gap: 10px; text-align: center; background: linear-gradient(180deg, rgba(11, 20, 56, 0.25), rgba(11, 20, 56, 0.82) 45%); z-index: 10; }
.result__ribbon {
  margin: 0; padding: 4px 24px 6px; border: 3px solid var(--c-ink); border-radius: 14px; background: var(--c-red); color: #fff; box-shadow: 0 5px 0 var(--c-ink);
  font-size: clamp(20px, 6vmin, 28px); font-weight: 900; transform: rotate(-2deg);
}
.is-fail .result__ribbon { background: #4a6bd0; }
.is-active .result__ribbon { animation: ribbon 0.5s var(--ease-pop) both; }
@keyframes ribbon { from { transform: rotate(6deg) scale(0.4); opacity: 0; } }
.result__stars { display: flex; gap: 6px; }
.result__stars .star { width: 40px; height: 40px; }
.result__stars .star:nth-child(2) { margin-top: -6px; width: 46px; height: 46px; }
.is-active .result__stars .star.is-on { animation: star-in 0.5s var(--ease-pop) both; animation-delay: calc(0.3s + var(--i) * 0.2s); }
@keyframes star-in { from { transform: scale(0) rotate(-120deg); } }
.is-fail .result__stars { display: none; }
.result__reach { position: relative; width: min(100%, 330px); height: 28px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); overflow: hidden; }
.result__reach i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%); background: var(--c-gold); border-right: 3px solid var(--c-ink); }
.result__reach .num { position: relative; font-size: 14px; line-height: 22px; }
.snap {
  position: relative; margin: 4px 0 6px; padding: 8px 8px 6px; width: min(62vw, 34vh, 260px); min-width: 170px;
  border: 3px solid var(--c-ink); border-radius: 8px; background: var(--c-paper); box-shadow: 0 6px 0 var(--c-ink); transform: rotate(2.5deg);
}
.is-active .snap { animation: snap-in 0.45s var(--ease-pop) 0.15s both; }
@keyframes snap-in { from { transform: rotate(-14deg) translateY(40px) scale(0.7); opacity: 0; } }
.snap__pic { display: block; width: 100%; aspect-ratio: 1; border: 3px solid var(--c-ink); border-radius: 4px; background: var(--c-night); }
.snap__cap { display: flex; flex-direction: column; margin-top: 4px; line-height: 1.3; }
.snap__cap b { font-size: 14px; }
.snap__reason { color: var(--c-red); font-size: 13px; font-weight: 800; }
.snap__stamp {
  position: absolute; right: -18px; top: -10px; padding: 2px 10px; border: 3px solid var(--c-red-deep); border-radius: 8px; background: rgba(255, 253, 247, 0.94);
  color: var(--c-red-deep); font-size: 13px; font-weight: 900; transform: rotate(8deg);
}
.snap__stamp .num { font-size: 20px; }
.result__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 0; color: var(--c-paper); font-size: 14px; font-weight: 700; }
.result__stats b { font-size: 17px; }
.result__new { padding: 0 10px; border-radius: 999px; background: var(--c-gold); color: var(--c-ink); font-weight: 900; }
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; width: min(100%, 340px); padding-bottom: 6px; }
.result__actions .btn { padding-inline: 12px; font-size: 18px; min-height: 52px; }
.result__actions .btn--block, .result__actions .btn--wide { grid-column: 1 / -1; }
.result__actions .btn--small { min-height: 44px; font-size: 15px; }

/* ---------- 一覧に戻る・ミュート ---------- */
.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 > .title__mute { position: absolute !important; top: calc(10px + var(--safe-top)); right: calc(10px + var(--safe-right)); }
.screen.screen--title { justify-content: flex-start; padding-top: calc(60px + var(--safe-top)); }
.title__spacer { flex: 1; min-height: 0; }
.screen--courses > * { width: min(100%, 760px); margin-inline: auto; }

.title__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.title__actions .btn--block { grid-column: 1 / -1; }
.title__actions .btn--small { min-height: 44px; padding: 6px 8px; font-size: 14px; white-space: nowrap; }
@media (min-width: 700px) and (orientation: landscape) and (min-height: 561px) {
  .screen.screen--title { align-items: flex-start; justify-content: center; padding-left: 9vw; }
  .title__spacer { display: none; }
  .screen--title .title__actions { margin-top: 40px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .screen.screen--title { padding-top: calc(20px + var(--safe-top)); gap: 10px; }
  .screen--title .logo__main { font-size: 34px; margin-top: 4px; }
  .screen--title .logo { margin-top: 6px; }
  .screen--title .btn--block { min-height: 50px; }
}
.hud__mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hud__line { display: flex; justify-content: space-between; align-items: center; height: 15px; font-size: 11px; font-weight: 900; line-height: 1; white-space: nowrap; }
.hud__stamina { padding: 0 10px 0 6px; gap: 7px; }
.hud__stamina .hud__bar { flex: none; width: 100%; height: 16px; border-width: 2.5px; }
.hud__stamina .hud__face { --lv: var(--c-ok); width: 30px; height: 30px; background: radial-gradient(circle at 32% 40%, var(--c-ink) 0 2px, transparent 2.6px), radial-gradient(circle at 68% 40%, var(--c-ink) 0 2px, transparent 2.6px), var(--lv); }
.hud__stamina .hud__face.is-soso { --lv: #d7e07a; }
.hud__stamina .hud__face.is-warn { --lv: var(--c-warn); }
.hud__stamina .hud__face.is-bad { --lv: var(--c-bad); }
.hud__stamina .hud__face::after { left: 9px; top: 14px; border: 0; height: 5px; border-bottom: 2.5px solid var(--c-ink); border-radius: 0 0 8px 8px; }
.hud__stamina .hud__face.is-soso::after, .hud__stamina .hud__face.is-warn::after { top: 17px; height: 1px; border-radius: 0; }
.hud__stamina .hud__face.is-bad::after { top: 17px; border-bottom: 0; border-top: 2.5px solid var(--c-ink); border-radius: 8px 8px 0 0; }
.hud__line .hud__rhythm { position: static; padding: 1px 6px; border-width: 1.5px; font-size: 10px; line-height: 1; transform: scale(0); }
.hud__line .hud__rhythm.is-on { transform: none; }
.courses__head { position: sticky; top: -16px; z-index: 5; padding: 10px 0; margin-top: -10px; background: linear-gradient(180deg, #34488a 80%, rgba(52, 72, 138, 0)); }
.screen.screen--courses > .courses__head { position: sticky; z-index: 5; }
.result__advice { color: #ffe28a; font-weight: 900; }
.result__actions { grid-template-columns: repeat(3, 1fr); }
.result__actions .btn--small { padding-inline: 4px; font-size: 14px; white-space: nowrap; }
@media (orientation: portrait) {
  .screen--result { justify-content: flex-start; gap: 9px; background: linear-gradient(180deg, rgba(11, 20, 56, 0.7), rgba(11, 20, 56, 0.45) 62%, rgba(11, 20, 56, 0) 78%); }
  .snap { width: min(50vw, 26vh, 250px); min-width: 140px; }
}
@media (min-height: 561px) and (orientation: landscape) {
  .screen--result { justify-content: flex-start; gap: 9px; background: linear-gradient(180deg, rgba(11, 20, 56, 0.7), rgba(11, 20, 56, 0.45) 62%, rgba(11, 20, 56, 0) 78%); }
  .snap { width: min(50vw, 24vh, 220px); }
}
@media (max-height: 700px) and (orientation: portrait) { .snap { width: 22vh; min-width: 120px; } .snap__cap b { font-size: 12px; } }
/* ---------- 低い画面・横向き ---------- */
@media (max-height: 700px) and (orientation: portrait) {
  .snap { width: min(50vw, 27vh); }
  .screen--result { gap: 6px; padding-top: 12px; }
  .result__actions { gap: 9px 10px; }
  .result__actions .btn { min-height: 46px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .screen.screen--title { padding: 12px 24px; align-items: flex-start; justify-content: center; }
  .screen--title .logo { margin-top: 30px; }
  .logo__main { font-size: 34px; }
  .title__spacer { display: none; }
  .title__actions { width: 250px; }
  .screen--title .btn { min-height: 46px; }
  .courses__list { grid-template-columns: repeat(4, 1fr); }
  .card { width: min(100%, 560px); padding: 14px; max-height: 94dvh; overflow-y: auto; }
  .rules { grid-template-columns: repeat(3, 1fr); }
  .rules__item { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .rules__pic { width: 92px; height: 92px; }
  .modal--pause .card { width: 340px; }
  .hud { width: 100%; }
  .hud__stamina { right: auto; width: 240px; }
  .hud__height { height: 44vh; top: 84px; right: calc(20px + var(--safe-right)); }
  .screen--result { display: grid; grid-template-columns: auto 340px; grid-auto-rows: min-content; align-content: safe center; justify-content: center; justify-items: center; gap: 4px 36px; padding-block: 10px; }
  .snap { grid-column: 1; grid-row: 1 / span 6; width: min(54vh, 240px); align-self: center; }
  .screen--result > :not(.snap):not(.screen__bg) { grid-column: 2; }
  .result__actions .btn { min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .screen--result { grid-template-columns: 124px 240px; justify-content: end; gap: 8px 14px; padding-right: calc(24px + var(--safe-right)); background: linear-gradient(90deg, rgba(11, 20, 56, 0) 42%, rgba(11, 20, 56, 0.72) 58%); }
  .screen--result > .result__ribbon, .screen--result > .result__actions { grid-column: 1 / -1 !important; }
  .screen--result > .snap { grid-column: 1; grid-row: 2 / span 2; width: 124px; min-width: 0; margin: 0; padding: 5px; }
  .screen--result > .result__stars, .screen--result > .result__reach { grid-row: 2; align-self: end; max-width: 100%; }
  .screen--result > .result__stats { grid-row: 3; align-self: start; }
  .snap__cap b { font-size: 11px; } .snap__reason { font-size: 11px; }
  .snap__stamp { right: -10px; font-size: 10px; padding: 1px 6px; } .snap__stamp .num { font-size: 14px; }
  .result__actions { width: 100%; }
}
