:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e3e5e9;
  --border-hover: #cbd0d8;
  --text: #1a1d23;
  --text-dim: #62697a;
  --text-faint: #9198a6;
  --accent: #0d9488;
  --accent-2: #4f6df5;
  --accent-soft: #0d94881a;
  --danger: #d1453f;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --border: #262a33;
    --border-hover: #383e4a;
    --text: #e8eaed;
    --text-dim: #9aa1b0;
    --text-faint: #666e7e;
    --accent: #2dd4bf;
    --accent-2: #7c9cff;
    --accent-soft: #2dd4bf22;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --border: #262a33;
  --border-hover: #383e4a;
  --text: #e8eaed;
  --text-dim: #9aa1b0;
  --text-faint: #666e7e;
  --accent: #2dd4bf;
  --accent-2: #7c9cff;
  --accent-soft: #2dd4bf22;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); color: var(--text); }

body {
  font-family: var(--sans);
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  line-height: 1.5;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
}
.top-right { display: flex; align-items: center; gap: 0.6rem; }

.brand {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}
.brand .dot { color: var(--accent); }

.theme-toggle {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--border-hover); }

h1 {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
}
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 0.75rem; }
h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 650;
  margin: 0 0 0.85rem;
}

.tagline { color: var(--text-dim); margin: 0 0 2rem; }
.hint { color: var(--text-faint); font-size: 0.82rem; margin: 0.15rem 0 0.6rem; }
a.hint { display: inline-block; text-decoration: none; }
a.hint:hover { color: var(--text-dim); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

form { display: flex; flex-direction: column; gap: 0.9rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--text-dim); }

input, select, textarea, button {
  font: inherit;
  font-family: var(--sans);
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input[readonly] { color: var(--text-dim); background: var(--surface); }
select { cursor: pointer; }

button { cursor: pointer; font-weight: 600; }
button:hover { border-color: var(--border-hover); }

button[type="submit"], .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button[type="submit"]:hover { filter: brightness(1.06); }
#done-button { display: block; width: 100%; margin-bottom: 0.75rem; }

.row { display: flex; gap: 0.5rem; }
.row input[readonly] { flex: 1; font-family: var(--mono); font-size: 0.82rem; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.room-code {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
}

.status-line {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.status-line .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.status-line.joined .pulse { background: var(--text-faint); }

ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
ul.plain li {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 0.35rem 0.55rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.list-row .btn-small { padding: 0.3rem 0.55rem; font-size: 0.78rem; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { border-color: var(--danger); }

details.task-row {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.35rem 0.55rem;
}
details.task-row summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
details.task-row summary::-webkit-details-marker { display: none; }
details.task-row .task-body {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  color: var(--text);
}
.status-tag { color: var(--text-faint); font-size: 0.75rem; }

.empty { color: var(--text-faint); font-size: 0.82rem; }

.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

footer.foot {
  margin-top: 2.5rem;
  color: var(--text-faint);
  font-size: 0.75rem;
  text-align: center;
}

a { color: var(--accent-2); }
