:root {
  color-scheme: dark;
  --bg: #141c1f;
  --panel: #1d292c;
  --line: #334649;
  --text: #f2f7f1;
  --muted: #acc0bd;
  --mint: #a4e7d0;
  --gold: #f2ce86;
  font: 16px/1.45 system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { overflow-y: scroll; scrollbar-gutter: stable; }
[hidden] { display: none !important; }
body { margin: 0; width: 100%; overflow-x: clip; color: var(--text); background: var(--bg); }
main { width: 100%; max-width: 610px; margin: auto; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); }
button, textarea, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, .upload:focus-within { outline: 2px solid var(--mint); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .53; }
h1, h2, p { margin: 0; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: clamp(29px, 8vw, 40px); line-height: 1.07; letter-spacing: -.06em; }
.balance { border: 1px solid #3d5a5a; border-radius: 14px; padding: 8px 11px; background: #233739; color: var(--mint); font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.balance.infinite {
  padding: 5px 10px; border-color: #887244;
  color: #ffe5a9; background: linear-gradient(145deg, #3a392b, #242e2a);
  box-shadow: 0 3px 18px #ddb36528, inset 0 1px #ffeac32b;
}
.balance-infinite { display: flex; align-items: center; gap: 8px; }
.infinity-amount { display: flex; align-items: center; gap: 4px; }
.infinity-symbol { font-size: 1.8rem; font-weight: 630; line-height: 1; text-shadow: 0 0 10px #ffc87761; }
.infinity-crystal { font-size: .9rem; line-height: 1; }
#balance-timer { padding-left: 8px; border-left: 1px solid #92835b; font-size: .82rem; }
.tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; background: #0e171a; border: 1px solid var(--line); padding: 4px; border-radius: 14px; margin: 20px 0 12px; }
.tabs button { border: 0; min-height: 40px; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; }
.tabs button[aria-pressed="true"] { background: #294041; color: #dcf8eb; }
.room-card { border: 1px solid #526360; border-radius: 16px; overflow: hidden; background: #233031; }
.scene { isolation: isolate; position: relative; }
.scene svg { display: block; width: 100%; height: auto; }
.lit { display: none; }
.glow .lit { display: inline; }
.hit { position: absolute; padding: 0; background: #a4e7d020; border: 1.5px solid var(--mint); border-radius: 9px; box-shadow: 0 0 12px #80f3de56; touch-action: manipulation; }
.hit::after { content: ""; position: absolute; right: 4px; top: 4px; width: 6px; height: 6px; background: var(--mint); border-radius: 50%; }
.hit.is-on { background: #f2ce8615; border-color: #ffe3a3; box-shadow: 0 0 14px #ffcf708c; }
.hit.is-on::after { background: var(--gold); }
.hit[aria-pressed="true"] { border-color: #fff9dc; box-shadow: 0 0 0 2px #fff9dc, 0 0 18px #ffcf70aa; }
.light { left: 44%; top: 3%; width: 24%; height: 20%; }
.strip { left: 1%; top: 59%; width: 26%; height: 14%; }
.garland { left: 29%; top: 41%; width: 65%; height: 13%; }
.display { left: 43%; top: 54%; width: 28.5%; height: 23%; }
.speaker { left: 74%; top: 65.5%; width: 14%; height: 16%; }
.screen { background: #1c3440; position: absolute; left: 45%; top: 57%; width: 24.7%; height: 17.6%; overflow: hidden; border-radius: 2px; color: #e6f4fb; text-align: center; padding: 3px; font-size: clamp(7px, 2.45vw, 13px); overflow-wrap: anywhere; white-space: pre-wrap; pointer-events: none; }
.screen img { width: 100%; height: 100%; display: block; object-fit: contain; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; padding: 13px; margin-top: 12px; }
#device-heading, .progress-label, .game-header { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
h2 { font-size: 1.12rem; letter-spacing: -.025em; }
.state { flex-shrink: 0; font-size: .72rem; color: var(--muted); background: #293738; border-radius: 999px; padding: 4px 8px; }
.state.on { background: #3a3926; color: #ffe3a3; }
.muted { color: var(--muted); font-size: .85rem; margin-top: 5px; }
.screen-copy { overflow-wrap: anywhere; white-space: pre-wrap; }
.actions { display: grid; gap: 6px; margin-top: 8px; }
.actions:empty { margin-top: 0; }
.action, .quiet, .primary, .game-choice, .tile { min-height: 42px; border-radius: 10px; border: 1px solid #4b6463; color: var(--text); background: #2a4141; padding: 8px 11px; }
.action, .game-choice { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
.price { color: var(--mint); white-space: nowrap; font-weight: 650; }
.notice { margin-top: 9px; color: #ffda99; font-size: .88rem; }
#connection { margin: 4px 0 12px; }
.composer { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.composer > label:first-child { font-weight: 650; }
textarea { display: block; resize: vertical; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: #121b1e; padding: 8px; }
.upload { display: block; position: relative; margin-top: 6px; padding: 10px; border: 1px dashed #64857e; border-radius: 9px; color: var(--mint); }
.upload input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.composer-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
.quiet { background: transparent; }
.primary { color: #142423; background: var(--mint); border-color: var(--mint); font-weight: 720; }
.progress-label { font-size: .88rem; }
.progress-label strong { color: var(--mint); white-space: nowrap; }
.game-choice { background: linear-gradient(145deg, #223436, #1a272a); width: 100%; margin-top: 12px; min-height: 78px; padding: 11px 12px; }
.game-choice .muted { display: block; }
.game-header .quiet { padding: 5px 8px; min-height: 36px; font-size: .8rem; white-space: nowrap; }
.flight-result { border-color: #487666; }
.flight-result.crashed { border-color: #805957; }
.flight-stage { position: relative; margin: 10px 0; }
.space-game { display: block; width: 100%; height: clamp(225px, 66vw, 340px); border: 1px solid #456064; border-radius: 14px; background: #091522; }
.flight-play, .flight-pause { position: absolute; display: grid; place-items: center; padding: 0; border: 1px solid #88c4ba; color: #e8fff8; cursor: pointer; }
.flight-play { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 82px; height: 82px; border-radius: 50%; background: #224b4c; box-shadow: 0 0 28px #6effce24, 0 5px 16px #041318b3; }
.flight-play:active { background: #37665e; }
.play-icon { margin-left: 5px; width: 29px; height: 33px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.flight-pause { right: 9px; top: 9px; width: 42px; height: 42px; border-radius: 11px; background: #143036ed; }
.pause-icon { width: 16px; height: 15px; border-right: 5px solid currentColor; border-left: 5px solid currentColor; }
.space-hud { display: flex; justify-content: space-between; gap: 8px; margin: 7px 2px 0; color: #c7d9ea; font-size: .82rem; font-variant-numeric: tabular-nums; }
.space-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.space-control { min-height: 51px; border: 1px solid #536e6c; border-radius: 10px; background: #294041; color: #edf8f2; font-size: 1rem; font-weight: 740; touch-action: none; user-select: none; }
.space-control.held { background: #3e615b; border-color: var(--mint); }
.flight-tools { margin-top: 9px; min-height: 21px; }
.flight-tools p { margin: 0; }
.flight-tools .accelerated { color: #ffd291; font-weight: 700; }
.repair-card { overflow: hidden; background: linear-gradient(145deg, #38282c, #241d25); }
.repair-card .price { color: #ffbd9d; font-variant-numeric: tabular-nums; }
.repair-now { width: 100%; margin-top: 6px; justify-content: center; }
.roulette { margin-top: 12px; }
.reel-window { position: relative; overflow: hidden; height: 76px; margin: 10px 0; border: 1px solid #705d3f; border-radius: 13px; background: #10181b; }
.reel-window::before { content: ""; position: absolute; z-index: 2; top: 0; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #ffe3a3; }
.reel-window::after { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; background: linear-gradient(90deg, #10181b 0, transparent 25%, transparent 75%, #10181b 100%); }
.reel-track { position: absolute; left: 50%; display: flex; height: 100%; align-items: center; width: max-content; }
.reel-item { display: grid; flex: 0 0 var(--reel-cell); place-items: center; height: 55px; border-right: 1px solid #334649; color: var(--gold); font-size: 1.15rem; font-weight: 800; }
.reel-item.winner { color: #fff4c9; background: #3a3926; }
.roulette-result { margin: 0 0 9px; color: var(--gold); font-size: .9rem; }
.roulette .primary { width: 100%; }
.roulette-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.countdown { color: var(--gold); font-variant-numeric: tabular-nums; }
dialog { padding: 12px; border: 1px solid var(--line); color: var(--text); background: var(--bg); border-radius: 14px; }
dialog::backdrop { background: #050709da; }
dialog img { display: block; max-width: 82vw; max-height: 70vh; margin-top: 10px; }
.account-blocked {
  width: min(390px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 27px 22px 22px;
  border-color: #77515c;
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 0%, #442b36, transparent 70%),
    linear-gradient(155deg, #253135, #161f25 74%);
  box-shadow: 0 22px 64px #010306a8, inset 0 1px #ffb0ac24;
  text-align: center;
}
.account-blocked:focus, #blocked-title:focus { outline: none; }
.account-blocked::backdrop { background: #070b11cb; backdrop-filter: blur(2px); }
html:has(.account-blocked[open]) { overflow: hidden; scrollbar-gutter: auto; }
main[inert] :is(.balance, .screen) { visibility: hidden; }
.blocked-symbol {
  position: relative; width: 68px; height: 68px; margin: 0 auto 15px;
  border: 1px solid #9a5c64; border-radius: 22px;
  color: #ffc4b9; background: radial-gradient(ellipse at 30% 10%, #794751, #382632);
  box-shadow: 0 5px 25px #e3747633, inset 0 1px #ffbaaa3b;
}
.blocked-symbol::before {
  content: ""; position: absolute; top: 16px; left: 23px;
  width: 20px; height: 24px; border: 2px solid currentColor; border-radius: 11px 11px 0 0;
  box-sizing: border-box;
}
.blocked-symbol span {
  position: absolute; top: 30px; left: 17px;
  width: 32px; height: 22px; border-radius: 6px; background: currentColor;
}
.blocked-symbol span::after {
  content: ""; position: absolute; top: 7px; left: 14px;
  width: 4px; height: 9px; border-radius: 3px; background: #58313d;
}
.account-blocked h2 { font-size: clamp(22px, 6vw, 27px); line-height: 1.15; text-wrap: balance; }
.blocked-details {
  margin-top: 19px; padding: 12px 14px;
  border: 1px solid #604952; border-radius: 12px; background: #100e1580;
  text-align: left;
}
.blocked-label { margin-bottom: 4px; color: #eeb1ad; font-size: .79rem; font-weight: 650; }
#blocked-reason { font-size: .94rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.room-action-feedback { width: min(280px, calc(100% - 32px)); padding: 26px 18px 22px; background: var(--panel); text-align: center; }
.room-action-feedback::backdrop { background: #050a0dc7; }
.room-action-feedback p { margin-top: 13px; font-size: 1.05rem; font-weight: 720; }
.feedback-symbol { display: grid; place-items: center; width: 58px; height: 58px; margin: auto; }
.feedback-spinner { width: 40px; height: 40px; border: 3px solid #456563; border-top-color: var(--mint); border-radius: 50%; animation: feedback-spin .76s linear infinite; }
.feedback-check { display: none; width: 55px; height: 55px; padding: 11px; border-radius: 50%; color: var(--mint); background: #285047; }
.room-action-feedback[data-phase="done"] .feedback-spinner { display: none; }
.room-action-feedback[data-phase="done"] .feedback-check { display: block; animation: feedback-pop .26s cubic-bezier(.2,.8,.28,1.3) both; }
.room-action-feedback[data-phase="done"] path { stroke-dasharray: 1; animation: feedback-draw .3s ease-out both; }
@keyframes feedback-spin { to { transform: rotate(360deg); } }
@keyframes feedback-pop { from { transform: scale(.76); opacity: .4; } to { transform: scale(1); opacity: 1; } }
@keyframes feedback-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (max-width: 360px) {
  main { padding-left: 11px; padding-right: 11px; }
  .state { font-size: .67rem; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-spinner, .room-action-feedback[data-phase="done"] :is(svg, path) { animation: none; }
}
