@font-face{font-family:Inter;src:url("./fonts/inter.woff2") format("woff2");font-weight:100 900;font-display:swap}
@font-face{font-family:Barlow Condensed;src:url("./fonts/barlow-condensed-700.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:Barlow Condensed;src:url("./fonts/barlow-condensed-900.woff2") format("woff2");font-weight:900;font-display:swap}

:root {
  color-scheme: dark;
  --bg: #101011;
  --ink: #f6f2e9;
  --muted: #a8a4a0;
  --line: #343231;
  --accent: #ff783f;
  --blue: #66d6f6;
  --display: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem Inter, system-ui, sans-serif; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbol-sheet { position: absolute; width: 0; height: 0; overflow: hidden; }

.header { height: 4.7rem; border-bottom: 1px solid #282526; }
.header-inner, .main { width: min(100% - 3rem, 1320px); margin-inline: auto; }
.header-inner { height: 100%; display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: .65rem; border: 0; padding: 0; background: transparent; font: 900 1.58rem/.9 var(--display); letter-spacing: .04em; }
.brand-icon { color: var(--accent); width: 1.95rem; height: 1.95rem; }
.brand-accent { color: var(--accent); }
.header-tools { display: flex; gap: .55rem; }
.icon-button { display: grid; place-items: center; min-width: 2.7rem; min-height: 2.7rem; padding: .4rem; background: #171718; border: 1px solid var(--line); border-radius: 4px; color: #d4cfca; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.main { padding: 1.7rem 0 2.5rem; }

.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: clamp(33rem, 44vw, 39rem); overflow: hidden; border: 1px solid var(--line); background: #111112; }
.hero-image, .hero::after { position: absolute; inset: 0; z-index: -1; }
.hero-image {
  background: #101112 url("./rivet.webp") right 26% / cover no-repeat;
}
.hero::after {
  content: "";
  background: linear-gradient(90deg, #101011 1%, #101011eb 13%, #1010119c 35%, #10101106 64%), linear-gradient(0deg, #101011ca, transparent 24%);
}
.hero-content { padding: 2.5rem clamp(2.2rem, 5.4vw, 5rem); display: flex; flex-direction: column; align-items: flex-start; }
.eyebrow { display: flex; align-items: center; gap: .65rem; margin: 0; color: var(--accent); font-size: .82rem; font-weight: 800; letter-spacing: .19em; }
.eyebrow span { width: 1.65rem; height: 2px; background: currentColor; }
h1 { margin: .9rem 0 0; font: 900 clamp(7.3rem, 12vw, 11rem)/.76 var(--display); letter-spacing: -.018em; }
h1 em { font-style: normal; color: var(--accent); }
.intro { color: #ded6cf; font-weight: 500; font-size: clamp(1rem, 1.6vw, 1.25rem); margin: 1.35rem 0 1rem; }
.level-select { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); width: min(100%, 20.5rem); gap: .35rem; margin-bottom: .85rem; }
.level-choice { display: grid; gap: .18rem; min-height: 4.25rem; padding: .45rem .63rem; text-align: left; background: #181718e8; border: 1px solid #534842; border-radius: 3px; }
.level-choice span, .level-choice small { color: #d4c7be; font-size: .72rem; font-weight: 650; }
.level-choice strong { font: 900 1.22rem/.9 var(--display); letter-spacing: .04em; }
.level-choice[aria-pressed="true"] { border-color: var(--accent); background: #33201a; }
.level-choice[aria-pressed="true"] small { color: #ffb99b; }
.level-choice:disabled { opacity: .76; }
.level-choice:hover:not(:disabled) { border-color: var(--accent); }
.hero-actions { display: flex; gap: .65rem; align-items: center; }
.button, .text-button { display: inline-flex; justify-content: center; align-items: center; gap: .55rem; text-align: center; }
.button { min-height: 3.05rem; padding: .65rem 1.12rem; border: 1px solid transparent; border-radius: 3px; font: 800 .85rem/1.2 Inter, sans-serif; letter-spacing: .025em; }
.button svg { width: 1.12rem; height: 1.12rem; }
.primary { background: var(--accent); color: #1c100c; border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #ff9469; border-color: #ff9469; }
.secondary { background: #191716e8; border-color: #514643; color: #f2ede6; }
.secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.text-button { min-height: 2.75rem; padding: .35rem 0; background: transparent; border: 0; color: #c2bcb7; font-size: .84rem; font-weight: 650; }
.text-button svg { width: 1rem; height: 1rem; }
.text-button:hover { color: var(--accent); }
.hero-content > .text-button { margin-top: .55rem; }
.opponent { position: absolute; bottom: clamp(1.2rem, 3vw, 2.4rem); right: clamp(1.3rem, 3.5vw, 3.15rem); display: grid; gap: .2rem; color: #f5eee8; text-align: right; }
.opponent span { font-size: .74rem; color: #ffe1d6; font-weight: 800; letter-spacing: .15em; }
.opponent strong { font: 900 2.5rem/.94 var(--display); letter-spacing: .05em; }
.guide { margin-top: 1.65rem; }
.guide h2 { margin: 0 0 .75rem; font: 700 1.35rem/1 var(--display); letter-spacing: .11em; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.guide-tile { display: flex; align-items: center; min-width: 0; gap: .8rem; padding: 1rem; background: #171616; border: 1px solid #312e2d; }
.guide-icon { flex: none; display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border: 1px solid #614030; background: #2a1c17; color: var(--accent); border-radius: 3px; }
.guide-icon svg { width: 1.4rem; height: 1.4rem; }
.guide-tile h3 { margin: 0 0 .22rem; font-size: 1rem; }
.guide-tile p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.35; }

.stage { position: relative; isolation: isolate; width: 100%; min-height: clamp(25rem, 54vw, 44rem); overflow: hidden; background: #0a0f12; border: 1px solid var(--line); }
#arena { display: block; position: absolute; width: 100%; height: 100%; inset: 0; }
.fight-hud { display: grid; align-items: start; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: clamp(.65rem, 3vw, 2.4rem); position: absolute; inset: 0 0 auto; padding: clamp(.8rem, 3vw, 1.9rem); background: linear-gradient(#08090de8, #08090d85 63%, transparent); }
.health { min-width: 0; }
.health-label { display: flex; justify-content: space-between; align-items: baseline; gap: .25rem; margin-bottom: .25rem; text-shadow: 0 1px 4px #000; }
.health-label strong { font: 900 clamp(1.1rem, 3vw, 1.6rem)/1 var(--display); letter-spacing: .08em; }
.health-label span { color: #ece3db; font-size: .8rem; font-weight: 700; }
.robot-health .health-label { flex-direction: row-reverse; }
.health-track { position: relative; height: .76rem; background: #2a292b; border: 1px solid #888184; }
.health-track span { display: block; position: absolute; inset: 0; background: var(--blue); transform-origin: left; transition: transform .14s ease-out; }
.robot-health .health-track span { transform-origin: right; background: #ff774b; }
.stage[data-level="volt"] .robot-health .health-track span { background: #b58aff; }
.stage[data-level="titan"] .robot-health .health-track span { background: #e8cf66; }
.guard-badge { display: inline-flex; align-items: center; gap: .35rem; width: max-content; margin-top: .42rem; padding: .24rem .45rem; border: 1px solid #45a3be; border-radius: 2px; background: #102b37ed; color: #a9edff; font-size: .75rem; font-weight: 800; }
.guard-badge svg { width: .88rem; height: .88rem; }
.clock { text-align: center; min-width: clamp(4rem, 10vw, 6rem); }
.clock span { display: block; color: #e9ded9; font-weight: 800; font-size: clamp(.63rem, 1.5vw, .82rem); letter-spacing: .08em; white-space: nowrap; }
.clock #levelLabel { color: var(--accent); margin-bottom: .2rem; }
.clock strong { display: block; font: 900 clamp(2rem, 4.5vw, 3.5rem)/.82 var(--display); letter-spacing: .035em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.callout { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font: 900 clamp(2rem, 5vw, 4.1rem)/.9 var(--display); text-shadow: 0 2px 0 #090a0d, 0 4px 18px #090a0d, 0 0 2px #090a0d; text-align: center; letter-spacing: .055em; text-transform: uppercase; max-width: 94%; width: max-content; pointer-events: none; }
.callout[data-tone="good"] { color: var(--blue); }
.callout[data-tone="danger"] { color: #ffa27c; }
.callout[data-tone="countdown"] { top: 41%; color: var(--accent); font-size: clamp(5.25rem, 16vw, 11rem); }
.tracking-alert { position: absolute; left: clamp(.5rem, 2vw, 1.2rem); bottom: clamp(.5rem, 2vw, 1.2rem); max-width: 60%; padding: .55rem .7rem; border: 1px solid #785044; background: #1e1515ed; color: #ffdfd0; font-size: .8rem; }
.camera-card { position: absolute; z-index: 1; bottom: clamp(.5rem, 2vw, 1.2rem); right: clamp(.5rem, 2vw, 1.2rem); width: clamp(7rem, 19%, 13rem); border: 1px solid #51443d; background: #101416; }
.camera-frame { position: relative; aspect-ratio: 4/3; overflow: hidden; background: radial-gradient(#283237, #101416); }
.camera-frame video, .camera-frame canvas { position: absolute; display: block; inset: 0; width: 100%; height: 100%; }
.camera-frame video { object-fit: contain; transform: scaleX(-1); }
.camera-corners { position: absolute; inset: 7%; pointer-events: none; --corner: #f6eee8a3; background: linear-gradient(var(--corner),var(--corner)) top left / 1px 13px, linear-gradient(var(--corner),var(--corner)) top left / 13px 1px, linear-gradient(var(--corner),var(--corner)) top right / 1px 13px, linear-gradient(var(--corner),var(--corner)) top right / 13px 1px, linear-gradient(var(--corner),var(--corner)) bottom left / 1px 13px, linear-gradient(var(--corner),var(--corner)) bottom left / 13px 1px, linear-gradient(var(--corner),var(--corner)) bottom right / 1px 13px, linear-gradient(var(--corner),var(--corner)) bottom right / 13px 1px; background-repeat: no-repeat; }
.camera-readout { min-height: 1.75rem; display: flex; align-items: center; gap: .42rem; padding: .3rem .5rem; color: #f4eee7; font-size: .75rem; font-weight: 700; line-height: 1.25; }
#statusDot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); flex: none; }
#statusDot[data-ready="true"] { background: #6ae6aa; }
.stage-overlay { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; padding: 1rem; background: #0b0b0dcc; overflow-y: auto; }
.panel { width: min(100%, 28rem); text-align: center; background: #1a1717; border: 1px solid #5c473d; padding: clamp(1.2rem, 3vw, 2rem); box-shadow: 0 1.2rem 4rem #08080966; }
.panel-icon { display: grid; place-items: center; width: 2.55rem; height: 2.55rem; margin: 0 auto .65rem; border: 1px solid #754933; color: var(--accent); background: #332018; }
.panel h2 { font: 900 clamp(2.15rem, 6vw, 4rem)/.88 var(--display); letter-spacing: .045em; margin: 0 0 .7rem; }
.panel p { margin: .55rem 0; line-height: 1.4; }
.panel .panel-hint { font-size: .88rem; color: #c2b9b3; }
.panel .eyebrow { justify-content: center; }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .6rem; margin-top: 1rem; }
.panel-actions .text-button { flex-basis: 100%; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1.1rem; border: 1px solid #594741; }
.result-stats div { padding: .65rem .18rem; }
.result-stats div + div { border-left: 1px solid #594741; }
.result-stats strong { display: block; font: 900 1.85rem/.9 var(--display); color: var(--accent); }
.result-stats span { font-size: .7rem; color: #cec5be; font-weight: 700; }
.stage:has(#setup:not([hidden])) .camera-card { z-index: 3; width: clamp(10rem, 25%, 18rem); }
.stage:has(#setup:not([hidden])) .setup-panel { margin-right: min(26vw, 17rem); }
.play-strip { display: flex; justify-content: space-between; align-items: center; min-height: 3.65rem; gap: .55rem; padding: .35rem .8rem; border: 1px solid var(--line); border-top: 0; background: #171616; }
.play-strip .icon-button { margin-left: auto; }
.play-hint { color: var(--muted); font-size: .85rem; }
.practice-moves { display: flex; flex-wrap: wrap; gap: .35rem; }
.practice-moves span { padding: .33rem .5rem; background: #202022; border: 1px solid #464443; color: #c9c3bd; font-size: .76rem; font-weight: 700; }
.practice-moves span[data-done="true"] { border-color: #487965; color: #8dedc1; background: #182923; }
.small { min-height: 2.5rem; padding: .5rem .65rem; }
.manual-controls { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .4rem; margin-top: .55rem; }
.control { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; min-width: 0; min-height: 3.15rem; padding: .45rem .3rem; color: #f0e9e4; background: #191718; border: 1px solid var(--line); border-radius: 3px; font-size: .83rem; font-weight: 700; touch-action: none; user-select: none; }
.control:hover, .control[data-held="true"] { border-color: var(--accent); color: var(--accent); }
.control svg { width: .95rem; height: .95rem; color: var(--accent); }
kbd { min-width: 1.05rem; padding: .06rem .24rem; border: 1px solid #655854; border-radius: 2px; color: #d5c6c0; font-size: .7rem; }
.utility-message { position: fixed; z-index: 5; bottom: 1rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); margin: 0; padding: .7rem 1rem; border: 1px solid #68534a; background: #211c1b; }
body.expanded .header { height: 3.15rem; }
body.expanded .main { width: 100%; padding: 0; }
body.expanded .stage { min-height: calc(100dvh - 6.8rem); }

@media (max-width: 760px) {
  .header { height: 3.75rem; }
  .header-inner, .main { width: calc(100% - 1.5rem); }
  .main { padding-top: .75rem; }
  .hero { min-height: 32rem; }
  .hero-content { padding-inline: 1.65rem; }
  .hero-image { background-position: 61% 29%; }
  .hero::after { background: linear-gradient(90deg, #101011f5 1%, #101011d1 24%, #10101123 77%), linear-gradient(0deg,#101011c9,transparent 23%); }
  h1 { font-size: clamp(6rem, 15vw, 7.2rem); }
  .guide-tile { align-items: flex-start; flex-direction: column; gap: .55rem; padding: .6rem; }
  .guide-tile p { font-size: .83rem; }
  .guide-icon { width: 2.3rem; height: 2.3rem; }
  .stage { min-height: max(26rem, 72vw); }
  .practice-moves { flex: 1; }
  .play-hint { display: none; }
  .control { flex-direction: column; gap: .2rem; font-size: .76rem; }
}
@media (max-width: 510px) {
  .hero { min-height: 37rem; align-items: end; }
  .hero-image { background-size: auto 95%; background-position: 63% top; }
  .hero::after { background: linear-gradient(0deg, #101011 0%, #101011fc 20%, #10101198 52%, #10101108 82%), linear-gradient(90deg,#1010117a,#10101100); }
  .hero-content { padding: 1rem; width: 100%; }
  h1 { font-size: clamp(5.35rem, 20vw, 7rem); }
  .intro { margin: 1.2rem 0 .85rem; }
  .opponent { bottom: auto; top: .85rem; right: .7rem; text-shadow: 0 2px 8px #0a0909; }
  .opponent strong { font-size: 1.6rem; }
  .guide { margin-top: 1.25rem; }
  .guide-grid { gap: .31rem; }
  .guide-tile h3 { font-size: .93rem; }
  .guide-tile p { font-size: .8rem; }
  .stage:has(#setup:not([hidden])) { min-height: 38rem; }
  .stage:has(#setup:not([hidden])) .camera-card { top: .7rem; left: 50%; right: auto; bottom: auto; transform: translateX(-50%); width: 10rem; }
  .stage:has(#setup:not([hidden])) .stage-overlay { align-items: start; padding-top: 10.6rem; }
  .stage:has(#setup:not([hidden])) .setup-panel { margin-right: 0; padding: 1rem; }
  .setup-panel .panel-icon { display: none; }
  .play-strip { padding-inline: .45rem; }
  .play-strip .small { font-size: .75rem; }
}
@media (max-height: 470px) and (orientation: landscape) {
  body:has(#game:not([hidden])) .header { height: 2.85rem; }
  body:has(#game:not([hidden])) .main { padding-top: .2rem; }
  .stage, body.expanded .stage { min-height: 15rem; height: calc(100dvh - 6rem); }
  .stage:has(#setup:not([hidden])) { height: 19rem; }
  .play-strip { min-height: 2.7rem; padding-block: .15rem; }
  .play-strip .icon-button { min-height: 2rem; min-width: 2rem; }
}
@media (pointer: coarse) { kbd { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (max-width: 360px) {
  .hero-actions { gap: .4rem; }
  .hero-actions .button { padding-inline: .7rem; }
}
body.expanded:has(#manualControls:not([hidden])) .stage {
  min-height: max(15rem, calc(100dvh - 10.5rem));
}
