:root {
  --bg: #0b0b0c;
  --panel: #161618;
  --panel-2: #1f1f22;
  --line: #2c2c30;
  --text: #f3f3f4;
  --muted: #9a9aa2;
  --accent: #d7262e;
  --accent-2: #ff4a52;
  --ok: #2fbf71;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0 0 .5rem; letter-spacing: .01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem;
  background: rgba(11,11,12,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.brand span { color: var(--accent); }
.spacer { flex: 1; }

main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 6rem; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr);
  background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  padding: .7rem .25rem; text-align: center; text-decoration: none;
  color: var(--muted); font-size: .8rem; font-weight: 600;
}
.tabs a.active { color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .85rem;
}
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: .75rem; }
.pill {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: .75rem; color: var(--muted);
}
.pill.red { color: #fff; background: var(--accent); border-color: var(--accent); }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1rem; font: inherit; font-weight: 700; cursor: pointer;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button.danger { color: var(--accent-2); }
button.icon { padding: .45rem .6rem; }
button:disabled { opacity: .5; cursor: default; }
.full { width: 100%; }

.auth { max-width: 420px; margin: 8vh auto; padding: 1rem; }
.auth .logo { font-size: 2rem; font-weight: 900; text-transform: uppercase; margin-bottom: .25rem; }
.auth .logo span { color: var(--accent); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: .65rem 1rem; border-radius: 10px; z-index: 50; max-width: 90vw;
}
.toast.error { border-color: var(--accent); }

dialog {
  width: min(560px, 94vw); max-height: 90vh; padding: 0;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
}
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog form { padding: 1rem; }
dialog .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* Practice timer */
.timer {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column; padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
}
.timer .now { text-align: center; margin-top: 2vh; }
.timer .seg-title { font-size: clamp(1.6rem, 6vw, 3rem); font-weight: 900; text-transform: uppercase; }
.timer .clock {
  font-variant-numeric: tabular-nums; font-weight: 900; line-height: 1;
  font-size: clamp(5rem, 28vw, 15rem); text-align: center; margin: 2vh 0;
}
.timer .clock.warn { color: var(--accent-2); }
.timer .cues { text-align: center; color: var(--muted); font-size: 1.1rem; }
.timer .next { text-align: center; color: var(--muted); margin-top: auto; }
.timer .controls { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: .6rem; margin-top: 1rem; }
.timer .controls button { padding: 1.1rem; font-size: 1.1rem; }
.timer .bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.timer .bar > div { height: 100%; background: var(--accent); }
