/* Deep-space navy, one cool grey family, one ice-blue accent. */
:root {
  --bg: #04060c;
  --card: rgba(12, 17, 32, 0.78);
  --card-2: rgba(17, 24, 44, 0.82);
  --surface-3: #1a2340;
  --line: rgba(178, 198, 255, 0.08);
  --line-2: rgba(178, 198, 255, 0.14);
  --text: #e8edf7;
  --text-2: #b4bdd0;
  --muted: #8690a6;
  --faint: #75809b;

  --accent: #9cc8ff;
  --accent-soft: rgba(156, 200, 255, 0.12);
  --ink: #06101f;
  --up: var(--accent);
  --down: #f0a3a3;
  --bar: #4a6fc0;
  --bar-lo: #3a5ba8;
  --bar-hi: #cfe3ff;
  --bar-me: #b98a33;

  --sans: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --r-card: 28px;
  --r-md: 16px;

  --z-sky: 0;
  --z-content: 2;
  --z-skip: 10;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}
h1, h2, p, dl, dd, figure { margin: 0; }
button, input { font: inherit; color: inherit; }
::selection { background: rgba(156, 200, 255, 0.35); }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ───────── Space ───────── */

.sky { position: fixed; inset: 0; z-index: var(--z-sky); pointer-events: none; }
.sky canvas { position: absolute; inset: 0; }
.sky::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(900px 520px at 82% -6%, rgba(72, 112, 210, 0.16), transparent 70%),
    radial-gradient(700px 480px at -6% 38%, rgba(40, 140, 160, 0.07), transparent 70%),
    radial-gradient(900px 600px at 50% 120%, rgba(90, 80, 190, 0.08), transparent 70%),
    linear-gradient(180deg, #060a16 0%, var(--bg) 55%);
}

.planet-clip { position: absolute; inset: 0 0 auto 0; height: 780px; overflow: hidden; pointer-events: none; }
.planet { position: absolute; top: -440px; right: -300px; width: 680px; height: 680px; }
.planet::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 70%, #18234a 0%, #0b1129 42%, #05070f 72%);
  box-shadow:
    inset 26px -20px 60px -10px rgba(150, 190, 255, 0.22),
    inset 2px -2px 2px rgba(190, 215, 255, 0.25),
    0 0 120px 10px rgba(80, 120, 230, 0.10);
}
.planet::after {
  content: ''; position: absolute; left: -22%; right: -22%; top: 44%; height: 26%;
  border-radius: 50%; border: 1px solid rgba(160, 195, 255, 0.13);
  transform: rotate(-16deg);
  mask-image: linear-gradient(90deg, #000 0 34%, transparent 46% 100%);
}
.moon-path { position: absolute; left: -22%; right: -22%; top: 44%; height: 26%; transform: rotate(-16deg); }
.moon { display: none; }
@supports (offset-path: ellipse(50% 50% at 50% 50%)) {
  .moon {
    display: block; position: absolute; top: 0; left: 0; width: 9px; height: 9px; border-radius: 50%;
    background: #e3ecff;
    box-shadow: 0 0 12px 3px rgba(170, 200, 255, 0.55);
    offset-path: ellipse(50% 50% at 50% 50%); offset-rotate: 0deg;
    animation: orbit 40s linear infinite;
  }
}
@keyframes orbit {
  0% { offset-distance: 0%; opacity: 0; }
  27% { opacity: 0; }
  34% { opacity: 1; }
  66% { opacity: 1; }
  73% { opacity: 0; }
  100% { offset-distance: 100%; opacity: 0; }
}

.wrap { position: relative; z-index: var(--z-content); width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 28px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: var(--z-skip);
  background: var(--accent); color: var(--ink); padding: 10px 16px; border-radius: 999px; font-weight: 600;
  transition: top 0.3s var(--ease);
}
.skip:focus { top: 14px; }

/* ───────── Hero ───────── */

.hero {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: end;
  padding: 88px 0 56px;
}
.chip {
  display: inline-flex; align-items: center; gap: 8px; width: max-content;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2);
  background: rgba(178, 198, 255, 0.08); box-shadow: inset 0 0 0 1px var(--line);
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
h1 {
  font-weight: 800; font-size: clamp(40px, 6.2vw, 80px); line-height: 1.02; letter-spacing: -0.035em;
  text-wrap: balance;
}
h1 { background: linear-gradient(180deg, #ffffff 30%, #a9bde6 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.grad {
  display: inline-block; background: linear-gradient(180deg, #d9e8ff 10%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; padding-bottom: 0.08em;
}
.lede { margin-top: 22px; max-width: 54ch; color: var(--text-2); font-size: 17px; text-wrap: pretty; }


/* ───────── Cards ───────── */

.card {
  position: relative; border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(210, 222, 255, 0.07), 0 40px 80px -50px rgba(0, 0, 0, 0.9);
  --mx: 50%; --my: 50%;
}
/* Edge glow that follows the cursor. */
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx) var(--my), rgba(156, 200, 255, 0.55), rgba(156, 200, 255, 0.06) 45%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity 0.5s var(--ease);
}
@media (hover: hover) { .card:hover::after { opacity: 1; } }
.card-title { font-weight: 600; color: var(--text); }

/* ───────── Distribution ───────── */

.dist { padding: 22px 24px 18px; }
.dist figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 16px; }
.dist-plot { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line-2); }
.dist-col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; outline: none; }
.dist-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--bar); background: color-mix(in oklch, var(--bar-hi) calc(var(--t, 0) * 100%), var(--bar-lo)); transition: filter 0.3s var(--ease), height 0.9s var(--spring); }
.dist-col.mine .dist-bar { background: var(--bar-me); }
.dist-col:hover .dist-bar, .dist-col:focus-visible .dist-bar { filter: brightness(1.3); }
.dist-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 6px; }
.dist-you { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; }
.dist-axis { display: flex; justify-content: space-between; margin-top: 8px; font: 12px var(--mono); color: var(--muted); }
.dist-tip {
  position: absolute; z-index: 3; pointer-events: none; transform: translate(-50%, -100%);
  padding: 7px 12px; border-radius: 12px; font-size: 12px; white-space: nowrap;
  background: #121a33; box-shadow: inset 0 0 0 1px var(--line-2), 0 12px 24px -8px rgba(0, 0, 0, 0.7);
}
.dist-tip b { font-family: var(--mono); font-weight: 700; }

/* ───────── Sign in ───────── */

.auth { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 40px; padding: 34px 36px; }
h2 { font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.auth-copy .muted { margin-top: 8px; max-width: 38ch; font-size: 14px; }

.auth-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; }
.field { display: grid; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input {
  width: 100%; height: 52px; padding: 0 18px; border: 0; border-radius: var(--r-md); outline: none;
  background: rgba(4, 6, 16, 0.5); box-shadow: inset 0 0 0 1.5px var(--line-2);
  font-size: 15px; transition: box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}
.field input::placeholder { color: var(--faint); }
.field input:hover { box-shadow: inset 0 0 0 1.5px rgba(178, 198, 255, 0.32); }
.field input:focus { background: rgba(4, 6, 16, 0.7); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }
#uni { font-family: var(--mono); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 8px 0 24px;
  border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--text); color: var(--bg); font-weight: 600;
  transition: transform 0.4s var(--spring), background 0.4s var(--ease), opacity 0.3s var(--ease);
}
.btn-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(4, 6, 12, 0.08); transition: transform 0.5s var(--spring), background 0.4s var(--ease); }
.btn-icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: #fff; transform: translateY(-1px); }
.btn:hover .btn-icon { transform: translate(2px, -1px) scale(1.05); background: var(--accent); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.small { height: 42px; padding: 0 20px; font-size: 14px; }
.btn:focus-visible, .link:focus-visible, .seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.form-msg { grid-column: 1 / -1; min-height: 1.5em; font-size: 13px; color: var(--muted); }
.form-msg.err { color: var(--down); }
.shake { animation: shake 0.5s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.me { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px; align-items: start; }
.me-name { margin-top: 12px; font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.me-meta { margin-top: 8px; color: var(--muted); font-size: 14px; }
.me-meta b { color: var(--text); font: 700 13px var(--mono); }
.me-actions { margin-top: 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.link { padding: 0; border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: transparent; transition: color 0.3s, text-decoration-color 0.3s; }
.link:hover { color: var(--text); text-decoration-color: currentColor; }

.breakdown:empty { display: none; }
.bd { padding: 18px 20px; border-radius: 20px; background: rgba(4, 6, 16, 0.42); box-shadow: inset 0 0 0 1px var(--line); }
.bd + .bd { margin-top: 12px; }
.bd-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.bd-grid { display: grid; grid-template-columns: 1fr auto; margin: 0; font-size: 14px; }
.bd-grid dt, .bd-grid dd { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.bd-grid dt { color: var(--text-2); }
.bd-grid dd { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.bd-grid dd.na { color: var(--faint); font-family: var(--sans); font-style: italic; }
.bd-grid dd.note { font-family: var(--sans); color: var(--down); max-width: 26ch; justify-self: end; }
.bd-grid .sum { border-bottom: 0; padding-top: 12px; }
.bd-grid dt.sum { color: var(--text); font-weight: 600; }
.bd-grid dd.sum { font-size: 20px; font-weight: 600; color: var(--accent); }

/* ───────── Standings ───────── */

.standings { padding: 64px 0 64px; outline: none; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin-bottom: 4px; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.segmented:empty { display: none; }
.seg { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; transition: color 0.3s, background 0.3s; }
.seg:hover { color: var(--text); }
.seg[aria-selected="true"] { color: var(--text); background: var(--surface-3); box-shadow: inset 0 1px 0 rgba(210, 222, 255, 0.06); }

.search { position: relative; display: block; }
.search svg { position: absolute; left: 16px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); stroke: var(--muted); stroke-width: 1.6; fill: none; stroke-linecap: round; }
.search input {
  width: 250px; height: 44px; padding: 0 16px 0 40px; border: 0; border-radius: 999px; outline: none;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14px;
  transition: box-shadow 0.3s var(--ease);
}
.search input::placeholder { color: var(--faint); }
.search input:focus { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }

/* Rows float as separate rounded cards. */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-variant-numeric: tabular-nums; }
.table th { text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); padding: 0 20px 2px; white-space: nowrap; }
.table th.l, .table td.l { text-align: left; }
.table th.active { color: var(--text-2); }
.table td { padding: 14px 20px; text-align: right; white-space: nowrap; background: var(--card); transition: background 0.3s var(--ease), transform 0.4s var(--spring); }
.table td:first-child { border-radius: 18px 0 0 18px; }
.table td:last-child { border-radius: 0 18px 18px 0; }
.table tbody tr { transition: transform 0.4s var(--spring); }
.table tbody tr:hover td { background: var(--card-2); }
@media (hover: hover) { .table tbody tr:hover { transform: translateY(-2px); } }
.table tbody tr.enter { animation: rise 0.7s var(--spring) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

.rank { width: 76px; }
.badge {
  display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 8px; border-radius: 13px;
  font: 700 14px var(--mono); color: var(--text-2); background: rgba(178, 198, 255, 0.1);
}
.badge.m1 { color: var(--ink); background: var(--accent); }
.badge.m2, .badge.m3 { color: var(--text); background: var(--surface-3); }

.mv { width: 76px; }
.mv span { display: inline-block; padding: 3px 10px; border-radius: 999px; font: 700 12px var(--mono); }
.mv.up span { color: var(--accent); background: var(--accent-soft); }
.mv.down span { color: var(--down); background: rgba(240, 163, 163, 0.1); }
.mv.same span { color: var(--faint); background: rgba(178, 198, 255, 0.07); }

.who { min-width: 240px; }
.who-name { font: 700 14px var(--mono); display: flex; align-items: center; gap: 10px; }
.who-id { margin-top: 2px; font: 11px var(--mono); color: var(--faint); }
.tag { font: 600 11px var(--sans); color: var(--ink); background: var(--accent); padding: 3px 10px; border-radius: 999px; }

.score { font-family: var(--mono); color: var(--muted); }
.score.active { color: var(--text); }

.total { min-width: 180px; }
.total-inner { display: inline-flex; align-items: center; gap: 16px; justify-content: flex-end; }
.meter { width: 90px; height: 4px; border-radius: 999px; background: rgba(178, 198, 255, 0.08); overflow: hidden; }
.meter > i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--text-2); transform-origin: left; animation: grow 1s var(--spring) both; }
tr.lead .meter > i { background: var(--accent); }
@keyframes grow { from { transform: scaleX(0); } }
.total b { font: 700 16px var(--mono); min-width: 4ch; text-align: right; }

tr.me-row td { background: rgba(156, 200, 255, 0.14) !important; }
tr.me-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.me-row .who-name { font-family: var(--sans); }
tr.flash td { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 35% { background: rgba(156, 200, 255, 0.3); } }

.empty { text-align: center !important; color: var(--muted); padding: 56px 22px !important; white-space: normal !important; border-radius: 18px !important; }

.skel td span { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgba(178, 198, 255, 0.08) 0%, rgba(178, 198, 255, 0.2) 50%, rgba(178, 198, 255, 0.08) 100%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.glitch-text { color: var(--accent) !important; }

/* ───────── Footer ───────── */

.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 44px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }

/* ───────── Entry motion (only once app.js runs) ───────── */

.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.9s var(--spring); }
.js .reveal.in { opacity: 1; transform: none; }

/* ───────── Round phase ───────── */

.phase { margin-top: 26px; max-width: 520px; }
.phase-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.phase-label { font-weight: 600; color: var(--text); }
.phase-label::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.phase-track { height: 4px; border-radius: 999px; background: rgba(178, 198, 255, 0.1); overflow: hidden; }
.phase-track i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: var(--accent); transition: width 1s var(--ease); }

/* ───────── Attack column ───────── */

.table th.atk, .table td.atk { width: 90px; }
.table td.atk { color: var(--faint); }
.table td.atk.hot { color: var(--accent); }

/* ───────── Breakdown hints ───────── */

.bd-hint { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); }

/* ───────── How scoring works ───────── */

.scoring { padding: 0 0 96px; }
.rules { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.rule { padding: 20px 20px 22px; border-radius: 22px; }
.rule-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.rule-value { margin-top: 6px; font: 600 17px var(--mono); letter-spacing: -0.03em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-text { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }

@media (max-width: 1000px) { .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .rules { grid-template-columns: 1fr; }
  .table th.atk, .table td.atk { width: auto; }
}

/* ───────── Round stats + private attack detail ───────── */

.phase-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; font-size: 13px; }
.phase-stats div { display: flex; gap: 6px; align-items: baseline; }
.phase-stats dt { color: var(--muted); }
.phase-stats dd { margin: 0; font: 600 13px var(--mono); color: var(--text); }

.me-detail { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.me-detail:empty { display: none; }
.dcard { padding: 18px 20px; border-radius: 20px; background: rgba(4, 6, 16, 0.42); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.dcard.standing { box-shadow: inset 0 0 0 1px rgba(156, 200, 255, 0.35); }
.dcard.found { box-shadow: inset 0 0 0 1px rgba(240, 163, 163, 0.28); }
.d-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.d-status { margin-top: 4px; font: 600 22px var(--sans); letter-spacing: -0.02em; }
.dcard.standing .d-status { color: var(--accent); }
.dcard.found .d-status { color: var(--down); }
.d-text { margin-top: 6px; font-size: 13px; color: var(--muted); }
.d-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.d-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.d-list .mono { font-family: var(--mono); }
.place { flex: none; min-width: 34px; padding: 2px 6px; border-radius: 7px; text-align: center; font: 600 11px var(--mono); color: var(--muted); background: rgba(178, 198, 255, 0.08); }
.place.p1 { color: var(--ink); background: var(--accent); }
.place.p2, .place.p3 { color: var(--text); background: var(--surface-3); }
.pr { color: var(--text); font-family: var(--mono); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.pr:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.d-meta { color: var(--faint); font-size: 12px; white-space: nowrap; }
.d-pts { margin-left: auto; font: 600 13px var(--mono); color: var(--accent); white-space: nowrap; }
.d-list.rej li { align-items: flex-start; flex-direction: column; gap: 2px; }
.d-note { color: var(--down); font-size: 12px; overflow-wrap: anywhere; }

/* ───────── Responsive ───────── */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 64px 0 40px; }
  .auth { grid-template-columns: 1fr; gap: 22px; padding: 26px 22px; }
  .me { grid-column: 1; grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 48px; }
  .planet { width: 400px; height: 400px; top: -260px; right: -220px; }
  .auth-form { grid-template-columns: 1fr; }
  .btn { justify-content: space-between; }
  .controls, .search, .search input { width: 100%; }
  .table td { padding: 12px 10px; }
  .table th { padding: 0 10px 2px; }
  .who { min-width: 0; }
  /* Competitor takes whatever width is left; long codenames wrap instead of pushing Total off-screen. */
  .table td.who { width: 100%; max-width: 0; }
  .who-name { min-width: 0; font-size: 13px; }
  .who-name .nm, .who-id { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .tag { flex: none; }
  .meter { display: none; }
  .table .rcol:not(.active) { display: none; }
  .total { min-width: 0; }
  .rank { width: 56px; }
  .badge { min-width: 32px; height: 32px; border-radius: 11px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
