/* Charcoal and near-black, white text, one green accent. */
:root {
  --bg: #121212;
  --sidebar: #090909;
  --panel: #181818;
  --surface: #181d19;
  --stage: #161c17;
  --text: #f5f5f2;
  --muted: #b5b8b6;
  --line: #2c302c;
  --grid: #354539;
  --accent: #1ed760;
  --ink: #07190c;
  --label: #63cb7d;
  --voice: #f0d888;
  --warn: #f0b36a;
  --bad: #ff8a80;
  color-scheme: dark;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: 0; background: none; transition: background .16s, color .16s, transform .16s; }
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
main:focus, h1:focus { outline: none; }
svg.icon {
  width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
p { line-height: 1.6; margin: 0 0 16px; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.03em; }
h1 { font-size: 36px; line-height: 1.2; }
h2 { font-size: 24px; margin-bottom: 12px; }
small { display: block; font-size: 12px; line-height: 1.6; color: var(--muted); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 20px; top: -100px; z-index: 20; background: var(--accent); color: var(--ink); padding: 12px; }
.skip:focus { top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.empty { padding: 40px 12px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ buttons and fields */

.primary, .secondary, .danger {
  display: inline-flex; justify-content: center; align-items: center; gap: 10px;
  min-height: 44px; padding: 11px 24px; border-radius: 30px;
  font-weight: 650; font-size: 14px; white-space: nowrap;
}
.primary { background: var(--accent); color: var(--ink); }
.primary:hover:not(:disabled) { background: #3be879; }
.secondary { border: 1px solid #88938a; }
.secondary:hover:not(:disabled) { background: #2d332e; border-color: var(--text); }
.danger { background: #e86767; color: #230808; }
.danger:hover:not(:disabled) { background: #f07c7c; }
.plain { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 8px 0; font-size: 14px; }
.plain:hover { color: var(--text); }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #c4ccc5; }
.icon-button:hover { background: #303730; }

label { display: block; font-size: 14px; color: #d3dbd5; margin: 0 0 14px; }
label.check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
label.check input { margin-top: 4px; accent-color: var(--accent); }
input[type=text], select {
  display: block; width: 100%; margin-top: 8px; padding: 11px 12px;
  background: #252d27; border: 1px solid #7c8e81; border-radius: 6px;
}
.notice { padding: 12px 16px; border-radius: 7px; background: #29352c; font-size: 14px; margin: 14px 0; }
.notice.warn { background: #3a2f1f; color: #ffe1b8; }
.notice.bad { background: #3d2020; color: #ffd6d2; }

/* ------------------------------------------------------------ shell */

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.sidebar { grid-column: 1; grid-row: 1; background: var(--sidebar); padding: 34px 16px 18px; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 46px; font-size: 21px; font-weight: 750; letter-spacing: -1px; white-space: nowrap; }
.brand small { font-size: 12px; letter-spacing: 0; font-weight: 400; margin-top: 2px; }
.brand-two { color: var(--accent); }
.brand-wave { display: flex; gap: 3px; align-items: center; height: 36px; }
.brand-wave i { display: block; width: 3px; height: 14px; border-radius: 3px; background: var(--accent); }
.brand-wave i:nth-child(2), .brand-wave i:nth-child(4) { height: 25px; }
.brand-wave i:nth-child(3) { height: 36px; }
nav { display: grid; gap: 6px; }
nav button {
  position: relative; display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 13px 16px; border-radius: 6px; text-align: left;
  color: var(--muted); font-weight: 600; font-size: 14px;
}
nav button:hover { color: var(--text); background: #181818; }
nav button[aria-current=page] { background: #242424; color: var(--text); }
nav button[aria-current=page]::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.sidebar-bottom { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid #282a28; }
.profile { display: flex; gap: 11px; align-items: center; font-size: 14px; margin-bottom: 8px; min-width: 0; }
.profile > div { min-width: 0; }
.profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: #29352d; color: #c2d4c7; font-weight: 600; }

.workspace { grid-column: 2; grid-row: 1; min-width: 0; overflow-y: auto; }
.topbar {
  position: sticky; top: 0; z-index: 3; height: 72px; padding: 0 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg); border-bottom: 1px solid #252725;
}
.breadcrumb { font-size: 14px; color: #c2c5c2; }
.breadcrumb span { color: #777e78; margin: 0 10px; }
.session-ok, .session-link { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.session-ok svg { color: var(--accent); width: 17px; }
.session-link { padding: 8px 16px; border-radius: 20px; border: 1px solid #88938a; }
.session-link:hover { border-color: var(--text); background: #2d332e; }

.player {
  grid-column: 1 / -1; grid-row: 2; z-index: 4;
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 270px; gap: 24px; align-items: center;
  padding: 16px 24px; background: #0d0f0d; border-top: 1px solid #3a3f3a;
}
.player-song { display: flex; align-items: center; gap: 13px; min-width: 0; }
.player-song strong { font-size: 14px; }
.transport { display: flex; align-items: center; gap: 13px; min-width: 0; }
.play-button { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: #f4f6f1; color: #111b13; }
.play-button:hover:not(:disabled) { background: var(--accent); }
.play-button svg { width: 18px; height: 18px; }
.transport-label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.time { font-size: 12px; font-variant-numeric: tabular-nums; color: #c2cbc3; }
.transport input { width: 100%; min-width: 40px; accent-color: var(--accent); cursor: pointer; }
.player-device { display: flex; align-items: center; gap: 10px; justify-content: flex-end; font-size: 13px; min-width: 0; }
.player-device > div { min-width: 0; }
.player-device > div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busy nav, .busy .player, .busy #session-status { opacity: .4; }
.bare nav, .bare .player, .bare #session-status { display: none; }

dialog {
  width: calc(100% - 40px); max-width: 500px; padding: 36px;
  color: var(--text); background: #1d241f; border: 1px solid #637667; border-radius: 14px; box-shadow: 0 22px 80px #0009;
}
dialog::backdrop { background: #000b; }
.dialog-close { position: absolute; right: 15px; top: 15px; }
.dialog-symbol { display: block; color: var(--accent); margin-bottom: 18px; }
.dialog-symbol svg { width: 34px; height: 34px; }
.help-steps { padding-left: 20px; font-size: 14px; line-height: 1.6; }
.help-steps li { margin-bottom: 10px; }

#toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 10;
  width: max-content; max-width: min(640px, calc(100% - 40px));
  padding: 13px 22px; border-radius: 8px; background: #edf4ec; color: #17261b; font-size: 14px;
  box-shadow: 0 8px 30px #0005; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.visible { opacity: 1; }

/* ------------------------------------------------------------ covers and pages */

.cover { aspect-ratio: 1; border-radius: 5px; overflow: hidden; flex-shrink: 0; line-height: 0; }
.cover svg { width: 100%; height: 100%; display: block; }
.cover.mini { width: 44px; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 38px 40px; }
.page.narrow { max-width: 760px; }
.subtitle { margin: 10px 0 26px; color: var(--muted); font-size: 15px; }
.panel { background: var(--surface); border: 1px solid #364139; border-radius: 10px; padding: 26px; margin: 16px 0; }

/* ------------------------------------------------------------ consent */

.consent { margin: 0 0 20px; display: grid; gap: 14px; }
.consent div { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.consent dt { font-weight: 650; margin-bottom: 4px; }
.consent dd { margin: 0; color: #d0d6d1; line-height: 1.6; font-size: 14px; }

/* ------------------------------------------------------------ library */

.library-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 100%; }
.library { padding: 32px 34px 28px; min-width: 0; }
.progress-heading { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; margin-bottom: 10px; }
.progress-heading span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
progress { display: block; appearance: none; width: 100%; height: 5px; border: 0; border-radius: 5px; overflow: hidden; background: #373a37; }
progress::-webkit-progress-bar { background: #373a37; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
.library-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
.filters { display: flex; gap: 7px; }
.filter { padding: 7px 14px; border-radius: 20px; background: #252725; color: #c5c9c6; font-size: 13px; }
.filter:hover { background: #3a3d3a; }
.filter[aria-pressed=true] { background: #f0f2ef; color: #141814; }
.search { display: flex; align-items: center; gap: 8px; margin: 0; }
.search svg { width: 16px; color: var(--muted); }
.search input { width: 140px; min-width: 0; padding: 8px 0; border: 0; background: transparent; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
th:nth-child(3) { width: 140px; }
th:nth-child(4) { width: 130px; }
th { height: 36px; text-align: left; font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #b7bcb8; }
th:first-child, td:first-child { width: 34px; text-align: center; color: var(--muted); }
td { height: 68px; border-top: 1px solid #292c29; }
td.empty { text-align: center; }
tbody tr:hover { background: #1f211f; }
tbody tr.selected { background: #292c29; }
tbody tr.selected td:first-child { box-shadow: inset 3px 0 var(--accent); color: var(--accent); }
.song-button { display: flex; align-items: center; gap: 13px; width: 100%; padding: 8px; text-align: left; font-weight: 500; }
.song-button > span { min-width: 0; }
.song-button small { margin-top: 2px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-button:hover strong { color: var(--accent); }
.takes-cell { white-space: nowrap; }
.take-count { color: var(--muted); font-size: 13px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.take-slot {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 3px;
  border: 1px solid #929b94; border-radius: 50%; font-size: 11px; vertical-align: middle;
}
.take-slot svg { width: 13px; height: 13px; stroke-width: 2.5; }
.take-slot.done { background: #e5eae4; border-color: #e5eae4; color: #132017; }
.take-slot.next { border-color: var(--accent); color: var(--accent); }
.take-slot.failed { border-color: #8a5a5a; color: var(--bad); }
.status-cell { padding: 0 10px; font-size: 13px; color: #b8bfb9; white-space: nowrap; }
.privacy { display: flex; gap: 8px; align-items: center; margin: 26px 0 0; font-size: 12px; color: #a4ada6; }
.privacy svg { width: 14px; height: 14px; }

.detail { background: var(--panel); border-left: 1px solid var(--line); padding: 30px 26px; min-width: 0; }
.detail-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #bac4bc; margin-bottom: 20px; }
.detail-cover { width: 100%; max-width: 230px; margin: 0 auto 22px; }
.detail h2 { font-size: 28px; line-height: 1.15; margin-bottom: 6px; }
.take-caption { font-size: 14px; color: #c0c7c1; margin-bottom: 20px; }
.detail-instruction { padding-top: 18px; border-top: 1px solid #393e39; margin-bottom: 20px; font-size: 14px; }
.detail-instruction p { margin-bottom: 6px; }
.detail .primary, .detail .secondary { width: 100%; }
.next-hint { font-size: 12px; color: #b8c0ba; margin: 10px 0 22px; }
.take-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.take-list li { display: flex; gap: 10px; align-items: center; font-size: 13px; color: #c5cdc6; }
.take-list li.next { color: var(--text); }
.take-list small { margin-left: auto; }

.takes-grid { display: grid; gap: 8px; }
.saved-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: #1c211d; border-radius: 7px; }
.saved-row > .cover + div { flex: 1; min-width: 0; }
.saved-row.discarded { background: transparent; border: 1px solid #262b27; }
.saved-mark { display: flex; gap: 6px; align-items: center; font-size: 13px; color: #cfedd6; text-align: right; }
.discarded .saved-mark { color: var(--muted); }
.saved-mark svg { width: 17px; }

/* ------------------------------------------------------------ session */

.setup-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; margin-top: 8px; }
.setup-steps { list-style: none; padding: 0; margin: 0; display: grid; align-content: start; gap: 22px; }
.setup-steps li { display: flex; gap: 10px; align-items: center; color: #9faea2; font-size: 14px; }
.setup-steps b { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border: 1px solid #6a7b6e; border-radius: 50%; font-weight: 400; font-size: 13px; }
.setup-steps b svg { width: 15px; }
.setup-steps .done { color: #d3dbd5; }
.setup-steps .done b { border-color: var(--accent); color: var(--accent); }
.setup-steps .active { color: var(--text); font-weight: 600; }
.setup-steps .active b { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.setup-panel { max-width: 720px; padding: 30px; border: 1px solid #364139; border-radius: 10px; background: var(--surface); font-size: 14px; }
.setup-panel p, .setup-panel li { color: #d3ddd5; }
.setup-panel ul, .setup-panel ol.steps { padding-left: 20px; margin: 0 0 16px; line-height: 1.6; }
.setup-panel li { margin-bottom: 6px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 28px; padding-top: 20px; border-top: 1px solid #2f3a32; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.meter { position: relative; width: 160px; height: 14px; border-radius: 3px; overflow: hidden; background: #2b352e; }
.meter.large { width: 100%; height: 26px; margin: 20px 0 8px; }
.meter .zone { position: absolute; top: 0; bottom: 0; background: var(--accent); opacity: .22; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
.meter.hot i { background: #ff7777; }
/* Segments over the bar, as on a hardware meter */
.meter::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 7px, var(--surface) 7px 10px); }

/* ------------------------------------------------------------ take and review */

.back { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; font-size: 14px; color: #c4ccc5; }
.back:hover { color: var(--accent); }
.back svg { width: 16px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.recorder-heading { display: flex; align-items: center; gap: 20px; }
.recorder-heading .cover { width: 68px; }
.recorder-heading h1 { font-size: 32px; }
.recorder-heading p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.flow-steps { display: flex; gap: 22px; align-items: center; list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: #afb8b0; }
.flow-steps li { display: flex; gap: 7px; align-items: center; }
.flow-steps b { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #78877b; border-radius: 50%; font-weight: 400; }
.flow-steps b svg { width: 13px; }
.flow-steps .done b { border-color: var(--accent); color: var(--accent); }
.flow-steps .active { color: var(--text); }
.flow-steps .active b { background: var(--accent); border-color: var(--accent); color: var(--ink); }

.roll-wrap { margin: 0 0 20px; overflow: hidden; background: var(--stage); border: 1px solid #354238; border-radius: 8px; }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 18px; border-bottom: 1px solid #303a32; font-size: 13px; color: #c4d0c7; }
.stage { position: relative; }
canvas { display: block; width: 100%; height: 280px; background: var(--stage); }
.countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 110px; font-weight: 700; color: var(--accent); pointer-events: none;
  text-shadow: 0 0 28px var(--stage), 0 0 8px var(--stage);
}
.legend { display: flex; gap: 17px; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { display: block; width: 15px; height: 5px; border-radius: 2px; background: var(--label); }
.legend .voice i { height: 2px; background: var(--voice); }

.record-control { text-align: center; padding: 4px 0 18px; }
.timer { font-size: 36px; font-weight: 500; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.timer span { font-size: 19px; color: #a8b6aa; }
.record-message { max-width: 640px; margin: 6px auto 18px; font-size: 14px; color: #d0dad2; }
.record-message.recording { color: #ff9999; }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #ff7777; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
.record-actions { display: flex; justify-content: center; gap: 12px; }
#device-check .notice { max-width: 720px; margin: 16px auto 0; text-align: left; }
.device-strip {
  display: flex; justify-content: center; align-items: center; gap: 28px; flex-wrap: wrap;
  padding-top: 18px; border-top: 1px solid #303830; font-size: 13px; color: #c5cec7;
}
.device-strip > span { display: flex; align-items: center; gap: 8px; }
.device-strip svg { width: 17px; height: 17px; }
.device-strip .meter::after { background: repeating-linear-gradient(90deg, transparent 0 7px, var(--bg) 7px 10px); }

.review-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 15px 20px; border-radius: 7px; font-size: 14px;
  background: #1d2b21; border: 1px solid #456c4c;
}
.review-summary strong { display: flex; align-items: center; gap: 9px; color: #d3f3db; white-space: nowrap; }
.review-summary.warn { background: #2e2719; border-color: #7a6338; }
.review-summary.warn strong { color: #ffe1b8; }
.review-summary.bad { background: #331c1c; border-color: #8a4646; }
.review-summary.bad strong { color: #ffd6d2; }
.review-rule { margin: 18px 0; font-size: 14px; color: #d0dad2; }
.review-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.review-actions .spacer { flex: 1; }
.repeat-panel fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.repeat-panel legend { font-weight: 650; font-size: 16px; margin-bottom: 14px; }
.repeat-panel .row small { flex: 1; }

/* ------------------------------------------------------------ narrower windows (desktop only) */

@media (max-width: 1200px) {
  .app { grid-template-columns: 200px minmax(0, 1fr); }
  .brand { font-size: 17px; margin-left: 0; gap: 8px; }
  .sidebar { padding-inline: 12px; }
  .library-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .library { padding: 28px 22px; }
  .detail { padding: 26px 20px; }
  .topbar { padding: 0 22px; }
  .player { grid-template-columns: 210px minmax(0, 1fr) 200px; gap: 18px; padding: 14px 16px; }
  .transport-label, .player-device small, .take-count { display: none; }
  .page { padding: 28px 24px; }
}
@media (max-width: 1100px) {
  .library-layout { grid-template-columns: minmax(0, 1fr); }
  .detail { border-left: 0; border-top: 1px solid var(--line); }
  .detail-cover { max-width: 160px; margin-left: 0; }
}
@media (max-width: 980px) {
  .player { grid-template-columns: 180px minmax(0, 1fr); }
  .player-device, .flow-steps { display: none; }
  .setup-layout { grid-template-columns: 1fr; gap: 20px; }
  .setup-steps { grid-auto-flow: column; justify-content: start; gap: 14px; }
  .setup-steps li { font-size: 0; gap: 0; }
  .setup-steps li.active { font-size: 14px; gap: 10px; }
  .fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .primary, .take-slot.done { border: 1px solid ButtonText; }
  .cover { border: 1px solid CanvasText; }
}
