@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/press-start-2p.woff2") format("woff2");
  font-display: swap;
}
:root {
  --bg: #1a0e33;
  --bg2: #26164a;
  --panel: #2f1c5a;
  --line: #5c3d99;
  --txt: #e9e2ff;
  --muted: #b4a6dc;
  --pk: #ff2e88;
  --cy: #29f0ff;
  --yl: #ffd23f;
  --gn: #3dff8a;
  --rd: #ff3b3b;
  --font: "Press Start 2P", "Courier New", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font-family: var(--font); }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, #5a2296 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, #0b4a63 0%, transparent 45%),
    var(--bg);
  letter-spacing: .5px;
}
.scanlines {
  pointer-events: none; position: fixed; inset: 0; z-index: 50;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.06) 2px 3px);
  mix-blend-mode: multiply;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ── header ───────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
       padding: 14px 22px 6px; }
.logo { font-weight: 900; font-size: 28px; display: flex; align-items: baseline; gap: 12px; text-transform: uppercase; }
.logo-p { color: var(--yl); text-shadow: 3px 3px 0 var(--pk), 6px 6px 0 #000; font-style: italic; letter-spacing: 3px; }
.logo-vs { color: var(--pk); font-size: 18px; text-shadow: 2px 2px 0 #000; }
.logo-i { color: var(--cy); font-size: 18px; text-shadow: 2px 2px 0 #000; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 11px; padding: 6px 10px; border: 2px solid var(--line); background: var(--panel);
        color: var(--txt); text-transform: uppercase; box-shadow: 3px 3px 0 #000; }
.chip.belt { color: #1a1000; background: linear-gradient(180deg, #ffe680, #f0a500); border-color: #ffec9e; font-weight: 700; }
.chip.btn { cursor: pointer; }
.chip.btn:hover { border-color: var(--cy); }

/* ── HUD ──────────────────────────────────── */
.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding: 6px 22px 10px; }
.fighter .fname { font-size: 13px; font-weight: 800; margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.fighter.right .fname { justify-content: flex-end; }
.mood { font-size: 10px; padding: 3px 6px; background: #000; color: var(--yl); border: 1px solid var(--line); }
.bar { position: relative; height: 22px; background: #000; border: 3px solid #fff; box-shadow: 3px 3px 0 #000;
       overflow: hidden; margin-bottom: 6px; }
.bar .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; transition: width .6s cubic-bezier(.2,.9,.2,1), background .6s; }
.bar .ghost { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(255,255,255,.55); transition: width 1.6s ease-in .4s; }
.bar.hp .fill { background: linear-gradient(180deg, #9dffc4, var(--gn) 45%, #10a24b); z-index: 2; }
.bar.hp .fill.mid { background: linear-gradient(180deg, #fff2a6, var(--yl) 45%, #c08a00); }
.bar.hp .fill.low { background: linear-gradient(180deg, #ffb3b3, var(--rd) 45%, #9c0f0f); animation: blink 0.7s steps(2) infinite; }
.bar.stam { height: 12px; border-width: 2px; }
.bar.stam .fill { background: linear-gradient(90deg, #00a8c4, var(--cy)); }
.fighter.right .bar .fill { left: auto; right: 0; }
.bar.foe .fill { background: linear-gradient(180deg, #ff9ac6, var(--pk) 45%, #9c0f55); }
.bar.combo { height: 12px; border-width: 2px; background: #120a20; display: flex; align-items: center; justify-content: flex-end; }
.btext { position: absolute; z-index: 3; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 800;
         color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.btext.small { font-size: 8px; }
.fighter.right .btext { right: auto; left: 8px; }
.bar.combo .btext { left: auto; right: 6px; color: var(--cy); }
.round { text-align: center; min-width: 110px; }
.rlabel { font-size: 10px; color: var(--muted); }
.rno { font-size: 34px; font-weight: 900; color: var(--yl); text-shadow: 3px 3px 0 var(--pk), 5px 5px 0 #000; line-height: 1.1; }
.rclock { font-size: 13px; color: var(--cy); margin-top: 2px; }

/* ── layout ───────────────────────────────── */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 0 22px 16px;
        grid-template-areas: "ring side" "rounds side" "feed feed"; }
.ringwrap { grid-area: ring; position: relative; border: 3px solid var(--line); background: #24104a; box-shadow: 6px 6px 0 #000; }
.ringwrap canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 16px; }
.rounds { grid-area: rounds; }
.rounds canvas { width: 100%; height: 170px; display: block; }
.feed { grid-area: feed; }

.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 3px solid var(--line); padding: 12px 14px;
        box-shadow: 6px 6px 0 #000; }
.card h2 { margin: 0 0 10px; font-size: 11px; color: var(--pk); letter-spacing: 2px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.stats b { display: block; font-size: 15px; color: var(--txt); white-space: nowrap; }
.stats span { font-size: 7px; color: var(--muted); }
.cy { color: var(--cy) !important; } .rd { color: var(--rd) !important; } .yl { color: var(--yl) !important; }
.ratio, .sysrow { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 8px; margin-top: 10px; font-size: 8px; color: var(--muted); }
.sysrow { grid-template-columns: 40px 1fr 54px; margin-top: 7px; }
.ratio b, .sysrow b { color: var(--txt); text-align: right; font-size: 9px; }
.bar.mini { height: 10px; border-width: 2px; margin: 0; box-shadow: none; }
.bar.mini .fill { background: var(--cy); }
.bar.mini .fill.warn { background: var(--yl); } .bar.mini .fill.bad { background: var(--rd); }
.career { margin-top: 12px; font-size: 8px; color: var(--muted); line-height: 1.8; }
.career b { color: var(--txt); }

.crew { list-style: none; padding: 0; margin: 0 0 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.crew li { font-size: 9px; display: flex; align-items: center; gap: 8px; padding: 6px; background: #1c1038; border: 1px solid var(--line); }
.crew .led { width: 10px; height: 10px; background: var(--rd); box-shadow: 0 0 8px var(--rd); flex: none; }
.crew .on .led { background: var(--gn); box-shadow: 0 0 8px var(--gn); }
.crew .off { color: var(--rd); }
.sysfoot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 8px; color: var(--muted); }

.top-list { margin: 0; padding: 0; list-style: none; counter-reset: c; }
.top-list li { display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 6px; align-items: center; font-size: 9px; padding: 5px 0;
               border-bottom: 1px dashed var(--line); counter-increment: c; }
.top-list li::before { content: counter(c); color: var(--yl); }
.top-list li.muted::before { content: ""; }
.top-list li.muted { display: block; }
.cc { font-size: 8px; padding: 2px 3px; background: #000; color: var(--cy); text-align: center; border: 1px solid var(--line); }
.top-list .n { color: var(--pk); text-align: right; }

.feed-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.feed-list li { display: grid; grid-template-columns: 78px 70px 30px 130px 1fr; gap: 8px; align-items: center; font-size: 9px;
                padding: 5px 4px; border-bottom: 1px solid #3e2a6e; animation: slidein .35s ease-out; }
.feed-list .ts { color: var(--muted); }
.tag { font-size: 8px; padding: 3px 4px; text-align: center; font-weight: 800; color: #000; }
.tag.block { background: var(--cy); } .tag.hit { background: var(--pk); } .tag.crit { background: var(--rd); color: #fff; }
.tag.poke { background: #6b5a99; } .tag.ko { background: var(--yl); }
.feed-list .ip { color: var(--txt); overflow: hidden; text-overflow: ellipsis; }
.feed-list .lbl { color: #ddd4ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-list .src { color: var(--muted); }

.legend { font-size: 8px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; }
.lg-h { background: var(--pk); } .lg-b { background: var(--cy); } .lg-hp { background: var(--gn); height: 3px !important; }

.banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-size: 46px; font-weight: 900;
          color: var(--yl); text-shadow: 4px 4px 0 var(--pk), 8px 8px 0 #000; pointer-events: none; opacity: 0;
          transform: scale(.6); transition: opacity .2s, transform .25s cubic-bezier(.2,1.6,.4,1); font-style: italic; }
.banner.show { opacity: 1; transform: scale(1); }
.offline { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--rd); color: #fff; font-size: 10px;
           padding: 8px 12px; border: 2px solid #fff; animation: blink 1s steps(2) infinite; }

.foot { display: flex; justify-content: space-between; padding: 0 22px 18px; font-size: 8px; color: var(--muted); }

@keyframes blink { 50% { opacity: .55; } }
@keyframes slidein { from { transform: translateX(-12px); opacity: 0; background: rgba(41,240,255,.18); } to { transform: none; opacity: 1; } }
@keyframes shake {
  0%,100% { transform: translate(0,0); } 20% { transform: translate(-6px,3px); } 40% { transform: translate(5px,-4px); }
  60% { transform: translate(-4px,-2px); } 80% { transform: translate(3px,4px); }
}
.shake { animation: shake .35s linear; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; grid-template-areas: "ring" "side" "rounds" "feed"; }
  .feed-list li { grid-template-columns: 62px 60px 30px 1fr; }
  .feed-list .lbl { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .hud { grid-template-columns: 1fr; }
  .round { order: -1; }
  .logo { font-size: 20px; }
  .stats b { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .shake, .bar.hp .fill.low, .offline { animation: none; }
}

/* mode chips */
.chip.replay { color: var(--yl); border-color: var(--yl); }
.chip.live { color: #0b0614; background: var(--gn); border-color: #b6ffd3; font-weight: 700; }

/* coins */
.chip.coins { color: #1a1000; background: linear-gradient(180deg, #fff3a0, #ffd23f 55%, #e0a400); border-color: #fff7c2; font-weight: 700; }
.chip.throw { color: var(--yl); border-color: var(--yl); }
.chip.throw:hover:not(:disabled) { background: #3a2a10; }
.chip.throw:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.chip.throw:disabled { opacity: .55; cursor: not-allowed; }
.toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: #000; color: var(--yl);
         border: 2px solid var(--yl); font-size: 10px; padding: 8px 12px; pointer-events: none; }

/* crowd chants */
.bar.crowd { height: 12px; border-width: 2px; }
.bar.crowd .fill { background: linear-gradient(90deg, #7a2cff, var(--pk), var(--yl)); width: 0; }
.chants { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chant { font: inherit; font-size: 10px; padding: 8px 10px; border: 2px solid #000; box-shadow: 3px 3px 0 #000; cursor: pointer; color: #0b0614; }
.chant.cheer { background: var(--gn); } .chant.boo { background: var(--pk); color: #fff; } .chant.duck { background: var(--yl); }
.chant:hover:not(:disabled) { filter: brightness(1.12); }
.chant:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.chant:disabled { opacity: .5; cursor: not-allowed; }
.toast { bottom: 58px; }
@media (max-width: 640px) { .chant { font-size: 8px; padding: 6px 7px; } }
