:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --accent: #53fc18;
  --accent-text: #0b0d10;
  --danger: #ff5c5c;
  --warn: #ffb547;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Classes like .login set display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
}
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

button { cursor: pointer; background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); font-weight: 500; }
button.link { background: none; border: none; padding: 0; color: var(--muted); font-weight: 400; text-decoration: underline; }

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.small { font-size: 12px; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.topbar nav button.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }
main > section { display: flex; flex-direction: column; gap: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--muted); font-size: 12px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 180px; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }

.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--panel-2); }
td.num { font-variant-numeric: tabular-nums; }
/* Let long messages wrap instead of widening the table. */
td.message { white-space: pre-wrap; word-break: break-word; min-width: 240px; width: 100%; }

.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.pill.off { color: var(--danger); }

.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.detail-head a { color: var(--text); font-size: 18px; font-weight: 700; text-decoration: none; }
.detail-head a:hover { color: var(--accent); }
.detail-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { color: var(--muted); padding: 12px 14px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--panel-2);
  display: inline-flex; align-items: center; gap: 4px;
}

/* Snipe: watched chats, and the chatters who fit their streamer's leaderboard. */
.snipe-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.snipe-head .tiles { flex: 1; min-width: 0; }
.snipe-status { font-size: 12px; max-width: 420px; text-align: right; }
.snipe-status.error { color: var(--danger); }
#snipe-detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
label.check input { padding: 0; }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.live-now { color: var(--danger); }
.only { color: var(--accent); font-weight: 600; }
.lb-name { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
button.link.lb-name { color: var(--text); text-decoration: none; text-align: left; }
button.link.lb-name:hover { color: var(--accent); }
.chip.match.high { color: var(--accent); border-color: #53fc1855; }
.chip.match.medium { color: var(--warn); border-color: #ffb54755; }
.said { margin-top: 4px; }
.lb-entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; }
.lb-entries li { display: grid; grid-template-columns: 40px auto 1fr auto; gap: 8px; align-items: baseline; }
.lb-entries .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtabs { display: flex; gap: 4px; }
.subtabs button { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.subtabs button.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }
#snipe-older { align-self: center; }

@media (max-width: 900px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .split { grid-template-columns: 1fr; }
  #snipe-detail { position: static; max-height: none; }
}
