@font-face{font-family:Nunito;src:url('./nunito-400.ttf') format('truetype');font-weight:400;font-display:swap}
@font-face{font-family:Nunito;src:url('./nunito-600.ttf') format('truetype');font-weight:600;font-display:swap}
@font-face{font-family:Nunito;src:url('./nunito-700.ttf') format('truetype');font-weight:700;font-display:swap}
@font-face{font-family:Nunito;src:url('./nunito-800.ttf') format('truetype');font-weight:800;font-display:swap}
@font-face{font-family:Nunito;src:url('./nunito-900.ttf') format('truetype');font-weight:900 1000;font-display:swap}
:root {
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  color: #332d4b;
  font-synthesis: none;
  --ink: #332d4b;
  --muted: #7b7795;
  --cream: #fffefa;
  --rose: #ff5b6a;
  --rose-dark: #c93c55;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: #243f38; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible { outline: 4px solid #ffe483; outline-offset: 4px; }
button, a, input { -webkit-user-select: none; user-select: none; }
h1, h2, h3, p { margin: 0; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.surface { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; pointer-events: auto; }
.surface button, .surface input { pointer-events: auto; }
.surface-menu::before { content: ""; position: fixed; inset: 0; background: linear-gradient(90deg, #1e26334d, transparent 52%), linear-gradient(0deg, #122d3b70, transparent 32%); pointer-events: none; }
.top-tools { position: absolute; z-index: 3; left: max(22px, env(safe-area-inset-left)); right: max(22px, env(safe-area-inset-right)); top: max(18px, env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.local-chip { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; background: #fffffff2; border-radius: 24px; box-shadow: 0 3px 0 #262a4812; color: #36314e; font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.local-dot { width: 8px; height: 8px; border-radius: 50%; background: #60b376; box-shadow: 0 0 0 3px #60b37620; }
.top-actions { display: flex; gap: 8px; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 50%; background: #fffffff2; font-size: 21px; font-weight: 900; box-shadow: 0 3px 0 #262a4812; transition: transform .15s, background .15s; }
.icon-button:hover { background: white; transform: translateY(-2px); }
.menu-layout { position: relative; min-height: calc(100% - 100px); display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(370px, 470px); align-items: center; gap: 50px; max-width: 1390px; margin: auto; padding: 105px 54px 40px; }
.menu-identity { padding: 0 0 30px; transform: rotate(-3deg); }
.wordmark { position: relative; width: fit-content; }
.wordmark-title { position: relative; color: #fff; font-size: clamp(65px, 8.1vw, 126px); line-height: 1.1; letter-spacing: -7px; font-weight: 1000; -webkit-text-stroke: 1px #32316c; text-shadow: 0 6px 0 #38336b, 2px 0 0 #38336b, -2px 0 0 #38336b, 0 -2px 0 #38336b, 0 10px 14px #172f305c; white-space: nowrap; }
.wordmark-gold { color: #ffd140; }
.wordmark-ball { position: absolute; right: -19px; top: -3px; width: 23px; height: 23px; border: 3px solid #332e65; border-radius: 50%; background: linear-gradient(#ff7952 45%, #332e65 45% 57%, #fff 57%); box-shadow: 0 3px #38336b; transform: rotate(25deg); }
.wordmark-ball::after, .ball-icon::after { content: ""; position: absolute; inset: 34%; border: 1px solid #4a415a; border-radius: 50%; background: white; }
.edition-badge { display: inline-flex; align-items: center; gap: 7px; margin: 7px 0 0 5px; padding: 4px 9px 4px 4px; color: #61577d; background: #fffffff5; border-radius: 18px; box-shadow: 0 3px 0 #39346d6b; font-size: 12px; font-weight: 900; }
.edition-badge b { padding: 3px 6px; color: white; background: #ff7749; border-radius: 12px; font-size: 10px; letter-spacing: .06em; }
.wordmark-tagline { margin: 22px 8px 0; font-size: 17px; font-weight: 800; color: white; text-shadow: 0 2px 3px #243448; }
.welcome-card { width: 100%; background: #fffefaed; border-radius: 26px; overflow: hidden; box-shadow: 0 16px 45px #19362c35; transform: rotate(1deg); pointer-events: auto; }
.striped-heading { display: flex; align-items: center; gap: 14px; padding: 18px 26px; color: #fff; background: repeating-linear-gradient(-45deg, #ffffff00 0 10px, #ffffff12 10px 20px), linear-gradient(100deg, #ff606b, #ffa246); }
.striped-heading h1, .striped-heading h2 { font-size: 24px; line-height: 1.15; font-weight: 1000; letter-spacing: -.5px; }
.ball-icon { position: relative; display: block; width: 20px; height: 20px; flex: 0 0 20px; border: 2px solid #6b475b; border-radius: 50%; background: linear-gradient(#ffb445 44%, #6b475b 44% 56%, #fff 56%); transform: rotate(-20deg); box-shadow: 0 2px 0 #6b475b55; }
.welcome-body { padding: 25px 24px 22px; }
.welcome-eyebrow { font-size: 10px; letter-spacing: .16em; font-weight: 900; text-align: center; color: #8a819e; margin-bottom: 17px; }
.benefit-list { display: grid; gap: 7px; margin-bottom: 22px; }
.benefit { display: flex; gap: 12px; align-items: center; min-height: 47px; padding: 10px 13px; border-radius: 15px; background: #f1edf8e8; font-size: 13px; line-height: 1.35; font-weight: 800; }
.benefit-icon { display: inline-grid; place-items: center; width: 22px; flex: 0 0 22px; font-size: 24px; color: #ff9364; line-height: 1; }
.primary-button { display: flex; width: 100%; min-height: 62px; justify-content: center; align-items: center; padding: 15px 20px; border: 0; border-bottom: 5px solid var(--rose-dark); border-radius: 36px; color: white; background: repeating-linear-gradient(-45deg, #ffffff00 0 11px, #ffffff0c 11px 22px), linear-gradient(#ff7279, #ff5266); text-shadow: 0 2px #cc405144; box-shadow: 0 5px 12px #a72b4033, inset 0 1px 0 #ffffff33; font-size: 21px; line-height: 1.15; font-weight: 1000; letter-spacing: -.4px; transition: filter .15s, transform .15s, box-shadow .15s; }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-2px); box-shadow: 0 8px 16px #a72b4040; }
.primary-button:active { transform: translateY(2px); box-shadow: 0 1px 3px #a72b4033; }
.secondary-button { min-height: 44px; border: 2px solid #e8e3f0; border-bottom-width: 3px; border-radius: 15px; padding: 10px 15px; background: #fff; color: #625675; font-size: 13px; font-weight: 900; transition: background .15s, border-color .15s; }
.secondary-button:hover { background: #f6f2fc; border-color: #d8cfe8; }
.new-adventure { width: 100%; margin-top: 12px; }
.text-button { border: 0; background: none; padding: 8px 5px; color: #77678c; font-size: 12px; line-height: 1.3; font-weight: 900; text-decoration: underline; text-decoration-color: #c2b7d2; text-underline-offset: 4px; }
.text-button:hover { color: #c9435b; }
.menu-shortcuts { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 11px 0 18px; }
.shortcut-separator { color: #beb3ce; }
.menu-stats { display: flex; justify-content: space-around; gap: 10px; padding: 15px 0; border-top: 1px solid #e8e1ed; margin-bottom: 6px; }
.metric { display: flex; align-items: center; flex-direction: column; gap: 3px; }
.metric strong { font-size: 23px; font-weight: 1000; line-height: 1; }
.metric span { color: #827594; font-size: 8px; font-weight: 1000; letter-spacing: .08em; white-space: nowrap; }
.menu-stats .metric strong { font-size: 21px; }
.save-status { color: #8b819b; font-size: 10px; font-weight: 700; line-height: 1.45; margin-top: 17px; text-align: center; }
.fan-footer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; width: fit-content; max-width: calc(100% - 36px); margin: 0 auto; padding: 15px 25px max(16px, env(safe-area-inset-bottom)); color: #ffffffe3; text-align: center; font-size: 10px; font-weight: 700; line-height: 1.5; text-shadow: 0 1px 3px #0d2a28; }
.fan-footer strong { font-size: 12px; font-weight: 900; }
.fan-footer span { opacity: .8; }
.surface-selection, .surface-upgrade, .surface-pause, .surface-result { background: #172c3a50; backdrop-filter: blur(5px); }
.selection-layout { max-width: 1040px; min-height: calc(100% - 65px); margin: auto; display: flex; flex-direction: column; justify-content: center; padding: 78px 30px 22px; }
.selection-heading { color: #fff; text-align: center; margin-bottom: 24px; text-shadow: 0 3px 4px #20302f66; }
.eyebrow { color: #fff; font-size: 12px; font-weight: 1000; letter-spacing: .2em; text-align: center; }
.selection-heading .eyebrow { margin-bottom: 6px; }
.selection-heading h1, .upgrade-layout > h1 { color: white; font-size: clamp(30px, 4.2vw, 53px); line-height: 1.15; letter-spacing: -1.4px; font-weight: 1000; text-shadow: 0 4px 0 #2e38544d; }
.selection-subtitle { color: white; text-align: center; font-size: 13px; line-height: 1.5; font-weight: 800; margin: 8px auto 0; max-width: 560px; }
.mobile-selection-hint { display: none; }
.starter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.starter-card { display: block; min-width: 0; text-align: left; padding: 0; background: var(--cream); border: 4px solid transparent; border-radius: 29px; box-shadow: 0 8px 0 #162d3c29, 0 15px 35px #162d3c3d; overflow: hidden; transition: transform .17s, border-color .17s; }
.starter-card:hover { transform: translateY(-5px); }
.starter-card.is-selected { border-color: #ff6776; transform: translateY(-6px); box-shadow: 0 0 0 3px #fff5, 0 12px 25px #172d3b55; }
.starter-art { position: relative; height: 259px; overflow: hidden; background: repeating-conic-gradient(from 0deg at 50% 65%, #ffffff0e 0deg 14deg, transparent 14deg 28deg), radial-gradient(ellipse at 50% 65%, #ffffff60, transparent 70%), var(--companion-color); border-radius: 23px 23px 16px 16px; }
.starter-art::after { content: ""; position: absolute; z-index: 0; width: 65%; height: 38px; border: 2px solid #ffffff70; background: #ffffff22; border-radius: 50%; left: 17.5%; top: 147px; }
.starter-number { position: absolute; top: 2px; right: 13px; color: #fff3; font-size: 64px; line-height: 1; font-weight: 1000; letter-spacing: -4px; }
.starter-portrait { position: absolute; width: 168px; height: 168px; object-fit: contain; top: 18px; left: calc(50% - 84px); z-index: 1; filter: drop-shadow(0 10px 3px #273a2e2b); }
.starter-identity { position: absolute; bottom: 12px; left: 12px; right: 28px; z-index: 2; padding: 10px 13px 11px; border-left: 7px solid var(--companion-color); background: white; border-radius: 15px; transform: skew(-5deg); box-shadow: 0 4px 12px #263e3e1f; }
.starter-identity > * { transform: skew(5deg); }
.starter-role { display: block; font-size: 8px; font-weight: 1000; letter-spacing: .17em; color: #756588; text-transform: uppercase; margin-bottom: 3px; }
.starter-identity h2 { font-size: 24px; line-height: 1.1; font-weight: 1000; letter-spacing: -.7px; }
.element-pill { display: inline-block; margin-top: 5px; padding: 3px 10px; border-radius: 12px; color: #fff; background: var(--companion-dark, #4f7c71); font-size: 10px; line-height: 1.1; font-weight: 900; }
.starter-info { padding: 14px 13px 15px; }
.starter-description { min-height: 36px; color: #746581; font-size: 11px; line-height: 1.45; font-weight: 700; }
.starter-stats { display: flex; justify-content: space-around; padding: 13px 0; margin: 9px 0 0; border-top: 1px solid #ece6f2; border-bottom: 1px solid #ece6f2; }
.starter-stats .metric strong { font-size: 19px; }
.starter-details { display: grid; gap: 2px; padding-top: 12px; }
.mini-label { display: block; font-size: 8px; letter-spacing: .14em; font-weight: 1000; color: #8d809d; }
.starter-details strong { font-size: 12px; font-weight: 900; margin-bottom: 7px; }
.starter-details strong:last-child { margin-bottom: 0; }
.selection-actions { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: 24px; }
.selection-confirm { width: auto; min-width: 340px; min-height: 60px; }
.light-text { color: white; text-decoration-color: #fff6; }
.light-text:hover { color: #ffe7a3; }
.surface-game { overflow: hidden; pointer-events: none; }
.game-hud { display: flex; justify-content: space-between; align-items: start; gap: 20px; position: absolute; top: max(18px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right)); }
.hud-player { display: flex; align-items: center; gap: 9px; padding: 7px 15px 7px 7px; width: 275px; background: #fffdf8ed; border-radius: 45px 18px 18px 45px; border: 2px solid #fff8; box-shadow: 0 4px 0 #18343122; }
.hud-portrait { width: 51px; height: 51px; object-fit: contain; border-radius: 50%; background: #e8f3dc; border: 2px solid #b6d594; }
.hud-player-data { flex: 1; min-width: 0; }
.hud-name { font-size: 13px; font-weight: 1000; display: block; margin-bottom: 6px; }
.hp-track { height: 17px; position: relative; background: #d9d9d5; border-radius: 7px; box-shadow: inset 0 2px 3px #0002; overflow: hidden; }
.hp-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(#7ed669, #4faf58); border-bottom: 3px solid #37924b; transition: width .15s; }
.hp-fill.is-low { background: linear-gradient(#ff8990, #ee5b72); border-color: #c93c55; }
.hp-text { position: absolute; inset: 0; color: #fff; font-size: 10px; font-weight: 900; text-align: center; line-height: 17px; text-shadow: 0 1px 2px #234736; }
.hud-run { display: flex; gap: 20px; align-items: center; background: #fffdf8ed; border: 2px solid #fff8; padding: 10px 12px 10px 20px; border-radius: 20px; box-shadow: 0 4px 0 #18343122; }
.hud-run .metric strong { font-size: 24px; min-width: 44px; }
.hud-run .metric span { font-size: 8px; }
.pause-button { width: 37px; height: 37px; border: 0; border-radius: 12px; background: #efe8f6; font-size: 23px; font-weight: 900; color: #715d86; }
.pause-button:hover { background: #e2d7ee; }
.xp-row { position: absolute; left: max(22px, env(safe-area-inset-left)); right: max(22px, env(safe-area-inset-right)); top: max(100px, calc(env(safe-area-inset-top) + 82px)); display: flex; gap: 10px; align-items: center; }
.level-label { color: #ffed91; font-size: 12px; font-weight: 1000; text-shadow: 0 2px 3px #173c36; white-space: nowrap; }
.xp-track { height: 9px; flex: 1; border: 2px solid #ffffffb3; border-radius: 6px; background: #132b4155; overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a88ef2, #d1acff); transition: width .15s; }
.xp-text { color: #fff; font-size: 10px; font-weight: 800; text-shadow: 0 2px 3px #173c36; }
.game-control-hint { position: absolute; bottom: max(19px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 9px 14px; color: #ffffffe0; background: #143b3370; border: 1px solid #ffffff17; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; backdrop-filter: blur(5px); }
kbd { display: inline-block; padding: 3px 5px; border-radius: 5px; background: white; color: #635c78; font: 900 9px/1.1 inherit; box-shadow: 0 2px 0 #0002; }
.upgrade-layout { max-width: 940px; min-height: 100%; margin: auto; display: flex; flex-direction: column; justify-content: center; padding: 40px 30px; text-align: center; }
.upgrade-layout > h1 { margin-top: 5px; font-size: 64px; }
.upgrade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 30px; }
.upgrade-card { position: relative; border: 4px solid #fff; background: var(--cream); border-radius: 25px; padding: 24px 20px 20px; text-align: center; box-shadow: 0 10px 25px #122b3344; transition: transform .17s, border-color .17s; }
.upgrade-card:hover, .upgrade-card:focus-visible { transform: translateY(-6px); border-color: #ffac76; }
.upgrade-index { position: absolute; top: 11px; left: 13px; color: #c1b4d2; font-size: 13px; font-weight: 900; }
.upgrade-icon { display: inline-grid; place-items: center; width: 75px; height: 75px; border-radius: 24px; background: #f1e9fc; font-size: 36px; margin-bottom: 18px; }
.upgrade-card h2 { font-size: 22px; font-weight: 1000; line-height: 1.15; }
.upgrade-card p { color: #7c6c8c; font-size: 12px; font-weight: 700; line-height: 1.5; min-height: 54px; margin-top: 12px; }
.upgrade-choose { display: block; padding: 11px; margin-top: 20px; background: #ffebda; border-radius: 12px; color: #b97845; font-size: 12px; font-weight: 1000; }
.surface-pause, .surface-result, .surface-error { display: grid; place-items: center; padding: 25px; }
.center-panel { width: min(100%, 470px); margin: auto; background: var(--cream); border-radius: 26px; overflow: hidden; box-shadow: 0 20px 60px #142c3e45; pointer-events: auto; }
.center-panel-body { padding: 28px; text-align: center; }
.panel-intro { color: #8d7c9b; font-size: 13px; line-height: 1.5; margin-bottom: 24px; font-weight: 700; }
.pause-options { display: grid; gap: 10px; margin-top: 20px; }
.result-portrait { width: 125px; height: 125px; object-fit: contain; margin: -12px auto 5px; filter: drop-shadow(0 7px 0 #ddd7e259); }
.result-panel .panel-intro { margin-bottom: 20px; }
.result-stats { display: flex; gap: 10px; justify-content: space-around; padding: 17px 0; border-top: 1px solid #eee6f2; border-bottom: 1px solid #eee6f2; }
.result-stats strong { font-size: 27px; }
.result-panel .secondary-button { width: 100%; margin-top: 13px; }
.record-line { font-size: 10px; color: #9d8aa8; font-weight: 800; line-height: 1.4; margin: 12px 0 24px; }
.victory-heading { background: repeating-linear-gradient(-45deg, #ffffff00 0 10px, #ffffff12 10px 20px), linear-gradient(100deg, #e7ae47, #ffc257); }
.game-dialog { color: var(--ink); width: min(calc(100% - 32px), 520px); max-height: calc(100dvh - 36px); border: 3px solid #fff; border-radius: 25px; padding: 0; background: var(--cream); box-shadow: 0 20px 70px #10272a70; pointer-events: auto; overflow: auto; overscroll-behavior: contain; }
.game-dialog::backdrop { background: #17263b80; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; gap: 15px; align-items: start; justify-content: space-between; padding: 23px 22px 18px; border-bottom: 1px solid #ece4f1; }
.dialog-heading h2 { font-size: 24px; font-weight: 1000; letter-spacing: -.5px; }
.dialog-heading p { margin-top: 7px; color: #9b88a4; font-size: 11px; line-height: 1.5; font-weight: 700; }
.dialog-heading .icon-button { width: 29px; height: 29px; flex-basis: 29px; font-size: 24px; background: #f1ecf7; box-shadow: none; }
.dialog-body { padding: 22px; }
.dialog-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dialog-actions > * { flex: 1; min-width: 160px; }
.compact-button { min-height: 48px; padding: 11px 20px; border-radius: 23px; font-size: 16px; border-bottom-width: 4px; }
.help-controls { display: grid; gap: 8px; }
.help-control { display: flex; align-items: center; gap: 16px; padding: 10px 12px; background: #f3eef8; border-radius: 11px; }
.help-control kbd { min-width: 130px; font-size: 10px; padding: 6px; text-align: center; }
.help-control span { font-size: 11px; font-weight: 800; line-height: 1.4; }
.touch-help { color: #9784a3; font-size: 10px; line-height: 1.6; font-weight: 700; margin: 12px 0 20px; }
.help-steps { padding: 0 0 0 23px; margin: 0 0 24px; }
.help-steps li { padding-left: 5px; margin-bottom: 15px; font-size: 12px; font-weight: 900; }
.help-steps li::marker { color: #e9976e; font-weight: 1000; }
.help-steps p { margin-top: 4px; color: #9986a6; font-size: 11px; line-height: 1.55; font-weight: 700; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 4px 0 22px; margin-bottom: 18px; border-bottom: 1px solid #eee7f3; cursor: pointer; }
.setting-copy { display: grid; gap: 5px; }
.setting-copy strong { font-size: 14px; font-weight: 1000; }
.setting-copy small { color: #9985a7; font-size: 10px; font-weight: 700; line-height: 1.5; }
.setting-toggle { appearance: none; width: 44px; height: 26px; flex: 0 0 44px; border-radius: 15px; background: #d7cfe1; padding: 3px; cursor: pointer; transition: background .15s; }
.setting-toggle::before { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 2px 3px #58436933; transition: transform .15s; }
.setting-toggle:checked { background: #7abd87; }
.setting-toggle:checked::before { transform: translateX(18px); }
.save-settings { padding-bottom: 20px; }
.save-settings h3 { font-size: 15px; font-weight: 1000; }
.save-settings > p { color: #9985a7; font-size: 11px; line-height: 1.5; font-weight: 700; margin-top: 7px; }
.save-actions { display: flex; gap: 10px; margin-top: 17px; }
.save-actions > button { flex: 1; font-size: 11px; padding: 9px; }
.save-settings .save-status { font-size: 10px; }
.toast-host { position: absolute; z-index: 50; bottom: max(28px, env(safe-area-inset-bottom)); left: 16px; right: 16px; display: flex; justify-content: center; }
.toast { width: fit-content; max-width: 450px; background: #fffdf7; border: 2px solid #fff; padding: 13px 20px; border-radius: 18px; box-shadow: 0 7px 30px #163c3640; font-size: 12px; line-height: 1.5; font-weight: 800; animation: toast-in .2s ease-out; }
.loading-overlay { position: absolute; z-index: 60; inset: 0; display: grid; place-content: center; justify-items: center; gap: 20px; background: #253e3de8; color: white; pointer-events: auto; }
.loading-label { font-size: 17px; font-weight: 900; text-shadow: 0 2px #17342d; padding: 0 20px; text-align: center; }
.loading-spinner { width: 48px; height: 48px; border: 4px solid #ffffff33; border-top-color: #ffd27b; border-right-color: #ff907a; border-radius: 50%; animation: spin .85s linear infinite; }
.surface-error { background: #21382be0; }
.error-symbol { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; background: #f2a05e; font-size: 34px; font-weight: 1000; margin: 0 0 19px; }
.error-panel h1 { font-size: 26px; font-weight: 1000; }
.error-message { margin: 18px 0 24px; color: #8c769c; font-size: 13px; line-height: 1.6; font-weight: 700; overflow-wrap: anywhere; }
.error-hint { color: #a28faf; font-size: 10px; font-weight: 700; line-height: 1.6; margin-top: 20px; }
.noscript-notice { position: fixed; inset: 0; display: grid; place-content: center; gap: 18px; padding: 25px; background: #213c36; text-align: center; color: white; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; clip-path: inset(50%) !important; }
#touch-controls { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#touch-controls button { pointer-events: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 1050px) and (min-width: 701px) {
  .menu-layout { grid-template-columns: minmax(0, 1fr) minmax(330px, .95fr); gap: 30px; padding: 95px 35px 30px; }
  .wordmark-title { font-size: 7.9vw; letter-spacing: -4px; }
  .wordmark-tagline { font-size: 13px; }
  .welcome-body { padding: 22px 18px; }
  .striped-heading { padding: 18px 20px; }
  .striped-heading h2 { font-size: 22px; }
}
@media (max-width: 700px) {
  .top-tools { top: max(13px, env(safe-area-inset-top)); left: max(15px, env(safe-area-inset-left)); right: max(15px, env(safe-area-inset-right)); }
  .local-chip { font-size: 9px; padding: 9px 11px; }
  .top-actions { gap: 6px; }
  .icon-button { width: 32px; height: 32px; flex-basis: 32px; font-size: 18px; }
  .menu-layout { min-height: calc(100% - 74px); display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 66px 22px 20px; }
  .menu-identity { padding: 0; width: fit-content; max-width: 100%; transform: rotate(-3deg); }
  .wordmark-title { font-size: clamp(48px, 14.5vw, 90px); letter-spacing: -4px; }
  .wordmark-ball { right: -10px; top: -4px; width: 16px; height: 16px; border-width: 2px; }
  .edition-badge { font-size: 10px; margin-top: 4px; }
  .edition-badge b { font-size: 8px; padding: 3px 6px; }
  .wordmark-tagline { display: none; }
  .welcome-card { max-width: 420px; border-radius: 24px; transform: rotate(1deg); }
  .striped-heading { padding: 18px 22px; gap: 12px; }
  .striped-heading h2 { font-size: 24px; }
  .welcome-body { padding: 20px 18px 18px; }
  .welcome-eyebrow { font-size: 8px; margin-bottom: 14px; }
  .benefit-list { gap: 7px; margin-bottom: 20px; }
  .benefit { font-size: 12px; min-height: 44px; padding: 10px 12px; gap: 9px; }
  .primary-button { min-height: 58px; font-size: 20px; }
  .menu-shortcuts { margin: 9px 0 5px; }
  .save-status { margin-top: 13px; font-size: 9px; }
  .menu-stats { margin-top: 13px; padding: 12px 0; }
  .fan-footer { padding: 8px 0 max(14px, env(safe-area-inset-bottom)); gap: 2px; font-size: 8px; }
  .fan-footer strong { font-size: 10px; }
  .selection-layout { padding: 69px 15px 15px; min-height: calc(100% - 55px); }
  .selection-heading { margin-bottom: 18px; }
  .eyebrow { font-size: 8px; letter-spacing: .17em; }
  .selection-heading h1 { font-size: 31px; letter-spacing: -1px; }
  .selection-subtitle { font-size: 10px; max-width: 300px; margin-top: 7px; }
  .starter-grid { gap: 8px; }
  .starter-card { border-width: 3px; border-radius: 17px; box-shadow: 0 5px 0 #162d3c29, 0 8px 16px #162d3c3d; }
  .starter-card.is-selected { transform: translateY(-3px); box-shadow: 0 0 0 2px #fff7, 0 7px 12px #172d3b55; }
  .starter-art { height: 154px; border-radius: 12px 12px 10px 10px; }
  .starter-number { font-size: 35px; right: 5px; letter-spacing: -2px; }
  .starter-portrait { width: 96px; height: 96px; top: 6px; left: calc(50% - 48px); }
  .starter-art::after { height: 21px; top: 79px; border-width: 1px; }
  .starter-identity { left: 4px; right: 5px; bottom: 6px; padding: 6px 3px 6px 5px; border-left-width: 3px; border-radius: 8px; }
  .starter-role { font-size: 5px; letter-spacing: .05em; line-height: 1.3; min-height: 7px; margin-bottom: 2px; }
  .starter-identity h2 { font-size: clamp(10px, 3.1vw, 18px); letter-spacing: -.5px; }
  .element-pill { font-size: 6px; padding: 2px 5px; margin-top: 4px; }
  .starter-info { padding: 8px 5px 9px; }
  .starter-description { font-size: 8px; line-height: 1.4; min-height: 56px; }
  .starter-stats { padding: 9px 0; gap: 2px; margin-top: 8px; }
  .starter-stats .metric { gap: 3px; }
  .starter-stats .metric strong { font-size: 13px; }
  .starter-stats .metric span { font-size: 5px; letter-spacing: .03em; }
  .starter-details { padding-top: 8px; gap: 3px; }
  .mini-label { font-size: 5px; letter-spacing: .08em; }
  .starter-details strong { font-size: 8px; line-height: 1.25; min-height: 20px; margin-bottom: 3px; overflow-wrap: anywhere; }
  .selection-actions { margin-top: 19px; }
  .selection-confirm { min-width: 0; width: min(100%, 340px); min-height: 54px; font-size: 18px; }
  .game-hud { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); gap: 8px; align-items: stretch; }
  .hud-player { width: 49%; gap: 5px; padding: 5px 8px 5px 5px; border-radius: 30px 13px 13px 30px; }
  .hud-portrait { width: 37px; height: 37px; }
  .hud-name { font-size: 10px; margin-bottom: 4px; }
  .hp-track { height: 13px; border-radius: 5px; }
  .hp-text { font-size: 8px; line-height: 13px; }
  .hud-run { gap: 8px; padding: 6px 7px 6px 9px; border-radius: 13px; }
  .hud-run .metric strong { min-width: 30px; font-size: 17px; }
  .hud-run .metric span { font-size: 6px; }
  .pause-button { width: 29px; height: 30px; border-radius: 9px; font-size: 19px; }
  .xp-row { top: max(75px, calc(env(safe-area-inset-top) + 65px)); left: 14px; right: 14px; gap: 7px; }
  .level-label { font-size: 10px; }
  .xp-track { height: 8px; }
  .xp-text { font-size: 8px; }
  .game-control-hint { display: none; }
  .upgrade-layout { padding: 20px 17px; }
  .upgrade-layout > h1 { font-size: 42px; }
  .upgrade-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
  .upgrade-card { display: grid; grid-template-columns: 54px 1fr; grid-template-rows: auto auto; gap: 4px 15px; text-align: left; border-width: 3px; border-radius: 18px; padding: 15px 18px; }
  .upgrade-icon { grid-column: 1; grid-row: 1 / 3; margin: 0; width: 54px; height: 54px; border-radius: 17px; font-size: 27px; }
  .upgrade-card h2 { grid-column: 2; font-size: 19px; align-self: end; }
  .upgrade-card p { grid-column: 2; font-size: 10px; margin: 0; min-height: 0; }
  .upgrade-index { top: 5px; right: 8px; left: auto; font-size: 8px; }
  .upgrade-choose { display: none; }
  .surface-pause, .surface-result, .surface-error { padding: 20px; }
  .center-panel-body { padding: 23px 20px; }
  .striped-heading h1 { font-size: 21px; }
  .result-portrait { width: 100px; height: 100px; }
  .result-stats strong { font-size: 24px; }
  .game-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 20px; }
  .dialog-heading { padding: 19px 17px 15px; gap: 10px; }
  .dialog-heading h2 { font-size: 21px; }
  .dialog-body { padding: 18px 17px; }
  .help-control { gap: 10px; padding: 9px; }
  .help-control kbd { min-width: 112px; font-size: 8px; }
  .help-control span { font-size: 10px; }
  .compact-button { min-height: 46px; font-size: 16px; }
}
@media (max-width: 350px) {
  .menu-layout { gap: 17px; padding-left: 18px; padding-right: 18px; }
  .striped-heading { padding: 17px; gap: 10px; }
  .striped-heading h2 { font-size: 21px; }
  .welcome-body { padding: 17px 14px; }
  .benefit { font-size: 11px; padding: 9px; }
  .benefit-list { margin-bottom: 17px; }
  .welcome-eyebrow { font-size: 7px; }
  .menu-shortcuts { gap: 7px; }
  .text-button { font-size: 11px; }
  .starter-grid { gap: 6px; }
  .starter-card { border-width: 2px; }
  .starter-portrait { width: 84px; height: 84px; left: calc(50% - 42px); top: 13px; }
  .starter-role { font-size: 4px; }
  .starter-art { height: 145px; }
  .starter-description { min-height: 70px; }
  .starter-info { padding-left: 4px; padding-right: 4px; }
  .hud-run { gap: 6px; padding-left: 7px; padding-right: 6px; }
  .hud-run .metric strong { font-size: 16px; min-width: 27px; }
  .hud-player { width: 47%; }
  .hud-portrait { width: 31px; height: 31px; }
  .help-control kbd { min-width: 100px; }
}
@media (max-height: 700px) and (min-width: 701px) {
  .menu-layout { min-height: calc(100% - 55px); padding-top: 65px; padding-bottom: 15px; }
  .welcome-body { padding: 18px 22px; }
  .welcome-eyebrow { margin-bottom: 12px; }
  .benefit-list { margin-bottom: 16px; }
  .benefit { min-height: 39px; padding: 8px 12px; }
  .menu-shortcuts { margin-bottom: 4px; }
  .save-status { margin-top: 10px; }
  .fan-footer { padding-top: 3px; padding-bottom: 10px; }
  .selection-layout { padding-top: 65px; }
  .selection-heading { margin-bottom: 15px; }
  .selection-heading h1 { font-size: 35px; }
  .selection-subtitle { font-size: 11px; }
  .starter-art { height: 200px; }
  .starter-portrait { width: 134px; height: 134px; top: 5px; left: calc(50% - 67px); }
  .starter-art::after { top: 112px; }
  .starter-identity { bottom: 8px; padding-top: 8px; padding-bottom: 8px; }
  .starter-identity h2 { font-size: 21px; }
  .starter-info { padding-top: 10px; padding-bottom: 10px; }
  .starter-description { min-height: 30px; font-size: 10px; }
  .starter-stats { padding: 9px 0; margin-top: 7px; }
  .starter-details { padding-top: 9px; }
  .selection-actions { margin-top: 16px; }
  .selection-confirm { min-height: 50px; font-size: 18px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .menu-layout { display: grid; grid-template-columns: minmax(180px, .95fr) minmax(250px, 1fr); max-width: 950px; gap: 25px; padding: 58px 30px 15px; min-height: 100%; }
  .wordmark-title { font-size: 7.5vw; letter-spacing: -3px; }
  .menu-identity { padding: 0; }
  .wordmark-tagline { display: none; }
  .welcome-card { max-width: 390px; }
  .striped-heading { padding: 12px 19px; }
  .striped-heading h2 { font-size: 20px; }
  .welcome-body { padding: 13px 17px; }
  .welcome-eyebrow { display: none; }
  .benefit-list { margin-bottom: 13px; gap: 5px; }
  .benefit { font-size: 10px; min-height: 30px; padding: 6px 9px; }
  .benefit-icon { font-size: 18px; width: 18px; flex-basis: 18px; }
  .primary-button { min-height: 44px; padding: 10px 13px; font-size: 17px; border-bottom-width: 4px; }
  .menu-shortcuts { margin: 4px 0 0; }
  .text-button { font-size: 10px; padding-top: 5px; padding-bottom: 5px; }
  .menu-stats { padding: 8px 0; margin: 6px 0 0; }
  .menu-stats .metric strong { font-size: 15px; }
  .menu-stats .metric span { font-size: 6px; }
  .save-status { font-size: 8px; margin-top: 8px; }
  .surface-menu > .fan-footer { position: absolute; left: 20px; bottom: 5px; max-width: 40%; padding: 0; font-size: 6px; }
  .surface-menu > .fan-footer strong { font-size: 8px; }
  .selection-layout { padding: 50px 15px 15px; min-height: 100%; max-width: 700px; }
  .selection-heading { margin-bottom: 10px; }
  .selection-heading .eyebrow { display: none; }
  .selection-heading h1 { font-size: 24px; }
  .selection-subtitle { margin-top: 2px; font-size: 9px; }
  .starter-grid { gap: 12px; }
  .starter-card { display: grid; grid-template-columns: 1fr; border-radius: 16px; }
  .starter-art { height: 160px; border-radius: 11px; }
  .starter-portrait { width: 100px; height: 100px; left: calc(50% - 50px); top: 4px; }
  .starter-number { font-size: 40px; }
  .starter-art::after { top: 85px; height: 22px; }
  .starter-identity { padding: 6px 7px; bottom: 6px; left: 6px; right: 10px; border-radius: 8px; border-left-width: 4px; }
  .starter-role { font-size: 5px; margin-bottom: 1px; }
  .starter-identity h2 { font-size: 16px; }
  .element-pill { font-size: 6px; margin-top: 3px; }
  .starter-info { padding: 7px; }
  .starter-description, .starter-details { display: none; }
  .starter-stats { margin: 0; padding: 0; border: 0; }
  .starter-stats .metric strong { font-size: 13px; }
  .starter-stats .metric span { font-size: 5px; }
  .selection-actions { flex-direction: row; justify-content: center; gap: 15px; margin-top: 11px; }
  .selection-confirm { width: 270px; min-width: 0; min-height: 42px; font-size: 16px; }
  .surface-selection > .fan-footer { display: none; }
  .game-hud { top: 8px; left: 12px; right: 12px; }
  .hud-player { width: 200px; padding: 4px 10px 4px 4px; gap: 6px; }
  .hud-portrait { width: 35px; height: 35px; }
  .hud-name { font-size: 10px; margin-bottom: 3px; }
  .hp-track { height: 12px; }
  .hp-text { font-size: 8px; line-height: 12px; }
  .hud-run { padding: 6px 8px 6px 13px; gap: 14px; }
  .hud-run .metric strong { font-size: 18px; }
  .hud-run .metric span { font-size: 6px; }
  .pause-button { width: 29px; height: 29px; font-size: 18px; }
  .xp-row { top: 66px; left: 16px; right: 16px; }
  .game-control-hint { display: none; }
  .upgrade-layout { max-width: 780px; padding: 20px; }
  .upgrade-layout > .eyebrow { display: none; }
  .upgrade-layout > h1 { font-size: 33px; }
  .upgrade-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 15px; gap: 12px; }
  .upgrade-card { display: block; padding: 15px 11px; border-radius: 18px; }
  .upgrade-icon { width: 45px; height: 45px; margin: 0 0 8px; font-size: 25px; border-radius: 14px; }
  .upgrade-card h2 { font-size: 16px; }
  .upgrade-card p { min-height: 45px; font-size: 10px; line-height: 1.4; margin-top: 8px; }
  .upgrade-choose { padding: 8px; margin-top: 10px; font-size: 10px; }
  .surface-pause, .surface-result { display: block; padding: 18px; }
  .center-panel-body { padding: 17px 24px; }
  .pause-panel { max-width: 430px; }
  .pause-panel .panel-intro { margin-bottom: 14px; }
  .pause-options { grid-template-columns: 1fr 1fr; margin-top: 14px; gap: 8px; }
  .pause-options > .text-button { min-height: 38px; }
  .result-panel { max-width: 600px; }
  .result-portrait { width: 60px; height: 60px; margin-top: -5px; }
  .result-panel .panel-intro { font-size: 11px; margin-bottom: 8px; }
  .result-stats { padding: 10px 0; }
  .result-stats strong { font-size: 21px; }
  .record-line { margin: 8px 0 12px; }
  .result-panel .secondary-button { margin-top: 8px; min-height: 37px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .surface-selection { display: flex; flex-direction: column; }
  .selection-layout { width: 100%; min-height: 0; flex: 1; justify-content: center; padding-top: max(65px, calc(env(safe-area-inset-top) + 53px)); padding-bottom: 10px; }
  .selection-heading { margin-bottom: 8px; }
  .selection-heading h1 { font-size: clamp(26px, 7.7vw, 33px); }
  .selection-heading .eyebrow { font-size: 7px; }
  .selection-subtitle { max-width: 290px; font-size: 10px; }
  .mobile-selection-hint { display: block; margin-top: 9px; color: #fffbdc; font-size: 10px; font-weight: 900; letter-spacing: .02em; }
  .starter-grid { display: flex; flex: 0 0 auto; gap: 16px; margin: 0 -15px; padding: 10px max(26px, calc((100vw - 278px) / 2)) 14px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: max(26px, calc((100vw - 278px) / 2)); scrollbar-width: none; }
  .starter-grid::-webkit-scrollbar { display: none; }
  .starter-card { flex: 0 0 min(278px, calc(100vw - 52px)); border: 3px solid transparent; border-radius: 22px; scroll-snap-align: center; scroll-snap-stop: always; box-shadow: 0 5px 0 #162d3c29, 0 8px 16px #162d3c3d; }
  .starter-card.is-selected { border-color: #ff6776; transform: translateY(-2px); }
  .starter-art { height: 190px; border-radius: 16px 16px 12px 12px; }
  .starter-portrait { width: 133px; height: 133px; left: calc(50% - 66.5px); top: 1px; }
  .starter-number { font-size: 56px; right: 12px; top: 3px; }
  .starter-art::after { height: 28px; top: 110px; }
  .starter-identity { left: 12px; right: 24px; bottom: 10px; padding: 9px 11px; border-left-width: 5px; border-radius: 12px; }
  .starter-role { font-size: 7px; letter-spacing: .12em; min-height: 9px; margin-bottom: 3px; }
  .starter-identity h2 { font-size: 24px; letter-spacing: -.5px; }
  .element-pill { font-size: 9px; padding: 3px 8px; margin-top: 5px; text-transform: capitalize; }
  .starter-info { padding: 12px 14px 13px; }
  .starter-description { font-size: 11px; line-height: 1.4; min-height: 32px; }
  .starter-stats { padding: 10px 0; gap: 10px; margin-top: 9px; }
  .starter-stats .metric strong { font-size: 18px; }
  .starter-stats .metric span { font-size: 7px; }
  .starter-details { padding-top: 10px; gap: 3px; }
  .mini-label { font-size: 7px; letter-spacing: .1em; }
  .starter-details strong { font-size: 10px; line-height: 1.4; min-height: 0; margin-bottom: 6px; }
  .starter-details strong:last-child { margin-bottom: 0; text-transform: capitalize; }
  .selection-actions { position: sticky; bottom: 0; z-index: 2; margin-top: 1px; padding: 7px 0 0; flex: 0 0 auto; background: linear-gradient(transparent, #243e3c30); }
  .selection-confirm { width: min(100%, 320px); min-height: 52px; font-size: 19px; }
  .selection-actions .text-button { padding-top: 5px; padding-bottom: 5px; }
  .surface-selection > .fan-footer { flex: 0 0 auto; padding-top: 3px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) and (max-height: 730px) and (orientation: portrait) {
  .selection-layout { padding-top: 58px; }
  .selection-heading .eyebrow { display: none; }
  .selection-heading h1 { font-size: 26px; }
  .selection-subtitle { font-size: 9px; margin-top: 5px; }
  .mobile-selection-hint { font-size: 9px; margin-top: 6px; }
  .starter-grid { padding-top: 6px; padding-bottom: 10px; }
  .starter-art { height: 163px; }
  .starter-portrait { width: 113px; height: 113px; left: calc(50% - 56.5px); top: 0; }
  .starter-art::after { top: 90px; }
  .starter-identity { padding: 7px 10px; bottom: 7px; }
  .starter-identity h2 { font-size: 22px; }
  .starter-info { padding-top: 10px; padding-bottom: 10px; }
  .starter-description { min-height: 30px; }
  .starter-stats { padding: 8px 0; margin-top: 7px; }
  .starter-details { padding-top: 8px; }
  .selection-confirm { min-height: 48px; font-size: 18px; }
  .surface-selection > .fan-footer span { display: none; }
}
