/* Pile Raid — admin console.
 *
 * Dependency-free on purpose: an operations console that can lock you out
 * because a CDN is unreachable is worse than a plain one. Same palette as the
 * game and the site, so a screenshot from here is recognisably Pile Raid. */

:root {
  --night: #050711;
  --panel: #0a1028;
  --panel-2: #0d1535;
  --raise: #111a3f;
  --line: #1e2750;
  --line-2: #2b366b;
  --ink: #fffbea;
  --muted: #b7b6ca;
  --dim: #7d7c95;
  --lime: #c8ff4d;
  --lime-dim: #8fb832;
  --violet: #755cff;
  --violet-soft: #a695ff;
  --coral: #ff6978;
  --amber: #ffc453;
  --teal: #4ddcc8;
  --rail: 248px;
  --radius: 12px;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

/* The browser's own `[hidden]` rule is `display: none`, and ANY class selector
 * that sets `display` outranks it — `.gate { display: grid }` did, so setting
 * `.hidden = true` changed the attribute and nothing else, and the sign-in form
 * stayed on screen underneath the console. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet-soft); }
button { font: inherit; }

/* ---------------------------------------------------------------- sign-in */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(117, 92, 255, 0.18), transparent 60%),
    radial-gradient(700px 400px at 110% 10%, rgba(200, 255, 77, 0.08), transparent 60%),
    var(--night);
}
.gate__card {
  width: 100%;
  max-width: 400px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}
.gate__brand { font-size: 20px; font-weight: 800; letter-spacing: 3px; margin-bottom: 4px; }
.gate__brand span { color: var(--lime); }
.gate__sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }

label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; letter-spacing: .3px; }
input, select {
  width: 100%;
  background: var(--night);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  padding: 11px 13px;
  font: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--violet); }
.field { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--raise);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn:hover { border-color: var(--violet); }
.btn--primary { background: var(--lime); border-color: var(--lime); color: #081018; }
.btn--primary:hover { background: #d6ff70; }
.btn--danger { color: var(--coral); border-color: rgba(255,105,120,.4); }
.btn--wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert {
  border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px;
  border: 1px solid rgba(255,105,120,.35); background: rgba(255,105,120,.08); color: #ffd7db;
}
.alert--ok { border-color: rgba(200,255,77,.3); background: rgba(200,255,77,.07); color: #eaffc0; }

/* -------------------------------------------------------------- app shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail__brand {
  padding: 20px 20px 16px;
  font-weight: 800; letter-spacing: 2.5px; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.rail__brand span { color: var(--lime); }
.rail__brand small {
  display: block; margin-top: 5px; letter-spacing: .6px;
  font-size: 10px; font-weight: 700; color: var(--dim);
}
.rail__group { padding: 16px 12px 4px; font-size: 10px; letter-spacing: 1.2px; color: var(--dim); font-weight: 700; }
.rail nav { padding: 0 8px 16px; }
.rail a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
}
.rail a:hover { background: var(--raise); color: var(--ink); }
.rail a.is-active { background: var(--raise); color: var(--ink); box-shadow: inset 2px 0 0 var(--lime); }
.rail a .ico { width: 16px; text-align: center; opacity: .85; }
.rail__foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(10,16,40,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.topbar__spacer { flex: 1; }
.who { text-align: right; line-height: 1.3; }
.who strong { display: block; font-size: 13px; }
.who small { color: var(--dim); font-size: 11px; }

.view { padding: 26px; max-width: 1400px; }
.view__lede { color: var(--muted); margin: -6px 0 22px; font-size: 13px; max-width: 70ch; line-height: 1.55; }

/* ------------------------------------------------------------------ parts */
.grid { display: grid; gap: 14px; }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.card h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card .big { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.card .foot { margin-top: 6px; font-size: 11.5px; color: var(--dim); }

.section { margin-top: 26px; }
.section__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section__head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section__head .spacer { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted);
}
.chip--live { color: #d8ffa1; border-color: rgba(200,255,77,.35); background: rgba(200,255,77,.08); }
.chip--stub { color: var(--amber); border-color: rgba(255,196,83,.35); background: rgba(255,196,83,.08); }
.chip--role { color: var(--violet-soft); border-color: rgba(166,149,255,.35); }
.chip--ok { color: #d8ffa1; border-color: rgba(200,255,77,.35); }
.chip--bad { color: #ffd7db; border-color: rgba(255,105,120,.4); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .8px; color: var(--dim);
  font-weight: 700; padding: 0 12px 9px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 11px 12px; border-bottom: 1px solid rgba(30,39,80,.5); vertical-align: middle; }
tbody tr:hover { background: rgba(17,26,63,.5); }
.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.empty { padding: 34px 18px; text-align: center; color: var(--dim); font-size: 13px; line-height: 1.6; }
.empty strong { display: block; color: var(--muted); margin-bottom: 5px; font-size: 14px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 220px; }

.notice {
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  padding: 18px; color: var(--muted); font-size: 13px; line-height: 1.6;
}
.notice strong { color: var(--ink); }

dialog {
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  border-radius: 14px; padding: 22px; width: min(440px, 92vw);
}
dialog::backdrop { background: rgba(5,7,17,.72); }
dialog h3 { margin: 0 0 14px; font-size: 15px; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.rolepick { display: flex; flex-wrap: wrap; gap: 8px; }
.rolepick label {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 12px;
  cursor: pointer; color: var(--muted); font-size: 12px;
}
.rolepick input { width: auto; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail nav { display: flex; flex-wrap: wrap; }
}

/* ------------------------------------------------------- utility classes
 *
 * These exist because the console runs under `style-src 'self'` with no
 * `unsafe-inline`. A `style="…"` attribute is blocked by that policy, and the
 * right answer is to name the intent here rather than weaken the policy — the
 * one directive that stops an injected string from restyling the page into a
 * convincing fake. */
.t-good { color: var(--lime); }
.t-bad { color: var(--coral); }
.t-muted { color: var(--muted); }
.t-dim { color: var(--dim); }
.t-right { text-align: right; }
.t-break { word-break: break-all; margin-top: 8px; }
.t-note { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0 0 14px; }
.t-needs { margin-top: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.gate__hint {
  margin: 16px 0 0; color: var(--dim); font-size: 11.5px; line-height: 1.6;
}
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
