:root {
  --bg: #0d0e12;
  --panel: #16181f;
  --panel-2: #1d2029;
  --line: #2a2e3a;
  --text: #eceef3;
  --muted: #9097a8;
  --faint: #626a7d;
  --accent: #ff3b5c;
  --accent-ink: #fff;
  --ok: #3ecf8e;
  --warn: #f5b83d;
  --bad: #ff5a5f;
  --unknown: #626a7d;
  --radius: 12px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- chrome -- */
.top {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.top .spacer { flex: 1; }
.top .who { color: var(--muted); font-size: 14px; }

.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.brand .pill {
  position: relative; display: inline-block; padding: 2px 8px 1px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; letter-spacing: .08em;
}
.brand .pill::after { /* the strike that makes it NOT live */
  content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 2px;
  background: var(--text); transform: rotate(-8deg);
}
.brand .not { font-size: 18px; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .02em; }
.card h2 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }

input[type=text], input[type=password], select {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label.field { display: block; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }

.copy {
  display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.copy code {
  flex: 1; min-width: 0; padding: 8px 10px; background: var(--bg); font-family: var(--mono); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy code.secret:not(.shown) { filter: blur(5px); user-select: none; }
.copy button { border: 0; border-left: 1px solid var(--line); background: var(--panel-2); padding: 0 12px; cursor: pointer; font-size: 13px; }
.copy button:hover { color: var(--accent); }

.err { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px;
  font-size: 14px; z-index: 50; transition: opacity .2s;
}

.state {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; background: var(--panel-2); color: var(--muted);
}
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.state.on { color: var(--text); }
.state.on::before { background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 59, 92, .25); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 59, 92, 0); } }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------------------ home -- */
.hero { max-width: 460px; margin: 40px auto 0; }
.hero h1 { font-size: 34px; line-height: 1.1; margin: 0 0 10px; letter-spacing: -.01em; }
.hero p { color: var(--muted); margin: 0 0 24px; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.key-card { display: block; text-decoration: none; }
.key-card:hover { border-color: var(--faint); }
.key-card .row { justify-content: space-between; }
.key-card h3 { margin: 0; font-size: 16px; }

/* ---------------------------------------------------------- stream page -- */
.stream-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .stream-grid { grid-template-columns: minmax(0, 1fr); } }

.stage { background: #07080b; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.stage-body { display: flex; justify-content: center; align-items: center; padding: 20px; min-height: 480px; }

.seeyou { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.seeyou div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.seeyou b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.seeyou span { font-size: 12px; color: var(--muted); }
.seeyou-head { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.seeyou-head .dim { color: var(--muted); font-weight: 400; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.checks li:first-child { border-top: 0; }
.checks .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); transform: translateY(1px); }
.checks .ok .dot { background: var(--ok); }
.checks .warn .dot { background: var(--warn); }
.checks .bad .dot { background: var(--bad); }
.checks .val { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.checks .fix { grid-column: 2 / 4; font-size: 13px; color: var(--muted); }
.checks .bad .fix { color: #ffb4b6; }
.checks .warn .fix { color: #f8d997; }

.meter { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; position: relative; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--ok), var(--warn) 75%, var(--bad)); transition: width .25s; }
canvas.spark { width: 100%; height: 56px; display: block; }

.shares { list-style: none; margin: 10px 0 0; padding: 0; }
.shares li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.shares li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.replay video { width: 100%; border-radius: 8px; background: #000; margin-top: 10px; max-height: 420px; }

.obs-tips { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.obs-tips b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------ watch page -- */
body.watch { min-height: 100vh; display: flex; flex-direction: column; }
body.watch main { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 16px; width: 100%; }
.watch-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }

@media (max-width: 600px) {
  .top { padding: 12px 16px; }
  main { padding: 16px 16px 48px; }
  .stage-body { padding: 10px; min-height: 0; }
  .seeyou b { font-size: 17px; }
}
