* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #0d0d10;
  overflow: hidden;
}

#app {
  height: 100%;
  width: 100%;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #0d0d10;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

[hidden] { display: none !important; }
button { touch-action: manipulation; }
button:disabled { opacity: .4; cursor: wait; }
.front-door, .tutorial-ui, .arena-ui { font-family: system-ui, sans-serif; color: #eee7d5; }
.front-door { position: fixed; inset: 0; z-index: 2; pointer-events: none; padding: 34px 6.5vw; }
.front-door button { pointer-events: auto; }
.title-brand { display: flex; gap: 12px; align-items: center; letter-spacing: 3px; font-size: 11px; color: #d2dacc; }
.title-brand>span { color: #c9b383; font-size: 25px; }
.title-brand small { margin-left: auto; font-size: 9px; color: #819d99; letter-spacing: 2px; }
.title-copy { position: absolute; left: 8.5vw; top: 49%; transform: translateY(-46%); width: min(410px, 80vw); }
.overline { font-size: 10px; font-weight: 600; letter-spacing: 2.6px; color: #a5c3b7; }
.title-copy h1 { margin: 24px 0 20px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(70px, 8.4vw, 116px); font-weight: 400; letter-spacing: -5px; line-height: .82; color: #f1e6cc; text-shadow: 0 5px 30px #0007; }
.title-copy h1 span { display: block; margin-top: 9px; }
.title-tagline { color: #a8b9b0; font-size: 14px; margin-bottom: 30px; }
.title-actions { display: flex; flex-direction: column; gap: 10px; width: min(320px,100%); }
.gold-button, .outline-button, .text-button { display: flex; justify-content: space-between; align-items: center; min-height: 51px; padding: 14px 19px; border-radius: 4px; cursor: pointer; font: 600 13px system-ui; letter-spacing: .2px; }
.gold-button { background: #d5bb80; color: #172626; border: 1px solid #ead8a4; box-shadow: 0 3px 20px #c9a36113; }
.gold-button:hover:not(:disabled) { background: #ead3a0; transform: translateY(-1px); }
.gold-button>span { font-size: 18px; }
.outline-button { background: #17312c77; border: 1px solid #5e797077; color: #cbd8cc; }
.outline-button small { font-size: 8px; letter-spacing: 1.5px; color: #8ba99b; }
.outline-button:hover { background: #294239; border-color: #b7bea0; }
.text-button { min-height: 36px; padding: 7px 1px; background: transparent; border: 0; color: #9bb2a6; font-weight: 400; font-size: 11px; }
.title-party { margin-top: 17px; font-size: 10px; color: #6f9387; }
.title-party>span { color: #b7c6aa; letter-spacing: 2px; margin-right: 6px; font-size: 7px; }
.title-footer { position: absolute; left: 6.5vw; right: 6.5vw; bottom: 26px; display: flex; justify-content: space-between; font-size: 8px; letter-spacing: 1.5px; color: #58786d; }
.ready-light { color: #96b394; }
.front-title .key-settings-open { display: none; }
.front-door button:focus-visible, .arena-ui button:focus-visible, .tutorial-ui button:focus-visible { outline: 2px solid #f4d89b; outline-offset: 4px; }
.tutorial-ui, .arena-ui { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.tutorial-ui button, .arena-ui button { pointer-events: auto; cursor: pointer; }
.lesson-card { position: absolute; transform: translateX(-50%); padding: 13px 16px; border: 1px solid #557870; border-top: 2px solid var(--hero); border-radius: 9px; background: #0c1a20f2; box-shadow: 0 12px 35px #0007; text-align: center; }
.lesson-card header { display: flex; align-items: center; gap: 9px; }
.lesson-card header>span { color: var(--hero); font-size: 11px; font-weight: 700; }
.lesson-card header button { margin-left: auto; border: 0; background: none; color: #8fa8a4; font-size: 10px; padding: 2px; }
.lesson-dots { display: flex; gap: 4px; }.lesson-dots i { width: 5px; height: 5px; border-radius: 50%; background: #344d4e; }.lesson-dots i.done { background: #c9b77b; }
.lesson-card h2 { margin: 10px 0; font: 500 18px Georgia,serif; color: #e8ddbe; }
.lesson-weapons { display: flex; align-items: center; justify-content: center; gap: 14px; }
.lesson-weapons canvas { width: 78px; height: 40px; background: #14262b; border-radius: 5px; border: 1px solid #344a48; }
.lesson-weapons canvas.active { border-color: #d5bb80; background: #253b38; }
.lesson-weapons>span { color: #899b8c; }
.lesson-keys { display: flex; justify-content: center; gap: 7px; margin: 11px 0 3px; }
.lesson-keys kbd { display: inline-block; padding: 6px 10px; min-width: 32px; background: #d5d8c3; color: #132628; border-radius: 4px; border-bottom: 3px solid #899f95; font: 700 13px system-ui; box-shadow: 0 0 18px #a5e9ce12; }
.lesson-keys.release kbd { opacity: .3; box-shadow: none; }
.lesson-complete { border-color: #75b78e; opacity: .8; }.lesson-complete h2 { color: #a3d6aa; }
.lesson-skip-all { position: fixed; bottom: 13px; left: 50%; transform: translateX(-50%); border-radius: 20px; background: #14262eea; color: #c4ccc0; border: 1px solid #52736b; padding: 9px 17px; font: 11px system-ui; white-space: nowrap; }
.lesson-energy-row { display: flex; gap: 8px; align-items: center; font-size: 11px; color: #ddcf99; padding-top: 8px; }
.lesson-meter { flex: 1; height: 5px; border-radius: 4px; background: #2b4243; overflow: hidden; }.lesson-meter i { display: block; height: 100%; background: #8fdbc4; }
canvas.energy-curve { width: 100%; height: 90px; background: transparent; }
.energy-meaning { display: flex; justify-content: space-between; color: #a8b9ac; font-size: 11px; }.energy-rate { color: #92c5b2; }
.arena-toolbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 25px; align-items: center; padding: 7px 9px 7px 15px; background: #0e1d25ee; border: 1px solid #48645f; border-radius: 6px; white-space: nowrap; }
.arena-toolbar>span { color: #9db8a8; font-size: 9px; letter-spacing: 1.5px; }.arena-round { color: #d4c48f; font-weight: 400; }
.arena-toolbar button { background: transparent; color: #c3d3c5; border: 0; padding: 7px 9px; font-size: 10px; }
.arena-picker { position: absolute; inset: 0; display: grid; place-items: center; background: #071218db; backdrop-filter: blur(6px); pointer-events: auto; padding: 66px 22px 18px; }
.arena-sheet { width: min(960px,100%); max-height: 100%; display: flex; flex-direction: column; border: 1px solid #47665e; border-radius: 12px; background: #101f27f5; overflow: hidden; box-shadow: 0 25px 100px #0007; }
.arena-sheet header { padding: 22px 26px 10px; }.arena-sheet header .overline { margin: 0 0 8px; font-size: 9px; }
.arena-sheet h1 { margin: 0 0 7px; font: 400 30px Georgia,serif; color: #eadfc4; }.arena-outcome { color: #91aaa2; font-size: 11px; margin: 0; }
.arena-loadouts { padding: 0 26px 8px; }.arena-loadouts>div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 9px; }
.arena-loadouts b { padding: 4px 6px 4px 0; color: #dcc595; }.arena-loadouts span { padding: 4px 7px; color: #aac0b3; border: 1px solid #344d49; border-radius: 3px; }
.monster-gallery { overflow-y: auto; padding: 0 26px 16px; min-height: 0; scrollbar-color: #526d61 #14282b; }
.monster-gallery h2 { font: 500 10px system-ui; text-transform: uppercase; letter-spacing: 2px; color: #8aa296; margin: 18px 0 11px; }
.monster-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 9px; }
.monster-card { position: relative; min-width: 0; padding: 0 4px 10px; background: #142931; border: 1px solid #2e494b; border-radius: 5px; color: #afc4bd; font: 10px system-ui; transition: background .15s,border-color .15s; }
.monster-card:hover { background: #25413e; border-color: #7f9b80; }.monster-card[aria-pressed="true"] { background: #2b3d36; border-color: #d3ba7f; color: #eadcb9; }
.monster-card i { display: none; position: absolute; top: 7px; right: 7px; color: #d3ba7f; font-style: normal; }.monster-card[aria-pressed="true"] i { display: block; }
canvas.monster-portrait { width: 100%; height: 90px; object-fit: contain; background: radial-gradient(ellipse at center,#6eaa8833,transparent 65%); }
.monster-card span { display: block; min-height: 24px; padding: 0 4px; }
.arena-sheet footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 26px; border-top: 1px solid #334e47; background: #13262b; }
.arena-selection-count { color: #a0b8aa; font-size: 11px; }.arena-sheet .gold-button { min-height: 42px; gap: 25px; padding: 10px 14px; font-size: 12px; }
.arena-countdown { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; flex-direction: column; background: #08161b33; color: #ead6a6; }
.arena-countdown>span { font-size: 11px; letter-spacing: 4px; }.arena-countdown strong { font: 400 140px Georgia,serif; text-shadow: 0 4px 45px #000; }
@media(max-width:760px) {
  .front-door { padding-top: 18px; }.title-copy { left: 8vw; top: 49%; }.title-copy h1 { font-size: 76px; margin-top: 18px; }
  .title-tagline { margin-bottom: 21px; }.title-actions { width: 280px; }.title-footer { bottom: 16px; font-size: 7px; }.title-brand small { font-size: 8px; }
  .monster-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }.arena-sheet header { padding: 16px 16px 8px; }.arena-sheet h1 { font-size: 25px; }
  .monster-gallery,.arena-loadouts { padding-left: 16px; padding-right: 16px; }.arena-sheet footer { padding: 11px 16px; }.arena-picker { padding: 58px 12px 12px; }
  canvas.monster-portrait { height: 72px; }.arena-toolbar { gap: 9px; width: max-content; max-width: 96vw; }.arena-toolbar>span { font-size: 8px; }
  .lesson-card { padding: 9px 12px; }.lesson-card h2 { font-size: 16px; margin: 8px 0; }.lesson-keys { margin: 7px 0 1px; }
}
@media(max-height:600px) {
  .title-copy h1 { font-size: 65px; margin: 16px 0; }.title-tagline { margin: 12px 0 18px; }.title-party { margin-top: 8px; }.title-actions { gap: 6px; }
  .gold-button,.outline-button { min-height: 43px; padding-top: 10px; padding-bottom: 10px; }.title-brand { font-size: 9px; }.title-footer { bottom: 13px; }
}

.key-settings-open, .key-settings button, .key-settings select {
  color: #ded8c5; background: #25333c; border: 1px solid #586667;
  border-radius: 5px; font: 13px system-ui, sans-serif; padding: 8px 12px; cursor: pointer;
}
.key-settings-open { position: fixed; right: 12px; top: 12px; z-index: 3; }
.key-settings-open.in-game { top: auto; bottom: 12px; }
.key-settings button:hover, .key-settings-open:hover { background: #364852; }
.key-settings button:focus-visible, .key-settings-open:focus-visible, .key-settings select:focus-visible {
  outline: 2px solid #d5bb7b; outline-offset: 2px;
}
.key-settings {
  box-sizing: border-box; width: min(820px, calc(100vw - 28px)); max-height: calc(100dvh - 28px);
  padding: 0; color: #e6e1d3; background: #15212a; border: 1px solid #6d756b;
  border-radius: 10px; box-shadow: 0 18px 80px #000b; font: 14px system-ui, sans-serif;
}
.key-settings[open] { display: flex; flex-direction: column; }
.key-settings::backdrop { background: #060d15c9; }
.key-settings-header { display: flex; justify-content: space-between; align-items: start; padding: 20px 22px 12px; }
.key-settings-header h1 { font-size: 23px; margin: 0 0 5px; }
.key-settings-header p, .key-settings-help { color: #a9b5b7; font-size: 12px; line-height: 1.5; margin: 0; }
.key-settings-header button { font-size: 22px; line-height: 1; }
.key-settings-content { padding: 0 22px 14px; overflow-y: auto; min-height: 0; }
.key-settings-player { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.key-settings-help { margin-bottom: 14px; }
.key-settings-bindings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; }
.key-settings-row { display: grid; grid-template-columns: minmax(0, 1fr) 108px 28px; gap: 5px; align-items: center; min-height: 37px; }
.key-settings-row span { font-size: 12px; }
.key-settings-row button { padding: 7px 4px; min-height: 34px; }
.key-settings-row .key-settings-clear { color: #a4aca9; }
.key-settings-row .awaiting-key { background: #6b5935; border-color: #dbbd77; }
.key-settings-footer { border-top: 1px solid #39474c; padding: 10px 22px 16px; }
.key-settings-footer [role="status"] { color: #c4c1aa; font-size: 12px; line-height: 1.4; min-height: 32px; margin: 0 0 9px; }
.key-settings-resets, .key-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.key-settings-resets { margin-bottom: 12px; }
.key-settings-actions { justify-content: flex-end; }
.key-settings [data-save] { background: #496252; border-color: #7b9b7e; }
@media (max-width: 650px) {
  .key-settings-open:not(.in-game) { font-size: 0; width: 32px; padding: 4px; }
  .key-settings-open:not(.in-game)::before { content: "⚙"; font-size: 20px; }
  .key-settings-bindings { grid-template-columns: 1fr; }
  .key-settings-header, .key-settings-content, .key-settings-footer { padding-left: 14px; padding-right: 14px; }
  .key-settings-resets button { font-size: 11px; padding: 7px; }
}

.player-count-menu {
  position: fixed; z-index: 2; inset: 0; margin: auto;
  width: min(680px, calc(100vw - 40px)); height: fit-content;
  max-height: calc(100dvh - 100px); overflow-y: auto;
  color: #eee7d5; font: 15px system-ui, sans-serif; text-align: center;
}
.player-count-menu[hidden], .player-count-back[hidden] { display: none; }
.player-count-eyebrow { color: #c4a35a; letter-spacing: 5px; font-size: 12px; }
.player-count-menu h1 { font-size: clamp(24px, 4vw, 36px); margin: 14px 0 10px; }
.player-count-menu p { color: #a6b2b6; line-height: 1.6; }
.player-count-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 28px 0; }
.player-count-options button {
  color: #eee7d5; background: #1e2a34; border: 1px solid #46565e;
  border-radius: 8px; padding: 25px 12px; cursor: pointer; font: inherit;
}
.player-count-options strong { display: block; font-size: 23px; margin-bottom: 7px; }
.player-count-options span { color: #a4b3b8; font-size: 12px; }
.player-count-options button.selected, .player-count-options button:hover {
  border-color: #d5b66f; background: #2b3540;
}
.player-count-options button:focus-visible, .player-count-back:focus-visible {
  outline: 2px solid #e2c684; outline-offset: 4px;
}
.player-count-menu .player-count-help { font-size: 12px; }
.player-count-back {
  position: fixed; z-index: 2; left: 12px; top: 12px; padding: 8px 12px;
  color: #ded8c5; background: #25333c; border: 1px solid #586667; border-radius: 5px;
  cursor: pointer; font: 13px system-ui, sans-serif;
}
@media (max-width: 650px) {
  .player-count-back { top: auto; bottom: 36px; padding: 6px 9px; font-size: 11px; }
  .player-count-options { gap: 10px; margin: 18px 0; }
  .player-count-options button { padding: 18px 8px; }
}

.arena-toolbar { z-index: 2; }
.arena-picker { z-index: 1; }
.arena-countdown { z-index: 1; }
.arena-back { display: block; margin: 0 0 14px; padding: 0; border: 0; background: transparent; color: #c8d5be; font: 11px system-ui; }
.arena-back:hover { color: #f4d89b; }
.arena-loot-hint { margin: 0; padding: 0 26px 4px; color: #c8b58a; font-size: 10px; }
@media(max-width:760px) { .arena-loot-hint { padding-left:16px; padding-right:16px; } }
.tutorial-ui .lesson-skip-all { top:12px; bottom:auto; }
.tutorial-ui.multiplayer .lesson-card { padding:8px 11px; }
.tutorial-ui.multiplayer .lesson-card h2 { font-size:16px; margin:7px 0; }
.tutorial-ui.multiplayer .lesson-weapons canvas { height:34px; }
.tutorial-ui.multiplayer .lesson-keys { margin:7px 0 1px; }
.tutorial-ui.multiplayer .lesson-keys kbd { padding:4px 8px; font-size:11px; min-width:26px; }
.tutorial-ui.multiplayer canvas.energy-curve { height:60px; }

.game-navigation { position:fixed; left:12px; top:12px; z-index:6; display:flex; gap:6px; }
.title-menu { background:#14262edb; border:1px solid #49655e; border-radius:5px; padding:8px 12px; color:#d5decf; font:12px system-ui; }
.title-menu:hover { background:#2a423e; }
.game-navigation button, .navigation-dialog button {
  cursor:pointer; border:1px solid #49655e; border-radius:5px; background:#14262ef5;
  color:#d5decf; padding:9px 12px; font:12px system-ui,sans-serif;
}
.game-navigation button:hover, .navigation-dialog button:hover { background:#2a423e; border-color:#95ac90; }
.game-navigation button:focus-visible, .navigation-dialog button:focus-visible { outline:2px solid #e2c684; outline-offset:3px; }
.navigation-dialog { width:min(460px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:22px; overflow-y:auto; border:1px solid #6b8271; border-radius:12px;
  background:#101f27; color:#eadfc4; box-shadow:0 24px 100px #000b; font:13px system-ui,sans-serif; }
.navigation-dialog::backdrop { background:#060e15ce; backdrop-filter:blur(5px); }
.navigation-dialog header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.navigation-dialog header .overline { margin:0 0 8px; font-size:9px; }
.navigation-dialog h1 { margin:0; font:32px Georgia,serif; }
.navigation-dialog header button { font-size:24px; padding:4px 12px; }
.navigation-dialog .navigation-resume { display:flex; justify-content:space-between; width:100%; padding:13px;
  background:#d5bb80; color:#172626; border-color:#ead8a4; font-weight:600; }
.navigation-dialog .navigation-resume:hover { background:#ead3a0; }
.navigation-links { display:grid; gap:7px; margin-top:14px; }
.navigation-links button { text-align:left; padding:12px; }
.navigation-links span { display:inline-block; width:30px; color:#8da69a; font-size:10px; }
.navigation-note { margin:17px 0 0; color:#96aca3; font-size:11px; line-height:1.6; }
.key-settings-header [data-game-menu] { font-size:12px; line-height:1.4; margin-right:6px; }
.arena-toolbar { left:auto; right:12px; transform:none; max-width:calc(100vw - 235px); }
@media(max-width:760px) {
  .game-navigation button { font-size:11px; padding:8px 9px; }
  .arena-toolbar { gap:0; max-width:calc(100vw - 205px); padding:3px; }
  .arena-toolbar>span { display:none; }
  .arena-toolbar button { font-size:10px; padding:7px 5px; }
}
@media(max-width:500px) {
  .tutorial-ui .lesson-skip-all { top:54px; left:auto; right:12px; transform:none; padding:8px 11px; font-size:10px; }
  .navigation-dialog { padding:16px; }.navigation-dialog header { margin-bottom:14px; }
  .arena-toolbar [data-home] { display:none; }
}
