/* The hub: landing page and admin.
 *
 * Three theme states, matching the boards: an explicit choice stamps
 * data-theme on the root, and the default "system" setting stamps nothing, so
 * only prefers-color-scheme separates light from dark there. Every colour is
 * a token defined on bare :root and redefined in both dark blocks - a colour
 * declared only inside a media query never applies in the unstamped state.
 */

:root {
  color-scheme: light;
  --valorant: #ff4655;
  --league:   #1d7fc4;
  --good:     #0ca30c;
  --critical: #d03b3b;
  --r: 8px;

  --page:      #f2f4f7;
  --surface:   #ffffff;
  --surface-2: #fbfcfd;
  --raised:    #eceff3;
  --line:      #dde2e9;
  --line-soft: #e8ecf1;
  --edge:      #c3ccd8;

  --ink:   #0b0b0b;
  --ink-2: #3d444e;
  --muted: #626c78;
  --faint: #8a939f;

  --accent:      #2a78d6;
  --accent-wash: #e6f0fb;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05), 0 10px 30px -20px rgba(11, 11, 11, .35);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:      #0f1216;
    --surface:   #171b21;
    --surface-2: #1b2027;
    --raised:    #222831;
    --line:      #2a313b;
    --line-soft: #232932;
    --edge:      #3a4350;

    --ink:   #e9ecf1;
    --ink-2: #c2c8d2;
    --muted: #97a0ad;
    --faint: #6d7684;

    --accent:      #6fa8e8;
    --accent-wash: #14243a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -20px rgba(0, 0, 0, .9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:      #0f1216;
  --surface:   #171b21;
  --surface-2: #1b2027;
  --raised:    #222831;
  --line:      #2a313b;
  --line-soft: #232932;
  --edge:      #3a4350;

  --ink:   #e9ecf1;
  --ink-2: #c2c8d2;
  --muted: #97a0ad;
  --faint: #6d7684;

  --accent:      #6fa8e8;
  --accent-wash: #14243a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -20px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 28px 18px 56px;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ── landing ──────────────────────────────────────────────────────────── */

.landing { max-width: 760px; margin: 0 auto; }

.hero { text-align: center; padding: 40px 0 34px; }
.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 1.02rem; }

.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 22px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease;
}
.door::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone, var(--accent));
}
.door.valorant { --tone: var(--valorant); }
.door.league   { --tone: var(--league); }
.door:hover { transform: translateY(-2px); border-color: var(--edge); }
.door:focus-visible { outline: 2px solid var(--tone, var(--accent)); outline-offset: 3px; }

.door .game {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--tone, var(--accent));
}
.door .name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.door .sub { color: var(--muted); font-size: 13.5px; }
.door .status {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line-soft);
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.door.down { opacity: .72; }
.door.down .status { color: var(--critical); }

.foot { margin-top: 30px; text-align: center; font-size: 12.5px; color: var(--faint); }

/* ── admin shell ──────────────────────────────────────────────────────── */

.admin .wrap { max-width: 1040px; margin: 0 auto; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.back { color: var(--muted); text-decoration: none; font-size: 13.5px; }
.back:hover { color: var(--ink); }

.lock {
  max-width: 380px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.lock h2 { margin: 0 0 4px; font-size: 1.1rem; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.field.inline > span { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

input, select {
  height: 38px;
  padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  width: 100%;
}
select { padding-right: 8px; }
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
input:disabled, select:disabled { opacity: .55; }

.check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.check input { width: auto; height: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border-radius: 7px; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.wide { width: 100%; }
.btn.primary { background: #b3252f; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #c72b36; }
.btn.quiet { background: var(--raised); color: var(--ink-2); border-color: var(--line); }
.btn.quiet:hover:not(:disabled) { border-color: var(--edge); color: var(--ink); }
.btn.quiet.danger-text { color: #c0392f; }
:root[data-theme="dark"] .btn.quiet.danger-text,
:root:where(:not([data-theme="light"])) .btn.quiet.danger-text { color: #ff8a8a; }

.err { color: var(--critical); font-size: 13px; margin: 0; }

/* ── tabs ─────────────────────────────────────────────────────────────── */

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: none; cursor: pointer;
  padding: 9px 14px; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── roster cards ─────────────────────────────────────────────────────── */

.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 16px; }

.mcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
  min-width: 0;
}
.mcard > header { display: flex; align-items: baseline; gap: 10px; }
.mcard h3 { margin: 0; font-size: 1.02rem; font-weight: 650; flex: 1; }
.tally {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--raised); border-radius: 20px; padding: 2px 10px;
}

.addform { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px 12px; align-items: start; }
.fld { display: grid; gap: 6px; min-width: 0; }
.fld > span {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.fld > em { font-style: normal; font-size: 10.5px; color: var(--faint); min-height: 14px; line-height: 14px; }
.addfoot {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line-soft);
}

.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rrow {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  font-size: 13px;
}
.rrow .av {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 50%; background: var(--raised); border: 1px solid var(--line);
  color: var(--ink-2); font-weight: 650; font-size: 12.5px;
}
.rrow .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .nm span { color: var(--faint); font-weight: 400; }
.rrow .chips { display: flex; gap: 6px; }
.chip2 {
  background: var(--raised); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 8px; font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.rrow .btn { height: 30px; padding: 0 12px; font-size: 12px; }
.empty { color: var(--faint); font-size: 13px; padding: 6px 2px; }

/* ── visit log ────────────────────────────────────────────────────────── */

.logbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.logbar .field.inline select { width: auto; min-width: 130px; }
.count { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.tablewrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
table.log { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 640px; }
table.log th, table.log td {
  text-align: left; padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
table.log thead th {
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  background: var(--raised); border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
table.log tbody tr:last-child td { border-bottom: none; }
table.log tbody tr:hover { background: var(--surface-2); }

.pill {
  display: inline-block; border-radius: 4px; padding: 1px 7px;
  font-size: 11px; font-weight: 600;
}
.pill.ok  { background: var(--accent-wash); color: var(--accent); }
.pill.bad { background: #fbe6e6; color: var(--critical); }
:root[data-theme="dark"] .pill.bad,
:root:where(:not([data-theme="light"])) .pill.bad { background: #3a1c1c; color: #ff8a8a; }

@media (max-width: 620px) {
  body { padding: 20px 14px 44px; }
  .boards { grid-template-columns: 1fr; }
  .rrow { grid-template-columns: 32px minmax(0, 1fr) auto; row-gap: 8px; }
  .rrow .btn { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .door:hover { transform: none; }
}
