/* Bertha -- arcade theme shared by every page (see assets/bertha.js for the data layer). */
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap");

:root {
  --bg: #07060d;
  --panel: #0d0b19;
  --panel-2: #120f22;
  --line: #f4f1ff;
  --line-dim: #2a2440;
  --text: #f4f1ff;
  --muted: #8b86a8;
  --neon: #7cff6b;
  --cyan: #5ef2ff;
  --pink: #ff4fa3;
  --yellow: #ffd23f;
  --purple: #c79bff;
  --shadow: #3b1a8f;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --term: "VT323", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 4px);
  color: var(--text);
  font: 22px/1.25 var(--term);
  -webkit-font-smoothing: none;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #b8fbff; text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.wrap { max-width: 1152px; margin: 0 auto; padding: 0 16px 48px; }
@media (min-width: 720px) { .wrap { padding: 0 32px 64px; } }

/* ---------- top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding: 24px 0 8px; font: 11px/1.6 var(--pixel);
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.topbar nav a { color: var(--text); }
.topbar nav a[aria-current="page"] { color: var(--neon); }
.topbar .hiscore { color: var(--yellow); }

/* ---------- headings ---------- */
.logo {
  display: block; text-align: center; margin: 40px 0 0;
  font: clamp(44px, 11vw, 104px)/1 var(--pixel); color: var(--neon);
  text-shadow: 5px 5px 0 var(--shadow), 0 0 28px var(--neon);
}
.logo:hover { color: var(--neon); text-decoration: none; }
.tagline { text-align: center; margin-top: 16px; font: 12px/1.6 var(--pixel); color: var(--yellow); letter-spacing: 2px; }
.insert { text-align: center; margin-top: 22px; font: clamp(11px, 2.4vw, 16px)/1.6 var(--pixel); }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

.page-title { margin: 40px 0 8px; font: clamp(20px, 4vw, 30px)/1.3 var(--pixel); color: var(--pink); letter-spacing: 3px; font-weight: 400; }
.page-sub { margin: 0 0 24px; color: var(--muted); }
h2.section {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 56px 0 18px; font: clamp(15px, 2.6vw, 22px)/1.4 var(--pixel); font-weight: 400; color: var(--yellow);
}
h2.section a { font-size: 11px; }
.center { text-align: center; }

/* ---------- high-score table ---------- */
.scores { width: 100%; border-collapse: collapse; }
.scores th {
  font: 10px/1.6 var(--pixel); color: var(--muted); font-weight: 400; text-align: left; padding: 0 10px 10px;
}
.scores td { padding: 7px 10px; vertical-align: middle; }
.scores .num { text-align: right; font-variant-numeric: tabular-nums; }
.scores .rank, .scores .big { font: clamp(12px, 2vw, 18px)/1.4 var(--pixel); white-space: nowrap; }
.scores tr.row { cursor: pointer; }
.scores tr.row:hover td { background: var(--panel-2); }
.scores .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.scores .who a { color: inherit; font-size: clamp(24px, 3.2vw, 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scores .dim { color: var(--muted); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- avatar ---------- */
.av {
  flex: 0 0 auto; width: 40px; height: 40px; border: 3px solid var(--line); background: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  font: 16px/1 var(--pixel); color: var(--bg); image-rendering: pixelated;
}
.av img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.av.lg { width: 96px; height: 96px; border-width: 4px; font-size: 38px; }
.av.xl { width: 128px; height: 128px; border-width: 5px; font-size: 48px; }

/* ---------- panels, tiles ---------- */
.panel { border: 4px solid var(--line); background: var(--panel-2); padding: 20px; }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile { border: 4px solid var(--c, var(--cyan)); background: var(--panel); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile .label { font: 10px/1.6 var(--pixel); color: var(--c, var(--cyan)); }
.tile .value { font-size: 36px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { color: var(--muted); font-size: 20px; overflow-wrap: anywhere; }
.tile a.value { color: var(--text); }

/* ---------- buttons / tabs ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font: 11px/1 var(--pixel); color: var(--text); background: var(--panel); border: 3px solid var(--line-dim);
  padding: 12px 14px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--line); text-decoration: none; color: var(--text); }
.btn[aria-pressed="true"], .btn.on { border-color: var(--neon); color: var(--neon); }
select.btn { font: 20px var(--term); max-width: 100%; }
.btn:disabled { opacity: .35; cursor: default; }
.btn:disabled:hover { border-color: var(--line-dim); }
.btn-row-label { font: 10px/1.6 var(--pixel); color: var(--muted); margin: 18px 0 8px; }

/* ---------- fight card (duels) ---------- */
.fight { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); border: 4px solid var(--line); background: var(--panel-2); }
.fighter { padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; position: relative; }
.fighter.p2 { align-items: flex-end; text-align: right; }
.fighter .id { display: flex; align-items: center; gap: 16px; min-width: 0; width: 100%; }
.fighter.p2 .id { flex-direction: row-reverse; }
.fighter .tag { font: 10px/1.6 var(--pixel); color: var(--muted); }
.fighter .nm { display: block; font-size: clamp(28px, 4vw, 44px); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fighter .nm a { color: var(--text); }
.hp { height: 24px; width: 100%; border: 3px solid var(--line); background: var(--line-dim); display: flex; }
.fighter.p2 .hp { justify-content: flex-end; }
.hp span { display: block; height: 100%; }
.fighter .pts { font: 14px/1.4 var(--pixel); }
.ko { position: absolute; top: 56px; font: 22px/1 var(--pixel); color: var(--pink); transform: rotate(-12deg); text-shadow: 3px 3px 0 var(--bg); pointer-events: none; }
.fighter.p1 .ko { left: 18px; } .fighter.p2 .ko { right: 18px; }
.vs {
  width: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); border-left: 4px solid var(--line); border-right: 4px solid var(--line); padding: 12px 6px;
  font: 9px/1.7 var(--pixel); color: var(--muted); text-align: center;
}
.vs b { font: 40px/1 var(--pixel); color: var(--pink); text-shadow: 4px 4px 0 var(--shadow); font-weight: 400; }
@media (max-width: 720px) {
  .fight { grid-template-columns: 1fr; }
  .vs { width: auto; flex-direction: row; border: 0; border-top: 4px solid var(--line); border-bottom: 4px solid var(--line); }
  .vs b { font-size: 24px; }
  .fighter.p2 { align-items: flex-start; text-align: left; }
  .fighter.p2 .id { flex-direction: row; }
  .fighter.p2 .hp { justify-content: flex-start; }
  .fighter.p2 .ko { right: auto; left: 18px; }
}

/* ---------- match list ---------- */
.mlist { display: flex; flex-direction: column; gap: 10px; }
.mrow {
  display: grid; grid-template-columns: 170px 1fr auto; gap: 6px 18px; align-items: center;
  border: 3px solid var(--line-dim); background: var(--panel); padding: 12px 16px; color: var(--text);
}
.mrow:hover { border-color: var(--line); text-decoration: none; color: var(--text); }
.mrow .kind { font: 10px/1.6 var(--pixel); color: var(--c, var(--cyan)); }
.mrow .what { font-size: 26px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .when { color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 720px) {
  .mrow { grid-template-columns: 1fr; }
  .mrow .when { text-align: left; }
}

/* ---------- replay rounds ---------- */
.round { border: 3px solid var(--line-dim); background: var(--panel); padding: 16px 18px; display: grid; grid-template-columns: 64px 1fr; gap: 14px; }
.round .no { font: 16px/1.3 var(--pixel); color: var(--muted); }
.round .cat { font: 10px/1.6 var(--pixel); color: var(--purple); }
.round .q { font-size: 26px; margin: 4px 0 8px; overflow-wrap: anywhere; }
.round img.qimg { display: block; max-width: min(100%, 360px); max-height: 220px; border: 3px solid var(--line-dim); margin: 6px 0 10px; background: #fff; }
.round .ans { color: var(--muted); }
.round .result { margin-top: 6px; }
.round.insane { border-color: var(--pink); }
.round details summary { cursor: pointer; color: var(--cyan); }
.round .found { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
@media (max-width: 520px) { .round { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- duel XP strip (under the fight card) ---------- */
.xpline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; border: 4px solid var(--line); border-top: 0;
  background: var(--panel); padding: 12px 20px; font-size: 24px;
}
.xpline .label { font: 10px/1.6 var(--pixel); color: var(--neon); }
.xpline b { color: var(--neon); font-weight: 400; }

/* ---------- missions ---------- */
.missions { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mission { border: 3px solid var(--c, var(--cyan)); background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.mission .diff { font: 9px/1.6 var(--pixel); color: var(--c, var(--cyan)); }
.mission .txt { font-size: 26px; line-height: 1.1; }
.mission .who { color: var(--muted); }

/* ---------- misc ---------- */
.xpbar { height: 20px; border: 3px solid var(--line); background: var(--line-dim); }
.xpbar span { display: block; height: 100%; background: var(--neon); }
.badges { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.badge { border: 3px solid var(--line-dim); padding: 10px 12px; background: var(--panel); }
.badge.got { border-color: var(--yellow); }
.badge .bn { font: 10px/1.6 var(--pixel); color: var(--yellow); }
.badge:not(.got) .bn { color: var(--muted); }
.badge .bd { color: var(--muted); font-size: 19px; }
.loading { text-align: center; padding: 64px 0; font: 12px/1.6 var(--pixel); color: var(--muted); }
.error { border: 4px solid var(--pink); padding: 16px; color: var(--pink); margin: 24px 0; }
footer.site {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 64px; padding-top: 20px;
  border-top: 3px solid var(--line-dim); font: 10px/1.8 var(--pixel); color: var(--muted);
}
.pill { display: inline-block; font: 9px/1 var(--pixel); padding: 5px 7px; border: 2px solid currentColor; vertical-align: middle; }
