:root {
  color-scheme: dark;
  --bg: #1d1d1d;
  --card: #131313;
  --panel: #0b0b0b;
  --raised: #171717;
  --line: #262626;
  --line-2: #333;
  --text: #f4f4f4;
  --muted: #8c8c8c;
  --faint: #5f5f5f;
  --accent: #8f83f7;
  --danger: #f2706a;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.shell { max-width: 780px; margin: 0 auto; padding: 40px 16px; }
.card { background: var(--card); border: 1px solid #222; border-radius: 32px; padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }

/* header */
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.icon { width: 40px; height: 40px; border-radius: 50%; background: #262626; display: grid; place-items: center; flex: none; }
.title { font-weight: 600; font-size: 17px; }
.sub, .muted, .meta, .label, .note { color: var(--muted); }
.faint { color: var(--faint); }
.tabs { margin-left: auto; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); }
.tabs a, .tab-btn { padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.tabs a.on { color: var(--text); background: #262626; }
.tabs a:hover, .tab-btn:hover { color: var(--text); }
.tabs form { margin: 0; }
.tabs.inline { display: inline-flex; margin: 24px 0 12px; }

/* panels and numbers */
h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 28px 4px 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.hero { display: flex; gap: 32px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }
.label { font-size: 13px; }
.big { font-size: 28px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.big .muted { font-weight: 400; }
.bar { height: 6px; border-radius: 99px; background: #2a2a2a; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.note { margin: 0 4px 10px; font-size: 14px; }

/* rows */
.list { border: 1px solid var(--line); border-radius: 22px; padding: 2px 18px; background: var(--raised); }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; color: inherit; text-decoration: none; flex-wrap: wrap; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 46px; right: 0; border-top: 1px solid var(--line); }
a.row:hover .name { color: var(--accent); }
.row form { margin: 0; }
.dot {
  --h: 250;
  min-width: 32px; height: 32px; padding: 0 8px; flex: none;
  border-radius: 999px; display: grid; place-items: center;
  font: 600 12px/1 var(--mono); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  background: linear-gradient(135deg, hsl(var(--h) 75% 68%), hsl(calc(var(--h) + 35) 70% 50%));
}
.dot.lg { min-width: 44px; height: 44px; font-size: 14px; }
.row-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.name { font-weight: 500; font-size: 16px; }
.state { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.state .done { color: var(--text); }
.state .when { color: var(--faint); }
.check circle { fill: var(--accent); }
.check path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ring circle { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.actions { display: flex; gap: 8px; align-items: center; }
.row details { order: 10; }
.row details[open] { flex-basis: 100%; }
details summary { list-style: none; display: inline-flex; }
details summary::-webkit-details-marker { display: none; }
details code { display: block; margin-top: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
code { font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--text); }
.new-key code { display: block; margin: 8px 0; }
.empty { color: var(--muted); text-align: center; padding: 20px 0; margin: 0; }

/* buttons */
button, .pill, .primary { font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; }
.pill { padding: 8px 16px; background: #1d1d1d; color: var(--text); border: 1px solid var(--line-2); }
.pill:hover { background: #282828; }
.pill.danger { color: var(--danger); }
.primary { padding: 12px 22px; border: 0; color: #111; font-weight: 600; background: linear-gradient(#fff, #d4d4d4); box-shadow: inset 0 1px 0 #fff, 0 6px 20px rgba(0, 0, 0, .4); }
.primary:hover { background: #fff; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* forms */
label { display: block; margin: 16px 0 0; color: var(--muted); font-size: 13px; }
input:not([type=checkbox]), textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
.inline-form { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 12px; padding: 16px 20px 20px; }
.inline-form label { margin: 0; }
.check-label { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; }
.error { color: var(--danger); }
.status { color: var(--muted); min-height: 1.5em; margin: 12px 4px; }

/* footer, pager, step-through */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding: 4px 4px 0; }
.foot-left { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.foot form { margin: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--muted); }
.step-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 4px 12px; }
.step-head + .bar { margin: 0 4px 16px; }
.player-panel { padding: 18px; }

/* recorder */
.rec-wrap { display: flex; align-items: center; gap: 18px; }
.rec { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line-2); background: #1a1a1a; display: grid; place-items: center; padding: 0; }
.rec-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--danger); transition: border-radius .2s, width .2s, height .2s; }
.rec.on .rec-dot { width: 22px; height: 22px; border-radius: 6px; }
.rec.on { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(242, 112, 106, .18); } 50% { box-shadow: 0 0 0 12px rgba(242, 112, 106, .05); } }
.take { margin-top: 16px; }

/* waveform player */
.player { display: flex; align-items: center; gap: 14px; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--text); color: #111; display: grid; place-items: center; flex: none; padding: 0; }
.player canvas { flex: 1; height: 56px; min-width: 0; cursor: pointer; border-radius: 6px; --wave: #3a3a3a; --wave-played: #8f83f7; }
.player .time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.player audio { width: 100%; }

@media (max-width: 560px) {
  .shell { padding: 12px 8px; }
  .card { padding: 14px; border-radius: 24px; }
  .head .tabs { margin-left: 0; width: 100%; justify-content: space-between; overflow-x: auto; }
  .tabs a, .tab-btn { padding: 6px 10px; font-size: 14px; }
  .state .when { display: none; }
  .big { font-size: 22px; }
  .hero { gap: 20px; }
  .list { padding: 2px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .rec.on { animation: none; box-shadow: 0 0 0 4px rgba(242, 112, 106, .18); }
  .rec-dot { transition: none; }
}
