/* SPAWN arena screens. Builds on style.css (design system). */

/* ---------- arena layout ---------- */
.arena { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.stage-col { display: grid; gap: 14px; min-width: 0; }
.stage-wrap { position: relative; background: var(--shadow); border: 3px solid var(--line-2); box-shadow: 0 10px 0 var(--shadow); padding: 10px; display: grid; gap: 10px; }
.stage-box { display: grid; min-width: 0; position: relative; }
.stage-box > * { grid-area: 1 / 1; min-width: 0; }
.stage-wrap canvas { width: 100%; height: auto; display: block; background: #070302; image-rendering: pixelated; aspect-ratio: 1000 / 420; align-self: center; }

/* fight HUD above the canvas */
.fhud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.fhud .side { display: grid; gap: 5px; min-width: 0; }
.fhud .side.b { text-align: right; }
.fhud .side .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fhud .side.b .name { flex-direction: row-reverse; }
.fhud .side .name b { font-family: var(--font-display); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fhud .side .name small { font-family: var(--font-term); font-size: 15px; color: var(--muted); white-space: nowrap; }
.fhud .portrait { width: 34px; height: 34px; flex: none; border: 2px solid var(--line-2); background: var(--bg); object-fit: cover; image-rendering: pixelated; }
.hpbar { position: relative; height: 16px; background: #2b0a06; border: 2px solid var(--shadow); overflow: hidden; }
.hpbar > i { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(180deg, #ffd27a, #ffb020 50%, #c97a0c); transition: width .12s linear; }
.hpbar > i.ghost { background: #ff3b52; transition: width .5s ease-out .25s; }
.hpbar.low > i:not(.ghost) { background: linear-gradient(180deg, #ff8a95, #ff3b52 50%, #a51d2d); }
.side.b .hpbar > i { left: auto; right: 0; }
.meterbar { height: 7px; background: #0a1f1e; border: 2px solid var(--shadow); overflow: hidden; }
.meterbar > i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--cyan) 0 6px, #1aa89f 6px 8px); transition: width .2s; }
.meterbar.full > i { background: var(--lime); animation: blink .6s steps(2, start) infinite; }
.side.b .meterbar > i { margin-left: auto; }
.lives { display: inline-flex; gap: 2px; }
.lives i { width: 8px; height: 8px; background: var(--red); clip-path: polygon(50% 100%, 0 45%, 0 15%, 25% 0, 50% 20%, 75% 0, 100% 15%, 100% 45%); }
.lives i.off { background: var(--line); }
.fhud .center { display: grid; justify-items: center; gap: 4px; min-width: 96px; }
.fhud .clock { font-family: var(--font-display); font-size: 22px; color: var(--gold); text-shadow: 3px 3px 0 var(--shadow); line-height: 1; }
.fhud .clock.hurry { color: var(--red); animation: blink .5s steps(2, start) infinite; }
.fhud .roundno { font-family: var(--font-display); font-size: 7px; color: var(--muted); letter-spacing: .08em; }
.pips { display: flex; gap: 4px; }
.pips i { width: 10px; height: 10px; border: 2px solid var(--gold-2); background: transparent; }
.pips i.on { background: var(--gold); }

.stage-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.stage-foot .num { font-size: 17px; color: var(--fg); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 8px; color: var(--red); }
.live-dot::before { content: ''; width: 8px; height: 8px; background: var(--red); animation: blink 1s steps(2, start) infinite; }
.live-dot.replay { color: var(--cyan); } .live-dot.replay::before { background: var(--cyan); animation: none; }

/* overlay on top of the canvas: intermission / idle / result */
.overlay { position: relative; display: grid; place-items: center; background: rgba(6,2,1,.82); z-index: 3; padding: 12px; }
.overlay .card { width: min(100%, 640px); display: grid; gap: 10px; text-align: center; justify-items: center; }
.overlay .eyebrow { color: var(--gold); }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; width: 100%; }
.vs .fighter { display: grid; gap: 6px; justify-items: center; min-width: 0; }
.vs .fighter img, .vs .fighter .portrait-big { width: 64px; height: 64px; border: 3px solid var(--line-2); background: var(--bg); object-fit: cover; image-rendering: pixelated; }
.vs .fighter b { font-size: 15px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs .fighter small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.vs .vsmark { font-family: var(--font-display); font-size: 22px; color: var(--pink); text-shadow: 3px 3px 0 var(--shadow); }
.countdown { font-family: var(--font-display); font-size: 28px; color: var(--gold); text-shadow: 4px 4px 0 var(--shadow); line-height: 1; }
.pickrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.pickrow .btn { width: 100%; min-width: 0; }
.pickrow .btn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickrow .btn[aria-pressed="true"] { background: var(--lime); color: #0a2200; border-color: var(--shadow); }
.pickbar { display: flex; height: 10px; width: 100%; border: 2px solid var(--line); background: var(--bg); overflow: hidden; }
.pickbar i { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.pickbar i + i { background: var(--pink); }
.h2h { font-family: var(--font-term); font-size: 18px; color: var(--muted); }
.overlay .result-line { font-family: var(--font-display); font-size: 12px; color: var(--lime); line-height: 1.7; }
.overlay .result-sub { font-family: var(--font-term); font-size: 20px; color: var(--muted); }

/* commentary + tactics under the stage */
.commentary { padding: 0; }
.commentary .log { max-height: 220px; font-size: 18px; }
.commentary .log li { grid-template-columns: 5ch 1fr; }
.tactics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tactic { display: grid; gap: 6px; padding: 10px 12px; background: var(--bg); border: 2px solid var(--line); min-width: 0; }
.tactic b { font-family: var(--font-display); font-size: 7px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; gap: 8px; }
.tactic b span { color: var(--cyan); }
.tactic p { font-family: var(--font-term); font-size: 17px; line-height: 1.15; color: var(--fg); }
.tactic q { display: block; font-size: 13px; color: var(--pink); font-style: italic; quotes: '"' '"'; }
.replay-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.replay-controls .btn { min-height: 36px; }

/* recent fights strip */
.recent { display: grid; gap: 8px; }
.recent-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; background: var(--bg); border: 2px solid var(--line); font-size: 14px; }
.recent-row .n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent-row .n:last-of-type { justify-content: flex-end; text-align: right; }
.recent-row .n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row .n.won b { color: var(--lime); }
.recent-row .n.lost b { color: var(--muted); }
.recent-row .score { font-family: var(--font-display); font-size: 10px; color: var(--gold); }
.recent-row .portrait { width: 26px; height: 26px; flex: none; border: 2px solid var(--line-2); object-fit: cover; image-rendering: pixelated; }
.recent-row .btn-sm { min-height: 30px; padding: 4px 8px; font-size: 10px; }

/* ---------- stream chat ---------- */
.chat { display: grid; grid-template-rows: auto auto 1fr auto; height: min(78vh, 760px); min-height: 420px; padding: 0; position: sticky; top: calc(var(--hud-h) + 16px); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 3px solid var(--line); background: var(--bg-3); }
.chat-head b { font-family: var(--font-display); font-size: 9px; }
.chat-head .viewers { font-family: var(--font-term); font-size: 17px; color: var(--muted); }
.hyperow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 10px; border-bottom: 3px solid var(--line); }
.hype { display: grid; gap: 2px; justify-items: center; padding: 6px 4px; background: var(--bg); border: 2px solid var(--line); color: var(--fg); min-height: 44px; min-width: 0; }
.hype:hover { border-color: var(--gold-2); }
.hype:active { transform: scale(.96); }
.hype b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hype span { font-family: var(--font-term); font-size: 18px; color: var(--gold); line-height: 1; }
.hype.b span { color: var(--pink); }
.chat-list { list-style: none; margin: 0; padding: 10px 12px; overflow-y: auto; display: grid; gap: 4px; align-content: start; font-size: 14px; line-height: 1.35; overscroll-behavior: contain; }
.chat-list li { min-width: 0; overflow-wrap: anywhere; animation: logIn .15s steps(2); }
.chat-list li b { color: var(--cyan); margin-right: 6px; }
.chat-list li.sys { color: var(--gold); font-family: var(--font-term); font-size: 17px; }
.chat-list li.sys b { color: var(--gold); }
.chat-list li.me b { color: var(--lime); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px; border-top: 3px solid var(--line); background: var(--bg-3); }
.chat-form input { background: var(--bg); border: 3px solid var(--line); color: var(--fg); padding: 9px 10px; min-height: 44px; min-width: 0; }
.chat-form input:focus { border-color: var(--gold); outline: none; }
.chat-form .btn { min-height: 44px; padding-inline: 12px; }
.chat-me { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 2px solid var(--line); }
.chat-me b { color: var(--fg); }
.chat-me button { background: none; border: 0; color: var(--cyan); padding: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- fighters tab ---------- */
.ccard .portrait { width: 84px; height: 84px; border: 3px solid var(--line-2); background: var(--bg); object-fit: cover; image-rendering: pixelated; }
.ccard.eliminated { opacity: .55; filter: grayscale(.6); }
.arch-chip { font-family: var(--font-display); font-size: 6px; letter-spacing: .06em; padding: 4px 6px 3px; border: 2px solid currentColor; text-transform: uppercase; white-space: nowrap; }
.arch-brawler { color: var(--gold); } .arch-rushdown { color: var(--pink); } .arch-grappler { color: var(--orange); } .arch-zoner { color: var(--cyan); } .arch-turtle { color: var(--lime); }
.drawer-id .portrait { width: 112px; height: 112px; border: 3px solid var(--line-2); background: var(--bg); object-fit: cover; image-rendering: pixelated; }
.persona { font-family: var(--font-term); font-size: 19px; line-height: 1.2; color: var(--muted); border-left: 4px solid var(--pink); padding-left: 12px; }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-family: var(--font-term); font-size: 17px; }
.ledger li { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 4px 0; border-bottom: 2px dashed var(--line); }
.ledger li span { color: var(--muted); } .ledger li .plus { color: var(--lime); } .ledger li .minus { color: var(--red); }

/* ---------- launch wizard: archetype picker ---------- */
.arch-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.arch-pick .brain h4 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cost { display: grid; gap: 6px; }
.cost div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; border-bottom: 2px dashed var(--line); padding-bottom: 6px; }
.cost div.total { border-bottom: 0; font-weight: 700; font-size: 16px; }
.cost .num { font-size: 20px; color: var(--gold); }
.wallet-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sim-note { padding: 10px 12px; border: 2px dashed var(--cyan); color: var(--cyan); font-size: 13px; }
.progress { display: grid; gap: 8px; font-family: var(--font-term); font-size: 19px; }
.progress div { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.progress div.done { color: var(--lime); } .progress div.now { color: var(--gold); } .progress div.bad { color: var(--red); }

/* ---------- ranks ---------- */
.board .portrait { width: 28px; height: 28px; border: 2px solid var(--line-2); object-fit: cover; image-rendering: pixelated; flex: none; }
.board .lives { vertical-align: middle; }
.streak-up { color: var(--lime); } .streak-down { color: var(--red); }

/* ---------- misc ---------- */
.ticker-track .win { color: var(--lime); }
.ticker-track .ko { color: var(--pink); }
.badge-live { font-family: var(--font-display); font-size: 7px; color: #fff; background: var(--red); padding: 5px 6px 4px; letter-spacing: .06em; }
.nick-form { display: grid; gap: 10px; }
.kbd { font-family: var(--font-term); font-size: 16px; border: 2px solid var(--line-2); padding: 0 6px; }
.hidden-measure { position: absolute; left: -9999px; top: 0; }

@media (max-width: 1000px) {
  .arena { grid-template-columns: 1fr; }
  .chat { position: static; height: 480px; min-height: 0; }
}
@media (max-width: 760px) {
  .fhud { grid-template-columns: 1fr auto 1fr; gap: 6px; }
  .fhud .side .name b { font-size: 8px; }
  .fhud .side .name small { display: none; }
  .fhud .portrait { width: 26px; height: 26px; }
  .fhud .clock { font-size: 16px; }
  .fhud .center { min-width: 64px; }
  .tactics { grid-template-columns: 1fr; }
  .recent-row { grid-template-columns: 1fr auto 1fr; }
  .recent-row .btn-sm { grid-column: 1 / -1; justify-self: center; }
  .vs .fighter img, .vs .fighter .portrait-big { width: 56px; height: 56px; }
  .countdown { font-size: 22px; }
  .overlay { padding: 10px 8px; background: rgba(6,2,1,.93); }
  .vs { gap: 8px; }
  .vs .fighter small { font-size: 11px; }
  .chat { height: 420px; }
}

/* winner highlight on the result card */
.vs .fighter.won b { color: var(--lime); }
.vs .fighter.won img, .vs .fighter.won .portrait-big { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(140, 255, 90, .22); }
.vs .fighter.won::after { content: 'WINNER'; font-family: var(--font-display); font-size: 7px; color: var(--lime); letter-spacing: .08em; }

/* ---------- fighter speech bubbles over the stage ---------- */
.bubble { position: absolute; top: 14px; z-index: 2; max-width: min(46%, 300px); padding: 8px 10px; background: var(--fg); color: #1a0a05; font-family: var(--font-term); font-size: 19px; line-height: 1.1; border: 3px solid var(--shadow); box-shadow: 0 4px 0 var(--shadow); pointer-events: none; animation: bubbleIn .2s steps(3); }
.bubble::after { content: ''; position: absolute; bottom: -12px; width: 12px; height: 12px; background: var(--fg); border: 3px solid var(--shadow); border-top: 0; border-left: 0; transform: rotate(45deg); }
.bubble.a { left: 14px; border-color: var(--gold); } .bubble.a::after { left: 22px; border-color: var(--gold); }
.bubble.b { right: 14px; border-color: var(--pink); } .bubble.b::after { right: 22px; border-color: var(--pink); }
.bubble b { display: block; font-family: var(--font-display); font-size: 7px; letter-spacing: .04em; margin-bottom: 4px; }
.bubble.a b { color: var(--gold-2); } .bubble.b b { color: #1f5fa6; }
.bubble.hide { animation: bubbleOut .25s steps(3) forwards; }
@keyframes bubbleIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bubbleOut { to { transform: translateY(-6px); opacity: 0; } }
@media (max-width: 640px) { .bubble { font-size: 15px; max-width: 48%; padding: 6px 8px; } }
@media (prefers-reduced-motion: reduce) { .bubble, .bubble.hide { animation: none; } }

/* fighter taunts in the stream chat */
.chat-list li.agent { border-left: 3px solid var(--gold); padding-left: 8px; font-family: var(--font-term); font-size: 18px; line-height: 1.15; }
.chat-list li.agent.b { border-left-color: var(--pink); }
.chat-list li.agent b { color: var(--gold); } .chat-list li.agent.b b { color: var(--pink); }
.chat-list li.agent b::after { content: ' (fighter)'; font-family: var(--font-body); font-size: 11px; color: var(--dim); font-weight: 400; }
