:root {
  color-scheme: dark;
  --bg: #0b1112;
  --panel: #141e1c;
  --text: #f5ecd8;
  --muted: #c3c3ac;
  --gold: #efc786;
  --line: #796343;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; font: 15px/1.45 var(--sans); color: var(--text); background: radial-gradient(ellipse at top, #263128 0, #111917 39%, var(--bg) 78%); }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, .arena:focus-visible { outline: 2px solid #fff0bd; outline-offset: 4px; }
.shell { width: min(1360px, calc(100% - 64px)); margin: 0 auto; padding: clamp(19px, 3.6vh, 42px) 0 25px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 16px; }
.eyebrow { margin: 0; color: var(--gold); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 650; }
h1, h2, .fighter-name strong { font-family: var(--serif); font-weight: 600; }
h1 { margin: 2px 0 0; font-size: clamp(2.6rem, 5vw, 4.85rem); letter-spacing: -.05em; line-height: .95; }
.mode { display: flex; align-items: center; gap: 12px; padding-bottom: 3px; color: var(--muted); font-size: .83rem; text-align: right; }
.arena { isolation: isolate; position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 9px; background: #252e27; box-shadow: 0 18px 75px #0009; }
.arena > canvas { display: block; width: 100%; height: 100%; }
.arena::after { content: ""; pointer-events: none; position: absolute; inset: 4px; border: 1px solid #f2c6882e; z-index: 2; border-radius: 5px; }
.hud { position: absolute; top: 3.7%; left: 4%; right: 4%; z-index: 3; display: grid; grid-template-columns: 1fr 7% 1fr; align-items: start; gap: 2%; color: #fff4da; filter: drop-shadow(0 2px 5px #000b); }
.fighter-name { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 4px; }
.fighter-name strong { font-size: clamp(.95rem, 2.5vw, 2.25rem); line-height: 1.05; }
.fighter-name small, .clock small { color: #f0dcc0; font-size: clamp(.48rem, 1vw, .73rem); }
.opponent .fighter-name, .opponent .special-line { flex-direction: row-reverse; }
.life-track { height: clamp(7px, 1.5vw, 19px); overflow: hidden; border: 1px solid #edd7a5b0; background: #251410e0; border-radius: 2px; box-shadow: inset 0 0 4px #000; }
.life-track i, .special-track i { display: block; height: 100%; transform-origin: left; background: linear-gradient(90deg, #c47749, #f6ce83); }
.opponent .life-track i { background: linear-gradient(90deg, #f0ce83, #a3624d); }
.opponent .life-track i, .opponent .special-track i { transform-origin: right; }
.special-line { display: flex; align-items: center; gap: 8px; color: #f6ecd6; font-size: clamp(.44rem, 1vw, .73rem); margin-top: 5px; min-height: 12px; }
.special-track { display: inline-block; width: 39%; height: clamp(4px, .58vw, 8px); background: #142423dc; border: 1px solid #a6d5d088; overflow: hidden; border-radius: 2px; }
.special-track i { background: linear-gradient(90deg, #60a098, #a6ebd9); transform: scaleX(0); }
.special-line.ready { color: #c5ffeb; font-weight: 700; }
.resource-line { margin-top: 4px; color: #ffde9b; font-size: clamp(.47rem, 1vw, .74rem); }
.opponent .resource-line { text-align: right; }
.combat-line { display: flex; gap: 10px; margin-top: 4px; color: #ffdf9e; font-size: clamp(.44rem, 1vw, .73rem); font-weight: 650; }
.opponent .combat-line { flex-direction: row-reverse; }
.dash-status { color: #ded4bc; font-variant-numeric: tabular-nums; }
.dash-status.available { color: #b6eedc; }
.clock { display: grid; place-items: center; padding: 2px 2px 5px; background: #171c17db; border: 1px solid #d7b47d9c; border-radius: 3px; font-variant-numeric: tabular-nums; }
.clock span { font-family: var(--serif); font-size: clamp(1.1rem, 3.3vw, 2.8rem); line-height: 1; }
.cue { position: absolute; z-index: 4; inset: 35% 6% auto; text-align: center; pointer-events: none; color: #ffe4aa; text-shadow: 0 4px 4px #1c180b, 0 1px 25px #000; font: 700 clamp(1.7rem, 6.3vw, 6rem)/1 var(--serif); }
.dialogue { position: absolute; z-index: 4; inset: auto 12% 7%; width: fit-content; max-width: 76%; margin: auto; padding: .45em .9em; border: 1px solid #a98a56; border-radius: 4px; color: #fff1ce; background: #131914ed; text-align: center; pointer-events: none; font-size: clamp(.68rem, 1.6vw, 1.16rem); }
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; align-items: center; justify-items: center; overflow: auto; padding: 14px; background: #0712107a; }
.overlay.select { background: linear-gradient(90deg, #08121185, #14201b18 50%, #0d1815a3), #0e151231; }
.panel { width: min(530px, 95%); text-align: center; padding: clamp(13px, 3vw, 30px); background: #111b18f2; border: 1px solid #c3a775a1; border-radius: 5px; box-shadow: 0 18px 54px #070b0a9c; }
.choose { width: min(1140px, 98%); }
.panel h2 { margin: 0 0 .55em; line-height: 1; font-size: clamp(1.7rem, 3.4vw, 3rem); letter-spacing: -.035em; }
.dialog p { margin: 0 0 13px; color: var(--muted); }
.dialog .eyebrow { color: var(--gold); }
.choices { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: clamp(6px, 1vw, 12px); margin-bottom: 16px; }
.choice { padding: 0; position: relative; display: flex; align-items: end; overflow: hidden; min-height: clamp(86px, 15vw, 158px); border: 1px solid #72674c; border-radius: 4px; text-align: left; color: var(--text); background: radial-gradient(ellipse at 60% 18%, #86633f 0, #302920 75%); }
.choice.andernath { background: radial-gradient(ellipse at 62% 17%, #62705a 0, #262d23 75%); }
.choice.jaldrud { background: radial-gradient(ellipse at 62% 17%, #8a785a 0, #392c26 75%); }
.choice.ila { background: radial-gradient(ellipse at 62% 17%, #587c88 0, #25363c 75%); }
.choice.jaliel { background: radial-gradient(ellipse at 62% 17%, #80638e 0, #372a42 75%); }
.choice.mojo { background: radial-gradient(ellipse at 62% 17%, #957140 0, #283444 75%); }
.choice.tiahria { background: radial-gradient(ellipse at 62% 17%, #9c5e80 0, #462235 75%); }
.choice.edwin { background: radial-gradient(ellipse at 62% 17%, #a87848 0, #413124 75%); }
.choice.cora { background: #5b342d; }
.choice:hover, .choice[aria-pressed="true"] { border-color: #ffe0a1; }
.choice[aria-pressed="true"] { outline: 1px solid #ffe0a1; outline-offset: 2px; }
.choice img { width: 100%; height: 100%; object-fit: cover; object-position: center 34%; position: absolute; inset: 0; }
.announcer-art { position: absolute; z-index: 4; inset: 0 auto 0 0; width: 66%; height: 100%; object-fit: contain; object-position: left bottom; filter: drop-shadow(0 12px 20px #0d1110c9); pointer-events: none; }
.announcer-art[data-side="right"] { inset: 0 0 0 auto; transform: scaleX(-1); }
.choice span { position: relative; display: grid; gap: 1px; padding: 18px 9px 7px; width: 100%; background: linear-gradient(transparent, #111511f2); }
.choice strong { font: 600 clamp(.72rem, 1.45vw, 1.18rem)/1 var(--serif); overflow-wrap: anywhere; }
.choice small { color: #e2ceb1; font-size: clamp(.56rem, 1vw, .73rem); }
.match-options { display: flex; justify-content: center; align-items: end; gap: 10px 25px; flex-wrap: wrap; margin-bottom: 14px; }
.opponent-option, .difficulty { display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: .77rem; }
.opponent-option select { min-width: 125px; padding: 5px 12px; color: var(--text); background: #26312a; border: 1px solid #796a50; border-radius: 4px; font: inherit; }
.difficulty-options { display: flex; gap: 6px; }
.difficulty-options button { padding: 5px 12px; min-width: 68px; color: var(--text); background: #26312a; border: 1px solid #796a50; border-radius: 4px; }
.difficulty-options button:hover { background: #38453a; }
.difficulty-options button[aria-pressed="true"] { color: #19160f; background: #ebc58a; border-color: #f3d6a0; font-weight: 700; }
.primary, .secondary { border-radius: 4px; padding: 8px 16px; border: 1px solid #b89861; min-height: 38px; }
.primary { color: #19160f; font-weight: 700; background: #ebc58a; }
.primary:hover:not(:disabled) { background: #ffe2ae; }
.secondary { color: var(--text); background: #26312a; }
.secondary:hover { background: #38453a; }
.compact { min-height: 30px; padding: 4px 11px; }
.actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.load-status { margin: 8px 0 0; font-size: .78rem; color: var(--muted); }
.load-status:empty { display: none; }
.controls { padding: 14px 0 0; }
.controls dl { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 22px; margin: 0; }
.controls dl div { display: flex; align-items: baseline; gap: 7px; }
.controls dd { margin: 0; color: var(--text); font-size: .82rem; }
.controls p { margin: 9px 0 0; color: var(--muted); font-size: .79rem; }
kbd { display: inline-block; font: 600 .78em/1.1 var(--sans); padding: 3px 5px; min-width: 20px; text-align: center; background: #24302a; color: #f5e8c9; border: 1px solid #6f7059; border-bottom-width: 2px; border-radius: 4px; white-space: nowrap; }
.primary kbd { color: #21190e; background: #f9dca7; border-color: #a47b47; margin-left: 4px; }
.no-script { position: absolute; z-index: 6; bottom: 5%; width: 100%; text-align: center; background: var(--panel); }
@media (min-width: 850px) and (max-height: 870px) { .shell { width: min(1280px, calc((100vh - 165px) * 16 / 9), calc(100% - 58px)); } }
@media (max-width: 650px) {
  .shell { width: calc(100% - 24px); padding-top: 14px; }
  .masthead { margin-bottom: 10px; }
  .mode { max-width: 130px; font-size: .68rem; flex-wrap: wrap; justify-content: end; }
  .overlay { padding: 6px; }
  .panel { padding: 9px; }
  .panel h2 { font-size: 1.2rem; margin-bottom: 8px; }
  .choices { margin-bottom: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .match-options { gap: 5px 10px; margin-bottom: 8px; }
  .difficulty, .opponent-option { gap: 3px; }
  .difficulty-options button { min-width: 57px; padding: 3px 8px; }
  .choice { min-height: 62px; }
  .choice span { padding: 10px 6px 5px; }
  .primary, .secondary { min-height: 30px; padding: 4px 8px; font-size: .72rem; }
  .controls dl { gap: 6px 10px; }
}
