:root {
  --gold: #d9ae5e;
  --gold-dim: rgba(217, 174, 94, 0.36);
  --obsidian: rgba(11, 9, 15, 0.78);
  --ink: #f3ece0;
  --ink-muted: rgba(243, 236, 224, 0.68);
  --accent-a: #ff7a18;
  --dorsal-a: #6b2a12;
  --accent-b: #3ab8ff;
  --dorsal-b: #13324a;
  --serif: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07060a;
  color: var(--ink);
  font-family: var(--sans);
}

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(0, 0, 0, 0) 56%, rgba(4, 3, 7, 0.72) 100%),
    linear-gradient(to bottom, rgba(5, 4, 8, 0.55) 0%, rgba(5, 4, 8, 0) 18%, rgba(5, 4, 8, 0) 82%, rgba(5, 4, 8, 0.62) 100%);
}

/* ------------------------------------------------------------------ Top HUD */
.hud {
  position: fixed;
  top: 20px;
  left: 28px;
  right: 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 22px;
  pointer-events: none;
  transition: opacity 0.65s ease, transform 0.65s ease;
  z-index: 10;
}

.hud.hidden {
  opacity: 0;
  transform: translateY(-14px);
}

.fighter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fighter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.fighter-name {
  font-family: var(--serif);
  font-size: clamp(16px, 1.8vw, 23px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.fighter-a .fighter-name {
  color: #fff6e8;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent-a) 55%, transparent), 0 2px 10px #000;
}

.fighter-b .fighter-name {
  color: #eef8ff;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent-b) 55%, transparent), 0 2px 10px #000;
}

.fighter-meta {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.hp-frame {
  position: relative;
  height: 15px;
  background: rgba(8, 7, 12, 0.84);
  border: 1px solid var(--gold-dim);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.9),
    0 4px 18px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  border-radius: 2px;
}

.fighter-a .hp-frame {
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.fighter-b .hp-frame {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%);
}

.hp-lag,
.hp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  transition: width 0.08s linear;
}

.fighter-a .hp-lag,
.fighter-a .hp-fill {
  left: 0;
}

.fighter-b .hp-lag,
.fighter-b .hp-fill {
  right: 0;
}

.hp-lag {
  background: rgba(255, 232, 194, 0.55);
}

.fighter-a .hp-fill {
  background: linear-gradient(90deg, var(--dorsal-a) 0%, var(--accent-a) 82%, #fff0cf 100%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-a) 75%, transparent);
}

.fighter-b .hp-fill {
  background: linear-gradient(270deg, var(--dorsal-b) 0%, var(--accent-b) 82%, #e0f7ff 100%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-b) 75%, transparent);
}

.hp-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, 0.25) 100%);
  pointer-events: none;
}

.hp-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
}

.hp-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

.fighter.hurt .hp-frame {
  border-color: rgba(255, 235, 190, 0.9);
  box-shadow: 0 0 18px rgba(255, 160, 80, 0.45);
}

.center-crest {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 18px 7px;
  background: linear-gradient(to bottom, rgba(16, 13, 21, 0.88), rgba(10, 8, 14, 0.72));
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  min-width: 118px;
}

.crest-title {
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--gold);
  opacity: 0.9;
}

.clock {
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* ------------------------------------------------------------------ Intro Card */
.intro-card {
  position: fixed;
  bottom: 11vh;
  left: 6vw;
  max-width: 460px;
  padding: 18px 26px 20px;
  background: linear-gradient(125deg, rgba(12, 10, 17, 0.86) 0%, rgba(16, 12, 22, 0.56) 100%);
  border-left: 3px solid var(--gold);
  border-top: 1px solid rgba(217, 174, 94, 0.22);
  border-bottom: 1px solid rgba(217, 174, 94, 0.14);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 15;
}

.intro-card.side-b {
  left: auto;
  right: 6vw;
  text-align: right;
  border-left: none;
  border-right: 3px solid var(--accent-b);
}

.intro-card.side-a {
  border-left-color: var(--accent-a);
}

.intro-card.on {
  opacity: 1;
  transform: translateY(0);
}

.intro-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}

.intro-card.side-b .intro-top {
  flex-direction: row-reverse;
}

.intro-eyebrow {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}

.intro-class {
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 3px 10px 3px 11px;
  border-radius: 2px;
  border: 1px solid var(--gold-dim);
  background: rgba(217, 174, 94, 0.14);
  color: #f8e6bd;
  white-space: nowrap;
}

.intro-card.side-a .intro-class {
  border-color: color-mix(in srgb, var(--accent-a) 68%, transparent);
  background: color-mix(in srgb, var(--accent-a) 18%, rgba(12, 10, 17, 0.72));
  color: #fff2dc;
}

.intro-card.side-b .intro-class {
  border-color: color-mix(in srgb, var(--accent-b) 68%, transparent);
  background: color-mix(in srgb, var(--accent-b) 18%, rgba(12, 10, 17, 0.72));
  color: #e6f6ff;
}

.intro-name {
  font-family: var(--serif);
  font-size: clamp(28px, 3.8vw, 48px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.08;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

.intro-rule {
  height: 2px;
  margin: 10px 0 9px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.intro-card.side-b .intro-rule {
  background: linear-gradient(270deg, var(--accent-b), transparent);
}

.intro-card.side-a .intro-rule {
  background: linear-gradient(90deg, var(--accent-a), transparent);
}

.intro-stats {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ Callout */
#callout {
  position: fixed;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.84);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(36px, 6vw, 76px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
  z-index: 20;
  text-shadow: 0 6px 32px rgba(0, 0, 0, 0.95);
}

#callout.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#callout.combat {
  color: #f9e6ba;
  text-shadow:
    0 0 28px rgba(217, 174, 94, 0.78),
    0 0 64px rgba(255, 145, 50, 0.45),
    0 6px 26px #000;
}

#callout.break {
  top: 30%;
  font-size: clamp(26px, 4vw, 50px);
  color: #ffe3b8;
  text-shadow:
    0 0 24px rgba(255, 155, 64, 0.85),
    0 4px 20px #000;
}

#callout.core {
  top: 30%;
  font-size: clamp(28px, 4.4vw, 54px);
  color: #ffffff;
  text-shadow:
    0 0 26px rgba(130, 210, 255, 0.95),
    0 0 54px rgba(255, 160, 70, 0.6),
    0 4px 22px #000;
}

#callout.ko {
  font-size: clamp(54px, 8.2vw, 108px);
  letter-spacing: 0.3em;
  color: #fff6e4;
  text-shadow:
    0 4px 12px rgba(0, 0, 0, 0.98),
    0 0 22px rgba(255, 118, 42, 0.85),
    0 0 48px rgba(255, 175, 65, 0.45);
}

#callout.clean {
  top: 30%;
  font-size: clamp(30px, 4.8vw, 60px);
  color: #fff3d6;
  text-shadow: 0 0 26px rgba(255, 120, 40, 0.95), 0 0 60px rgba(255, 200, 90, 0.5), 0 4px 22px #000;
}

#callout.block {
  top: 30%;
  font-size: clamp(26px, 4vw, 50px);
  color: #d8ecff;
  text-shadow: 0 0 22px rgba(120, 190, 255, 0.9), 0 4px 20px #000;
}

#callout.dodge {
  top: 30%;
  font-size: clamp(24px, 3.6vw, 44px);
  font-style: italic;
  color: #e4ffe8;
  text-shadow: 0 0 20px rgba(90, 255, 170, 0.8), 0 4px 20px #000;
}

/* ------------------------------------------------------------------ Verdict */
.verdict {
  position: fixed;
  left: 50%;
  bottom: 11vh;
  transform: translate(-50%, 16px);
  padding: 16px 38px 18px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(14, 11, 20, 0.88), rgba(8, 7, 12, 0.82));
  border-top: 2px solid var(--gold);
  border-bottom: 1px solid var(--gold-dim);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.55s ease;
  z-index: 18;
}

.verdict.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.verdict-kicker {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}

.verdict-winner {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: clamp(26px, 3.6vw, 44px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.verdict-sub {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ Interactive Controls */
.controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--obsidian);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  z-index: 25;
  opacity: 0.72;
  transition: opacity 0.25s ease;
}

.controls:hover {
  opacity: 1;
}

body.clip-mode .controls {
  display: none;
}

.ctrl-btn {
  background: transparent;
  border: 1px solid rgba(217, 174, 94, 0.32);
  color: var(--ink);
  width: 30px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ctrl-btn:hover {
  background: rgba(217, 174, 94, 0.18);
  border-color: var(--gold);
}

.ctrl-speed {
  width: 38px;
  font-size: 11px;
  font-weight: 600;
}

#scrubber {
  width: min(36vw, 320px);
  accent-color: var(--gold);
  cursor: pointer;
}

/* ------------------------------------------------------------------ Status */
.status-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 6, 10, 0.92);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  z-index: 40;
  transition: opacity 0.45s ease;
}

.status-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* behaviour rule currently firing (program monsters) */
.rule-now { margin-top: 5px; font: 700 13px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; color: #e9d9a6; opacity: 0; transition: opacity .25s; text-shadow: 0 1px 2px #000; min-height: 14px; }
.fighter-b .rule-now { text-align: right; }
.rule-now.on { opacity: .95; }
.rule-now.flash { color: #fff6c8; }
