/* AoA Server Panel - mobile first, no external assets. */
:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181d; --muted: #5e6572; --line: #e2e5ea;
  --accent: #2b59c3; --accent-text: #ffffff;
  --ok: #1f8a4c; --ok-bg: #e5f5eb; --warn: #a96500; --warn-bg: #fff3dc;
  --bad: #c0392b; --bad-bg: #fde8e6; --busy: #2b59c3; --busy-bg: #e6edfb; --off: #5e6572; --off-bg: #eceef1;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --card: #1a1d23; --text: #e7e9ee; --muted: #9aa1ad; --line: #2c3039;
    --accent: #6d93ec; --accent-text: #0d1220;
    --ok: #4cc27d; --ok-bg: #16301f; --warn: #f0b04a; --warn-bg: #352812;
    --bad: #f07466; --bad-bg: #3a1a17; --busy: #7fa3f2; --busy-bg: #1a2640; --off: #9aa1ad; --off-bg: #23262d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { padding: 12px; max-width: 960px; margin: 0 auto; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
code { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
small { color: var(--muted); }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px 12px 32px; }

.devbar { background: #7b2cbf; color: #fff; text-align: center; font-size: .8rem; padding: 2px 8px; }

/* Sticky status header */
.statusbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--card); border-bottom: 3px solid var(--line); flex-wrap: wrap; }
.statusbar .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.statusbar .meta { color: var(--muted); font-size: .9rem; }
.statusbar.st-ok { border-bottom-color: var(--ok); }
.statusbar.st-bad { border-bottom-color: var(--bad); }
.statusbar.st-busy { border-bottom-color: var(--busy); }
.statusbar.st-off { border-bottom-color: var(--off); }

.nav { display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px; background: var(--card);
  border-bottom: 1px solid var(--line); scrollbar-width: none; }
.nav a { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a.on { background: var(--busy-bg); color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.grid2 { display: grid; gap: 12px; margin-bottom: 12px; }
.grid2 .card { margin: 0; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } main { padding: 20px; } }

.hero { text-align: center; border-width: 2px; }
.hero .big-state { font-size: 2rem; font-weight: 800; letter-spacing: .02em; }
.hero .facts { display: flex; justify-content: center; gap: 28px; margin: 8px 0; flex-wrap: wrap; }
.hero .facts div { display: flex; flex-direction: column; }
.num { font-size: 1.5rem; font-weight: 700; }
.st-ok.hero, .st-ok.half { border-color: var(--ok); }
.st-ok .big-state { color: var(--ok); }
.st-bad.hero, .st-bad.half { border-color: var(--bad); }
.st-bad .big-state { color: var(--bad); }
.st-busy.hero, .st-busy.half { border-color: var(--busy); }
.st-busy .big-state { color: var(--busy); }
.st-off .big-state { color: var(--off); }
.reason { margin: .25rem 0; color: var(--warn); font-size: .95rem; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--off-bg); color: var(--off); vertical-align: middle; }
.pill.ok, .st-ok .pill { background: var(--ok-bg); color: var(--ok); }
.pill.bad, .st-bad .pill { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.busy, .st-busy .pill { background: var(--busy-bg); color: var(--busy); }
.ok-text { color: var(--ok); font-weight: 600; }

/* Buttons and forms: large touch targets */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger, .button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.caution, .button.caution { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
h3:first-of-type { margin-top: 4px; }
.button.on { outline: 3px solid var(--accent); }
.big { width: 100%; min-height: 52px; font-size: 1.05rem; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font-weight: 400; text-decoration: underline; }
form.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; font-weight: 400; min-height: 44px; }
input, select { font: inherit; padding: 10px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); width: 100%; }
input[type=checkbox] { width: 22px; min-height: 22px; }
.filter input[name=q] { flex: 1 1 180px; width: auto; }
.actions { display: grid; gap: 10px; }
.actions { grid-template-columns: 1fr 1fr; }
.actions .button.big { font-size: .98rem; }
.levels { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.flash { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 10px; }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.files, .list, .audit { list-style: none; padding: 0; margin: 0; }
.files li, .list li, .audit li { padding: 10px 0; border-bottom: 1px solid var(--line); position: relative; overflow-wrap: anywhere; }
.files li { padding-right: 52px; display: flex; flex-direction: column; }
.files .dl { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 1.2rem; }
.audit li.r-denied, .audit li.r-error, .audit li.r-failed { border-left: 3px solid var(--bad); padding-left: 8px; }

.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.stale td { color: var(--bad); }

pre.log { font-family: var(--mono); font-size: 12px; line-height: 1.4; background: #0d0f13; color: #d6dae2;
  padding: 10px; border-radius: var(--radius); overflow-x: auto; white-space: pre; max-height: 75vh; overflow-y: auto; margin: 0 0 12px; }
pre.log .l-err { color: #ff8a7a; }
pre.log .l-warn { color: #f5c26b; }
pre.log .l-dbg { color: #8b93a3; }
pre.log .sys { color: #7fa3f2; font-style: italic; }
.filename { overflow-wrap: anywhere; font-family: var(--mono); font-size: 1.05rem; }

.narrative { padding-left: 1.2rem; }
.narrative li { margin: 4px 0; }
.narrative time { color: var(--muted); font-family: var(--mono); font-size: .85rem; }
.narrative .k-ok { color: var(--ok); }
.narrative .k-warn { color: var(--warn); }
.narrative .k-error { color: var(--bad); }
.confirm .players { font-size: 1.1rem; }
.confirm .players.warn .num { color: var(--warn); }

.qr-wrap { background: #fff; padding: 10px; border-radius: var(--radius); max-width: 260px; margin: 8px auto; }
.qr-wrap svg { display: block; width: 100%; height: auto; }
.secret code { font-size: 1rem; letter-spacing: .05em; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0; list-style: none; }
.codes code { display: block; padding: 6px; background: var(--bg); border-radius: 8px; text-align: center; }
.steps { padding-left: 1.2rem; }
.busy-card { border-color: var(--busy); background: var(--busy-bg); }
