:root {
  --bg: #07080d;
  --panel: rgba(12, 14, 22, .78);
  --panel-solid: #10131e;
  --line: rgba(174, 184, 214, .16);
  --text: #f4f5fb;
  --muted: #a5abc2;
  --dim: #6d7590;
  --accent: #818cf8;
  --accent-2: #c4b5fd;
  --blue: #60a5fa;
  --red: #fb7185;
  --green: #6ee7b7;
  --shadow: 0 24px 80px rgba(0, 0, 0, .55);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body {
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
}
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
#app { position: fixed; inset: 0; min-height: 100dvh; isolation: isolate; }
#cage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #07080d; }

/* ---------- top bar ---------- */
.game-top {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px;
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
  background: linear-gradient(180deg, rgba(7,8,13,.9), rgba(7,8,13,0));
  pointer-events: none;
}
.game-top > * { pointer-events: auto; }
.game-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.game-brand img { width: 34px; height: 34px; object-fit: contain; opacity: .92; }
.game-brand strong { display: block; font-size: .78rem; letter-spacing: .02em; }
.game-brand small { display: block; color: var(--dim); font-size: .58rem; letter-spacing: .11em; text-transform: uppercase; }
.round-badge {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(12,14,22,.6); backdrop-filter: blur(12px);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.round-badge span { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.round-badge b { font-size: .95rem; color: var(--text); font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(12,14,22,.65); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; font-size: .9rem;
}
.icon-btn.on { color: var(--text); border-color: rgba(129,140,248,.45); }

/* ---------- HUD ---------- */
.hud {
  position: absolute; z-index: 4; left: 0; right: 0;
  top: calc(60px + var(--safe-top));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px;
  padding: 0 calc(14px + var(--safe-right)) 0 calc(14px + var(--safe-left));
  pointer-events: none;
}
.fighter-hud { max-width: 340px; width: 100%; }
.fighter-hud.right { justify-self: end; }
.fighter-name { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: .68rem; color: var(--muted); }
.fighter-hud.right .fighter-name { justify-content: flex-end; }
.fighter-name strong { color: var(--text); font-size: .78rem; letter-spacing: .02em; }
.fighter-name em { font-style: normal; color: var(--dim); font-family: ui-monospace, monospace; font-size: .58rem; }
.corner-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.corner-dot.blue { background: var(--blue); box-shadow: 0 0 12px rgba(96,165,250,.8); }
.corner-dot.red { background: var(--red); box-shadow: 0 0 12px rgba(251,113,133,.8); }
.center-mark { color: var(--dim); font-size: .58rem; font-weight: 700; letter-spacing: .12em; padding-top: 17px; }
.bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,.09); overflow: hidden; border: 1px solid rgba(255,255,255,.06); }
.bar + .bar { margin-top: 4px; height: 4px; }
.bar i { display: block; height: 100%; width: 100%; border-radius: inherit; transition: width .18s linear; }
.health i { background: linear-gradient(90deg, #60a5fa, #818cf8); }
.fighter-hud.right .health i { background: linear-gradient(90deg, #fb7185, #f97316); }
.stamina i { background: rgba(110,231,183,.75); }
.fighter-hud.right .bar i { transform-origin: right center; }

/* ---------- center messages ---------- */
.announce {
  position: absolute; z-index: 6; inset: 0; display: grid; place-items: center;
  pointer-events: none; opacity: 0; transform: scale(.92);
  transition: opacity .22s ease, transform .22s ease;
  font-size: clamp(2rem, 8vw, 5rem); font-weight: 900; letter-spacing: -.06em;
  text-transform: uppercase; color: var(--text); text-align: center;
  text-shadow: 0 10px 40px rgba(0,0,0,.8), 0 0 50px rgba(129,140,248,.25);
}
.announce.show { opacity: 1; transform: scale(1); }
.announce small { display: block; font-size: .18em; letter-spacing: .22em; color: var(--accent-2); margin-top: 10px; }
.combo {
  position: absolute; z-index: 6; left: 50%; top: 34%; transform: translate(-50%, -50%);
  padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(129,140,248,.35);
  background: rgba(12,14,22,.65); color: var(--accent-2); font-family: ui-monospace, monospace;
  font-size: .68rem; letter-spacing: .09em; opacity: 0; transition: opacity .15s, transform .15s;
}
.combo.show { opacity: 1; transform: translate(-50%, -50%) translateY(-6px); }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; z-index: 20; inset: 0; display: grid; place-items: center;
  padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(20px + var(--safe-left));
  background: radial-gradient(900px 600px at 70% 20%, rgba(129,140,248,.15), transparent 65%),
              linear-gradient(180deg, rgba(7,8,13,.55), rgba(7,8,13,.9));
  backdrop-filter: blur(5px);
}
.overlay[hidden] { display: none; }
.panel {
  width: min(620px, 100%); padding: clamp(22px, 4vw, 40px);
  border: 1px solid rgba(174,184,214,.18); border-radius: 18px;
  background: linear-gradient(160deg, rgba(19,23,36,.92), rgba(10,12,19,.9));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
.kicker { display: inline-block; color: var(--accent-2); font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 12px; }
.panel h1, .panel h2 { margin: 0; font-size: clamp(2.1rem, 7vw, 4rem); line-height: .98; letter-spacing: -.055em; font-weight: 900; }
.panel h1 span { color: var(--accent-2); }
.panel h2 { font-size: clamp(1.9rem, 6vw, 3.2rem); }
.lede { color: var(--muted); font-size: clamp(.86rem, 2.5vw, .98rem); line-height: 1.65; margin: 16px 0 0; max-width: 52ch; }
.start-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.cta {
  display: inline-flex; align-items: center; gap: 12px;
  border: 0; border-radius: 9px; padding: 13px 18px;
  background: var(--accent); color: #080a12; font-weight: 800; font-size: .88rem;
  cursor: pointer; box-shadow: 0 12px 30px rgba(129,140,248,.28);
  transition: transform .18s, background .18s;
}
.cta:hover { transform: translateY(-2px); background: #a5b4fc; }
.cta span { font-size: 1.05rem; }
.text-link { color: var(--accent-2); font-size: .78rem; font-weight: 600; }
.text-link:hover { color: var(--text); }
.hints { display: grid; gap: 10px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.hints div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: start; }
.hints b { font-family: ui-monospace, monospace; font-size: .58rem; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); padding-top: 2px; }
.hints span { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.fine { margin: 18px 0 0; color: var(--dim); font-size: .64rem; line-height: 1.55; }

/* ---------- controls ---------- */
.controls {
  position: absolute; z-index: 7; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 14px;
  padding: 0 calc(16px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(16px + var(--safe-left));
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.controls.show { opacity: 1; pointer-events: auto; }
.stick {
  position: relative; width: clamp(104px, 24vw, 132px); height: clamp(104px, 24vw, 132px);
  border-radius: 50%; flex: 0 0 auto; touch-action: none;
  background: radial-gradient(circle at 50% 45%, rgba(129,140,248,.16), rgba(12,14,22,.35) 65%);
  border: 1px solid rgba(174,184,214,.2); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 30px rgba(0,0,0,.35);
}
.stick-ring { position: absolute; inset: 20%; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.knob {
  position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #c7d2fe, #818cf8 55%, #4f46e5);
  box-shadow: 0 6px 18px rgba(79,70,229,.4), inset 0 1px 0 rgba(255,255,255,.35);
  will-change: transform;
}
.actions { display: grid; grid-template-columns: repeat(3, minmax(64px, 1fr)); gap: 8px; max-width: 300px; width: 100%; }
.action {
  min-height: 54px; padding: 8px 8px; border-radius: 10px; border: 1px solid rgba(174,184,214,.16);
  background: rgba(12,14,22,.62); backdrop-filter: blur(8px); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; touch-action: none; transition: transform .1s, border-color .15s, background .15s;
}
.action b { font-size: clamp(.62rem, 1.8vw, .74rem); letter-spacing: .03em; font-weight: 800; }
.action span { font-family: ui-monospace, monospace; font-size: .48rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.action:active, .action.pressed { transform: scale(.95); border-color: rgba(129,140,248,.5); background: rgba(129,140,248,.14); }
.action.cross { grid-column: span 2; }
.action.kick { grid-column: span 1; }
.action.block { grid-column: span 1; }
.action.takedown { grid-column: span 1; }
.action.block.pressed { border-color: rgba(110,231,183,.55); background: rgba(110,231,183,.12); }

.rotate-hint {
  position: absolute; z-index: 8; left: 50%; bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%); display: none; padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(12,14,22,.75); color: var(--dim);
  font-size: .62rem; letter-spacing: .04em; white-space: nowrap;
}
.mobile-safe { display: none; }

@media (max-width: 560px) and (orientation: portrait) {
  .hud { top: calc(56px + var(--safe-top)); grid-template-columns: 1fr 36px 1fr; gap: 6px; }
  .fighter-name em { display: none; }
  .game-brand small { display: none; }
  .round-badge { gap: 6px; padding: 5px 8px; }
  .round-badge span { font-size: .5rem; }
  .round-badge b { font-size: .82rem; }
  .icon-btn { width: 32px; height: 32px; }
  .panel { border-radius: 14px; }
  .start-actions { gap: 12px; }
  .hints { display: none; }
  .fine { display: none; }
  .controls { padding-bottom: calc(12px + var(--safe-bottom)); }
  .actions { max-width: 210px; gap: 6px; }
  .action { min-height: 48px; padding: 6px; }
  .action b { font-size: .58rem; }
  .action span { display: none; }
  .rotate-hint { display: block; }
}
@media (max-height: 520px) {
  .game-top { padding-top: calc(6px + var(--safe-top)); }
  .hud { top: calc(44px + var(--safe-top)); }
  .controls { padding-bottom: calc(8px + var(--safe-bottom)); }
  .stick { width: 96px; height: 96px; }
  .action { min-height: 42px; }
  .rotate-hint { display: none; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .controls { opacity: 1; pointer-events: auto; }
}

/* Hide the orientation hint once the fight controls are visible. */
.controls.show ~ .rotate-hint { display: none; }

/* Adult-mode gate */
.overlay.age-gate { z-index: 30; }
.age-gate .panel { border-color: rgba(251,113,133,.22); }
.age-gate .kicker { color: #fda4af; }
.age-gate .cta { background: #fda4af; box-shadow: 0 12px 30px rgba(251,113,133,.22); }
.age-gate .cta:hover { background: #fecdd3; }

body.gate-locked .hud,
body.gate-locked .controls,
body.gate-locked .announce,
body.gate-locked .combo { opacity: 0; pointer-events: none; }

/* Fight-night tale of the tape */
.start-screen .panel { width: min(720px, 100%); }
.tale { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 22px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.tale-fighter { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tale-fighter.right { text-align: right; align-items: flex-end; }
.tale-corner { font-family: ui-monospace, monospace; font-size: .52rem; letter-spacing: .12em; text-transform: uppercase; }
.tale-corner.blue { color: var(--blue); }
.tale-corner.red { color: var(--red); }
.tale-fighter strong { font-size: 1.02rem; letter-spacing: -.02em; }
.tale-fighter em { font-style: normal; color: var(--muted); font-family: ui-monospace, monospace; font-size: .62rem; }
.tale-fighter small { color: var(--dim); font-size: .62rem; }
.tale-vs { color: var(--dim); font-size: .68rem; font-weight: 900; letter-spacing: .08em; }
@media (max-width: 620px) {
  .tale { gap: 7px; padding: 10px; }
  .tale-fighter strong { font-size: .84rem; }
  .tale-fighter em { font-size: .54rem; }
  .tale-fighter small { font-size: .54rem; }
  .fighter-name strong { font-size: .68rem; }
  .fighter-name em { display: none; }
}

/* Fight style + expanded strike set */
.round-badge em { font-style: normal; color: var(--accent-2); font-size: .5rem; letter-spacing: .08em; text-transform: uppercase; }
.style-picker { margin-top: 16px; }
.style-title { display: block; margin-bottom: 6px; color: var(--dim); font-family: ui-monospace, monospace; font-size: .54rem; letter-spacing: .1em; text-transform: uppercase; }
.style-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.style-option { padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025); color: var(--muted); text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.style-option b { display: block; color: var(--text); font-size: .74rem; }
.style-option small { display: block; margin-top: 1px; color: var(--dim); font-size: .55rem; }
.style-option:hover { border-color: rgba(129,140,248,.42); }
.style-option.active { border-color: rgba(129,140,248,.62); background: rgba(129,140,248,.12); }
.style-option.active b { color: var(--accent-2); }
.actions { grid-template-columns: repeat(4, minmax(52px, 1fr)); max-width: 380px; }
.action.cross { grid-column: auto; }
.action.body { border-color: rgba(251,191,36,.22); }
.action.body.pressed, .action.body.active { border-color: rgba(251,191,36,.7); background: rgba(251,191,36,.14); }
.action.body.pressed b, .action.body.active b { color: var(--amber); }
@media (max-width: 560px) and (orientation: portrait) {
  .actions { max-width: 260px; gap: 5px; }
  .round-badge em { display: none; }
  .style-options { gap: 4px; }
  .style-option { padding: 7px 6px; }
  .style-option small { font-size: .5rem; }
}

/* Broadcast ticker */
.ticker {
  position: absolute; z-index: 6; left: 50%; top: calc(108px + var(--safe-top));
  transform: translateX(-50%) translateY(-4px);
  max-width: min(560px, calc(100vw - 34px)); padding: 5px 10px;
  border: 1px solid rgba(174,184,214,.14); border-radius: 6px;
  background: rgba(8,10,17,.58); backdrop-filter: blur(8px);
  color: var(--muted); font-family: ui-monospace, monospace;
  font-size: .58rem; letter-spacing: .03em; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.ticker.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 560px) and (orientation: portrait) {
  .ticker { display: none; }
}

/* Keep the 4x2 strike pad usable next to the joystick on small phones. */
@media (max-width: 560px) and (orientation: portrait) {
  .controls { gap: 8px; padding-left: calc(10px + var(--safe-left)); padding-right: calc(10px + var(--safe-right)); }
  .stick { width: clamp(92px, 22vw, 112px); height: clamp(92px, 22vw, 112px); }
  .actions { max-width: 250px; }
  .action { min-height: 46px; padding: 5px 4px; }
  .action b { font-size: .52rem; letter-spacing: 0; }
}
