:root {
  color-scheme: dark;
  --bg: #06080c;
  --panel: rgba(9, 13, 19, 0.94);
  --line: rgba(158, 177, 202, 0.25);
  --text: #f4f7fb;
  --muted: #9aa8ba;
  --player: #60e6ff;
  --rival: #ff6475;
  --gold: #f4cc62;
}

* { box-sizing: border-box; }

html,
body,
#app {
  height: 100%;
  margin: 0;
  overflow: hidden;
  width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select { font: inherit; }

button {
  background: var(--text);
  border: 0;
  border-radius: 3px;
  color: #080b10;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.1em;
  min-width: 230px;
  padding: 14px 22px;
  text-transform: uppercase;
}

button:hover { filter: brightness(0.88); }
button:focus-visible,
select:focus-visible { outline: 3px solid var(--player); outline-offset: 3px; }

#game {
  display: block;
  height: 100%;
  width: 100%;
}

.hidden { display: none !important; }

.match-header {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  left: 50%;
  max-width: 1050px;
  padding: 22px;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: translateX(-50%);
  width: 100%;
  z-index: 5;
}

.fighter-card {
  background: linear-gradient(180deg, rgba(8, 12, 18, 0.9), rgba(8, 12, 18, 0.55));
  border-top: 2px solid var(--player);
  padding: 10px 12px 9px;
}

.rival-card { border-color: var(--rival); text-align: right; }
.fighter-line { align-items: baseline; display: flex; justify-content: space-between; }
.fighter-name { font-size: 11px; font-weight: 900; letter-spacing: 0.17em; }
.player-card .fighter-name { color: var(--player); }
.rival-card .fighter-name { color: var(--rival); }
.fighter-line strong { font-size: 20px; }

.health-track {
  background: rgba(255, 255, 255, 0.1);
  height: 7px;
  margin: 6px 0 9px;
  overflow: hidden;
}

.health-fill { height: 100%; transition: width 120ms ease-out; width: 100%; }
.player-health { background: var(--player); box-shadow: 0 0 18px rgba(96, 230, 255, 0.65); }
.rival-health { background: var(--rival); box-shadow: 0 0 18px rgba(255, 100, 117, 0.65); margin-left: auto; }

.round-pips { display: flex; gap: 5px; }
.rival-card .round-pips { justify-content: flex-end; }

.pip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255,255,255,0.16);
  height: 6px;
  transform: skewX(-15deg);
  width: 30px;
}

.player-card .pip.filled { background: var(--player); border-color: var(--player); }
.rival-card .pip.filled { background: var(--rival); border-color: var(--rival); }

.round-card {
  align-items: center;
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 132px;
  padding: 8px 20px;
}

.round-card span,
.round-card small { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: 0.15em; }
.round-card strong { font-size: 27px; line-height: 1.05; }

.crosshair {
  height: 26px;
  left: 50%;
  pointer-events: none;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  z-index: 4;
}

.crosshair::before,
.crosshair::after,
.crosshair span::before,
.crosshair span::after {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 3px rgba(0,0,0,0.9);
  content: "";
  position: absolute;
}

.crosshair::before { height: 1px; left: 0; top: 13px; width: 8px; }
.crosshair::after { height: 1px; right: 0; top: 13px; width: 8px; }
.crosshair span::before { height: 8px; left: 13px; top: 0; width: 1px; }
.crosshair span::after { bottom: 0; height: 8px; left: 13px; width: 1px; }

.crosshair.ready::before,
.crosshair.ready::after,
.crosshair.ready span::before,
.crosshair.ready span::after { background: var(--player); }

.hitmarker {
  color: var(--text);
  font-size: 34px;
  font-weight: 200;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  text-shadow: 0 0 8px rgba(255,255,255,0.8);
  top: 50%;
  transform: translate(-50%, -54%) rotate(45deg);
  transition: opacity 80ms linear;
  z-index: 5;
}

.hitmarker.show { opacity: 1; }

.damage-flash {
  background: radial-gradient(circle, transparent 48%, rgba(255, 40, 64, 0.5) 100%);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 100ms linear;
  z-index: 3;
}

.damage-flash.show { opacity: 1; }

.weapon-hud,
.combat-log {
  background: rgba(8, 12, 18, 0.76);
  bottom: 24px;
  pointer-events: none;
  position: fixed;
  z-index: 4;
}

.weapon-hud { border-right: 2px solid var(--player); left: 24px; padding: 11px 18px 10px 12px; }
.weapon-hud span { color: var(--player); font-size: 9px; font-weight: 900; letter-spacing: 0.15em; }
.weapon-hud strong { display: block; font-size: 24px; line-height: 1.1; }
.weapon-hud strong small { color: var(--muted); font-size: 9px; letter-spacing: 0.12em; }
.weapon-hud p { color: var(--muted); font-size: 9px; margin: 2px 0 0; }

.combat-log {
  border-left: 2px solid var(--gold);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 12px 14px 11px 18px;
  right: 24px;
}

.overlay {
  align-items: center;
  background: radial-gradient(circle at 50% 42%, rgba(23, 31, 43, 0.75), rgba(4, 6, 9, 0.96));
  display: flex;
  inset: 0;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
  position: fixed;
  z-index: 10;
}

.panel {
  align-items: center;
  display: flex;
  flex-direction: column;
  max-width: 660px;
  text-align: center;
  width: 100%;
}

.eyebrow { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: 0.2em; }

.panel h1 {
  font-size: clamp(68px, 12vw, 138px);
  letter-spacing: -0.075em;
  line-height: 0.68;
  margin: 32px 0 25px;
  text-shadow: 8px 8px 0 rgba(255, 100, 117, 0.18), -8px -8px 0 rgba(96, 230, 255, 0.15);
}

.panel h2 { font-size: clamp(38px, 6vw, 70px); letter-spacing: -0.05em; margin: 15px 0 8px; }
.panel > p { color: var(--muted); line-height: 1.5; }
.promise { font-size: 17px; margin-bottom: 24px; }

.rules {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 20px;
  max-width: 540px;
  width: 100%;
}

.rules span {
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  font-size: 10px;
  gap: 2px;
  padding: 10px;
  text-transform: uppercase;
}

.rules strong { color: var(--text); font-size: 21px; }

.rival-setting { display: grid; gap: 7px; margin-bottom: 12px; max-width: 340px; text-align: left; width: 100%; }
.rival-setting span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: 0.13em; text-transform: uppercase; }
.rival-setting select { background: #141b25; border: 1px solid var(--line); border-radius: 3px; color: var(--text); padding: 11px 34px 11px 12px; width: 100%; }
.controls { font-size: 11px; margin-top: 14px; }

.result-stats {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  margin: 10px 0 16px;
  max-width: 520px;
  width: 100%;
}

.result-stats div { background: rgba(255,255,255,0.045); border: 1px solid var(--line); display: grid; gap: 4px; padding: 13px; }
.result-stats span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.result-stats strong { font-size: 25px; }
.coach { border-left: 2px solid var(--gold); color: var(--text) !important; margin: 0 0 18px; max-width: 520px; padding-left: 14px; text-align: left; }
#resultScore { color: var(--text); font-size: 24px; font-weight: 900; margin: 0; }

@media (max-width: 720px) {
  .match-header { gap: 5px; grid-template-columns: 1fr auto 1fr; padding: 8px; }
  .fighter-card { padding: 6px; }
  .fighter-name { font-size: 8px; }
  .fighter-line strong { font-size: 15px; }
  .round-card { min-width: 88px; padding: 5px 8px; }
  .round-card strong { font-size: 21px; }
  .round-card span { font-size: 7px; }
  .pip { width: 15px; }
  .weapon-hud,
  .combat-log { bottom: 10px; }
  .weapon-hud { left: 10px; }
  .combat-log { right: 10px; }
  .rules { grid-template-columns: 1fr; }
}

@media (pointer: coarse) {
  #startPanel { display: none; }
  #mobilePanel { display: flex !important; }
}
