/* Rocket Stack: the canvas fills the stage; menus, touch buttons and tools are HTML over it */
.rs { display: flex; flex-direction: column; color: #dfe9ff; --rs-accent: #55d6ff; --rs-warm: #ffd166; --rs-pink: #ff5fa8; }
.rs-stage { position: relative; width: 100%; height: min(80vh, 700px); min-height: 380px; background: #03050c; overflow: hidden; outline: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
@media (max-width: 600px) { .rs-stage { height: calc(100svh - 150px); min-height: 520px; max-height: 860px; } }
@media (orientation: landscape) and (max-height: 500px) { .rs-stage { height: calc(100svh - 70px); min-height: 300px; } }
.stage.is-immersive .stage-body > .rs { min-height: 0; }
.stage.is-immersive .rs-stage { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; }
.stage.is-immersive .rs-help { display: none; }
.rs-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.rs-help .hint-touch { display: none; }
@media (pointer: coarse) { .rs-help .hint-kb { display: none; } .rs-help .hint-touch { display: inline; } }
.rs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tools (top right) */
.rs-tools { position: absolute; top: 8px; right: 8px; z-index: 4; display: flex; gap: 6px; }
.rs-tool { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(85,214,255,0.28); background: rgba(8,14,32,0.72);
  color: #bfe0ff; cursor: pointer; padding: 0; touch-action: manipulation; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.rs-tool[hidden] { display: none; }
.rs-tool svg { width: 19px; height: 19px; }
.rs-tool:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: 2px; }
@media (hover: hover) { .rs-tool:hover { border-color: var(--rs-accent); color: #fff; } }
#rs-sound .off { display: none; } #rs-sound[aria-pressed="true"] { color: #6f84a3; } #rs-sound[aria-pressed="true"] .on { display: none; } #rs-sound[aria-pressed="true"] .off { display: inline; }

/* touch buttons */
.rs-touch { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  padding: 0 max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right)); pointer-events: none; }
.rs-touch[hidden] { display: none; }
.rs-tb { pointer-events: auto; height: 50px; min-width: 56px; padding: 0 14px; border-radius: 16px; border: 1px solid rgba(85,214,255,0.35); background: rgba(8,14,32,0.72);
  color: #dff4ff; font: 800 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.08em; display: grid; place-items: center; touch-action: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); -webkit-tap-highlight-color: transparent; transition: transform .07s, background .07s, border-color .07s; }
.rs-tb svg { width: 24px; height: 24px; }
.rs-tb.is-down { transform: scale(.93); background: rgba(85,214,255,0.3); border-color: var(--rs-accent); }
.rs-tb-hold { color: var(--rs-warm); border-color: rgba(255,209,102,0.45); margin-right: auto; }
.rs-tb-drop { color: #ffb3c9; border-color: rgba(255,95,168,0.4); }

/* toast */
.rs-toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 24px); padding: 9px 16px; border-radius: 12px;
  background: rgba(16,28,64,0.94); border: 1px solid #2c4478; color: #fff; font: 700 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; pointer-events: none; text-align: center; }
.rs-toast[hidden] { display: none; }

/* loading */
.rs-loading { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: #03050c; color: #8aa3c4; font-weight: 700; }
.rs-loading[hidden] { display: none; }

/* ---------- menus ---------- */
.rs-ui { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; padding: 14px; overflow: auto; }
.rs-ui.on { display: flex; }
.rs-ui.dim { background: rgba(2,4,12,0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.rs-ui.clear { pointer-events: none; }
.rs-ui.clear .rs-card { pointer-events: auto; }
.rs-card { position: relative; width: min(560px, 100%); max-height: 100%; overflow: auto; margin: auto; padding: 20px; border-radius: 18px; border: 1px solid rgba(85,214,255,0.22);
  background: linear-gradient(180deg, rgba(14,24,54,0.94), rgba(7,11,28,0.96)); box-shadow: 0 24px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #dfe9ff; animation: rs-up .2s ease-out; scrollbar-width: thin; }
.rs-card.narrow { width: min(400px, 100%); }
.rs-card.wide { width: min(760px, 100%); }
@keyframes rs-up { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .rs-card { animation: none; } }
.rs-reduced .rs-card { animation: none; }
.rs-card h2 { margin: 0 0 4px; font-size: 22px; color: #fff; letter-spacing: -0.01em; }
.rs-card h3 { margin: 16px 0 8px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #8aa3c4; }
.rs-card p { margin: 0 0 10px; color: #b9c9e4; }
.rs-sub { color: #9fb3d4; font-size: 14px; }
.rs-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: #cfe0ff; font-size: 20px; cursor: pointer; }
.rs-x:hover { background: rgba(255,255,255,0.16); }

/* title */
.rs-logo { display: flex; flex-direction: column; align-items: center; margin: 2px 0 14px; }
.rs-logo b { font: 900 clamp(30px, 8vw, 48px)/0.95 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.04em; background: linear-gradient(180deg, #ffffff 10%, #8fe6ff 60%, #55d6ff);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(85,214,255,0.45)); }
.rs-logo b + b { background: linear-gradient(90deg, #ffc23d, #ff7a45 45%, #ff5fa8); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px rgba(255,95,168,0.4)); }
.rs-logo span { margin-top: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.3em; color: #8aa3c4; }

/* buttons */
.rs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.rs-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rs-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: 12px 14px; border-radius: 14px; text-align: left;
  border: 1px solid #22355e; background: rgba(13,22,48,0.9); color: #e8f0ff; cursor: pointer; font: inherit; transition: border-color .15s, background .15s, transform .1s; }
.rs-tile b { font-size: 16px; font-weight: 800; color: #fff; }
.rs-tile small { font-size: 12.5px; color: #9fb3d4; line-height: 1.3; }
.rs-tile i { position: absolute; top: 10px; right: 12px; font-style: normal; font-size: 12px; font-weight: 800; color: var(--rs-warm); }
.rs-tile:hover, .rs-tile:focus-visible { border-color: var(--rs-accent); background: rgba(22,40,79,0.95); outline: none; }
.rs-tile:active { transform: translateY(1px); }
.rs-tile.go { border-color: rgba(255,209,102,0.6); background: linear-gradient(180deg, rgba(60,44,10,0.85), rgba(30,22,6,0.9)); }
.rs-tile.go b { color: var(--rs-warm); }
.rs-tile.pink { border-color: rgba(255,95,168,0.5); }
.rs-tile.pink b { color: #ff9cc8; }
.rs-tile .tag { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 800; color: #9ff0c2; }
.rs-tile[disabled] { opacity: .45; cursor: default; }
.rs-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.rs-row > .rs-btn { flex: 1 1 auto; }
.rs-btn { appearance: none; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid #22355e; background: #111d3b; color: #dfe9ff; font: 800 14px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer; transition: border-color .15s, background .15s; }
.rs-btn:hover, .rs-btn:focus-visible { border-color: var(--rs-accent); color: #fff; outline: none; }
.rs-btn.go { background: var(--rs-warm); border-color: var(--rs-warm); color: #1a1200; }
.rs-btn.go:hover, .rs-btn.go:focus-visible { background: #ffe08a; color: #1a1200; box-shadow: 0 0 0 3px rgba(255,209,102,0.35); }
.rs-btn.warn { border-color: rgba(255,107,129,0.6); color: #ffb3bf; }
.rs-btn.small { min-height: 34px; padding: 6px 10px; font-size: 12.5px; }
.rs-seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: #070e20; border: 1px solid #1f3056; flex-wrap: wrap; }
.rs-seg button { flex: 1 1 0; min-width: 0; min-height: 38px; padding: 6px 8px; border: 0; border-radius: 9px; background: transparent; color: #9fb3d4; font: 800 13px/1.15 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; white-space: nowrap; }
.rs-seg button[aria-pressed="true"] { background: #16284f; color: #fff; box-shadow: inset 0 0 0 1.5px var(--rs-accent); }
.rs-seg button:focus-visible { outline: 2px solid var(--rs-warm); outline-offset: 1px; }
.rs-opts { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; margin: 6px 0; }
.rs-opts label, .rs-opts .k { font-size: 13px; font-weight: 700; color: #b9c9e4; }
.rs-tabs { display: flex; gap: 4px; margin: 10px 0 12px; flex-wrap: wrap; }
.rs-tabs button { flex: 1 1 auto; min-height: 36px; border-radius: 9px; border: 1px solid #22355e; background: #0d1733; color: #9fb3d4; font: 800 13px/1 system-ui, sans-serif; cursor: pointer; }
.rs-tabs button[aria-pressed="true"] { border-color: var(--rs-accent); color: #fff; background: rgba(85,214,255,0.12); }
.rs-set { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; }
.rs-set .n { font-size: 14px; font-weight: 700; color: #dfe9ff; }
.rs-set .n small { display: block; font-weight: 500; font-size: 12px; color: #8aa3c4; }
.rs-set input[type=range] { width: min(180px, 42vw); accent-color: var(--rs-accent); }
.rs-set output { display: inline-block; min-width: 54px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; font-size: 13px; }
.rs-switch { position: relative; width: 46px; height: 26px; border-radius: 13px; border: 0; background: #2b3448; cursor: pointer; padding: 0; }
.rs-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.rs-switch[aria-checked="true"] { background: #2ec27e; }
.rs-switch[aria-checked="true"]::after { left: 23px; }
.rs-keys { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 8px; align-items: center; font-size: 13.5px; }
.rs-key { min-width: 64px; min-height: 32px; padding: 4px 8px; border-radius: 8px; border: 1px solid #2a3e6a; background: #0a1430; color: #fff; font: 800 12.5px/1 system-ui, sans-serif; cursor: pointer; }
.rs-key.wait { border-color: var(--rs-warm); color: var(--rs-warm); animation: rs-blink 1s infinite; }
@keyframes rs-blink { 50% { opacity: .5; } }

/* results */
.rs-big { font: 900 34px/1.05 system-ui, sans-serif; color: #fff; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.rs-big.win { color: var(--rs-warm); text-shadow: 0 0 18px rgba(255,209,102,0.45); }
.rs-big.lose { color: #ff8fa6; }
.rs-best { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255,209,102,0.16); color: var(--rs-warm); font-weight: 800; font-size: 12.5px; margin: 4px 0 8px; }
.rs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; margin: 10px 0; }
.rs-stats div { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.rs-stats span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #8aa3c4; }
.rs-stats b { font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.rs-manifest { display: flex; gap: 4px; align-items: flex-end; height: 60px; margin: 6px 0 2px; padding: 0 2px; }
.rs-manifest div { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; font-size: 10.5px; font-weight: 800; color: #9fb3d4; }
.rs-manifest i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; box-shadow: 0 0 10px currentColor; }
.rs-clears { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; margin: 6px 0; }
.rs-clears span { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.05); color: #cfe0ff; }
.rs-clears span b { color: #fff; }
.rs-score { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0; font: 900 28px/1 system-ui, sans-serif; color: #fff; }
.rs-score small { font-size: 13px; font-weight: 700; color: #9fb3d4; }
.rs-count { font: 900 clamp(60px, 18vw, 120px)/1 system-ui, sans-serif; color: #fff; text-shadow: 0 0 30px rgba(85,214,255,0.8); pointer-events: none; }

/* online */
.rs-link { display: flex; gap: 6px; margin: 6px 0 10px; }
.rs-link input, .rs-input { flex: 1; min-width: 0; min-height: 42px; padding: 8px 12px; border-radius: 10px; border: 1px solid #24375e; background: #060c1c; color: #e8f0ff; font: 700 15px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; }
.rs-code { font: 900 26px/1 ui-monospace, Menlo, monospace; letter-spacing: 0.12em; color: var(--rs-warm); }
.rs-spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(85,214,255,0.25); border-top-color: var(--rs-accent); animation: rs-rot .9s linear infinite; flex: none; }
@keyframes rs-rot { to { transform: rotate(360deg); } }
.rs-wait { display: flex; align-items: center; gap: 10px; color: #cfe0ff; font-weight: 700; margin: 10px 0; }
.rs-open { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rs-open li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; background: #0a1328; border: 1px solid #1c2b4a; font-size: 13px; color: #9fb3d4; }
.rs-open li b { color: #fff; }
.rs-open li span { flex: 1; }
.rs-err { color: #ff8fa0; font-size: 13.5px; margin: 8px 0 0; }
.rs-err:empty { display: none; }
.rs-help-list { margin: 0; padding-left: 18px; color: #b9c9e4; font-size: 14px; }
.rs-help-list li { margin: 0 0 6px; }
.rs-help-list b { color: #fff; }
.rs-kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 5px; background: #16213a; color: #bfe9ff; font: 700 12px/1.5 system-ui, sans-serif; text-align: center; }
.rs-pieces { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.rs-pieces span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,0.05); font-size: 12.5px; font-weight: 700; }
.rs-pieces i { width: 12px; height: 12px; border-radius: 3px; box-shadow: 0 0 8px currentColor; background: currentColor; }
@media (max-width: 420px) { .rs-card { padding: 16px 14px; border-radius: 16px; } .rs-grid { grid-template-columns: 1fr 1fr; } .rs-tile { min-height: 58px; padding: 10px 11px; } .rs-tile b { font-size: 15px; } }
