/* ミラーでビーム style.css — 構造とクラス名は docs/design.md
   シリーズ共通: ポップ・太い墨枠・押すと沈むボタン・丸ゴシック（外部フォントなし）＋明るい方眼紙と研究所 */

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

  --c-sky: #e6f6ff;          /* 画面背景（明るい水色の方眼紙） */
  --c-sky-line: #cde8f7;
  --c-lab: #24305e;          /* ロボの顔色・見出しの濃紺 */

  --c-cyan: #2fe0ff;         /* ビーム1・主アクセント */
  --c-cyan-deep: #1497b8;
  --c-cyan-light: #c8f6ff;
  --c-pink: #ff4fa3;         /* ビーム2・発射ボタン */
  --c-pink-deep: #c42a78;
  --c-pink-light: #ffd3e8;
  --c-lemon: #f5f03a;
  --c-gold: #ffc83d;         /* 星 */
  --c-gold-deep: #d99a00;
  --c-orange: #ff8a1f;       /* パワービーム・増幅器 */
  --c-orange-deep: #d4600a;
  --c-mint: #5ad6a8;         /* ゴール・クリア */
  --c-mint-deep: #2fa57a;
  --c-blue: #3fa9f5;         /* 固定の鏡 */
  --c-blue-deep: #1f74b8;
  --c-red: #ec3d3a;
  --c-gray: #a7a3ad;         /* ロック・未解放 */

  /* ワールド色（ステージ選択の見出し・タイル） */
  --w1: var(--c-cyan);
  --w2: var(--c-gold);
  --w3: #ffb48a;
  --w4: var(--c-orange);
  --w5: var(--c-pink);

  --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic",
    "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "SF Pro Rounded",
    ui-rounded, system-ui, sans-serif;

  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 28px;
  --btn-depth: 6px;

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

  --app-w: min(100vw, 480px);
  --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: #bfe4f7;
  overflow: hidden;
  position: fixed;
  inset: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
canvas { display: block; touch-action: none; }
.num { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }
[hidden]:not(.toast) { display: none !important; }

.app {
  position: relative;
  width: var(--app-w);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--c-sky);
  background-image:
    linear-gradient(var(--c-sky-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-sky-line) 1px, transparent 1px);
  background-size: 22px 22px;
  box-shadow: 0 0 0 3px 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;
}

/* ← ゲーム一覧（../rap-de-ikou と同じ） */
.screen--title > a.back-to-games { position: absolute !important; top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); z-index: 6; display: inline-flex; align-items: center; padding: 6px 12px 7px; font: 800 13px/1 var(--font-base); color: var(--c-ink); text-decoration: none; background: var(--c-paper); border: 3px solid var(--c-ink); border-radius: 999px; box-shadow: 0 3px 0 var(--c-ink); }
.screen--title > a.back-to-games[hidden] { display: none; }
.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }
.screen--title:has(> a.back-to-games:not([hidden])) { padding-top: calc(52px + var(--safe-top)); justify-content: safe center; }

/* ---------- ボタン ---------- */
.btn {
  --btn-bg: var(--c-pink);
  --btn-edge: var(--c-pink-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,.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-tile:focus-visible, .tray:focus-visible { outline: 4px solid var(--c-pink); outline-offset: 4px; }
.btn:disabled { filter: grayscale(0.8) opacity(0.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--cyan { --btn-bg: var(--c-cyan); --btn-edge: var(--c-cyan-deep); --btn-fg: var(--c-ink); }
.btn--gold { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); --btn-fg: var(--c-ink); }
.btn--mint { --btn-bg: var(--c-mint); --btn-edge: var(--c-mint-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: 48px; padding: 6px 14px; font-size: 15px; --btn-depth: 4px; }
.btn--small::after { top: 4px; height: 4px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; padding: 0;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-paper);
  font-size: 18px; font-weight: 900; line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn::before, .icon-btn::after { content: ""; position: absolute; }
.icon-btn--menu::before { width: 18px; height: 3px; border-radius: 2px; background: var(--c-ink); box-shadow: 0 -6px 0 var(--c-ink), 0 6px 0 var(--c-ink); }
.icon-btn--sound::before { width: 16px; height: 14px; left: 11px; top: 12px; background: var(--c-ink); clip-path: polygon(0 30%, 35% 30%, 75% 0, 75% 100%, 35% 70%, 0 70%); }
.icon-btn--sound.is-muted::after { width: 4px; height: 26px; left: 17px; top: 6px; border-radius: 2px; background: var(--c-red); transform: rotate(45deg); box-shadow: 0 0 0 2px var(--c-paper); }
.icon-btn--help::before { content: "?"; position: static; font: 900 18px/1 var(--font-num); }
.icon-btn--back::before { content: "←"; position: static; font: 900 18px/1 var(--font-base); }

/* ---------- 星 ---------- */
.star {
  display: inline-block; width: 18px; height: 18px; flex: none;
  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; }

/* ---------- タイトル ---------- */
.screen--title { align-items: center; justify-content: center; gap: 14px; text-align: center; }
.logo { margin: 0; font-weight: 900; line-height: 1.1; }
.logo__sub {
  display: inline-block; padding: 2px 14px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-lemon); color: var(--c-ink);
  font-size: clamp(13px, 3.8vmin, 17px);
  transform: rotate(-3deg);
}
.logo__main { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-size: clamp(40px, 12.5vmin, 64px); }
.logo__line { display: flex; justify-content: center; width: 100%; }
.logo__char {
  display: inline-block;
  color: var(--c-paper);
  -webkit-text-stroke: 3px var(--c-ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--c-ink);
  animation: logo-shine 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.logo__char--cyan { color: var(--c-cyan); }
.logo__char--pink { color: var(--c-pink); }
.logo__char--gold { color: var(--c-gold); }
/* ビームが左から右へ走るように1文字ずつ光る */
@keyframes logo-shine {
  0%, 70%, 100% { transform: none; filter: none; }
  78% { transform: translateY(-5px) rotate(-4deg); filter: brightness(1.25) drop-shadow(0 0 6px var(--c-cyan)); }
}
.title__art {
  position: relative;
  width: min(72vw, 300px); aspect-ratio: 4 / 3;
  border: 4px solid var(--c-ink); border-radius: var(--radius-l);
  background: #f3f9ff;
  box-shadow: 0 6px 0 var(--c-ink);
  overflow: hidden;
}
.title__art canvas { width: 100%; height: 100%; }
.title__actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(80vw, 320px); }
.title__sub { display: flex; justify-content: center; gap: 12px; }
.title__note { margin: 0; font-size: 13px; font-weight: 700; color: var(--c-ink-sub); }

/* ---------- モーダル共通 ---------- */
.modal {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(36, 48, 94, .6);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-mid), visibility 0s linear var(--dur-mid);
}
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-mid), visibility 0s; }
.card {
  width: min(100%, 400px); max-height: 100%; overflow-y: auto;
  padding: 20px 18px;
  border: 4px 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); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.card__title { margin: 0 0 12px; font-size: 24px; font-weight: 900; }
.card__actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* ---------- ルール（3枚） ---------- */
.rules { display: flex; flex-direction: column; gap: 12px; }
.rules__page { display: none; flex-direction: column; align-items: center; gap: 10px; }
.rules__page.is-active { display: flex; animation: slide-in .3s ease-out; }
.rules__art {
  width: 100%; aspect-ratio: 4 / 3; max-height: 34dvh;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: #f3f9ff; overflow: hidden;
}
.rules__art canvas { width: 100%; height: 100%; }
.rules__head { margin: 0; font-size: 20px; font-weight: 900; }
.rules__head .num { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 6px; border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-cyan); font-size: 15px; vertical-align: 2px; }
.rules__text { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.55; }
.rules__text b { color: var(--c-pink-deep); }
.rules__dots { display: flex; justify-content: center; gap: 8px; }
.rules__dot { width: 12px; height: 12px; border: 2px solid var(--c-ink); border-radius: 50%; background: var(--c-paper); }
.rules__dot.is-on { background: var(--c-pink); }
.rules__nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------- ステージ選択 ---------- */
.screen--select { gap: 10px; }
.select__head { display: flex; align-items: center; gap: 10px; flex: none; }
.select__title { flex: 1; margin: 0; color: var(--c-paper); font-size: 24px; font-weight: 900; -webkit-text-stroke: 4px var(--c-ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--c-ink); }
.select__total { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-weight: 900; }
.world { --w: var(--w1); margin: 0 0 6px; }
.world[data-world="2"] { --w: var(--w2); }
.world[data-world="3"] { --w: var(--w3); }
.world[data-world="4"] { --w: var(--w4); }
.world[data-world="5"] { --w: var(--w5); }
.world__head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; font-size: 15px; font-weight: 900;
}
.world__no { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px; border: 3px solid var(--c-ink); border-radius: 8px; background: var(--w); font: 900 13px/1 var(--font-num); transform: rotate(-4deg); }
.world__name { padding: 0 8px; border-radius: 6px; background: rgba(255,253,247,.85); }
.world__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.stage-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; aspect-ratio: 1 / 1; min-height: 62px; max-height: 96px;
  padding: 4px;
  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);
  transition: transform .08s ease, box-shadow .08s ease;
}
.stage-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%; border-radius: 14px 14px 0 0; background: var(--w); opacity: .55; }
.stage-tile > * { position: relative; }
.stage-tile:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-ink); }
.stage-tile__no { font: 900 24px/1 var(--font-num); }
.stage-tile .star { width: 14px; height: 14px; }
.stage-tile .stars { gap: 1px; }
.stage-tile.is-clear { background: #fffbe8; }
.stage-tile.is-perfect { background: #fff4c4; }
.stage-tile.is-perfect::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; box-shadow: 0 0 0 3px var(--c-gold) inset; pointer-events: none; }
.stage-tile.is-locked { background: #dcd8e2; cursor: not-allowed; }
.stage-tile.is-locked::before { background: var(--c-gray); }
.stage-tile.is-locked:active { transform: none; box-shadow: 0 5px 0 var(--c-ink); }
.stage-tile.is-locked .stage-tile__no, .stage-tile.is-locked .stars { display: none; }
.stage-tile__lock { display: none; }
.stage-tile.is-locked .stage-tile__lock {
  display: block; width: 22px; height: 18px; margin-top: 10px;
  border: 3px solid var(--c-ink); border-radius: 5px; background: var(--c-gold);
}
.stage-tile.is-locked .stage-tile__lock::before {
  content: ""; position: absolute; left: 1px; top: -13px; width: 14px; height: 13px;
  border: 3px solid var(--c-ink); border-bottom: 0; border-radius: 9px 9px 0 0;
}
.stage-tile.is-new { animation: tile-bounce 1.2s ease-in-out infinite; }
.stage-tile.is-new::after {
  content: "NEW"; position: absolute; top: -10px; right: -4px;
  padding: 1px 6px; border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-pink); color: #fff; font: 900 10px/1.4 var(--font-num);
}
@keyframes tile-bounce { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }

/* ---------- プレイ ---------- */
.screen--play {
  padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(8px + var(--safe-left));
  gap: 8px; overflow: hidden;
}
.hud { display: flex; align-items: center; gap: 6px; flex: none; }
.hud__chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 10px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper);
  font-weight: 800; white-space: nowrap;
}
.hud__chip small { font-size: 11px; color: var(--c-ink-sub); }
.hud__stage { flex: 1; min-width: 0; background: var(--c-lab); color: #fff; }
.hud__stage .num { color: var(--c-cyan); font-size: 16px; }
.hud__stage-name { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.hud__stars .star { width: 15px; height: 15px; }
.hud__stars .num { font-size: 15px; }
.hud__shots .num { font-size: 17px; }
.hud__shots.is-up .num, .hud__stars.is-up .num { animation: num-up .3s var(--ease-pop); }
@keyframes num-up { 0% { transform: scale(1); } 50% { transform: scale(1.35); color: var(--c-pink-deep); } 100% { transform: scale(1); } }
.hud .icon-btn { width: 40px; height: 40px; }

.board {
  position: relative; flex: 1; min-height: 0;
  display: grid; place-items: center;
}
.board canvas { width: 100%; height: 100%; }
.board__hint {      /* 盤面上の吹き出し（1面の「鏡をタップ」など） */
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  max-width: 92%; padding: 4px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-paper); font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 3px 0 var(--c-ink);
  animation: float 2s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -3px); } }
.board.is-firing { cursor: pointer; }
.board.is-shake { animation: shake .3s linear; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

.controls { display: flex; flex-direction: column; gap: 8px; flex: none; }
.controls__row { display: flex; align-items: center; gap: 8px; }
.tray {   /* 手持ちトレイ: ボタン（タップで「はずす」モード切替も可） */
  display: flex; align-items: center; gap: 6px;
  height: 48px; padding: 0 12px 0 8px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-pink-light);
  font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 0 var(--c-ink);
}
.tray[hidden] { display: none; }
.tray__label { font-size: 12px; line-height: 1.1; color: var(--c-pink-deep); }
.tray__slots { display: flex; gap: 3px; }
.tray__slot {   /* 手持ち鏡1枚ぶん。使ったら .is-used */
  width: 14px; height: 30px; border: 2.5px solid var(--c-ink); border-radius: 5px;
  background: linear-gradient(135deg, #fff 0 30%, #ffc4e2 30% 55%, #fff 55% 70%, #ffc4e2 70%);
  transform: rotate(20deg);
}
.tray__slot.is-used { background: transparent; border-style: dashed; border-color: var(--c-ink-sub); }
.tray.is-remove { background: var(--c-lemon); }
.tray.is-empty .tray__label { color: var(--c-ink-sub); }
.tray.is-bump { animation: num-up .3s var(--ease-pop); }
.controls__row .btn--small { flex: 1; padding: 6px 8px; }
.btn__badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-lemon); font: 900 11px/1 var(--font-num); color: var(--c-ink); }

.btn--fire {   /* 大きな「発射！」 */
  --btn-bg: var(--c-pink); --btn-edge: var(--c-pink-deep); --btn-depth: 7px;
  min-height: 64px; font-size: 26px; letter-spacing: .12em;
  background: linear-gradient(180deg, #ff7cc0, var(--c-pink) 60%);
}
.btn--fire::before {   /* ビームのアイコン */
  content: ""; width: 26px; height: 12px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: linear-gradient(90deg, var(--c-cyan), #fff);
}
.btn--fire:not(:disabled) { animation: fire-glow 1.6s ease-in-out infinite; }
@keyframes fire-glow {
  0%, 100% { box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink), 0 0 0 0 rgba(255,79,163,0); }
  50% { box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink), 0 0 18px 4px rgba(47,224,255,.6); }
}
.btn--fire:active, .btn--fire.is-pressed { animation: none; }
.btn--fire.is-firing { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); background: var(--c-gold); color: var(--c-ink); animation: none; }

/* ---------- 失敗トースト（「あと少し！」＋調整にもどる） ---------- */
.fail {
  position: absolute; left: 50%; bottom: calc(150px + var(--safe-bottom)); z-index: 15;
  display: flex; align-items: center; gap: 10px;
  width: min(92%, 380px); padding: 10px 10px 10px 14px;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m);
  background: var(--c-paper); box-shadow: 0 5px 0 var(--c-ink);
  transform: translateX(-50%);
  animation: toast-in .3s var(--ease-pop);
}
.fail[hidden] { display: none; }
.fail__icon { flex: none; width: 44px; height: 44px; }
.fail__body { flex: 1; min-width: 0; text-align: left; }
.fail__title { margin: 0; font-size: 18px; font-weight: 900; color: var(--c-pink-deep); }
.fail__msg { margin: 0; font-size: 12px; font-weight: 700; color: var(--c-ink-sub); }
.fail .btn { flex: none; white-space: nowrap; padding: 6px 12px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0); } }

.toast {   /* 短い通知（コピーしました 等） */
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 30;
  padding: 6px 16px; border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-lemon); font-weight: 900; white-space: nowrap;
  transform: translate(-50%, 0); transition: opacity .2s;
}
.toast[hidden] { display: block; opacity: 0; pointer-events: none; }

/* ---------- 結果 ---------- */
.result { position: relative; overflow: hidden; }
.result__ribbon {
  display: inline-block; margin: 0 0 6px; padding: 4px 22px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--c-mint); font-size: 22px; font-weight: 900;
  transform: rotate(-2deg);
}
.result__stage { margin: 0; font-size: 14px; font-weight: 800; color: var(--c-ink-sub); }
.result__art { width: 120px; height: 100px; margin: 0 auto; }
.result__stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 6px 0 4px; }
.result__stars .star { width: 54px; height: 54px; background: var(--c-line); }
.result__stars .star:nth-child(2) { width: 66px; height: 66px; margin-bottom: 8px; }
.result__stars .star.is-on { background: var(--c-gold); animation: star-pop .5s var(--ease-pop) both; filter: drop-shadow(0 3px 0 var(--c-ink)); }
.result__stars .star:nth-child(1).is-on { animation-delay: .25s; }
.result__stars .star:nth-child(2).is-on { animation-delay: .5s; }
.result__stars .star:nth-child(3).is-on { animation-delay: .75s; }
@keyframes star-pop {
  0% { transform: scale(0) rotate(-90deg); opacity: 0; }
  70% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.result__conds { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; text-align: left; }
.result__cond { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: var(--radius-s); background: var(--c-cream); font-size: 13px; font-weight: 800; }
.result__cond::before { content: ""; flex: none; width: 14px; height: 14px; border: 2px solid var(--c-ink); border-radius: 4px; background: var(--c-paper); }
.result__cond.is-ok::before { background: var(--c-mint); box-shadow: inset 0 0 0 2px var(--c-paper); }
.result__cond.is-ok { color: var(--c-mint-deep); }
.result__shots { margin: 6px 0 0; font-size: 14px; font-weight: 800; }
.result__tip { margin: 6px 0 0; padding: 6px 10px; border: 2px dashed var(--c-pink); border-radius: var(--radius-s); font-size: 13px; font-weight: 900; color: var(--c-pink-deep); }
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.result__actions .btn--block { grid-column: 1 / -1; }
.confetti { position: absolute; inset: 0; pointer-events: none; }  /* canvas: 花火・紙吹雪 */

/* ---------- 縦にして遊んでね ---------- */
.rotate {
  position: fixed; inset: 0; z-index: 100;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--c-lab); color: var(--c-paper);
  font-size: 20px; font-weight: 900; text-align: center;
}
.rotate__phone {
  width: 44px; height: 72px;
  border: 4px solid var(--c-paper); border-radius: 10px;
  box-shadow: inset 0 -8px 0 var(--c-cyan);
  animation: rotate-hint 1.8s ease-in-out infinite;
}
@keyframes rotate-hint { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 499px) {
  .rotate { display: flex; }
}

/* ---------- 小さい画面（360x640 など） ---------- */
@media (max-height: 700px) {
  .screen--play { gap: 6px; padding-top: calc(6px + var(--safe-top)); padding-bottom: calc(8px + var(--safe-bottom)); }
  .hud__chip { height: 34px; padding: 0 8px; }
  .hud .icon-btn { width: 38px; height: 38px; }
  .controls { gap: 6px; }
  .btn--fire { min-height: 56px; font-size: 22px; }
  .fail { bottom: calc(130px + var(--safe-bottom)); }
  .title__art { width: min(60vw, 230px); }
  .stage-tile { min-height: 56px; }
  .result__art { height: 72px; }
  .result__stars .star { width: 44px; height: 44px; }
  .result__stars .star:nth-child(2) { width: 54px; height: 54px; }
}
@media (max-width: 370px) {
  .hud__stage-name { display: none; }
  .tray { padding: 0 8px 0 6px; }
}

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .logo__char, .stage-tile.is-new, .btn--fire, .board__hint { animation: none !important; }
}
