:root {
  --bg: #f6f3f7;
  --surface: #ffffff;
  --surface-2: #f0ebf3;
  --ink: #1d1622;
  --ink-soft: #6c6075;
  --line: #e2d9e8;
  --accent: #b0367a;
  --accent-ink: #ffffff;
  --accent-soft: #f7dfec;
  --ok: #1f8a5b;
  --warn: #b26a00;
  --danger: #c62828;
  --danger-ink: #ffffff;
  --shadow: 0 1px 2px rgba(29, 22, 34, 0.06), 0 6px 24px rgba(29, 22, 34, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141016;
    --surface: #1e1822;
    --surface-2: #29212e;
    --ink: #f3edf6;
    --ink-soft: #a898b2;
    --line: #362c3c;
    --accent: #e0609f;
    --accent-ink: #1a0d14;
    --accent-soft: #3a1f2e;
    --ok: #4cc38a;
    --warn: #f0a640;
    --danger: #ef5350;
    --danger-ink: #1a0b0b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141016;
  --surface: #1e1822;
  --surface-2: #29212e;
  --ink: #f3edf6;
  --ink-soft: #a898b2;
  --line: #362c3c;
  --accent: #e0609f;
  --accent-ink: #1a0d14;
  --accent-soft: #3a1f2e;
  --ok: #4cc38a;
  --warn: #f0a640;
  --danger: #ef5350;
  --danger-ink: #1a0b0b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 640px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 0 0 12px; }
.lede { color: var(--ink-soft); margin-bottom: 20px; }
a { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.small { font-size: 13px; }
.hidden { display: none !important; }

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 46px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.danger { background: var(--danger); color: var(--danger-ink); border-color: transparent; }
button.block, .btn.block { width: 100%; }
button.big { min-height: 64px; font-size: 20px; border-radius: 16px; }
button.chip { min-height: 38px; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.choices { display: grid; gap: 12px; }
.choice { text-align: left; display: block; padding: 18px; }
.choice strong { display: block; font-size: 18px; margin-bottom: 4px; }
.choice span { color: var(--ink-soft); font-weight: 400; font-size: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }

.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; }
input[type="text"] {
  font: inherit;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.slider { display: grid; grid-template-columns: 92px 1fr 48px; gap: 10px; align-items: center; margin: 10px 0; }
.slider label { font-size: 14px; font-weight: 600; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-soft); }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.meter { background: var(--surface-2); border-radius: 10px; height: 64px; position: relative; overflow: hidden; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); transition: height 0.12s linear; height: 0; }
.meter b { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-size: 12px; z-index: 1; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.toggle:first-of-type { border-top: 0; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

.log { font: 12px/1.5 ui-monospace, Consolas, monospace; color: var(--ink-soft); max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.chatlog { max-height: 200px; overflow: auto; font-size: 14px; }
.chatlog div { padding: 4px 0; }
.chatlog b { color: var(--accent); }

.banner { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; margin-bottom: 14px; }
.banner.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); }

.stopbar { position: sticky; bottom: 12px; z-index: 5; }
