/* サンタのツリージャンプ 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;

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

/* PC でも中央に縦長のプレイ領域 */
.app {
  position: relative;
  width: var(--play-w);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--c-night-soft), var(--c-night) 55%, var(--c-night-deep));
}
@media (min-width: 520px) {
  .app { border-left: 4px solid var(--c-ink); border-right: 4px solid var(--c-ink); }
}

/* ---------- 画面切替 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
}
.screen.is-active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s;
}
.screen__bg { position: absolute; inset: 0; width: 100%; height: 100%; 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, .tree-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--trees { gap: 14px; }
.trees__head { display: flex; align-items: center; gap: 10px; }
.trees__title { flex: 1; margin: 0; color: var(--c-paper); font-size: 18px; font-weight: 900; white-space: nowrap; }
.trees__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);
}
.trees__total .star { background: var(--c-gold); }
.trees__list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; padding: 0 0 12px; list-style: none; }
.trees__item--wide { grid-column: 1 / -1; }
.tree-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;
}
.tree-card:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-ink); }
.tree-card__num {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border: 3px solid var(--c-ink); border-radius: 50% 50% 14px 14px;
  background: var(--c-fir); color: #fff;
  font-size: 22px;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.2);
}
.tree-card.is-cleared .tree-card__num { background: var(--c-gold); color: var(--c-ink); }
.tree-card__name { font-size: 14px; font-weight: 900; line-height: 1.3; text-align: center; }
.tree-card__meta { color: var(--c-ink-sub); font-size: 11px; }
.tree-card__stars { display: flex; gap: 2px; }
.tree-card__stars .star:not(.is-on) { background: var(--c-line); }
.tree-card.is-locked { background: #c9cde0; border-color: var(--c-lock); box-shadow: 0 5px 0 var(--c-lock); cursor: not-allowed; }
.tree-card.is-locked:active { transform: none; box-shadow: 0 5px 0 var(--c-lock); }
.tree-card.is-locked .tree-card__num { background: var(--c-lock); color: #c9cde0; border-color: var(--c-lock); }
.tree-card.is-locked .tree-card__name, .tree-card.is-locked .tree-card__meta { color: #6f7593; }
.tree-card.is-locked .tree-card__stars { visibility: hidden; }
/* 錠前（CSS だけで描く） */
.tree-card.is-locked::before {
  content: "";
  position: absolute; top: 10px; right: 12px;
  width: 12px; height: 9px;
  border: 3px solid #6f7593; border-bottom: 0; border-radius: 8px 8px 0 0;
}
.tree-card.is-locked::after {
  content: "";
  position: absolute; top: 18px; right: 9px;
  width: 18px; height: 13px;
  border-radius: 4px; background: #6f7593;
}
.tree-card--endless {
  flex-direction: row; justify-content: center; gap: 12px;
  background: linear-gradient(180deg, #2a3a86, var(--c-night));
  color: var(--c-paper);
}
.tree-card--endless .tree-card__num { background: var(--c-red); border-radius: 50%; font-size: 26px; }
.tree-card--endless .tree-card__name { color: var(--c-paper); font-size: 17px; }
.tree-card--endless .tree-card__meta { color: #c8d0ef; }
.tree-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; } }

/* ---------- プレイ ---------- */
.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; }
.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; left: 0; right: 0; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  padding: calc(10px + 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;
  min-height: 40px; padding: 4px 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;
}
.hud__height { justify-self: start; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 14px; border-radius: 16px; line-height: 1.1; }
.hud__height-label { color: var(--c-ink-sub); font-size: 10px; }
.hud__height-value { font-size: 22px; }
.hud__height-value small { color: var(--c-ink-sub); font-size: 12px; }
/* 段数バー: style="--p:0.4" */
.hud__progress {
  position: relative; width: 72px; height: 8px; margin-top: 3px;
  border: 2px solid var(--c-ink); border-radius: 99px; background: var(--c-line); overflow: hidden;
}
.hud__progress::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%);
  background: var(--c-fir); transition: width var(--dur-mid) ease;
}
.hud__left { justify-self: start; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hud__left .hud__combo { font-size: 13px; padding: 1px 10px; margin-left: 8px; }
.hud__center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud__hearts { gap: 2px; padding: 4px 10px; }
.hud__heart {
  width: 24px; height: 24px;
  background: var(--c-heart);
  clip-path: path("M12 22 C2 15 0 9 3 5 C6 1 11 3 12 7 C13 3 18 1 21 5 C24 9 22 15 12 22 Z");
}
.hud__heart.is-lost { background: rgba(59, 47, 47, 0.2); }
.hud__heart.is-losing { animation: heart-lose 0.5s ease-in forwards; }
@keyframes heart-lose {
  0% { transform: scale(1); }
  30% { transform: scale(1.35) rotate(-8deg); }
  100% { transform: scale(0.6) translateY(8px); background: rgba(59, 47, 47, 0.2); }
}
.hud__combo {
  padding: 2px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold);
  font-size: 15px; font-weight: 900;
  box-shadow: 0 3px 0 var(--c-ink);
  opacity: 0; transform: scale(0.6);
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-pop);
}
.hud__combo.is-on { opacity: 1; transform: none; }
.hud__combo.is-bump { animation: bump 0.3s var(--ease-pop); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3) rotate(-4deg); } 100% { transform: scale(1); } }
.hud__pause { justify-self: end; }
.hud__score { min-height: 0; padding: 0 10px; font-size: 14px; }
.screen--result.is-endless .result__stars, .screen--result.is-fail .result__stars { display: none; }
.play__hint {
  position: absolute; left: 50%; bottom: calc(28px + var(--safe-bottom)); z-index: 2;
  transform: translateX(-50%);
  padding: 8px 16px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: rgba(255, 253, 247, 0.95);
  font-size: 14px; font-weight: 900; white-space: nowrap;
  animation: blink-soft 1.6s ease-in-out infinite;
  pointer-events: none;
}
.play__hint.is-hidden { display: none; }
.play__hint { white-space: normal; width: max-content; max-width: calc(100% - 32px); text-align: center; }
@keyframes blink-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.play__toast {
  position: absolute; left: 50%; top: 18%; z-index: 3;
  width: max-content; max-width: 70%; white-space: normal; text-align: center; font-size: 18px;
  padding: 8px 18px;
  border: 3px solid var(--c-ink); border-radius: 16px;
  background: var(--c-paper);
  font-weight: 900;
  transform: translate(-50%, -50%);
  opacity: 0; pointer-events: none;
}
.play__toast.is-show { animation: toast 1.2s var(--ease-pop) forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* ---------- 結果 ---------- */
.screen--result { align-items: center; justify-content: flex-start; gap: 14px; text-align: center; background: rgba(11, 20, 56, 0.94); z-index: 5; }
/* はみ出すときは上から並べてスクロールできる中央寄せ */
.screen--result > :first-child { margin-top: auto; }
.screen--result > :last-child { margin-bottom: auto; }

.result__ribbon {
  margin: 0; padding: 6px 26px;
  border: 3px solid var(--c-ink); border-radius: 12px;
  background: var(--c-red); color: #fff;
  font-size: clamp(24px, 8vmin, 34px); font-weight: 900;
  box-shadow: 0 5px 0 var(--c-ink);
  transform: rotate(-2deg);
}
.screen--result.is-clear.is-active .result__ribbon { animation: pop-in 0.5s var(--ease-pop) both; }
.screen--result.is-fail .result__ribbon { background: var(--c-night-soft); transform: rotate(2deg); }
.result__scene { width: min(40vw, 150px); height: auto; aspect-ratio: 1; transition: opacity 0.6s ease; }
.result__scene.is-faded { opacity: 0.25; }
.result__stars { margin-top: 16px; }
.result__sub { margin: -6px 0 0; color: #c8d0ef; font-size: 14px; font-weight: 800; }
.result__stars { display: flex; align-items: flex-end; gap: 6px; }
.result__stars .star { width: 54px; height: 54px; background: rgba(255, 255, 255, 0.18); }
.result__stars .star:nth-child(2) { width: 68px; height: 68px; }
.result__stars .star.is-on {
  background: var(--c-gold);
  filter: drop-shadow(0 0 10px rgba(255, 220, 100, 0.7));
  animation: star-pop 0.5s var(--ease-pop) both;
  animation-delay: calc(0.25s + var(--i, 0) * 0.25s);
}
@keyframes star-pop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } 100% { transform: none; } }
.result__conds { display: grid; gap: 6px; width: min(86vw, 320px); margin: 0; padding: 0; list-style: none; }
.result__cond {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 3px solid var(--c-ink); border-radius: 12px;
  background: var(--c-paper);
  font-size: 13px; font-weight: 800; text-align: left;
}
.result__cond .star { flex: none; width: 16px; height: 16px; background: var(--c-line); }
.result__cond.is-ok .star { background: var(--c-gold); }
.result__cond-value { margin-left: auto; }
.result__score { margin: 0; color: var(--c-paper); font-size: 14px; font-weight: 800; }
.result__score .num { color: var(--c-gold); font-size: 30px; }
.result__new {
  display: inline-block; margin-left: 6px; padding: 0 8px;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-red); color: #fff; font-size: 12px; vertical-align: middle;
  animation: bump 0.8s ease-in-out infinite;
}
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(86vw, 320px); }
.result__actions .btn--block { grid-column: 1 / -1; }
.result__actions .btn { white-space: nowrap; padding-left: 8px; padding-right: 8px; }

/* ---------- 横向き ---------- */
.rotate {
  position: fixed; inset: 0; z-index: 100;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--c-night-deep); color: var(--c-paper);
  font-size: 20px; font-weight: 900; text-align: center;
}
.rotate__phone {
  width: 46px; height: 78px;
  border: 4px solid var(--c-paper); border-radius: 10px;
  animation: turn 1.8s ease-in-out infinite;
}
@keyframes turn { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }
.rotate__sub { margin: 0; color: #c8d0ef; font-size: 13px; font-weight: 700; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate { display: flex; }
}

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .logo__char, .play__hint, .result__new, .rotate__phone, .play__canvas.is-shake { animation: none !important; }
  .rotate__phone { transform: none; }
  .screen { transform: none; }
}

/* ---------- ゲーム一覧へ戻る（himaratsu.com/games/ 配下のときだけ表示） ---------- */
.screen.screen--title > a.back-to-games {
  position: absolute; top: calc(10px + var(--safe-top)); left: calc(10px + var(--safe-left)); z-index: 6;
  display: inline-flex; align-items: center; padding: 6px 12px 7px;
  font: 700 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.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }

/* ---------- 背の低い画面の結果（全ボタンを画面内に） ---------- */
@media (max-height: 720px) {
  .screen--result { gap: 8px; }
  .result__scene { width: 96px; }
  .result__stars { margin-top: 4px; }
  .result__stars .star { width: 40px; height: 40px; }
  .result__stars .star:nth-child(2) { width: 50px; height: 50px; }
  .result__ribbon { font-size: 24px; }
  .result__actions .btn { min-height: 42px; padding-top: 6px; padding-bottom: 6px; font-size: 17px; }
  .result__actions { gap: 10px; }
  .result__cond { padding: 3px 10px; }
  .result__conds { gap: 4px; }
  .result__score .num { font-size: 24px; }
}
@media (max-height: 660px) {
  .result__scene { width: 64px; }
  .result__ribbon { font-size: 20px; padding: 4px 18px; }
}
@media (max-height: 480px) {
  .screen--result { gap: 5px; padding-top: 8px; padding-bottom: 8px; }
  .result__scene, .result__sub { display: none; }
  .result__stars .star { width: 28px; height: 28px; }
  .result__stars .star:nth-child(2) { width: 34px; height: 34px; }
  .result__conds { gap: 3px; }
  .result__cond { font-size: 11px; padding: 1px 10px; }
  .result__actions { grid-template-columns: repeat(4, auto); width: auto; gap: 8px; }
  .result__actions .btn, .result__actions .btn--block { grid-column: auto; min-height: 38px; font-size: 15px; padding: 4px 14px; }
}

/* 背の低い画面のタイトル: はみ出すときは上から並べる */
.screen--title { justify-content: flex-start; }
.screen--title > .logo { margin-top: auto; }
.screen--title > .title__best { margin-bottom: auto; }
@media (max-height: 700px) {
  .screen--title { gap: 10px; }
  .title__scene { width: min(56vw, 200px); }
}
.result__ribbon { white-space: nowrap; font-size: clamp(20px, 7vmin, 30px); }
