@font-face {
  font-family: "Chakra Petch";
  src: url("assets/fonts/ChakraPetch-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("assets/fonts/Barlow-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("assets/fonts/Barlow-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f1f2e9;
  --muted: #929b91;
  --surface: #181d19;
  --line: #394239;
  --accent: #d0f568;
  --cyan: #87d8e6;
  --red: #f2766e;
  --heading: "Chakra Petch", Arial, sans-serif;
  --body: "Barlow", Arial, sans-serif;
}
* { box-sizing: border-box; letter-spacing: 0; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #111412; color: var(--ink); font-family: var(--body); }
button, input, select, textarea { font-family: inherit; }
button { min-width: 140px; min-height: 46px; padding: 10px 20px; border: 1px solid #505a4e; border-radius: 4px; background: #252c24; color: var(--ink); font-size: 16px; font-weight: 600; cursor: pointer; transition: border-color 160ms, background 160ms, color 160ms, box-shadow 160ms; }
button:hover { background: #343e2d; border-color: var(--accent); }
button:active { background: #455335; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button.primary { background: var(--accent); color: #18200c; border-color: var(--accent); font-family: var(--heading); font-size: 18px; }
button.primary:hover { background: #e0ff94; box-shadow: 0 0 22px #c9ed6120; }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); font-size: 13px; }
button.quiet:hover { color: var(--red); border-color: #7b4741; }
canvas#game { display: block; width: 100vw; height: 100vh; background: #1b201c; touch-action: none; }
.hidden { display: none !important; }
h1, h2, h3, strong { font-family: var(--heading); }
h2 { font-size: 30px; font-weight: 700; line-height: 1.15; }
p { line-height: 1.5; }
.panel { position: fixed; z-index: 10; padding: 28px; border: 1px solid #59624a; border-top: 2px solid var(--accent); border-radius: 6px; background: #171c18f7; box-shadow: 0 24px 100px #0009, inset 0 1px #f4ffdc08; scrollbar-width: thin; scrollbar-color: #6a755d #111711; overscroll-behavior: contain; }
.panel::-webkit-scrollbar { width: 5px; height: 5px; }
.panel::-webkit-scrollbar-thumb { background: #6a755d; border-radius: 4px; }
.screen, .modal { left: 50%; top: 50%; width: min(620px, calc(100% - 40px)); max-height: calc(100dvh - 40px); overflow: auto; transform: translate(-50%, -50%); }
.screen { text-align: center; }
.panel h2 { margin: 0 0 22px; }
.panel p { color: #b4bdb0; }
.modal > button { margin-top: 18px; }
.wide { width: min(1160px, calc(100% - 40px)); }
.section-index { display: block; margin-bottom: 8px; font-family: var(--heading); font-size: 11px; color: var(--accent); }
.menu-heading { text-align: left; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.menu-heading h2 { margin-bottom: 20px; font-size: 38px; }

#mainMenu { display: flex; flex-direction: column; align-items: center; width: min(660px, calc(100% - 32px)); padding: 24px 16px; border: 0; background: transparent; box-shadow: none; }
#mainMenu h1 { margin: 16px 0 34px; font-family: var(--heading); font-size: 82px; font-weight: 700; line-height: .95; text-transform: uppercase; text-shadow: 0 4px 1px #0a0d0a, 0 12px 48px #000; }
#mainMenu h1 span { display: block; color: var(--accent); font-size: 72px; }
.title-emblem { position: relative; width: 44px; height: 44px; border: 1px solid #cfee6c77; transform: rotate(45deg); }
.title-emblem i { position: absolute; inset: 10px; border: 3px solid var(--accent); }
.title-emblem i:nth-child(2) { inset: -5px 19px; border: 0; background: var(--accent); }
.title-emblem i:nth-child(3) { inset: 19px -5px; border: 0; background: var(--accent); }
.main-menu-actions { display: flex; flex-direction: column; align-items: stretch; gap: 9px; width: min(272px, 100%); }
.main-menu-actions button { width: 100%; margin: 0; background: #181e18ed; }
.main-menu-actions .primary { background: var(--accent); min-height: 54px; margin-bottom: 7px; }
.main-menu-actions .quiet { background: transparent; margin-top: 4px; }
.check-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.check-toggle span { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid #67755c; border-radius: 2px; color: var(--accent); }
.check-toggle.active { border-color: #a8c360; }

#levelMenu { width: min(1400px, calc(100% - 40px)); overflow-y: auto; }
.level-card-row { overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x; scrollbar-width: thin; scrollbar-color: #5d7051 #141a14; padding-bottom: 15px; }
.level-grid { display: flex; justify-content: center; gap: 14px; min-width: max-content; }
.level-card { position: relative; flex: 0 0 202px; width: 202px; display: flex; flex-direction: column; align-items: stretch; padding: 12px; border: 1px solid #424e3d; border-radius: 4px; background: #1d241d; text-align: left; }
.level-card.playable { border-color: #91ac53; }
.level-art { display: block; width: 100%; height: 142px; margin: 0 0 16px; border: 1px solid #495240; background: #222820; border-radius: 2px; }
.level-card h3 { margin: 0 0 6px; font-size: 22px; }
.level-card p { flex: 1; margin: 0; font-size: 13px; line-height: 1.5; }
.level-card button { width: 100%; min-width: 0; margin-top: 16px; font-family: var(--heading); font-size: 15px; }
.level-card.playable button { background: var(--accent); border-color: var(--accent); color: #1a2310; }
.level-card.unavailable .level-art { opacity: .5; }
.level-card.unavailable h3 { color: #8d9887; }
.muted { color: var(--muted); }
.menu-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 22px; border-top: 1px solid var(--line); }
.menu-row button { flex: 0 0 170px; width: 170px; min-height: 44px; margin: 0; border: 1px solid #59644e; border-radius: 22px; background: #242c22; font-size: 15px; }
.menu-row button:hover { background: #3e4b31; }

#pausePanel { width: min(410px, calc(100% - 32px)); }
#pausePanel h2 { text-align: center; margin: 7px 0 28px; }
.pause-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pause-actions button { width: min(280px, 100%); margin: 0; }
#endRunBtn { margin-top: 12px; border-color: #8b5147; color: #f19e8b; background: #35231f; }
#endRunBtn:hover, #confirmResetBtn:hover { background: #58312b; }
.controls-list { display: grid; gap: 0; }
.controls-list > div { display: flex; gap: 20px; align-items: center; min-height: 42px; padding: 8px 0; border-bottom: 1px solid #323b2e; font-size: 15px; }
.audio-credits { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.audio-credits summary { color: var(--accent); cursor: pointer; }
.audio-credits p { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.audio-credits a { color: #a2d9ef; }
kbd { min-width: 74px; color: var(--accent); font: 12px var(--heading); }
#resetPanel h2 { color: var(--red); }
#confirmResetBtn { border-color: #a05a52; background: #422820; }
#gameOverPanel { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; width: min(450px, calc(100% - 32px)); }
#gameOverPanel h2 { width: 100%; margin: 4px 0 14px; }
.result-stats { display: flex; flex-direction: column; align-items: stretch; width: 100%; gap: 0; }
.result-stat { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border-top: 1px solid var(--line); }
.result-stat span { color: var(--muted); font-size: 14px; }
.result-stat strong { color: var(--ink); font-size: 32px; line-height: 1; }
.result-stat:last-child strong { color: var(--accent); }
#resultContinueBtn { width: min(280px, 100%); margin: 6px 0 0; background: var(--accent); color: #1b2410; }

.hud { position: fixed; z-index: 5; left: 24px; right: 24px; top: 24px; pointer-events: none; }
.hud-row { position: relative; min-height: 50px; }
#xpText, #levelText, #selectedText { display: none; }
#powerText, #timerText { position: absolute; top: 0; padding: 8px 14px 10px; border: 1px solid #5f6a45; border-top: 2px solid var(--accent); border-radius: 3px; background: #151b15ec; color: #eaf0db; font: 700 28px var(--heading); line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
#powerText { left: 0; text-align: left; }
#timerText { right: 0; text-align: right; color: #e5e9dc; border-color: #5d6655; }
.hotbar { position: fixed; z-index: 6; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 10px; max-width: calc(100% - 24px); overflow-x: auto; padding: 9px; border: 1px solid #5c674a; border-radius: 5px; background: #11180fec; box-shadow: 0 8px 28px #0007; transform: translateX(-50%); scrollbar-width: thin; scrollbar-color: #73845b #11180f; }
.slot { position: relative; width: 108px; height: 114px; flex: 0 0 auto; display: grid; grid-template-rows: 18px 54px 1fr; place-items: center; padding: 4px 6px 6px; border: 1px solid #424f36; border-radius: 3px; background: #242d20; color: var(--ink); cursor: pointer; user-select: none; touch-action: manipulation; }
.slot::before { content: ""; position: absolute; inset: 0; }
.slot > strong { width: 100%; text-align: left; font: 12px var(--heading); color: #b1bc9f; line-height: 1; }
.slot.active { border-color: var(--accent); background: #354126; box-shadow: inset 0 -3px var(--accent); }
.slot.active > strong { color: var(--accent); }
.slot small { display: grid; gap: 3px; width: 100%; min-width: 0; font: 12px var(--body); line-height: 1.05; text-align: center; }
.slot-name, .slot-cost { display: block; max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.slot-name { color: #e4ead9; }
.slot-cost { color: #b4c795; font-size: 11px; }
.slot-icon { width: 66px; height: 51px; display: block; background: transparent; }

#upgradePanel { width: min(820px, calc(100% - 32px)); text-align: center; padding: 28px; }
#upgradePanel h2 { margin: 5px 0 26px; font-size: 32px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 14px; width: 100%; }
.choice { position: relative; min-width: 0; min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; padding: 24px 18px; border: 1px solid #607149; border-top: 3px solid currentColor; border-radius: 4px; background: #242b20; cursor: pointer; text-align: center; transition: background 150ms, border-color 150ms; }
.choice:hover { background: #3a462c; box-shadow: inset 0 0 0 1px currentColor; }
.choice p { margin: 0; color: var(--ink); font-family: var(--heading); font-size: 21px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.choice strong { font-family: var(--body); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.rarity-normal { color: #b2c594; }
.rarity-rare { color: #87d8e6; }
.rarity-epic { color: #cb9eed; }
.rarity-legendary { color: #f1d16d; }

.tutorial-guide { position: fixed; z-index: 8; top: 84px; left: 50%; width: min(680px, calc(100% - 36px)); transform: translateX(-50%); padding: 13px 18px; border: 1px solid #72894b; border-top: 2px solid var(--accent); border-radius: 4px; background: #171e16f5; box-shadow: 0 8px 30px #0005; }
.tutorial-guide-heading { display: flex; align-items: center; gap: 10px; }
.tutorial-guide-heading > span { flex: 0 0 auto; color: var(--accent); font: 12px var(--heading); }
.tutorial-guide-heading > strong { flex: 1; min-width: 0; font-size: 17px; }
.tutorial-guide-heading button { flex: 0 0 36px; width: 36px; min-width: 36px; min-height: 34px; padding: 0; font-size: 26px; line-height: 1; }
.tutorial-guide p { margin: 9px 0 0; font-size: 15px; line-height: 1.35; color: #e1e8d7; }
.tutorial-guide .tutorial-context { border-top: 1px solid #47563a; padding-top: 8px; color: #bcd395; font-size: 13px; }
@media (max-width: 680px) {
  .tutorial-guide { top: 112px; padding: 11px 13px; }
  .tutorial-guide-heading { gap: 7px; }
  .tutorial-guide-heading > strong { font-size: 15px; }
  .tutorial-guide-heading button { flex-basis: 40px; width: 40px; min-width: 40px; min-height: 40px; }
  .tutorial-guide p { font-size: 14px; }
}
@media (max-height: 500px) and (min-width: 540px) {
  .tutorial-guide { top: 55px; width: min(500px, calc(82% - 200px)); padding: 8px 12px; }
  .tutorial-guide p { margin-top: 5px; font-size: 13px; }
  .tutorial-guide .tutorial-context { padding-top: 5px; font-size: 12px; }
}

#shopPanel, #loadoutPanel, #artifactPanel { padding: 24px; overflow: auto; }
#shopPanel h2, #loadoutPanel h2, #artifactPanel h2 { margin-bottom: 16px; padding-right: 210px; }
.upgrade-tree-credits, .loadout-status, .artifact-status { position: absolute; right: 24px; top: 22px; z-index: 4; margin: 0; max-width: min(420px, calc(100% - 290px)); padding: 9px 12px; border: 1px solid #546340; border-radius: 3px; background: #222a1c; color: var(--accent); font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 14px; pointer-events: none; }
.loadout-status small { width: 100%; color: #a2ae94; font-size: 11px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-tree-reset { min-width: 112px; min-height: 32px; margin: 0 0 12px; padding: 5px 12px; background: #252d20; font-size: 12px; }
.skill-tree-canvas, .loadout-tree-canvas, .artifact-tree-canvas { position: relative; width: 100%; height: min(62vh, 560px); min-width: 0; min-height: 240px; border: 1px solid #3c4931; border-radius: 3px; background-color: #11180f; background-image: radial-gradient(#53624466 1px, transparent 1px); background-size: 24px 24px; overflow: hidden; touch-action: none; cursor: grab; }
.skill-tree-canvas.dragging, .loadout-tree-canvas.dragging, .artifact-tree-canvas.dragging { cursor: grabbing; }
.skill-tree-scene, .loadout-tree-scene, .artifact-tree-scene { position: absolute; left: 0; top: 0; width: 4400px; height: 4400px; transform-origin: 0 0; will-change: transform; }
.loadout-tree-scene, .artifact-tree-scene { width: 1700px; height: 2200px; }
.skill-tree-lines, .loadout-tree-lines, .artifact-tree-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.skill-tree-hub { position: absolute; width: 256px; height: 256px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--accent); border-radius: 50%; background: #2b361e; color: var(--ink); padding: 24px; font: 700 36px/1.05 var(--heading); text-align: center; box-shadow: 0 0 0 10px #c7ee6510, 0 0 0 12px #c7ee6520; pointer-events: none; }
.skill-branch-title, .loadout-branch-title, .artifact-branch-title { position: absolute; width: 230px; min-height: 54px; display: flex; align-items: center; justify-content: center; padding: 6px 12px; border: 1px solid #566444; border-radius: 4px; background: #1e2819; color: #dfe8d2; font: 700 18px var(--heading); text-align: center; pointer-events: none; }
.skill-branch-title { width: 160px; min-height: 42px; font-size: 22px; }
.tree-toolbar { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.tree-toolbar .skill-tree-reset { margin: 0 4px 0 0; }
.tree-zoom { min-width: 34px; width: 34px; min-height: 32px; padding: 2px; font: 22px/1 var(--body); }
.skill-line, .loadout-line, .artifact-line { stroke: #839663; stroke-width: 3; stroke-linecap: round; transition: stroke 240ms, opacity 240ms; }
.skill-line.locked { stroke: #39472f; opacity: .8; }
.skill-line.revealed { stroke: #d0f568; }
.skill-node, .loadout-node, .artifact-node { position: absolute; width: 150px; height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: 2px solid #718753; border-radius: 4px; background: #222d1a; color: var(--ink); text-align: center; cursor: pointer; user-select: none; touch-action: none; }
.skill-node:hover, .loadout-node:hover, .artifact-node:hover { border-color: var(--accent); background: #344329; }
.skill-node.available { border-color: #99b760; }
.skill-node { padding: 8px; gap: 5px; }
.skill-node.locked, .loadout-node.locked, .artifact-node.unknown { border-color: #3b4931; background: #182013; color: #8c9b7b; box-shadow: none; }
.skill-node.completed { border-color: var(--accent); background: #354522; }
.skill-node.maxed { border-color: #f1d16d; }
.skill-node.unaffordable { border-color: #8e644f; }
.skill-node.unaffordable .skill-price { color: #edb39d; }
.skill-node h3 { margin: 0; font-size: 28px; line-height: 1.1; }
.skill-node[data-tree="player"] h3 { font-size: 22px; line-height: 1.05; }
.skill-node p { margin: 0; color: #b6c4a3; font-size: 21px; line-height: 1.4; }
.skill-price { color: #e0efc7; font-weight: 600; }
.skill-max { color: #f1d16d; font: 700 22px var(--heading); }
.skill-question { font: 700 58px/1 var(--heading); }
.skill-node.purchase-animated { animation: nodeReveal 260ms ease-out; }
.loadout-node.weapon.selected { border-color: #f09f7d; background: #423226; box-shadow: inset 0 -5px #f09f7d; }
.loadout-node.structure.selected { border-color: var(--accent); background: #334423; box-shadow: inset 0 -5px var(--accent); }
.artifact-node.active { border-color: #f1d16d; background: #403b20; box-shadow: inset 0 -5px #f1d16d; }
.loadout-node-icon, .artifact-node-icon { display: block; width: 58px; height: 50px; background: transparent; }
.loadout-node strong, .artifact-node strong { font-size: 17px; line-height: 1.1; }
.loadout-node.weapon strong { font-size: 21px; }
.loadout-node-state, .artifact-node-state { color: #acb89e; font-size: 12px; line-height: 1.15; }
.loadout-node.locked .loadout-node-state, .artifact-node.unknown .artifact-node-state { color: #d89c84; }
.artifact-tooltip { position: absolute; z-index: 5; max-width: 240px; padding: 12px 14px; border: 1px solid #a8b772; border-radius: 4px; background: #182012f7; pointer-events: none; box-shadow: 0 10px 28px #0007; }
.artifact-tooltip strong, .artifact-tooltip span, .artifact-tooltip em { display: block; }
.artifact-tooltip strong { margin-bottom: 6px; font-size: 16px; }
.artifact-tooltip span { color: #c0cbb0; font-size: 14px; line-height: 1.3; }
.artifact-tooltip em { margin-top: 8px; color: #f1d16d; font-size: 12px; font-style: normal; }
.skill-tree-message { position: absolute; left: 50%; bottom: 18px; z-index: 5; max-width: 90%; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 4px; background: #1e2819f5; color: var(--ink); font-size: 14px; pointer-events: none; transform: translateX(-50%); animation: skillTreeMessage 1500ms ease-out forwards; }
.skill-particle { position: absolute; width: 4px; height: 4px; border-radius: 1px; background: #fff; pointer-events: none; animation: skillBurst 720ms ease-out forwards; }
.character-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.character-card { border: 1px solid #4f5e3f; border-radius: 4px; padding: 20px; background: #232c1d; }
.character-card h3 { font-size: 23px; margin: 10px 0; }
.character-card p { min-height: 62px; font-size: 15px; }
.character-card button { width: 100%; min-width: 0; margin: 10px 0 0; }
.character-card.active { border-color: var(--accent); box-shadow: inset 0 -3px var(--accent); }
.character-portrait { display: block; max-width: 100%; width: 100%; height: 150px; margin: 0 auto; background: #171f14; border: 1px solid #3d4a31; }
.shop-icon { width: 48px; height: 42px; background: transparent; }

.mobile-controls { position: fixed; z-index: 7; left: 0; right: 0; bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px)); height: 150px; pointer-events: none; user-select: none; -webkit-user-select: none; touch-action: none; }
.joystick { position: absolute; width: 124px; height: 124px; border-radius: 50%; border: 2px solid #a5be6c80; background: #18200f80; pointer-events: auto; touch-action: none; }
.move-stick { left: max(44px, 9%); bottom: 0; }
.mobile-right-controls { position: absolute; right: max(44px, 9%); bottom: 0; width: 132px; height: 214px; pointer-events: none; }
.aim-stick { right: 0; bottom: 0; border-color: #f2766e99; background: #4f201c80; }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: #c6e794cc; border: 2px solid #e9ffbe; transform: translate(-50%, -50%); }
.aim-stick .stick-knob { background: #f2766ed9; border-color: #ffccc4; }
.mobile-u { position: absolute; right: 0; top: 0; width: 104px; min-width: 104px; height: 48px; min-height: 48px; background: #344329ef; border-color: #a7c26c; pointer-events: auto; touch-action: none; }
.mobile-menu-btn { position: fixed; top: 74px; right: max(16px, 4%); width: 96px; min-width: 96px; height: 44px; min-height: 44px; background: #1e2918ed; pointer-events: auto; touch-action: none; }
body.mobile-game-ui .hud { left: 16px; top: max(14px, env(safe-area-inset-top)); right: auto; width: calc(200% - 64px); transform: scale(.5); transform-origin: top left; }
body.mobile-game-ui .hotbar { transform: translateX(-50%) scale(.5); transform-origin: bottom center; bottom: max(8px, env(safe-area-inset-bottom)); max-width: calc(200% - 32px); }
body.mobile-game-ui .slot { min-width: 108px; }
body.mobile-game-ui .joystick { background: transparent; border-color: transparent; }
body.mobile-game-ui .joystick::before { content: ""; position: absolute; inset: 25%; border: 2px solid #a5be6c99; border-radius: 50%; background: #18200f99; }
body.mobile-game-ui .aim-stick::before { border-color: #f2766eaa; background: #4f201c88; }
body.mobile-game-ui .stick-knob { width: 24px; height: 24px; }
body.mobile-game-ui .mobile-u { width: 90px; min-width: 90px; height: 44px; min-height: 44px; font-size: 12px; }
body.mobile-game-ui .mobile-menu-btn { width: 74px; min-width: 74px; height: 44px; min-height: 44px; top: max(54px, env(safe-area-inset-top)); padding: 8px; font-size: 12px; }

@media (max-width: 900px) {
  .panel { padding: 22px; }
  .menu-row { gap: 9px; }
  .menu-row button { flex-basis: 150px; width: 150px; }
  .level-grid { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .screen, .modal, .wide { max-height: calc(100dvh - 24px); width: calc(100% - 24px); }
  #mainMenu h1 { font-size: 60px; margin-bottom: 26px; }
  #mainMenu h1 span { font-size: 51px; }
  #levelMenu { width: calc(100% - 24px); padding: 18px; }
  .menu-heading h2 { font-size: 30px; }
  .level-card { flex-basis: 182px; width: 182px; }
  .level-art { height: 120px; }
  .menu-row { margin-top: 14px; padding-top: 18px; }
  .menu-row button { flex: 1 1 130px; min-width: 130px; font-size: 14px; }
  #powerText, #timerText { font-size: 22px; padding: 8px 10px; }
  body.mobile-game-ui #powerText, body.mobile-game-ui #timerText { font-size: 28px; }
  .hud { left: 14px; right: 14px; top: 14px; }
  .hotbar { gap: 6px; padding: 6px; }
  .slot { width: calc((100vw - 66px) / 4); max-width: 86px; height: 110px; padding: 4px; }
  .slot small { font-size: 11px; }
  #upgradePanel { width: calc(100% - 20px); padding: 18px 12px; }
  #upgradePanel h2 { font-size: 27px; margin-bottom: 20px; }
  .choice-grid { gap: 7px; }
  .choice { min-height: 182px; padding: 14px 8px; gap: 18px; }
  .choice p { font-size: 16px; }
  .choice strong { font-size: 10px; }
  #shopPanel, #loadoutPanel, #artifactPanel { padding: 16px; }
  #shopPanel h2, #loadoutPanel h2, #artifactPanel h2 { padding-right: 0; font-size: 28px; }
  .upgrade-tree-credits, .loadout-status, .artifact-status { position: static; max-width: none; justify-content: flex-start; margin: 0 0 10px; padding: 7px 10px; }
  .loadout-status small { text-align: left; }
  .skill-tree-canvas, .loadout-tree-canvas, .artifact-tree-canvas { height: 51dvh; min-height: 180px; }
  .tree-zoom { width: 44px; min-width: 44px; min-height: 40px; }
  .character-list { grid-template-columns: 1fr; }
  .character-portrait { height: 130px; }
  .character-card p { min-height: 0; }
  .controls-list > div { font-size: 13px; gap: 12px; }
}
@media (max-height: 570px) {
  #mainMenu { padding: 10px; }
  .title-emblem { display: none; }
  #mainMenu h1 { font-size: 43px; margin: 0 0 18px; }
  #mainMenu h1 span { font-size: 38px; }
  .main-menu-actions { gap: 6px; }
  .main-menu-actions button { min-height: 36px; padding: 7px 16px; font-size: 14px; }
  .main-menu-actions .primary { min-height: 40px; margin-bottom: 0; }
  .panel { max-height: calc(100dvh - 16px); }
  .skill-tree-canvas, .loadout-tree-canvas, .artifact-tree-canvas { height: 48dvh; min-height: 120px; }
  .mobile-controls { bottom: 76px; height: 115px; }
  .mobile-right-controls { height: 175px; }
  .joystick { width: 104px; height: 104px; }
  .choice { min-height: 138px; }
}
@media (max-width: 370px) {
  #mainMenu h1 { font-size: 49px; }
  #mainMenu h1 span { font-size: 42px; }
  .slot { width: calc((100vw - 50px) / 4); }
  .hotbar { gap: 4px; }
  .choice p { font-size: 14px; }
  .choice { padding: 12px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  button, .choice, .skill-line { transition: none; }
  .skill-node.purchase-animated { animation-duration: 1ms; }
}
@keyframes nodeReveal { from { box-shadow: 0 0 0 8px #f4ffe580; filter: brightness(1.8); } to { box-shadow: 0 0 0 0 #f4ffe500; filter: brightness(1); } }
@keyframes skillBurst { to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.35); } }
@keyframes skillTreeMessage { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
