/* ===== TANK WARS IV — JAPANESE HOT-BLOODED SHŌNEN ANIME UI (Trigger / Persona 5 / Guilty Gear Style) ===== */
:root {
  --ink: #0f0d13;
  --ink-soft: #221d2b;
  --bg: #16131c;
  --paper: #fff8eb;
  --paper-2: #f4ebd4;
  --crimson: #ff1e42;
  --crimson-dark: #b80022;
  --gold: #ffd000;
  --gold-dark: #d98a00;
  --p1: #0088ff;
  --p1-dark: #0055aa;
  --p2: #ff1e42;
  --p2-dark: #a80020;
  --mint: #00c46a;
  --text: #fff8eb;
  --text-dark: #14111a;
  --muted: #b8adc7;
  --font-display: "PingFang TC", "Heiti TC", "Noto Sans TC", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Manga Halftone & Diagonal Action Slash Background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 208, 0, 0.08) 1.5px, transparent 1.5px),
    repeating-linear-gradient(-32deg, rgba(255, 30, 66, 0.045) 0 18px, transparent 18px 46px);
  background-size: 16px 16px, 100% 100%;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===== TOP ANIME BROADCAST BAR ===== */
.topbar {
  height: 46px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  border-bottom: 3px solid var(--crimson);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: 14px;
  font-style: italic;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  background: var(--crimson);
  color: var(--gold);
  border: 2px solid var(--paper);
  transform: skewX(-12deg);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 #000;
}

.brand-sub {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.12em;
  border-left: 2px solid var(--crimson);
  padding-left: 10px;
  font-style: normal;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  transform: skewX(-10deg);
  box-shadow: 3px 3px 0 var(--crimson);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
}

.hud-pill.p1 { box-shadow: 3px 3px 0 var(--p1); }
.hud-pill.p2 { box-shadow: 3px 3px 0 var(--p2); }
.hud-pill strong { color: var(--ink); font-weight: 900; }
.hud-pill .dot {
  width: 9px;
  height: 9px;
  border: 2px solid var(--ink);
}
.hud-pill.p1 .dot { background: var(--p1); }
.hud-pill.p2 .dot { background: var(--p2); }

/* ===== ANIME ACTION BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  transform: skewX(-10deg);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease;
}

.btn:hover:not(:disabled) {
  background: var(--gold);
  transform: skewX(-10deg) translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn:active:not(:disabled) {
  transform: skewX(-10deg) translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-sm { padding: 4px 12px; font-size: 11.5px; border-width: 2.5px; box-shadow: 3px 3px 0 #000; }

.btn-primary {
  background: var(--crimson);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 5px 5px 0 var(--gold);
}

.btn-primary:hover:not(:disabled) {
  background: #ff3355;
  color: var(--gold);
  box-shadow: 7px 7px 0 var(--gold);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--crimson);
}

.btn-gold:hover:not(:disabled) {
  background: #ffe033;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  flex: 1;
  min-height: 0;
  position: relative;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ===== TITLE SCREEN (SHŌNEN ANIME KEY VISUAL) ===== */
#screen-title { overflow: hidden; }

#title-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  pointer-events: none;
}

/* Dramatic slanted crimson/ink manga slash overlay on left side */
#screen-title::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(104deg,
      rgba(15, 13, 19, 0.97) 0%,
      rgba(15, 13, 19, 0.94) 41%,
      var(--crimson) 41.2%,
      var(--crimson) 42.6%,
      var(--gold) 42.8%,
      var(--gold) 43.4%,
      rgba(15, 13, 19, 0.22) 43.6%,
      rgba(15, 13, 19, 0.05) 100%);
  z-index: 1;
}

#screen-title::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
  z-index: 1;
}

.title-layout {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 46px;
  max-width: 600px;
  gap: 18px;
}

.title-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 4px 14px;
  background: var(--gold);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  transform: skewX(-12deg);
  box-shadow: 4px 4px 0 var(--crimson);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.title-h1 {
  font-size: clamp(44px, 5.4vw, 68px);
  font-weight: 900;
  font-style: italic;
  line-height: 1.04;
  letter-spacing: 0.04em;
  color: var(--paper);
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow:
    5px 5px 0 var(--crimson),
    9px 9px 0 var(--ink);
}

.title-h1 span {
  display: block;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.24em;
  color: var(--gold);
  -webkit-text-stroke: 0;
  text-shadow: 2px 2px 0 var(--ink);
  margin-top: 8px;
}

.title-lead {
  font-size: 13.5px;
  line-height: 1.68;
  color: #efe5d5;
  max-width: 460px;
  background: rgba(15, 13, 19, 0.72);
  border-left: 4px solid var(--gold);
  padding: 8px 12px;
}

.title-modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 430px;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-left: 8px solid var(--accent, var(--crimson));
  transform: skewX(-10deg);
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-align: left;
}

.mode-btn:hover {
  background: var(--gold);
  transform: skewX(-10deg) translateX(10px);
  box-shadow: 9px 9px 0 var(--crimson);
}

.mode-btn.mode-primary {
  background: var(--crimson);
  color: #ffffff;
  border-color: var(--ink);
  border-left: 10px solid var(--gold);
  box-shadow: 7px 7px 0 var(--gold);
}
.mode-btn.mode-primary .mb-title { color: #ffffff; text-shadow: 2px 2px 0 var(--ink); }
.mode-btn.mode-primary .mb-sub { color: #fff3b0; }
.mode-btn.mode-primary:hover {
  background: #ff3355;
  transform: skewX(-10deg) translateX(10px);
  box-shadow: 9px 9px 0 var(--gold);
}

.mb-title { font-size: 17px; font-weight: 900; letter-spacing: 0.05em; color: var(--ink); }
.mb-sub { font-size: 11.5px; color: #3c3447; font-weight: 700; margin-top: 2px; }
.mb-tag {
  padding: 3px 8px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.mb-tag.hot {
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
}

.title-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* ===== ONLINE MULTIPLAYER LOBBY ===== */
#screen-online {
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.online-shell {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.online-controls-banner {
  background: #fff3b0;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--crimson);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.online-card {
  background: var(--paper);
  color: var(--ink);
  border: 3.5px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-card.p1 { border-top: 8px solid var(--p1); }
.online-card.p2 { border-top: 8px solid var(--p2); }

.oc-badge {
  display: inline-block;
  width: fit-content;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #ffffff;
  border: 2px solid var(--ink);
  transform: skewX(-10deg);
}
.oc-badge.p1 { background: var(--p1); }
.oc-badge.p2 { background: var(--p2); }

.online-card h3 {
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
}

.online-card p {
  font-size: 13px;
  color: #3c3447;
  font-weight: 700;
  line-height: 1.55;
}

.room-code-box {
  background: var(--ink);
  color: var(--gold);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--p1);
  padding: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.28em;
}

.room-input {
  background: #ffffff;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--p2);
  padding: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.room-input:focus {
  background: #fff9db;
}

.oc-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.online-status-bar {
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--gold);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #ffffff;
  flex-shrink: 0;
}
.status-dot.ok { background: var(--mint); }
.status-dot.err { background: var(--crimson); }

.online-pill { background: var(--gold); box-shadow: 3px 3px 0 var(--mint); }
.online-pill .dot { background: var(--mint); }

.ping-badge {
  background: var(--ink);
  color: var(--mint);
  border: 2px solid var(--mint);
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
}

/* ===== CHARACTER SELECT (ZERO-EMPTY-SPACE SHŌNEN FIGHTER ROSTER) ===== */
#screen-select {
  padding: 10px 20px 12px;
  gap: 10px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.select-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.select-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-top h2 {
  font-size: 19px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--ink);
}

.online-room-chip {
  padding: 3px 12px;
  background: var(--mint);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  transform: skewX(-10deg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 #000;
}

.picker-tabs {
  display: flex;
  gap: 10px;
  align-items: center;
}

.picker-tab {
  padding: 6px 14px;
  background: var(--ink-soft);
  color: var(--muted);
  border: 2.5px solid var(--ink);
  transform: skewX(-10deg);
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.14s ease;
}

.picker-tab.active.p1 {
  background: var(--p1);
  color: #ffffff;
  box-shadow: 4px 4px 0 var(--gold);
}

.picker-tab.active.p2 {
  background: var(--p2);
  color: #ffffff;
  box-shadow: 4px 4px 0 var(--gold);
}

.showcase-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.vs-emblem {
  align-self: center;
  justify-self: center;
  transform: skewX(-10deg) rotate(-5deg);
  background: var(--crimson);
  color: var(--gold);
  border: 3.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 0 0 0 2px var(--paper);
  padding: 6px 10px;
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 var(--ink);
  pointer-events: none;
}

/* Manga-Paper Character Dossier Cards — Clean, Comfortable Reading Layout */
.showcase-panel {
  background:
    radial-gradient(rgba(15, 13, 19, 0.04) 1.4px, transparent 1.4px),
    var(--paper);
  background-size: 12px 12px, 100% 100%;
  color: var(--ink);
  border: 3.5px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  cursor: pointer;
  position: relative;
}

.showcase-panel.p1 { border-top: 8px solid var(--p1); }
.showcase-panel.p2 { border-top: 8px solid var(--p2); }
.showcase-panel.editing.p1 { box-shadow: 7px 7px 0 var(--p1); }
.showcase-panel.editing.p2 { box-shadow: 7px 7px 0 var(--p2); }

.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-bottom: 2.5px solid var(--ink);
  padding-bottom: 5px;
  flex-shrink: 0;
}

.sc-hero {
  display: grid;
  grid-template-columns: 186px 1fr;
  gap: 14px;
  align-items: stretch;
  flex-shrink: 0;
}

.sc-stage {
  background:
    radial-gradient(circle at 38% 32%, #fffdf5 0%, #eadbc0 65%, #d3ba90 100%);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  height: 138px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sc-stage canvas { width: 180px; height: 132px; display: block; }

.sc-meta-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sc-meta-code {
  display: inline-block;
  width: fit-content;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.sc-meta-name {
  font-size: 27px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.03em;
  text-shadow: 2px 2px 0 rgba(15, 13, 19, 0.2);
}

.sc-meta-role {
  font-size: 12.5px;
  color: #463d54;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}

.sb-metric { display: flex; flex-direction: column; gap: 2px; }
.sb-metric-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 800;
}

.sb-track {
  height: 8px;
  background: #d8ccb3;
  border: 2px solid var(--ink);
  overflow: hidden;
}
.sb-fill { height: 100%; }

.passive-box {
  background: #fff3b0;
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 600;
  flex-shrink: 0;
}

.passive-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 800;
}

.passive-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--crimson);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  transform: skewX(-8deg);
  flex-shrink: 0;
}

/* 3 Spacious Full-Width Horizontal Skill Rows */
.dossier-skills {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.ds-card {
  background: var(--paper-2);
  border: 2.5px solid var(--ink);
  border-left: 7px solid var(--tc, var(--crimson));
  box-shadow: 3px 3px 0 rgba(15, 13, 19, 0.22);
  padding: 9px 13px;
  color: #241e2e;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.ds-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
  font-size: 14.5px;
  border-bottom: 1.5px solid rgba(15, 13, 19, 0.14);
  padding-bottom: 4px;
}

.ds-desc {
  font-size: 14px;
  line-height: 1.62;
  font-weight: 600;
  color: #231d2c;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.ds-cd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--ink);
  color: var(--gold);
}

/* Bottom Tactical Dock: 4-Map Arena Picker + 9-Tank Roster */
.select-bottom-dock {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  flex-shrink: 0;
}

.map-dock {
  background: var(--ink);
  border: 3px solid var(--crimson);
  box-shadow: 5px 5px 0 var(--gold);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--gold);
  font-weight: 900;
}

.map-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.map-tile {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  padding: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.map-tile:hover { transform: translateY(-2px); background: #fff3b0; }
.map-tile.selected {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--crimson);
}

.map-tile canvas {
  width: 72px;
  height: 44px;
  display: block;
  border: 1.5px solid var(--ink);
}

.map-tile-name {
  font-size: 10px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
}

/* Unified 9-Tank Roster Dock */
.roster-dock {
  background: var(--ink);
  border: 3px solid var(--gold);
  box-shadow: 5px 5px 0 var(--crimson);
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.roster-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--gold);
  font-weight: 800;
}

.roster-grid-9 {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.roster-tile {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 #000;
  padding: 4px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.roster-tile:hover {
  background: #fff3b0;
  transform: translateY(-3px);
}

.roster-tile.sel-p1 { border-color: var(--p1); box-shadow: 0 0 0 2px var(--p1), 4px 4px 0 #000; }
.roster-tile.sel-p2 { border-color: var(--p2); box-shadow: 0 0 0 2px var(--p2), 4px 4px 0 #000; }
.roster-tile.sel-p1.sel-p2 {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 4px 4px 0 var(--crimson);
}

.roster-tile canvas { width: 66px; height: 42px; display: block; }
.rt-name { font-size: 11px; font-weight: 900; color: var(--ink) !important; white-space: nowrap; }

.rt-badges {
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.rt-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  padding: 1px 4px;
  border: 1.5px solid var(--ink);
}

.rt-tag.p1 { background: var(--p1); color: #fff; }
.rt-tag.p2 { background: var(--p2); color: #fff; }

/* ===== BATTLE ARENA HUD (GUILTY GEAR / DRAGON BALL FIGHTERZ STYLE) ===== */
#screen-battle {
  padding: 6px 16px 8px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  overflow: hidden;
}

.training-bar {
  display: none;
  width: 100%;
  max-width: 1060px;
  flex-shrink: 0;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--crimson);
  padding: 4px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
}

.training-bar.active { display: flex; }
.tb-group { display: flex; align-items: center; gap: 6px; }
.tb-group select {
  background: var(--ink);
  color: var(--gold);
  border: 2px solid var(--ink);
  padding: 3px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
}

.battle-hud-top {
  width: 100%;
  max-width: 1060px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.player-hud {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 5px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: skewX(-8deg);
}

.player-hud.left {
  border-left: 8px solid var(--p1);
  box-shadow: 5px 5px 0 var(--p1);
}

.player-hud.right {
  border-right: 8px solid var(--p2);
  box-shadow: -5px 5px 0 var(--p2);
  text-align: right;
  transform: skewX(8deg);
}

.ph-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 900;
}

.ph-nums {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #3a3147;
  font-weight: 900;
}

.bar-wrap {
  height: 12px;
  background: #231d2c;
  border: 2.5px solid var(--ink);
  overflow: hidden;
  position: relative;
}

.bar-trail {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--gold);
  transition: width 0.28s ease-out;
}

.bar-fill {
  position: relative;
  height: 100%;
  transition: width 0.06s linear;
}

.bar-fill.hp-left {
  background: linear-gradient(90deg, #0055cc, #00b4ff);
}
.bar-fill.hp-right {
  background: linear-gradient(90deg, #ff5500, #ff1e42);
  margin-left: auto;
}
.bar-trail.right { right: 0; }
.bar-wrap.shield-wrap { height: 7px; border-width: 2px; }
.bar-fill.shield { background: linear-gradient(90deg, #e0f2fe, #ffffff); }

.battle-center-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer-box {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 900;
  padding: 3px 14px;
  background: var(--gold);
  color: var(--ink);
  border: 3px solid var(--ink);
  transform: skewX(-10deg);
  box-shadow: 4px 4px 0 var(--crimson);
  letter-spacing: 0.06em;
}

.arena-shell {
  position: relative;
  width: 100%;
  max-width: 1060px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1024 / 640;
  display: block;
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink), 0 0 0 2px var(--gold);
  background: #e5d8be;
}

.battle-hud-bottom {
  width: 100%;
  max-width: 1060px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.skill-bar { display: flex; gap: 8px; }
.skill-bar.right { justify-content: flex-end; }

.skill-box {
  position: relative;
  min-width: 120px;
  padding: 5px 10px;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  transform: skewX(-8deg);
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.skill-box.ready {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--p1);
}
.skill-bar.right .skill-box.ready {
  box-shadow: 4px 4px 0 var(--p2);
}
.skill-box.cooling {
  background: #d6cbb3;
  opacity: 0.78;
}

.skill-box .cd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 19, 0.56);
  transform-origin: bottom;
  pointer-events: none;
}

.sb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.keycap {
  padding: 1px 6px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 900;
}

.sb-name {
  font-size: 12px;
  color: var(--ink);
  font-weight: 900;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.controls-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--gold);
  background: var(--ink);
  border: 2px solid var(--gold);
  padding: 4px 10px;
  text-align: center;
  line-height: 1.5;
  font-weight: 800;
}

/* ===== SHOP & HISTORY ===== */
#screen-shop, #screen-history {
  max-width: 1020px;
  width: 100%;
  margin: 0 auto;
  padding: 22px;
  gap: 16px;
  overflow-y: auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-head h2 {
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.06em;
  text-shadow: 3px 3px 0 var(--ink);
}

.shop-summary {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--gold);
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  font-weight: 900;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.shop-card {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-top: 7px solid var(--sc, var(--crimson));
  box-shadow: 6px 6px 0 var(--ink);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.shop-art {
  background: radial-gradient(circle at 35% 30%, #fffdf5 0%, #eadbc0 70%, #d5be96 100%);
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-art canvas {
  width: 160px;
  height: 86px;
  display: block;
}

.sc-code {
  display: inline-block;
  width: fit-content;
  padding: 2px 7px;
  background: var(--ink);
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.history-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.score-card {
  background: var(--paper);
  color: var(--ink);
  border: 3.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 20px;
  text-align: center;
}

.score-card .num {
  font-size: 50px;
  font-weight: 900;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.history-log {
  background: var(--paper);
  color: var(--ink);
  border: 3.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--crimson);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-left: 6px solid var(--crimson);
  font-size: 12.5px;
  font-weight: 800;
}

/* Victory Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 19, 0.84);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.modal-backdrop.active { display: flex; }

.modal-card {
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 var(--crimson);
  padding: 28px 34px;
  max-width: 490px;
  width: 92%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-card h2 {
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
}

.modal-card p { font-size: 13.5px; color: #362e42; font-weight: 700; line-height: 1.65; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
