:root {
  --bg: #0b0f17;
  --surface: #131a26;
  --surface-2: #1a2434;
  --border: #253349;
  --text: #e6edf7;
  --muted: #93a4bd;
  --accent: #38bdf8;
  --accent-2: #2dd4bf;
  --purple: #c084fc;
  --amber: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1220px, 94vw); margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 15, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 12px 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: 0.04em; color: var(--text); font-size: 1.08rem;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 18px; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.94rem; }
.nav a.active, .nav a:hover { color: var(--accent-2); text-decoration: none; }

.hero { padding: 28px 0 24px; }
.hero-head {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-end; gap: 16px; margin-bottom: 18px;
}
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: rgba(56, 189, 248, 0.12); color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 0.78rem; font-weight: 600; margin-bottom: 8px;
}
h1, h2, h3 { margin: 0 0 10px; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); }
.lead { color: var(--muted); max-width: 720px; margin: 0; }

.arena-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start;
}
@media (max-width: 980px) {
  .arena-layout { grid-template-columns: 1fr; }
}

.arena-shell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.hud-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
  margin-bottom: 10px; font-size: 0.88rem;
}
.hud-stats, .hud-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stat-pill {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 8px; font-variant-numeric: tabular-nums;
}
.stat-pill strong { color: var(--accent-2); }
.stat-pill.combo strong { color: var(--amber); }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); padding: 7px 13px; border-radius: 8px;
  font-weight: 600; font-size: 0.86rem; cursor: pointer; transition: 0.15s border-color, 0.15s filter;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.active { border-color: var(--accent-2); color: var(--accent-2); background: rgba(45, 212, 191, 0.12); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018; border-color: transparent; font-weight: 700;
}
.btn-primary:hover { color: #061018; filter: brightness(1.08); }
select.ctrl-select, input.ctrl-input {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 10px; border-radius: 8px; font-size: 0.88rem;
}
input.ctrl-input { width: 100%; }

.canvas-wrap {
  position: relative; width: 100%; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: #070a10; user-select: none;
}
canvas#arena-canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; cursor: crosshair; touch-action: none;
}

.boss-bar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: min(460px, 82%); background: rgba(11, 15, 23, 0.85);
  border: 1px solid rgba(248, 113, 113, 0.55); border-radius: 999px;
  padding: 4px 10px; display: none; z-index: 5;
}
.boss-bar.visible { display: block; }
.boss-bar-label { font-size: 0.75rem; font-weight: 700; color: #fca5a5; text-align: center; margin-bottom: 3px; }
.boss-bar-track { height: 7px; background: #1e293b; border-radius: 999px; overflow: hidden; }
.boss-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #f87171, #fbbf24); transition: width 0.08s linear; }

.overlay-panel {
  position: absolute; inset: 0; background: rgba(9, 13, 21, 0.88);
  backdrop-filter: blur(6px); z-index: 10; display: none;
  align-items: center; justify-content: center; padding: 18px; overflow-y: auto;
}
.overlay-panel.visible { display: flex; }
.overlay-box {
  width: min(760px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.overlay-box h2 { margin-bottom: 6px; font-size: 1.35rem; }
.overlay-sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; }

.hangar-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 640px) { .hangar-row { grid-template-columns: 1fr; } }
.field-label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.ship-grid, .upgrade-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
@media (max-width: 680px) { .ship-grid, .upgrade-grid { grid-template-columns: 1fr; } }

.pick-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px; cursor: pointer; text-align: left;
  transition: 0.15s border-color, 0.15s transform;
}
.pick-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pick-card.selected { border-color: var(--accent-2); background: rgba(45, 212, 191, 0.1); }
.pick-card h4 { margin: 0 0 4px; font-size: 0.95rem; color: var(--text); }
.pick-card .meta { font-size: 0.78rem; color: var(--accent); margin-bottom: 4px; font-weight: 600; }
.pick-card p { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.35; }

.arena-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); font-size: 0.84rem; cursor: pointer; font-weight: 600;
}
.chip.selected { border-color: var(--accent); color: var(--text); background: rgba(56, 189, 248, 0.14); }

.hangar-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--muted); cursor: pointer; }

.touch-controls {
  display: none; position: absolute; inset: 0; pointer-events: none; z-index: 6;
}
@media (pointer: coarse) { .touch-controls.active { display: block; } }
.touch-pad {
  position: absolute; bottom: 16px; left: 16px; width: 108px; height: 108px;
  border-radius: 50%; border: 2px solid rgba(56, 189, 248, 0.35);
  background: rgba(11, 15, 23, 0.35); pointer-events: auto; touch-action: none;
}
.touch-dash {
  position: absolute; bottom: 24px; right: 20px; width: 72px; height: 72px;
  border-radius: 50%; border: 2px solid rgba(45, 212, 191, 0.55);
  background: rgba(19, 26, 38, 0.75); color: var(--accent-2); font-weight: 700;
  font-size: 0.78rem; pointer-events: auto;
}

.arena-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  padding-top: 10px; color: var(--muted); font-size: 0.83rem;
}

.side-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.side-card h3 { font-size: 1rem; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.mini-lb-list { list-style: none; margin: 0; padding: 0; }
.mini-lb-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.86rem;
}
.mini-lb-list li:last-child { border-bottom: none; }
.mini-lb-name { font-weight: 600; color: var(--text); }
.mini-lb-meta { color: var(--muted); font-size: 0.76rem; display: block; }
.mini-lb-score { font-weight: 700; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.online-badge {
  font-size: 0.76rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(45, 212, 191, 0.14); color: var(--accent-2); border: 1px solid rgba(45, 212, 191, 0.35);
}
.live-feed-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.live-feed-box h4 { margin: 0 0 8px; font-size: 0.9rem; color: var(--text); }
.live-feed-list { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow-y: auto; }
.live-feed-list li { font-size: 0.78rem; color: var(--muted); padding: 4px 0; border-bottom: 1px solid rgba(37, 51, 73, 0.5); }
.live-feed-list li:last-child { border-bottom: none; }
.live-feed-list span.ts { color: var(--accent); margin-right: 5px; font-variant-numeric: tabular-nums; }

.section { padding: 24px 0 38px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card img.preview {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); margin-bottom: 10px;
}
.card p { color: var(--muted); margin: 0; font-size: 0.92rem; }
.card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.92rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: rgba(56, 189, 248, 0.05); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.patch-item { margin-bottom: 16px; }
.patch-meta { color: var(--accent-2); font-size: 0.84rem; font-weight: 600; margin-bottom: 6px; }

.footer {
  border-top: 1px solid var(--border); padding: 22px 0 34px;
  color: var(--muted); font-size: 0.86rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px;
}
body.fullscreen-play .container.wide { width: min(1460px, 96vw); }
