/* サンタの道を作れ style.css — 構造とクラス名は docs/design.md を参照 */

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

  --c-red: #e8413b;
  --c-red-deep: #b8302c;
  --c-green: #3fa66a;
  --c-green-deep: #2b7a4b;
  --c-gold: #ffc83d;
  --c-gold-deep: #d99a00;
  --c-night: #1b2960;
  --c-night-deep: #0b1438;
  --c-sky: #4fb3ee;
  --c-snow: #ffffff;
  --c-snow-shade: #d3e5f5;
  --c-wood: #dba468;
  --c-wood-deep: #a86e38;

  --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;
  --shadow-card: 0 4px 0 rgba(59, 47, 47, 0.12), 0 10px 24px rgba(59, 47, 47, 0.08);
  --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);

  --hud-h: 52px;
  --tray-h: 92px;

  --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: var(--c-night-deep);
  -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;
}

button {
  font: inherit;
  color: inherit;
}

.num {
  font-family: var(--font-num);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--c-bg);
}

/* ---------- 画面切替 ---------- */

.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__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;
  user-select: none;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transform: translateY(0);
  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,
.stage-card:focus-visible,
.tray-item:focus-visible {
  outline: 4px solid var(--c-gold);
  outline-offset: 4px;
}

.btn:disabled {
  filter: grayscale(0.8) opacity(0.6);
  cursor: not-allowed;
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink);
}

.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 {
  position: relative;
  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, background var(--dur-fast);
}

.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn.is-on { background: var(--c-gold); }

.icon-btn svg { width: 22px; height: 22px; fill: var(--c-ink); }

/* ---------- 共通カード ---------- */

.card {
  background: var(--c-paper);
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

/* ---------- ロゴ ---------- */

.logo {
  margin: 0;
  text-align: center;
  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-green);
  color: #fff;
  font-size: clamp(16px, 3.6vmin, 24px);
  transform: rotate(-3deg);
}

.logo__main {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 6px;
  font-size: clamp(40px, 11vmin, 84px);
}

.logo__char {
  display: inline-block;
  color: var(--c-snow);
  text-shadow:
    0 4px 0 var(--c-ink),
    3px 0 0 var(--c-ink), -3px 0 0 var(--c-ink),
    0 3px 0 var(--c-ink), 0 -3px 0 var(--c-ink),
    3px 3px 0 var(--c-ink), -3px 3px 0 var(--c-ink),
    3px -3px 0 var(--c-ink), -3px -3px 0 var(--c-ink);
  animation: logo-bob 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.12s);
}

.logo__char--red { color: var(--c-red); }
.logo__char--gold { color: var(--c-gold); }

/* ---------- タイトル ---------- */

.screen--title {
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(#4fb3ee, #dff4ff);
  text-align: center;
}

.title__santa {
  width: clamp(110px, 26vmin, 200px);
  aspect-ratio: 1;
  animation: logo-bob 1.6s ease-in-out infinite;
}

.title__actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(320px, 100%);
}

.title__note {
  margin: 0;
  font-size: 13px;
  color: var(--c-ink-sub);
}

/* ---------- ステージ選択 ---------- */

.screen--stages {
  gap: 16px;
  background: linear-gradient(#6a6bb8, #f08f6c 70%, #ffd08a);
}

.stages__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stages__title {
  margin: 0;
  flex: 1;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 var(--c-ink), 2px 0 0 var(--c-ink), -2px 0 0 var(--c-ink), 0 -2px 0 var(--c-ink);
}

.stages__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);
  font-weight: 900;
}

.stages__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
}

.stage-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 14px 10px 12px;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--c-line), 0 6px 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  animation: pop-in var(--dur-mid) var(--ease-pop) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

.stage-card:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--c-line), 0 0 0 3px var(--c-ink);
}

.stage-card__num {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--c-ink);
  border-radius: 50%;
  background: var(--c-red);
  color: #fff;
  font-size: 22px;
}

.stage-card__name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.stage-card__stars {
  display: flex;
  gap: 2px;
}

.star {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: #e6dccb;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 0 var(--c-ink));
}

.star.is-on { background: var(--c-gold); }

.star--outline {
  position: relative;
  background: var(--c-ink);
}

.star--outline::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: #e6dccb;
  clip-path: inherit;
}

.star--outline.is-on::before { background: var(--c-gold); }

.stage-card.is-cleared { background: #fff6d6; }

.stage-card.is-cleared::after {
  content: "クリア";
  position: absolute;
  top: -10px;
  right: -8px;
  padding: 1px 8px;
  border: 2px solid var(--c-ink);
  border-radius: 999px;
  background: var(--c-green);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  transform: rotate(8deg);
}

.stage-card.is-locked {
  cursor: not-allowed;
  background: #d9d3c7;
  color: var(--c-ink-sub);
}

.stage-card.is-locked .stage-card__num {
  background: #a59c8e;
  color: transparent;
  position: relative;
}

.stage-card.is-locked .stage-card__num::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  width: 14px;
  height: 12px;
  border: 3px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  transform: translateX(-50%);
}

.stage-card.is-locked .stage-card__num::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 19px;
  width: 20px;
  height: 14px;
  border-radius: 3px;
  background: #fff;
  transform: translateX(-50%);
}

.stage-card.is-locked .star { opacity: 0.4; }
.stage-card.is-shake { animation: shake 0.4s ease; }

/* ---------- プレイ画面 ---------- */

.screen--play {
  padding: 0;
  overflow: hidden;
  background: var(--c-night-deep);
}

.play__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.play__canvas.is-placing { cursor: copy; }

.hud {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: calc(8px + var(--safe-left));
  right: calc(8px + var(--safe-right));
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--hud-h);
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.hud__stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 46%;
  padding: 4px 14px 4px 4px;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
}

.hud__stage-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-red);
  color: #fff;
  font-size: 17px;
}

.hud__stage-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 900;
}

.hud__gifts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
  font-size: 18px;
}

.hud__gift-icon {
  position: relative;
  width: 24px;
  height: 22px;
  border: 2.5px solid var(--c-ink);
  border-radius: 4px;
  background: linear-gradient(90deg, transparent 40%, var(--c-gold) 40% 60%, transparent 60%), var(--c-red);
}

.hud__gift-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -9px;
  width: 14px;
  height: 8px;
  border: 2.5px solid var(--c-ink);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--c-gold);
  transform: translateX(-50%);
}

.hud__gifts.is-bump { animation: score-bounce 0.5s ease; }

.hud__spacer { flex: 1; }

.hud__buttons {
  display: flex;
  gap: 8px;
}

.hud__fast-label {
  font-size: 13px;
  letter-spacing: -0.04em;
}

/* 時間の進み（昼→夜） */
.hud__clock {
  position: absolute;
  top: calc(var(--hud-h) + 12px);
  left: 50%;
  width: min(240px, 40vw);
  height: 12px;
  border: 2.5px solid var(--c-ink);
  border-radius: 999px;
  background: linear-gradient(90deg, #4fb3ee, #f08f6c 50%, #1b2960);
  transform: translateX(-50%);
  pointer-events: none;
}

.hud__clock-pin {
  position: absolute;
  top: 50%;
  left: calc(var(--p, 0) * 100%);
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--c-ink);
  border-radius: 50%;
  background: var(--c-paper);
  transform: translate(-50%, -50%);
}

/* 吹き出しヒント（ステージ開始時など） */
.hint {
  position: absolute;
  top: calc(var(--hud-h) + 34px);
  left: 50%;
  max-width: min(480px, 86vw);
  padding: 8px 16px;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  animation: pop-in var(--dur-mid) var(--ease-pop) both;
  pointer-events: none;
}

.hint.is-hiding { animation: fade-out var(--dur-mid) ease both; }

/* ---------- アイテムトレイ ---------- */

.tray {
  position: absolute;
  left: 50%;
  bottom: calc(8px + var(--safe-bottom));
  display: flex;
  gap: 8px;
  max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right));
  padding: 8px 10px;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-l);
  background:
    radial-gradient(circle at 12px 8px, rgba(255, 255, 255, 0.9) 3px, transparent 3.5px) 0 0 / 26px 14px repeat-x,
    var(--c-paper);
  box-shadow: 0 5px 0 var(--c-ink);
  transform: translateX(-50%);
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}

.tray::-webkit-scrollbar { display: none; }

.tray-item {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 3px solid var(--c-ink);
  border-radius: var(--radius-m);
  background: #e9f5ff;
  cursor: grab;
  box-shadow: 0 4px 0 #b9d6ea, 0 4px 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background var(--dur-fast);
  touch-action: none;
}

.tray-item:active { transform: translateY(4px); box-shadow: 0 0 0 #b9d6ea, 0 0 0 3px var(--c-ink); }

.tray-item__icon {
  width: 52px;
  height: 52px;
  pointer-events: none;
  -webkit-user-drag: none;
}

.tray-item__name {
  position: absolute;
  left: 50%;
  bottom: -2px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0.75;
}

.tray-item__count {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--c-red);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.tray-item__count.is-bump { animation: count-bounce 0.3s ease; }

.tray-item.is-selected {
  background: #fff3c4;
  transform: translateY(-6px);
  box-shadow: 0 10px 0 var(--c-gold-deep), 0 10px 0 3px var(--c-ink);
  outline: 4px solid var(--c-gold);
  outline-offset: 2px;
}

.tray-item.is-selected .tray-item__icon { animation: logo-bob 0.9s ease-in-out infinite; }

.tray-item.is-dragging {
  background: #e3f5df;
  opacity: 0.55;
}

.tray-item.is-empty {
  cursor: not-allowed;
  background: #e2ddd3;
  box-shadow: 0 4px 0 #c9c1b2, 0 4px 0 3px var(--c-ink);
}

.tray-item.is-empty .tray-item__icon { filter: grayscale(1) opacity(0.45); }
.tray-item.is-empty .tray-item__count { background: #a59c8e; }
.tray-item.is-denied { animation: shake 0.4s ease; }

/* 指に付いてくるアイテム（ドラッグ中） */
.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: 64px;
  height: 64px;
  pointer-events: none;
  transform: translate(-50%, -80%) scale(1.15) rotate(-6deg);
  filter: drop-shadow(0 6px 0 rgba(59, 47, 47, 0.25));
}

.drag-ghost img { width: 100%; height: 100%; }

/* ---------- オーバーレイ（一時停止・クリア・失敗） ---------- */

.overlay {
  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(11, 20, 56, 0.55);
  animation: fade-in var(--dur-mid) ease both;
}

.overlay[hidden] { display: none; }

.sheet {
  position: relative;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 20px;
  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;
  animation: sheet-up var(--dur-mid) var(--ease-pop) both;
}

.sheet__title {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.2;
}

.sheet__lead {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--c-ink-sub);
}

.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.sheet__actions .btn { flex: 1 1 140px; }

/* クリア */
.sheet--clear {
  background:
    radial-gradient(circle at 20% 0, rgba(255, 200, 61, 0.25), transparent 60%),
    var(--c-paper);
}

.sheet--clear .sheet__title { color: var(--c-red); }

.result__stars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  margin: 6px 0 12px;
}

.result-star {
  position: relative;
  width: 64px;
  height: 64px;
  background: var(--c-ink);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.result-star::before {
  content: "";
  position: absolute;
  inset: 5px;
  background: #e6dccb;
  clip-path: inherit;
}

.result-star:nth-child(2) { width: 80px; height: 80px; }

.result-star.is-on::before { background: var(--c-gold); }

.result-star.is-on {
  animation: star-pop 0.55s var(--ease-pop) both;
  animation-delay: calc(0.35s + var(--i, 0) * 0.35s);
}

.result__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.result__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 2px solid var(--c-line);
  border-radius: var(--radius-s);
  font-size: 14px;
  font-weight: 700;
}

.result__row .star { flex: none; width: 18px; height: 18px; }
.result__row .num { margin-left: auto; font-size: 16px; }
.result__row.is-on { border-color: var(--c-gold); background: #fff8dc; }

.result__new {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--c-red);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  animation: stamp 0.4s var(--ease-pop) both;
}

/* 失敗 */
.sheet--fail .sheet__title { color: var(--c-night); }

.sheet--fail {
  animation: sheet-up var(--dur-mid) var(--ease-pop) both, shake 0.4s ease 0.35s;
}

.result__reason {
  display: inline-block;
  margin: 4px 0 6px;
  padding: 6px 14px;
  border: 2px dashed var(--c-ink-sub);
  border-radius: var(--radius-s);
  font-size: 15px;
  font-weight: 800;
}

.result__tip {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--c-ink-sub);
}

.sheet__santa {
  display: block;
  width: 120px;
  height: 120px;
  margin: -70px auto 0;
}

/* 一時停止 */
.sheet--pause .sheet__actions { flex-direction: column; }
.sheet--pause .sheet__actions .btn { flex: none; }

/* ---------- 横向き推奨（縦でも遊べる。閉じられる） ---------- */

.rotate-tip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--tray-h) + 22px + var(--safe-bottom));
  z-index: 30;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 6px 6px 6px 12px;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
  font-size: 13px;
  font-weight: 800;
  transform: translateX(-50%);
  animation: pop-in var(--dur-mid) var(--ease-pop) both;
}

.rotate-tip__icon {
  flex: none;
  width: 16px;
  height: 24px;
  border: 2.5px solid var(--c-ink);
  border-radius: 4px;
  animation: phone-turn 2.4s ease-in-out infinite;
}

.rotate-tip__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--c-ink);
  border-radius: 50%;
  background: var(--c-bg);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

@media (orientation: portrait) {
  .rotate-tip:not(.is-dismissed) { display: flex; }

  :root { --tray-h: 80px; }

  .tray-item { width: 58px; height: 58px; }
  .tray-item__icon { width: 44px; height: 44px; }
  .hud__stage-name { font-size: 13px; }
  .hud__clock { top: calc(var(--hud-h) + 56px); }
}

@media (max-height: 420px) {
  :root { --hud-h: 44px; --tray-h: 72px; }

  .icon-btn { width: 38px; height: 38px; }
  .tray { padding: 6px 8px; }
  .tray-item { width: 54px; height: 54px; }
  .tray-item__icon { width: 42px; height: 42px; }
  .tray-item__name { display: none; }
  .hud__stage-num { width: 26px; height: 26px; font-size: 14px; }
  .sheet { padding: 14px 16px; }
  .sheet__title { font-size: 24px; }
  .result-star { width: 48px; height: 48px; }
  .result-star:nth-child(2) { width: 60px; height: 60px; }
  .sheet__santa { display: none; }
}

/* ---------- 汎用アニメ ---------- */

.fade-in { animation: fade-in var(--dur-mid) ease both; }
.fade-out { animation: fade-out var(--dur-mid) ease both; }
.shake { animation: shake 0.4s ease; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes pop-in {
  0% { opacity: 0; transform: translateX(var(--tx, 0)) scale(0.6); }
  60% { opacity: 1; transform: translateX(var(--tx, 0)) scale(1.06); }
  100% { opacity: 1; transform: translateX(var(--tx, 0)) scale(1); }
}

.rotate-tip,
.hint { --tx: -50%; }

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(60px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes count-bounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px) scale(1.15); }
  100% { transform: translateY(0); }
}

@keyframes score-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.25) rotate(-3deg); }
  55% { transform: scale(0.94) rotate(1deg); }
  100% { transform: scale(1); }
}

@keyframes star-pop {
  0% { transform: scale(0) rotate(-40deg); }
  70% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes stamp {
  0% { opacity: 0; transform: scale(2.2) rotate(-12deg); }
  70% { opacity: 1; transform: scale(0.94) rotate(-4deg); }
  100% { opacity: 1; transform: scale(1) rotate(-4deg); }
}

@keyframes logo-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

@keyframes shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -6px 0; }
  40% { translate: 6px 0; }
  60% { translate: -4px 0; }
  80% { translate: 4px 0; }
}

@keyframes phone-turn {
  0%, 30% { transform: rotate(0); }
  50%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0); }
}

/* ---------- reduced motion ---------- */

@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;
    scroll-behavior: auto !important;
  }

  .screen { transform: none; }
  .tray-item.is-selected { transform: none; }
}
