:root {
  --bg: #11130f;
  --panel: #1a1d17;
  --border: #2b2f26;
  --text: #e8eade;
  --dim: #8e9482;
  --accent: #b5c93f;
  --hot: #d9663f;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }

.topbar {
  padding: max(env(safe-area-inset-top), 18px) 16px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.02em; }
h1 .sub { color: var(--dim); font-weight: 400; font-size: 0.85rem; margin-left: 6px; }
.totals { color: var(--dim); font-size: 0.82rem; margin-top: 4px; }

.modes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.modes button {
  background: var(--panel); color: var(--dim);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 11px; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.modes button.active { background: var(--accent); color: #14170d; border-color: var(--accent); font-weight: 600; }

main { padding: 16px; max-width: 760px; margin: 0 auto; }

/* Scoreboard: the two players side by side, leader highlighted */
.scoreboard { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.player {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; position: relative;
}
.player.leader { border-color: var(--accent); }
.player .crown { position: absolute; top: 12px; right: 14px; font-size: 1.1rem; }
.player .name { font-size: 1.15rem; font-weight: 650; margin-bottom: 2px; }
.player .guid { font-size: 0.68rem; color: var(--dim); font-family: ui-monospace, Menlo, monospace; margin-bottom: 12px; }
.player .kills { font-size: 2.4rem; font-weight: 700; line-height: 1; color: var(--accent); }
.player .kills small { font-size: 0.8rem; color: var(--dim); font-weight: 400; margin-left: 6px; }
.player .line { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--dim); margin-top: 8px; }
.player .line b { color: var(--text); font-weight: 600; }

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; margin-top: 14px;
}
.panel h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--dim); margin: 0 0 10px;
}
.row { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; padding: 5px 0; }
.row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .bar { height: 6px; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.row .n { width: 48px; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.empty { color: var(--dim); font-size: 0.85rem; }
.form-item { padding: 9px 0; border-top: 1px solid var(--border); }
.form-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; }
.form-badge { flex-shrink: 0; color: var(--accent); font-size: 0.75rem; font-weight: 650; }
.form-meta { margin-top: 3px; color: var(--dim); font-size: 0.75rem; text-transform: capitalize; }
.form-note { color: var(--dim); font-size: 0.72rem; margin: 10px 0 0; }
.games-more { display: block; margin: 12px auto 0; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--accent); font: inherit; cursor: pointer; }
.game-rounds { margin-top: 8px; color: var(--dim); font-size: 0.77rem; }
.game-rounds summary { cursor: pointer; }
.game-rounds div { padding: 3px 0 2px 10px; }
.foot { text-align: center; color: var(--dim); font-size: 0.72rem; padding: 6px 16px 28px; }

/* Login gate. This subdomain is public, unlike the rest of the homelab, so
   the code is the only thing in front of it. */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.login-card {
  width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px 22px; text-align: center;
}
.login-card h1 { font-size: 1.25rem; }
.login-card .hint { color: var(--dim); font-size: 0.85rem; margin: 0 0 4px; }
.login-card input {
  padding: 13px 14px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  /* >=16px or iOS zooms the page on focus. */
  font-size: 16px; font-family: inherit;
}
.login-card button {
  padding: 13px; border: none; border-radius: 11px;
  background: var(--accent); color: #14170d; font: inherit; font-weight: 650;
  font-size: 1rem; cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; }
.error { color: var(--hot); font-size: 0.85rem; margin: 0; }
