:root {
  --bg: #0b0e17;
  --panel: rgba(11, 14, 23, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8ecf5;
  --muted: #8a93a8;
  --long: #39d353;
  --short: #ff4d4d;
  --gold: #ffcc4d;
  --font: 'Press Start 2P', 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
canvas#arena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
canvas#arena.dragging { cursor: grabbing; }

.hud { position: fixed; z-index: 2; font-size: 10px; line-height: 1.5; }
.hud-top { top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 18px; gap: 16px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 48px; height: 48px; image-rendering: pixelated; border-radius: 8px; border: 2px solid var(--line); }
.brand-name { font-size: 18px; color: var(--gold); text-shadow: 3px 3px 0 #000; }
.brand-cat { color: #f0913a; }
.brand-sub { color: var(--muted); font-size: 8px; margin-top: 6px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stat { background: var(--panel); border: 2px solid var(--line); padding: 8px 10px; min-width: 96px; }
.stat .k { display: block; color: var(--muted); font-size: 7px; margin-bottom: 4px; }
.stat .v { display: block; font-size: 11px; }
.stat .v.up { color: var(--long); } .stat .v.down { color: var(--short); }

.hud-score { top: 88px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: var(--panel); border: 2px solid var(--line); padding: 10px 14px; }
.fighter { width: 150px; }
.fighter .fname { font-size: 9px; margin-bottom: 6px; }
.fighter .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 8px; }
.fighter .meta.right { justify-content: flex-end; }
.status { color: var(--muted); }
.passes { color: var(--gold); }
.fighter.long .fname { color: var(--long); } .fighter.short .fname { color: var(--short); text-align: right; }
.hp { height: 8px; background: #222838; border: 1px solid var(--line); }
.hp-fill { height: 100%; width: 100%; transition: width .15s; }
.fighter.long .hp-fill { background: var(--long); }
.fighter.short .hp-fill { background: var(--short); margin-left: auto; }
.score { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--gold); }
.score small { font-size: 7px; color: var(--muted); text-align: center; line-height: 1.4; }

.hud-target { top: 152px; left: 50%; transform: translateX(-50%); width: 340px; background: var(--panel); border: 2px solid var(--line); padding: 8px 12px; }
.target-row { display: flex; justify-content: space-between; font-size: 8px; color: var(--gold); margin-bottom: 6px; }
.target-bar .hp-fill { background: var(--gold); transition: width .4s; }
.trophies { margin-top: 6px; font-size: 7px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.catch-banner { top: 40%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; z-index: 3; text-shadow: 4px 4px 0 #000; }
.catch-banner .cb-title { font-size: 22px; color: var(--gold); }
.catch-banner.fall .cb-title { color: var(--short); }
.catch-banner .cb-value { font-size: 40px; color: #fff; margin: 10px 0; }
.catch-banner .cb-sub { font-size: 8px; color: var(--muted); }
.catch-banner.pop { animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.hud-log { right: 18px; top: 150px; width: 250px; max-height: 40vh; overflow: hidden; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.hud-log .line { background: var(--panel); border-left: 3px solid var(--line); padding: 6px 8px; font-size: 8px; color: var(--muted); animation: slide .25s ease-out; }
.hud-log .line.long { border-color: var(--long); color: var(--text); }
.hud-log .line.short { border-color: var(--short); color: var(--text); }
.hud-log .line.ko { border-color: var(--gold); color: var(--gold); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.hud-bottom { bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; pointer-events: none; }
.hud-bottom > * { pointer-events: auto; }
.find { display: flex; gap: 6px; flex: 1; max-width: 520px; }
.find input { flex: 1; background: var(--panel); border: 2px solid var(--line); color: var(--text); font-family: var(--font); font-size: 9px; padding: 12px; outline: none; min-width: 0; }
.find input:focus { border-color: var(--gold); }
.actions { display: flex; gap: 8px; }
.btn { font-family: var(--font); font-size: 10px; padding: 12px 16px; border: 2px solid var(--gold); background: var(--gold); color: #000; text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 #000; white-space: nowrap; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn-buy { background: var(--long); border-color: var(--long); }

.hud-badge { left: 18px; top: 150px; background: var(--panel); border: 2px solid var(--gold); padding: 14px; width: 220px; }
.badge-close { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; font-family: var(--font); }
.badge-title { color: var(--gold); font-size: 8px; margin-bottom: 8px; }
.badge-seat { font-size: 10px; margin-bottom: 6px; }
.badge-tier { font-size: 9px; color: var(--muted); margin-bottom: 12px; }

.demo-tag { position: fixed; z-index: 2; left: 50%; bottom: 74px; transform: translateX(-50%); font-size: 7px; color: var(--muted); background: var(--panel); padding: 5px 8px; border: 1px solid var(--line); pointer-events: none; }
.demo-tag[hidden] { display: none; }

@media (max-width: 760px) {
  .stats { display: none; }
  .hud-score { top: 72px; gap: 6px; padding: 6px 8px; width: calc(100% - 24px); justify-content: space-between; }
  .fighter { width: 104px; }
  .fighter .fname { font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fighter .meta { flex-direction: column; gap: 2px; font-size: 7px; }
  .fighter.short .meta { align-items: flex-end; }
  .score { font-size: 13px; gap: 6px; }
  .hud-log { display: none; }
  .hud-target { top: 136px; width: calc(100% - 24px); padding: 6px 10px; }
  .catch-banner .cb-title { font-size: 16px; }
  .catch-banner .cb-value { font-size: 28px; }
  .hud-badge { top: auto; bottom: 90px; left: 12px; right: 12px; width: auto; }
  .hud-bottom { flex-direction: column; align-items: stretch; padding: 10px 12px; }
  .find { max-width: none; }
  .actions .btn { flex: 1; text-align: center; }
  .demo-tag { bottom: 128px; }
}

/* dev panel */
.dev-panel { left: 18px; bottom: 90px; width: 330px; max-height: calc(100vh - 120px); overflow: auto; background: var(--panel); border: 2px solid #7b61ff; padding: 12px; z-index: 4; }
.dev-title { color: #b39dff; font-size: 9px; margin-bottom: 8px; }
.dev-title small { font-size: 7px; color: var(--muted); }
.dev-state { font-family: var(--font); font-size: 7px; color: var(--muted); white-space: pre-wrap; margin: 0 0 8px; line-height: 1.6; }
.dev-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; font-size: 8px; }
.dev-row label { color: var(--muted); font-size: 8px; }
.dev-row input[type=number] { width: 110px; background: #0b0e17; border: 2px solid var(--line); color: var(--text); font-family: var(--font); font-size: 8px; padding: 6px; }
.dev-row input[type=range] { flex: 1; }
.dev-row .btn { font-size: 8px; padding: 7px 9px; box-shadow: 2px 2px 0 #000; }
@media (max-width: 760px) { .dev-panel { left: 12px; right: 12px; width: auto; bottom: 130px; max-height: 50vh; overflow: auto; } }
