/* AIの電力を確保せよ！ style.css
   シリーズ共通: ポップ・太い墨枠・押すと沈むボタン・丸ゴシック（外部フォントなし）＋電気の黄色と方眼 */
:root {
  --c-ink: #2b2140;
  --c-ink-sub: #6e6480;
  --c-paper: #fffdf6;
  --c-line: #e8dcc0;
  --c-bg: #ffe9a8;
  --c-bg-line: #f8d87e;
  --c-cyan: #3fd6ff; --c-cyan-deep: #1597ba;
  --c-pink: #ff5c8a; --c-pink-deep: #c93464;
  --c-gold: #ffc83d; --c-gold-deep: #d99a00;
  --c-mint: #5ad6a8; --c-mint-deep: #2fa57a;
  --c-red: #ec3d3a; --c-red-deep: #a8211f;
  --c-lemon: #fff15a;
  --c-navy: #34406e;
  --c-gray: #a7a3ad;
  --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: 16px; --radius-l: 26px;
  --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-mid: .3s;
  --ease-pop: cubic-bezier(.34, 1.56, .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: #f3cf6a;
  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; overflow: clip;
  background-color: var(--c-bg);
  background-image: linear-gradient(var(--c-bg-line) 1px, transparent 1px), linear-gradient(90deg, var(--c-bg-line) 1px, transparent 1px);
  background-size: 24px 24px;
  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; }

.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: .04em; cursor: pointer;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
.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:active { 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, .tool:focus-visible, .stage-card:focus-visible { outline: 4px solid var(--c-pink); outline-offset: 3px; }
.btn:disabled { filter: grayscale(.8) opacity(.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--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: 900 15px/1 var(--font-num); cursor: pointer; box-shadow: 0 4px 0 var(--c-ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn::before, .icon-btn::after { content: ""; position: absolute; }
.icon-btn--menu::before { width: 16px; height: 3px; border-radius: 2px; background: var(--c-ink); box-shadow: 0 -5px 0 var(--c-ink), 0 5px 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); }
.icon-btn--speed.is-fast { background: var(--c-lemon); }
.icon-btn--speed.is-paused { background: var(--c-cyan); }

.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); }
.coin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--c-ink); border-radius: 50%; background: var(--c-gold); box-shadow: inset -2px -2px 0 var(--c-gold-deep); flex: none; }
.bolt { display: inline-block; width: 12px; height: 18px; background: var(--c-lemon); clip-path: polygon(60% 0, 0 58%, 42% 58%, 30% 100%, 100% 38%, 56% 38%); filter: drop-shadow(0 0 0 var(--c-ink)); flex: none; }
.bolt.is-hit { background: var(--c-red); animation: bolt-hit .5s ease-out; }
@keyframes bolt-hit { 30% { transform: scale(1.8) rotate(-10deg); } }

/* ---------- タイトル ---------- */
.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-cyan); color: var(--c-ink); font-size: clamp(12px, 3.6vmin, 16px); transform: rotate(-3deg); }
.logo__main { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-size: clamp(38px, 12vmin, 60px); }
.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-zap 2.6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * .08s); }
.logo__char--cyan { color: var(--c-cyan); }
.logo__char--pink { color: var(--c-pink); }
.logo__char--gold { color: var(--c-gold); }
@keyframes logo-zap { 0%, 72%, 100% { transform: none; filter: none; } 78% { transform: translateY(-5px) rotate(-4deg); filter: brightness(1.2) drop-shadow(0 0 6px var(--c-lemon)); } }
.title__art { width: min(76vw, 320px); aspect-ratio: 4 / 3; border: 4px solid var(--c-ink); border-radius: var(--radius-l); background: #f4d58d; box-shadow: 0 6px 0 var(--c-ink); overflow: hidden; }
.title__art canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.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; }

/* ---------- ステージ選択 ---------- */
.screen--select { gap: 12px; }
.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; }
.stage-list { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.stage-card {
  position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center;
  width: 100%; padding: 10px; text-align: left;
  border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: var(--c-paper);
  box-shadow: 0 5px 0 var(--c-ink); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.stage-card:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-ink); }
.stage-card canvas { width: 96px; height: 120px; border: 3px solid var(--c-ink); border-radius: 10px; image-rendering: pixelated; }
.stage-card__no { display: inline-block; padding: 0 8px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-lemon); font: 900 12px/1.5 var(--font-num); }
.stage-card__name { margin: 4px 0 2px; font-size: 18px; font-weight: 900; line-height: 1.25; }
.stage-card__desc { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--c-ink-sub); line-height: 1.45; }
.stage-card__best { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.stage-card__best .stars { display: inline-flex; gap: 1px; }
.stage-card__best .star { width: 16px; height: 16px; }
.stage-card.is-locked { background: #e3dfe8; cursor: not-allowed; }
.stage-card.is-locked canvas { filter: grayscale(1) brightness(.7); }
.stage-card.is-locked:active { transform: none; box-shadow: 0 5px 0 var(--c-ink); }
.stage-card__lock { font-size: 13px; font-weight: 900; color: var(--c-ink-sub); }
.stage-card.is-new::after { content: "NEW"; position: absolute; top: -10px; right: 10px; padding: 1px 8px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-pink); color: #fff; font: 900 11px/1.4 var(--font-num); }

/* ---------- プレイ ---------- */
.screen--play { padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left)); gap: 6px; overflow: hidden; }
.hud { display: flex; align-items: center; gap: 5px; flex: none; }
.hud .icon-btn { width: 40px; height: 40px; }
.hud__chip { position: relative; display: inline-flex; align-items: center; gap: 3px; height: 38px; padding: 0 8px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-weight: 900; white-space: nowrap; overflow: hidden; }
.hud__chip small { font-size: 11px; font-weight: 800; }
.hud__chip .num { font-size: 18px; }
.hud__month { flex: 1 1 auto; min-width: 0; }
.hud__clock { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--c-cyan); }
.hud__money { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.hud__money.is-up { animation: chip-pop .35s var(--ease-pop); }
.hud__strikes { gap: 1px; padding: 0 6px; }
.hud__strikes small { margin-right: 2px; font-size: 10px; }
.hud__strikes .bolt { background: #d7d2c6; }
.hud__strikes .bolt.is-on { background: var(--c-red); }
@keyframes chip-pop { 50% { transform: scale(1.1); } }

.meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; flex: none; height: 38px; padding: 0 10px; border: 3px solid var(--c-ink); border-radius: 12px; background: var(--c-paper); }
.meter__label { font-size: 13px; font-weight: 900; }
.meter__bar { position: relative; height: 16px; border: 2px solid var(--c-ink); border-radius: 999px; background: #e9e3d4; overflow: hidden; }
.meter__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--c-mint); transition: width .25s, background .2s; }
.meter__need { position: absolute; top: -2px; bottom: -2px; width: 3px; left: 0; background: var(--c-ink); transition: left .25s; }
.meter__nums { font-size: 15px; font-weight: 900; white-space: nowrap; }
.meter__nums small { margin-left: 1px; font-size: 10px; }
.meter.is-short { background: #ffe0dc; animation: meter-blink .6s steps(2) infinite; }
.meter.is-short .meter__fill { background: var(--c-red); }
.meter.is-tight .meter__fill { background: var(--c-gold); }
@keyframes meter-blink { 50% { border-color: var(--c-red); } }

.news { display: flex; align-items: center; gap: 6px; flex: none; margin: 0; height: 30px; padding: 0 8px 0 4px; border: 3px solid var(--c-ink); border-radius: 8px; background: var(--c-navy); color: #fff; font-size: 13px; font-weight: 800; overflow: hidden; }
.news__tag { flex: none; padding: 0 5px; border-radius: 4px; background: var(--c-red); color: #fff; font: 900 10px/1.6 var(--font-num); letter-spacing: .05em; }
.news__tag.is-gen { background: var(--c-cyan); color: var(--c-ink); }
.news__tag.is-good { background: var(--c-mint); color: var(--c-ink); }
.news__tag.is-info { background: var(--c-gold); color: var(--c-ink); }
.news__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news.is-flash { animation: news-flash .5s ease-out; }
@keyframes news-flash { 0% { background: var(--c-lemon); color: var(--c-ink); } }

.board { position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
.board canvas { image-rendering: pixelated; }
.board.is-shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.board__alert { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); padding: 4px 12px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-red); color: #fff; font-size: 14px; font-weight: 900; white-space: nowrap; pointer-events: none; animation: alert-bob .8s ease-in-out infinite; }
@keyframes alert-bob { 50% { transform: translateX(-50%) translateY(-3px); } }
.board__pause { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.board__pause span { padding: 6px 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-weight: 900; }

.model { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 10px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); }
.model__name { font-size: 12px; font-weight: 900; white-space: nowrap; }
.model__name b { font-size: 15px; color: var(--c-pink-deep); }
.model__bar { height: 12px; border: 2px solid var(--c-ink); border-radius: 999px; background: #e9e3d4; overflow: hidden; }
.model__fill { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--c-pink), var(--c-pink) 6px, #ff86a8 6px, #ff86a8 12px); transition: width .3s; }
.model__rate { font-size: 14px; font-weight: 900; white-space: nowrap; }
.model__rate small { font-size: 10px; }
.model.is-pop { animation: chip-pop .5s var(--ease-pop); }

.palette { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; flex: none; }
.tool {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 0; height: 70px; padding: 4px 1px 3px; border: 3px solid var(--c-ink); border-radius: 12px; background: var(--c-paper);
  box-shadow: 0 4px 0 var(--c-ink); cursor: pointer; transition: transform .08s, box-shadow .08s, background .15s;
}
.tool:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.tool canvas { width: 28px; height: 28px; image-rendering: pixelated; }
.tool__name { max-width: 100%; font-size: 10px; font-weight: 900; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool__cost { font: 900 11px/1.1 var(--font-num); color: var(--c-ink-sub); }
.tool.is-on { background: var(--c-lemon); transform: translateY(2px); box-shadow: 0 2px 0 var(--c-ink); }
.tool.is-on::before { content: ""; position: absolute; inset: -6px; border: 3px solid var(--c-pink); border-radius: 15px; pointer-events: none; }
.tool.is-poor .tool__cost { color: var(--c-red); }
.tool.is-poor canvas { opacity: .5; }
.tool.is-off { display: none; }
.tool__demolish { display: grid; place-items: center; width: 28px; height: 28px; font: 900 22px/1 var(--font-num); color: var(--c-red); }

/* ---------- モーダル ---------- */
.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(43, 33, 64, .62); 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 { position: relative; 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 10px; font-size: 22px; font-weight: 900; line-height: 1.3; }
.card__actions { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

.intro__no { margin: 0; font: 900 13px/1 var(--font-num); color: var(--c-pink-deep); letter-spacing: .1em; }
.intro__news { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 3px solid var(--c-ink); border-radius: 12px; background: var(--c-navy); color: #fff; text-align: left; }
.intro__news .news__tag { margin-top: 2px; }
.intro__news p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.6; }
.intro__tip { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: #fff3c4; font-size: 13px; font-weight: 800; text-align: left; line-height: 1.55; }
.intro__tip::before { content: "ヒント "; color: var(--c-pink-deep); }
.intro__goal { margin: 8px 0 0; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }

.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: 32dvh; border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: #f4d58d; overflow: hidden; }
.rules__art canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.rules__head { margin: 0; font-size: 19px; 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.6; text-align: left; }
.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; } }

.result { padding-top: 16px; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.result > *:not(.confetti) { position: relative; }
.result__ribbon { display: inline-block; margin: 0; 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__ribbon.is-over { background: var(--c-red); color: #fff; }
.result__stage { margin: 6px 0 4px; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }
.result__art { width: 120px; height: 150px; margin: 0 auto; border: 3px solid var(--c-ink); border-radius: 10px; image-rendering: pixelated; }
.result__stars { display: flex; justify-content: center; gap: 6px; margin: 8px 0 0; }
.result__stars .star { width: 34px; height: 34px; }
.result__stars .star.is-on { animation: star-pop .45s var(--ease-pop) both; }
.result__stars .star:nth-child(2) { animation-delay: .15s; }
.result__stars .star:nth-child(3) { animation-delay: .3s; }
@keyframes star-pop { from { transform: scale(0) rotate(-30deg); } }
.result__score { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 2px 0 0; }
.result__score small { font-size: 13px; font-weight: 900; }
.result__score .num { font-size: 40px; line-height: 1.1; }
.result__best { margin: 0; font-size: 12px; font-weight: 800; color: var(--c-ink-sub); min-height: 1em; }
.result__best.is-new { color: var(--c-pink-deep); }
.result__rows { margin: 8px 0 0; padding: 6px 12px; list-style: none; border: 2px dashed var(--c-line); border-radius: 12px; font-size: 13px; font-weight: 800; }
.result__rows li { display: flex; justify-content: space-between; padding: 2px 0; }
.result__rows .minus { color: var(--c-red); }
.result__tip { margin: 8px 0 0; padding: 6px 10px; border-radius: 10px; background: #fff3c4; font-size: 13px; font-weight: 800; line-height: 1.5; text-align: left; }
.result__tip:empty { display: none; }
.result__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.result__actions > .btn--block { grid-column: 1 / -1; }
.result__actions .btn { white-space: nowrap; padding-left: 8px; padding-right: 8px; }

.toast { position: absolute; left: 50%; bottom: calc(118px + var(--safe-bottom)); z-index: 30; max-width: calc(100% - 32px); padding: 8px 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-size: 15px; font-weight: 900; text-align: center; box-shadow: 0 4px 0 var(--c-ink); transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-good { background: var(--c-mint); }
.toast.is-bad { background: var(--c-red); color: #fff; }
.toast.is-gen { background: var(--c-cyan); }
.toast.is-model { background: var(--c-pink); color: #fff; font-size: 17px; }

.rotate { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--c-bg); font-size: 20px; font-weight: 900; }
.rotate__phone { width: 48px; height: 80px; border: 4px solid var(--c-ink); border-radius: 10px; background: var(--c-paper); animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 50% { transform: rotate(-90deg); } }
@media (orientation: landscape) and (max-height: 520px) { .rotate { display: flex; } }

@media (max-height: 700px) {
  .screen--play { gap: 4px; }
  .meter { height: 34px; }
  .news { height: 26px; font-size: 12px; }
  .model { height: 26px; }
  .tool { height: 66px; }
  .result { padding: 12px 14px; }
  .result__art { display: none; }
  .result__score .num { font-size: 32px; }
  .result__stars .star { width: 28px; height: 28px; }
  .result__rows { margin-top: 4px; padding: 2px 10px; font-size: 12px; }
  .result__rows li { padding: 0; }
  .result__tip { margin-top: 4px; font-size: 12px; }
  .result__actions { gap: 8px; margin-top: 8px; }
  .result .btn--small { min-height: 44px; }
  .result .btn { min-height: 48px; }
  .tool canvas { width: 24px !important; height: 24px !important; }
}
@media (max-width: 370px) {
  .hud__chip { padding: 0 6px; }
  .hud__chip .num { font-size: 16px; }
  .hud__strikes small { display: none; }
  .meter__nums small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
