#gameScene {
  min-height: 100svh;
  padding: clamp(12px, 2vh, 22px) var(--scene-gutter) clamp(18px, 2.5vh, 30px);
}

.game-header {
  display: grid;
  width: min(100%, var(--content-wide));
  min-height: 54px;
  margin: 0 auto clamp(12px, 1.8vh, 18px);
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
}

.icon-button--levels {
  display: flex;
  width: auto;
  min-height: 48px;
  padding: 0 12px;
  gap: 7px;
  color: #b8dcff;
}

.icon-button--levels b { font-size: 8px; letter-spacing: .12em; }
.game-level-nav { display: flex; min-height: 48px; justify-self: center; align-items: center; gap: 12px; padding: 4px 7px; border: 1px solid var(--line-blue); border-radius: 15px; background: rgba(17,27,44,.66); box-shadow: inset 0 1px rgba(255,255,255,.07); }
.game-level-heading { display: flex; min-width: 80px; align-items: baseline; justify-content: center; gap: 9px; }
.game-level-heading span,
.move-counter span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .17em; }
.game-level-heading strong { font-size: 27px; }
.level-step-button { width: 40px; min-width: 40px; min-height: 40px; border-color: rgba(107,183,255,.32); color: #e2f2ff; background: linear-gradient(145deg,#284c81,#142744); box-shadow: inset 0 2px rgba(255,255,255,.13), 0 4px #081830; font-size: 28px; }
.level-step-button:disabled { opacity: .25; cursor: not-allowed; filter: grayscale(1); }

.move-counter { display: flex; min-width: 104px; min-height: 48px; padding: 8px 14px; align-items: center; justify-content: space-between; gap: 11px; border: 1px solid var(--line-blue); border-radius: 12px; background: linear-gradient(145deg,#142c50,#111827); box-shadow: inset 0 1px rgba(255,255,255,.09), 0 8px 16px rgba(0,0,0,.25); }
.move-counter strong { color: var(--sky); font-size: 26px; line-height: 1; text-shadow: 0 2px 9px rgba(52,124,242,.41); }
.move-counter.is-low,
.move-counter.is-danger { border-color: rgba(255,97,116,.55); background: linear-gradient(145deg,#461725,#21121a); animation: danger-counter .7s ease-in-out infinite alternate; }
.move-counter.is-low strong,
.move-counter.is-danger strong { color: #ff8996; text-shadow: 0 2px 9px rgba(255,55,93,.41); }

.game-layout { display: grid; width: min(100%, var(--content-wide)); margin: 0 auto; grid-template-columns: 142px minmax(0,auto) 82px; align-items: center; justify-content: center; gap: clamp(18px,2.6vw,38px); }
.board-stage { position: relative; display: grid; justify-self: center; place-items: center; touch-action: none; user-select: none; }
.board-shadow { position: absolute; z-index: -1; bottom: -18px; width: 88%; height: 34px; border-radius: 50%; background: rgba(0,0,0,.62); filter: blur(16px); }
.game-board { width: min(68svh, calc(100vw - 390px), 610px); max-width: none; }

.target-card { display: block; width: 142px; padding: 14px; border-radius: 18px; }
.target-label { display: flex; margin-bottom: 10px; align-items: center; justify-content: space-between; }
.target-label span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.target-label i { color: var(--sky); font-size: 12px; font-weight: 900; font-style: normal; }
.stage-progress { display: grid; margin: 1px 0 10px; grid-template-columns: 1fr auto; align-items: end; gap: 2px 8px; }
.stage-progress__eyebrow { color: #8799b2; font-size: 7px; font-weight: 900; letter-spacing: .15em; }
.stage-progress strong { color: #f4f9ff; font-size: 13px; letter-spacing: .02em; }
.stage-progress progress { width: 100%; height: 5px; grid-column: 1/-1; overflow: hidden; border: 0; border-radius: 99px; color: var(--accent); background: rgba(255,255,255,.08); appearance: none; }
.stage-progress progress::-webkit-progress-bar { border-radius: 99px; background: rgba(255,255,255,.08); }
.stage-progress progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg,var(--accent),var(--sky)); box-shadow: 0 0 8px var(--accent-glow); }
.stage-progress progress::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg,var(--accent),var(--sky)); }
.target-preview-wrap { position: relative; }
.target-card .mini-board { display: grid; width: 100%; aspect-ratio: 1; padding: 7px; grid-template-columns: repeat(9,1fr); grid-template-rows: repeat(9,1fr); gap: 2px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: #080e18; }
.target-card .mini-board > * { border-radius: 1px; background: rgba(255,255,255,.025); }
.target-card .mini-board .mini-cell.is-filled { background: rgba(212,224,241,.72); box-shadow: 0 0 4px rgba(255,255,255,.19); }
.target-preview-legacy[hidden] { display: none !important; }
.stage-next { display: grid; margin-top: 8px; padding: 7px 8px; gap: 2px; border: 1px solid rgba(255,255,255,.06); border-radius: 8px; opacity: .58; background: rgba(255,255,255,.025); }
.stage-next span,.confirm-budget span { color: #8d9db4; font-size: 6px; font-weight: 900; letter-spacing: .14em; }
.stage-next strong { overflow: hidden; color: #c1ccda; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.confirm-budget { display: flex; min-height: 29px; margin-top: 8px; padding: 5px 8px; align-items: center; justify-content: space-between; border: 1px solid rgba(255,214,64,.13); border-radius: 8px; background: rgba(255,214,64,.045); }
.confirm-budget strong { color: var(--gold); font-size: 10px; }
.target-stars { display: grid; margin-top: 11px; gap: 4px; color: #8190a5; font-size: 9px; font-weight: 800; line-height: 1.6; }
.target-stars span { display: flex; justify-content: space-between; }
.target-stars b { color: var(--gold); font-size: 8px; }
.target-stars i { font-style: normal; }

.game-actions { display: flex; width: 82px; flex-direction: column; align-items: center; gap: 10px; }
.round-action { display: grid; width: 70px; min-width: 64px; min-height: 64px; aspect-ratio: 1; place-items: center; align-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 50%; background: linear-gradient(145deg,#25344d,#111b2c); box-shadow: inset 0 2px rgba(255,255,255,.1), inset 0 -5px rgba(0,0,0,.22), 0 7px #080e19, 0 13px 20px rgba(0,0,0,.3); transition: .18s ease; }
.round-action span { font-size: 22px; line-height: 1; }
.round-action b { font-size: 8px; letter-spacing: .11em; }
.round-action:hover { filter: brightness(1.2); transform: translateY(-2px); }
.round-action.is-active { border-color: #9bd5ff; color: #fff; background: linear-gradient(145deg,#4f9cf8,#174aa7); box-shadow: inset 0 2px rgba(224,243,255,.45), 0 7px var(--accent-deep), 0 0 22px var(--accent-glow); }
.round-action--confirm { border-color: rgba(255,214,64,.42); color: #fff4ba; background: linear-gradient(145deg,#705516,#30210a); box-shadow: inset 0 2px rgba(255,244,180,.18), inset 0 -5px rgba(0,0,0,.2), 0 7px #160f03, 0 12px 20px rgba(0,0,0,.3); }
.round-action--confirm:not(:disabled) { animation: confirm-available 1.15s ease-in-out infinite alternate; }
.round-action:disabled { opacity: .38; filter: grayscale(.75); cursor: not-allowed; transform: none; }
.round-action--target { display: none !important; }

.line-confirm-tray,.special-effect-status,.special-tooltip,.stage-complete-banner { position: absolute; z-index: 34; left: 50%; pointer-events: none; }
.line-confirm-tray { top: -49px; display: grid; min-width: 215px; min-height: 42px; padding: 7px 12px 7px 39px; align-content: center; border: 1px solid rgba(255,220,91,.48); border-radius: 14px; opacity: 0; color: #fff8cf; background: rgba(58,41,7,.94); box-shadow: 0 8px 24px rgba(0,0,0,.38),0 0 18px rgba(255,214,64,.12); transform: translate(-50%,7px); transition: .2s var(--ease-brick); }
.line-confirm-tray:not([hidden]),.line-confirm-tray.is-visible { opacity: 1; transform: translate(-50%,0); }
.line-confirm-tray__pin { position: absolute; left: 13px; color: var(--gold); font-size: 17px; }
.line-confirm-tray strong { font-size: 9px; letter-spacing: .1em; }
.line-confirm-tray span:last-child { color: #d9cfa9; font-size: 7px; }
.special-effect-status { right: auto; bottom: -43px; display: flex; min-height: 34px; padding: 6px 11px; align-items: center; gap: 7px; border: 1px solid rgba(124,207,255,.28); border-radius: 99px; color: #dff4ff; background: rgba(9,25,45,.93); box-shadow: 0 7px 20px rgba(0,0,0,.3); font-size: 8px; font-weight: 900; transform: translateX(-50%); }
.special-tooltip { bottom: 14px; width: min(300px,calc(100% - 24px)); padding: 12px 14px; border: 1px solid rgba(166,218,255,.34); border-radius: 14px; color: #f3f9ff; background: rgba(13,26,45,.96); box-shadow: 0 14px 40px rgba(0,0,0,.55); font-size: 10px; font-weight: 800; line-height: 1.4; text-align: center; transform: translateX(-50%); }
.stage-complete-banner { top: 50%; display: flex; min-width: 218px; min-height: 70px; padding: 12px 18px; align-items: center; justify-content: center; gap: 14px; border: 2px solid rgba(171,255,184,.7); border-radius: 20px; opacity: 0; color: #edfff0; background: rgba(17,72,36,.94); box-shadow: 0 15px 50px rgba(0,0,0,.6),0 0 35px rgba(91,232,112,.24); transform: translate(-50%,-42%) scale(.8); }
.stage-complete-banner strong { display: grid; width: 34px; aspect-ratio: 1; place-items: center; border-radius: 50%; color: #174a25; background: #8af09a; font-size: 21px; }
.stage-complete-banner span { font-size: 14px; font-weight: 900; letter-spacing: .1em; }
.stage-complete-banner:not([hidden]),
.stage-complete-banner.is-visible { opacity: 1; animation: stage-complete .7s var(--ease-brick) both; }

.flow-test-actions { display: grid; width: 82px; padding: 8px; gap: 6px; border: 1px dashed rgba(255,255,255,.12); border-radius: 12px; opacity: .52; background: rgba(8,14,24,.55); filter: saturate(.55); transform: scale(.94); transition: opacity .16s, filter .16s; }
.flow-test-actions:hover,
.flow-test-actions:focus-within { opacity: 1; filter: none; }
.flow-test-actions > span { color: #b6c1d0; font-size: 10px; font-weight: 900; line-height: 1.25; letter-spacing: .1em; text-align: center; }
.flow-test-actions button { min-height: 25px; border: 1px solid rgba(255,255,255,.09); border-radius: 7px; color: #aab8ca; background: rgba(255,255,255,.03); font-size: 7px; font-weight: 900; }
.gesture-guide { margin: clamp(14px,2vh,22px) auto 0; min-height: 22px; color: #8d9db4; font-size: 11px; font-weight: 800; text-align: center; }
.gesture-guide span { margin-right: 7px; color: #86bcff; font-size: 18px; }

.result-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  opacity: 0;
  background: rgba(4, 8, 16, .76);
  backdrop-filter: blur(16px) saturate(.82);
}
.result-overlay.is-visible { opacity: 1; animation: overlay-in .28s ease-out both; }
.result-card {
  position: relative;
  width: min(440px,100%);
  max-height: calc(100svh - 48px);
  padding: 45px 32px 31px;
  overflow: hidden auto;
  border: 1px solid rgba(172, 215, 255, .28);
  border-radius: 32px;
  text-align: center;
  background:
    radial-gradient(circle at 50% -18%, rgba(94, 174, 255, .28), transparent 42%),
    linear-gradient(160deg, #25334b 0, #172136 48%, #111827 100%);
  box-shadow:
    inset 0 1px rgba(255,255,255,.16),
    inset 0 -1px rgba(0,0,0,.34),
    0 8px 0 #081326,
    0 36px 90px rgba(0,0,0,.68);
  animation: result-pop .52s .08s var(--ease-brick) both;
}
.result-card::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 116px;
  height: 5px;
  border-radius: 0 0 99px 99px;
  content: "";
  background: linear-gradient(90deg, var(--accent), var(--sky));
  box-shadow: 0 3px 18px rgba(91,167,255,.42);
  transform: translateX(-50%);
}
.result-card::after {
  position: absolute;
  z-index: 0;
  top: -88px;
  left: 50%;
  width: 260px;
  aspect-ratio: 1;
  border: 1px solid rgba(143,204,255,.13);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 28px rgba(93,164,255,.035), 0 0 0 58px rgba(93,164,255,.022);
  transform: translateX(-50%);
  pointer-events: none;
}
.result-card > * { position: relative; z-index: 1; }
.result-kicker {
  display: inline-flex;
  min-height: 26px;
  margin: 0 0 12px;
  padding: 0 12px;
  align-items: center;
  border: 1px solid rgba(138,202,255,.24);
  border-radius: 99px;
  color: #bfe3ff;
  background: rgba(72,151,235,.1);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .2em;
}
.result-card h2 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(43px,11vw,64px);
  line-height: 1;
  letter-spacing: -.065em;
  text-shadow: 0 4px 0 #174eaa, 0 12px 26px rgba(0,0,0,.38);
}
.result-stars {
  display: flex;
  min-height: 76px;
  margin: 24px auto 11px;
  padding: 9px 18px 11px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  background: rgba(4,10,20,.28);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.25);
}
.result-stars .star,
.result-stars .star:nth-child(2) { width: 52px; font-size: 58px; opacity: .2; transform: scale(.2); }
.result-stars .star.is-earned { opacity: 1; animation: star-earned .55s var(--ease-brick) both; }
.result-summary { min-height: 22px; margin: 14px 0 24px; color: #c8d5e5; font-size: 14px; font-weight: 700; line-height: 1.5; }
.result-overlay.is-final .result-summary { color: #f4f8ff; font-size: clamp(16px,4.5vw,20px); line-height: 1.75; }
.result-overlay.is-final .result-card { border-color: rgba(255,214,64,.32); background: radial-gradient(circle at 50% -18%,rgba(255,214,64,.22),transparent 43%),linear-gradient(160deg,#2c354b,#182137 52%,#111827); }
.result-overlay.is-final .result-card::before { background: linear-gradient(90deg,var(--gold),#fff2a3); box-shadow: 0 3px 20px rgba(255,214,64,.4); }
.result-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 13px; }
.result-actions.is-retry-primary { grid-template-columns: 1.2fr 1fr; }
.result-actions .brick-button { min-height: 57px; border-radius: 15px; }
.result-overlay.is-failure .result-card {
  border-color: rgba(255,143,156,.27);
  background: radial-gradient(circle at 50% -18%,rgba(255,97,116,.16),transparent 42%), linear-gradient(160deg,#2d2b3a,#1a202e 52%,#121722);
  box-shadow: inset 0 1px rgba(255,255,255,.12), 0 8px 0 #17101a, 0 36px 90px rgba(0,0,0,.68);
}
.result-overlay.is-failure .result-card::before { background: linear-gradient(90deg,#df405d,#ff8794); box-shadow: 0 3px 18px rgba(255,97,116,.3); }
.result-overlay.is-failure .result-card::after { border-color: rgba(255,155,166,.1); box-shadow: 0 0 0 28px rgba(255,97,116,.025), 0 0 0 58px rgba(255,97,116,.015); }
.result-overlay.is-failure .result-kicker { color: #ffc1c8; border-color: rgba(255,133,147,.22); background: rgba(255,97,116,.07); }
.result-overlay.is-failure h2 { color: #fff4f5; text-shadow: 0 4px 0 #87233a, 0 12px 25px rgba(0,0,0,.44); }

@keyframes danger-counter { to { box-shadow: 0 0 18px rgba(240,68,68,.27); transform: scale(1.025); } }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes result-pop { from { opacity: 0; transform: translateY(24px) scale(.9); } }
@keyframes star-earned { from { opacity: 0; transform: translateY(-38px) scale(.12) rotate(-120deg); } 60% { transform: translateY(4px) scale(1.24) rotate(10deg); } to { opacity: 1; transform: none; } }
@keyframes confirm-available { to { border-color: #ffe77c; filter: brightness(1.13); box-shadow: inset 0 2px rgba(255,255,255,.25),0 7px #211500,0 0 19px rgba(255,214,64,.3); } }
@keyframes stage-complete { 0% { opacity: 0; transform: translate(-50%,-42%) scale(.72); } 55% { opacity: 1; transform: translate(-50%,-50%) scale(1.06); } 100% { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

@media (max-width: 420px) {
  .result-overlay { padding: 12px; }
  .result-card { max-height: calc(100svh - 24px); padding: 38px 18px 22px; border-radius: 25px; overscroll-behavior: contain; }
  .result-card h2 { font-size: clamp(38px, 13vw, 52px); }
  .result-stars { min-height: 68px; margin-top: 20px; padding-inline: 10px; gap: 6px; }
  .result-stars .star,
  .result-stars .star:nth-child(2) { width: 45px; font-size: 50px; }
  .result-actions { gap: 9px; }
  .result-actions .brick-button { min-height: 54px; padding-inline: 10px; font-size: 12px; }
}
