/* lram-mc dashboard. Graphite ramp, one accent (Sunrise Orange, palette black-grey-orange). 4px grid. */
:root {
  color-scheme: dark;
  --deep: #0f0f10;
  --bg: #141415;
  --card: #19191b;
  --raised: #232325;
  --line: rgba(237, 237, 237, 0.08);
  --line-strong: rgba(237, 237, 237, 0.14);
  --text: #ededed;
  --text-2: #a1a1a6;
  --muted: #85858b;
  --accent: #f74b01;
  --accent-hover: #ff6420;
  --on-accent: #060507;
  --good: #4cc38a;
  --bad: #e5484d;
  --warn: #e5a84d;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 15px/22px var(--sans);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--text); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 28px; line-height: 32px; font-weight: 500; margin: 0 0 24px; }
h2 { font-size: 15px; line-height: 20px; font-weight: 500; margin: 0 0 16px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
pre { font: 12px/18px var(--mono); background: var(--deep); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
pre.crash { max-height: 70vh; }
.muted, .meta { color: var(--muted); }
.meta { font-size: 13px; line-height: 20px; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; }

/* ---------- shell ---------- */
.top { background: var(--deep); border-bottom: 1px solid var(--line); padding: 12px 16px 0; position: sticky; top: 0; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; text-decoration: none; height: 32px; }
.top nav ul { list-style: none; margin: 8px -16px 0; padding: 0 16px 8px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.top nav a { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; color: var(--text-2); text-decoration: none; white-space: nowrap; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.top nav a:hover { background: var(--card); color: var(--text); }
.top nav a[aria-current] { background: var(--raised); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.count { font: 12px/16px var(--mono); color: var(--on-accent); background: var(--accent); border-radius: 8px; padding: 0 6px; }
.who { display: none; color: var(--muted); font-size: 12px; margin: 0; }
main { padding: 24px 16px 64px; max-width: 1280px; }

@media (min-width: 960px) {
  body.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
  .top { position: sticky; top: 0; height: 100vh; padding: 20px 12px; border-bottom: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
  .brand { padding: 0 8px; }
  .top nav ul { flex-direction: column; margin: 24px 0 0; padding: 0; gap: 2px; overflow: visible; }
  .top nav a { height: 34px; }
  .who { display: block; margin-top: auto; padding: 0 8px; overflow-wrap: anywhere; }
  main { padding: 32px; }
}

/* ---------- blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; min-width: 0; }
.card.narrow { max-width: 560px; }
.cols { display: grid; gap: 16px; }
.cols > .card { margin-bottom: 0; }
.cols { margin-bottom: 16px; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } .cols.three { grid-template-columns: 1fr 1fr 1fr; } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.stat .label { color: var(--text-2); font-size: 13px; line-height: 20px; margin: 0 0 4px; }
.stat .figure { font-size: 24px; line-height: 32px; font-weight: 500; margin: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .figure.mono { font-size: 24px; }
.flash { background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; margin-bottom: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--bad); }

.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: none; margin-right: 8px; vertical-align: 1px; }
.stat .dot, .brand .dot { margin-right: 0; }
.dot-good { background: var(--good); box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.16); }
.dot-bad { background: var(--bad); }
.dot-warn { background: var(--warn); }
.dot-idle { background: var(--muted); }

.head { border-radius: 4px; image-rendering: pixelated; background: var(--raised); flex: none; vertical-align: middle; }
.players, .rows { list-style: none; margin: 0 0 16px; padding: 0; }
.players li, .rows li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.players li:last-child, .rows li:last-child { border-bottom: 0; }
.name { font-weight: 500; overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; }
.rows .grow p { margin: 0; }
.actions { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.players .name { flex: 1; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
dl.facts dt { color: var(--text-2); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
.card table { display: block; overflow-x: auto; }
@media (min-width: 760px) { .card table { display: table; } }
th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 13px; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
td time { white-space: nowrap; }
td.actions { display: table-cell; text-align: right; white-space: nowrap; }

/* ---------- controls ---------- */
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
form.inline.wide { display: flex; width: 100%; margin-top: 12px; flex-wrap: wrap; }
form.stack { display: grid; gap: 16px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
label { display: grid; gap: 6px; color: var(--text-2); font-size: 14px; }
form.inline label { display: block; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--raised); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 0 12px; height: 40px; width: 100%; min-width: 0;
}
textarea { height: auto; padding: 8px 12px; resize: vertical; }
input::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 8px;
  font: 500 14px/1 var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-strong);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: #2b2b2e; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: #ff8589; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
@media (min-width: 960px) { input, select { height: 36px; font-size: 14px; } .btn { height: 36px; } }

details.restore { display: inline-block; text-align: left; }
details.restore summary { list-style: none; }
details.restore summary::-webkit-details-marker { display: none; }
details.restore[open] form { position: absolute; right: 16px; left: 16px; margin-top: 8px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 12px; padding: 16px; z-index: 3; white-space: normal; }
@media (min-width: 760px) { details.restore[open] form { left: auto; width: 360px; } }
.card:has(details.restore) { position: relative; }

.tabs { display: flex; gap: 4px; margin: -8px 0 16px; }
.tabs a { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 8px; color: var(--text-2); text-decoration: none; font-family: var(--mono); font-size: 13px; }
.tabs a[aria-current] { background: var(--raised); color: var(--text); }

/* ---------- chat ---------- */
.chatlog { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; }
.chatlog li { padding: 4px 0; overflow-wrap: anywhere; }
.chatlog b { font-weight: 500; }
.chatlog .k-event, .chatlog .k-say { color: var(--text-2); }
.chatlog .k-web b { color: var(--accent); }
.out { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.out p { margin-bottom: 8px; }

/* ---------- charts ---------- */
.chart { position: relative; margin: 0; }
.chart svg { display: block; width: 100%; height: 160px; overflow: visible; }
.chart-main svg { height: 260px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .axis { position: absolute; color: var(--muted); font: 11px/16px var(--mono); pointer-events: none; }
.chart .axis.y { left: 0; transform: translateY(-100%); }
.chart .axis.y0 { top: 90%; }
.chart .axis.y1 { top: 47.5%; }
.chart .axis.y2 { top: 5%; transform: none; }
.chart .axis.x { bottom: 0; }
.chart .axis.x1 { right: 0; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-quiet { stroke: var(--text-2); }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 8px; font: 12px/16px var(--mono); white-space: nowrap; transform: translateX(-50%); }

/* ---------- public site ---------- */
body.public main { max-width: 720px; margin: 0 auto; }
.pub-top { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto; padding: 16px; }
.pub-hero { padding: 24px 0 8px; }
.pub-hero h1 { margin-bottom: 8px; }
.state { display: flex; align-items: center; gap: 8px; font-size: 18px; flex-wrap: wrap; }
.state .dot { margin-right: 0; }
.address { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.address code { font-size: 20px; color: var(--text); }
.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; }
.quiet { color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
