/* Soundboard styles. Colors are variables, redefined for the dark theme below
   (system dark unless Settings says light; or Settings says dark). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e4e7ec;
  --text: #111827;
  --muted: #5b6472;
  --border: rgba(17, 24, 39, 0.1);
  --border-strong: rgba(17, 24, 39, 0.2);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eceefe;
  --accent-ink: #3730a3;
  --on-accent: #ffffff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --go: #16a34a;
  --on-go: #ffffff;
  --warn: #8a5300;
  --warn-soft: #fef3c7;
  --danger: #c81e1e;
  --danger-soft: #fdecec;
  --focus: #4f46e5;
  --shade: rgba(246, 247, 249, 0.72);
  --top-bg: rgba(246, 247, 249, 0.86);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 16px 48px rgba(17, 24, 39, 0.2);
  --toast-bg: #1f2430;
  --toast-fg: #f3f4f6;
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --side-w: 0px;
  --top-h: 56px;
  --now-h: 60px;
  --tab-h: calc(56px + env(safe-area-inset-bottom));
  --pad: 104px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --surface-3: #2a2f3a;
    --text: #e8eaf0;
    --muted: #9aa3b2;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.17);
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #23264a;
    --accent-ink: #c7d2fe;
    --on-accent: #0f1115;
    --ok: #4ade80;
    --ok-soft: #12361f;
    --go: #22c55e;
    --on-go: #052e14;
    --warn: #fbbf24;
    --warn-soft: #3a2c0a;
    --danger: #f87171;
    --danger-soft: #3b1717;
    --focus: #a5b4fc;
    --shade: rgba(15, 17, 21, 0.66);
    --top-bg: rgba(15, 17, 21, 0.86);
    --shadow: none;
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
    --toast-bg: #e8eaf0;
    --toast-fg: #111827;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --surface-3: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.17);
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: #23264a;
  --accent-ink: #c7d2fe;
  --on-accent: #0f1115;
  --ok: #4ade80;
  --ok-soft: #12361f;
  --go: #22c55e;
  --on-go: #052e14;
  --warn: #fbbf24;
  --warn-soft: #3a2c0a;
  --danger: #f87171;
  --danger-soft: #3b1717;
  --focus: #a5b4fc;
  --shade: rgba(15, 17, 21, 0.66);
  --top-bg: rgba(15, 17, 21, 0.86);
  --shadow: none;
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --toast-bg: #e8eaf0;
  --toast-fg: #111827;
  color-scheme: dark;
}

/* Pad sizes (Settings → Pad size). */
/* Phone sizes fit 4, 3 and 2 pads across a 375 px iPhone screen. */
:root[data-pad-size='s'] {
  --pad: 76px;
}
:root[data-pad-size='m'] {
  --pad: 100px;
}
:root[data-pad-size='l'] {
  --pad: 150px;
}
@media (min-width: 860px) {
  :root[data-pad-size='s'] {
    --pad: 100px;
  }
  :root[data-pad-size='m'] {
    --pad: 132px;
  }
  :root[data-pad-size='l'] {
    --pad: 176px;
  }
}

/* ---- Pad colors (light, then dark) ------------------------------------------ */
.tint-default {
  --tint-bg: var(--surface);
  --tint-fg: var(--text);
  --tint-border: var(--border-strong);
  --tint-ring: var(--accent);
}
.tint-red {
  --tint-bg: #fee2e2;
  --tint-fg: #8f1c1c;
  --tint-border: #fca5a5;
  --tint-ring: #ef4444;
}
.tint-orange {
  --tint-bg: #ffedd5;
  --tint-fg: #8a3110;
  --tint-border: #fdba74;
  --tint-ring: #f97316;
}
.tint-amber {
  --tint-bg: #fef3c7;
  --tint-fg: #7c3a0b;
  --tint-border: #fcd34d;
  --tint-ring: #f59e0b;
}
.tint-green {
  --tint-bg: #dcfce7;
  --tint-fg: #14532d;
  --tint-border: #86efac;
  --tint-ring: #22c55e;
}
.tint-teal {
  --tint-bg: #ccfbf1;
  --tint-fg: #134e4a;
  --tint-border: #5eead4;
  --tint-ring: #14b8a6;
}
.tint-cyan {
  --tint-bg: #cffafe;
  --tint-fg: #164e63;
  --tint-border: #67e8f9;
  --tint-ring: #06b6d4;
}
.tint-blue {
  --tint-bg: #dbeafe;
  --tint-fg: #1e3a8a;
  --tint-border: #93c5fd;
  --tint-ring: #3b82f6;
}
.tint-indigo {
  --tint-bg: #e0e7ff;
  --tint-fg: #312e81;
  --tint-border: #a5b4fc;
  --tint-ring: #6366f1;
}
.tint-violet {
  --tint-bg: #ede9fe;
  --tint-fg: #4c1d95;
  --tint-border: #c4b5fd;
  --tint-ring: #8b5cf6;
}
.tint-pink {
  --tint-bg: #fce7f3;
  --tint-fg: #831843;
  --tint-border: #f9a8d4;
  --tint-ring: #ec4899;
}
.tint-brown {
  --tint-bg: #efe4dc;
  --tint-fg: #5c3a22;
  --tint-border: #d6b9a1;
  --tint-ring: #a0703f;
}
.tint-slate {
  --tint-bg: #e2e8f0;
  --tint-fg: #1e293b;
  --tint-border: #94a3b8;
  --tint-ring: #64748b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .tint-red {
    --tint-bg: #45191a;
    --tint-fg: #fecaca;
    --tint-border: #7f2a2a;
    --tint-ring: #f87171;
  }
  :root:not([data-theme='light']) .tint-orange {
    --tint-bg: #44230f;
    --tint-fg: #fed7aa;
    --tint-border: #7c3d16;
    --tint-ring: #fb923c;
  }
  :root:not([data-theme='light']) .tint-amber {
    --tint-bg: #41300c;
    --tint-fg: #fde68a;
    --tint-border: #775614;
    --tint-ring: #fbbf24;
  }
  :root:not([data-theme='light']) .tint-green {
    --tint-bg: #12331e;
    --tint-fg: #bbf7d0;
    --tint-border: #1f6037;
    --tint-ring: #4ade80;
  }
  :root:not([data-theme='light']) .tint-teal {
    --tint-bg: #0f3230;
    --tint-fg: #99f6e4;
    --tint-border: #1b5d58;
    --tint-ring: #2dd4bf;
  }
  :root:not([data-theme='light']) .tint-cyan {
    --tint-bg: #0d303c;
    --tint-fg: #a5f3fc;
    --tint-border: #175a6e;
    --tint-ring: #22d3ee;
  }
  :root:not([data-theme='light']) .tint-blue {
    --tint-bg: #16284d;
    --tint-fg: #bfdbfe;
    --tint-border: #284a8a;
    --tint-ring: #60a5fa;
  }
  :root:not([data-theme='light']) .tint-indigo {
    --tint-bg: #22214b;
    --tint-fg: #c7d2fe;
    --tint-border: #3d3b85;
    --tint-ring: #818cf8;
  }
  :root:not([data-theme='light']) .tint-violet {
    --tint-bg: #2c1b51;
    --tint-fg: #ddd6fe;
    --tint-border: #4e3190;
    --tint-ring: #a78bfa;
  }
  :root:not([data-theme='light']) .tint-pink {
    --tint-bg: #45142d;
    --tint-fg: #fbcfe8;
    --tint-border: #7e2552;
    --tint-ring: #f472b6;
  }
  :root:not([data-theme='light']) .tint-brown {
    --tint-bg: #37281d;
    --tint-fg: #e8d3c2;
    --tint-border: #634a36;
    --tint-ring: #c49a6c;
  }
  :root:not([data-theme='light']) .tint-slate {
    --tint-bg: #243041;
    --tint-fg: #cbd5e1;
    --tint-border: #3c4b61;
    --tint-ring: #94a3b8;
  }
}
:root[data-theme='dark'] .tint-red {
  --tint-bg: #45191a;
  --tint-fg: #fecaca;
  --tint-border: #7f2a2a;
  --tint-ring: #f87171;
}
:root[data-theme='dark'] .tint-orange {
  --tint-bg: #44230f;
  --tint-fg: #fed7aa;
  --tint-border: #7c3d16;
  --tint-ring: #fb923c;
}
:root[data-theme='dark'] .tint-amber {
  --tint-bg: #41300c;
  --tint-fg: #fde68a;
  --tint-border: #775614;
  --tint-ring: #fbbf24;
}
:root[data-theme='dark'] .tint-green {
  --tint-bg: #12331e;
  --tint-fg: #bbf7d0;
  --tint-border: #1f6037;
  --tint-ring: #4ade80;
}
:root[data-theme='dark'] .tint-teal {
  --tint-bg: #0f3230;
  --tint-fg: #99f6e4;
  --tint-border: #1b5d58;
  --tint-ring: #2dd4bf;
}
:root[data-theme='dark'] .tint-cyan {
  --tint-bg: #0d303c;
  --tint-fg: #a5f3fc;
  --tint-border: #175a6e;
  --tint-ring: #22d3ee;
}
:root[data-theme='dark'] .tint-blue {
  --tint-bg: #16284d;
  --tint-fg: #bfdbfe;
  --tint-border: #284a8a;
  --tint-ring: #60a5fa;
}
:root[data-theme='dark'] .tint-indigo {
  --tint-bg: #22214b;
  --tint-fg: #c7d2fe;
  --tint-border: #3d3b85;
  --tint-ring: #818cf8;
}
:root[data-theme='dark'] .tint-violet {
  --tint-bg: #2c1b51;
  --tint-fg: #ddd6fe;
  --tint-border: #4e3190;
  --tint-ring: #a78bfa;
}
:root[data-theme='dark'] .tint-pink {
  --tint-bg: #45142d;
  --tint-fg: #fbcfe8;
  --tint-border: #7e2552;
  --tint-ring: #f472b6;
}
:root[data-theme='dark'] .tint-brown {
  --tint-bg: #37281d;
  --tint-fg: #e8d3c2;
  --tint-border: #634a36;
  --tint-ring: #c49a6c;
}
:root[data-theme='dark'] .tint-slate {
  --tint-bg: #243041;
  --tint-fg: #cbd5e1;
  --tint-border: #3c4b61;
  --tint-ring: #94a3b8;
}

/* ---- Base ---------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent);
}
h1,
h2,
h3 {
  line-height: 1.2;
}
kbd {
  font: 600 0.75rem var(--mono);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.hint {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}
.warn-text {
  color: var(--warn);
}
.danger {
  color: var(--danger);
}
.row {
  display: flex;
  align-items: center;
}
.gap {
  gap: 8px;
}
.wrap {
  flex-wrap: wrap;
}
.center {
  justify-content: center;
}
.boot {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}
.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* ---- Layout ---------------------------------------------------------------------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  display: none;
}
.main-col {
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: var(--top-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.board-title {
  display: none;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 0;
}
.board-title.solo {
  display: block;
}
.title-btn {
  background: none;
  border: 0;
  padding: 2px 6px;
  border-radius: 8px;
  font: inherit;
  cursor: text;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title-btn:hover {
  background: var(--surface-2);
}
.board-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 8px;
  margin-left: -4px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
}
.board-switch:hover,
.board-switch[aria-expanded='true'] {
  background: var(--surface-2);
}
.board-switch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body:not([data-view='board']) .board-switch {
  display: none;
}
/* Hidden on narrow screens even on elements with their own display (a .btn); the board's
   ⋯ menu has the same actions there. */
@media (max-width: 859px) {
  .wide-only {
    display: none !important;
  }
}
.main {
  padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--now-h) + var(--tab-h) + 28px) max(16px, env(safe-area-inset-left));
  outline: none;
}
body:not([data-view='board']) .main {
  padding-bottom: calc(var(--tab-h) + 28px);
}
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tab.active {
  color: var(--accent);
}

@media (min-width: 860px) {
  :root {
    --side-w: 248px;
    --tab-h: 0px;
  }
  .app {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: calc(12px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: var(--surface);
    border-right: 1px solid var(--border);
  }
  .tabbar,
  .board-switch {
    display: none !important;
  }
  .board-title,
  .wide-only {
    display: block;
  }
  .main {
    padding: 24px 28px calc(var(--now-h) + 32px + env(safe-area-inset-bottom));
  }
  body:not([data-view='board']) .main {
    padding-bottom: 40px;
  }
  .topbar {
    padding-left: 28px;
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* ---- Sidebar ---------------------------------------------------------------------- */
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  font-weight: 750;
  font-size: 1.1rem;
}
.side-logo {
  border-radius: 7px;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.side-boards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.side-empty {
  padding: 4px 10px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.side-link:hover {
  background: var(--surface-2);
}
.side-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.side-dot {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.side-link.active .side-dot {
  color: inherit;
}
.side-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-count {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.side-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 2px;
}
.side-boards li.dragging {
  opacity: 0.4;
}
.side-boards li.drop-before {
  box-shadow: inset 0 2px 0 var(--accent);
}
.side-boards li.drop-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---- Buttons and inputs --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 0.93rem;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-text {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0 6px;
  min-height: 30px;
}
.btn-text:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.86rem;
}
.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  filter: brightness(1.08);
}
.btn.danger {
  color: var(--danger);
}
.btn-on {
  background: var(--accent-soft) !important;
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-stop {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
  font-weight: 650;
}
.btn-stop:hover:not(:disabled) {
  background: var(--danger-soft);
  filter: brightness(0.96);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.icon-btn.sm {
  width: 32px;
  height: 32px;
}
.flip .icon {
  transform: rotate(180deg);
}
.input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  /* 16px or more, or iOS Safari zooms the page when a field is focused. */
  font-size: 16px;
}
.input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
  outline-offset: 0;
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
}
.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.select-sm {
  min-height: 36px;
  width: auto;
}
textarea.input {
  padding: 10px 12px;
  min-height: 80px;
}
.range {
  width: 100%;
  accent-color: var(--accent);
  margin: 6px 0;
  touch-action: manipulation;
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.label {
  font-weight: 600;
  font-size: 0.9rem;
}
.field-error {
  color: var(--danger);
  font-size: 0.86rem;
  margin: 6px 0 0;
}
.field-error:empty {
  display: none;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  cursor: pointer;
}
.check input {
  margin-top: 3px;
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.choices {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.choice input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.choice > span {
  display: grid;
  gap: 2px;
}
.progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

/* Switches: a checkbox drawn as a toggle. */
.switch {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  position: relative;
}
.switch-text {
  flex: 1;
  display: grid;
  gap: 2px;
  font-weight: 550;
}
.switch-text .hint {
  font-weight: 400;
}
.switch-input {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 26px;
  right: 0;
  margin: 0;
  cursor: pointer;
}
.switch-track {
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--surface-3);
  position: relative;
  transition: background 0.15s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch-input:checked + .switch-track {
  background: var(--accent);
}
.switch-input:checked + .switch-track::after {
  transform: translateX(18px);
}
.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-x: auto;
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.chip {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 550;
  cursor: pointer;
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.warn-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--text);
}

/* ---- Empty states ------------------------------------------------------------------- */
.empty {
  max-width: 540px;
  margin: 8vh auto 0;
  padding: 16px;
  text-align: center;
}
.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.empty h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.empty p {
  color: var(--muted);
  margin: 0;
}
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}
.empty-line {
  padding: 24px;
  text-align: center;
}

/* ---- Pads ----------------------------------------------------------------------------- */
.pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pad), 1fr));
  gap: 10px;
}
@media (min-width: 600px) {
  .pad-grid {
    gap: 14px;
  }
}
.pad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  aspect-ratio: 1;
  min-width: 0;
  padding: 22px 8px 12px;
  border: 1px solid var(--tint-border);
  border-radius: 18px;
  background: var(--tint-bg);
  color: var(--tint-fg);
  font: 650 0.92rem/1.2 var(--font);
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 0.07s ease,
    box-shadow 0.12s ease;
  box-shadow: var(--shadow);
}
.pad:hover {
  filter: brightness(0.98);
}
.pad.pressed,
.pad:active {
  transform: scale(0.955);
}
.pad.playing {
  box-shadow:
    0 0 0 3px var(--tint-ring),
    var(--shadow);
  border-color: var(--tint-ring);
}
.pad-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  width: calc(var(--progress, 0) * 100%);
  background: var(--tint-ring);
  opacity: 0;
}
.pad.playing .pad-progress {
  opacity: 1;
}
.pad-art {
  font-size: calc(var(--pad) * 0.3);
  line-height: 1;
  flex: none;
}
.pad-label {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  max-width: 100%;
}
:root[data-pad-size='s'] .pad {
  font-size: 0.8rem;
  border-radius: 14px;
}
:root[data-pad-size='s'] .pad-label {
  -webkit-line-clamp: 2;
}
.pad.with-img {
  justify-content: flex-end;
  color: #fff;
  padding-bottom: 10px;
}
.pad-art.has-img {
  position: absolute;
  inset: 0;
}
.pad-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pad.with-img::after {
  content: '';
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}
.pad.with-img .pad-label {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.pad-key {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  min-width: 20px;
  padding: 0 5px;
  font: 700 0.7rem/18px var(--mono);
  text-align: center;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  opacity: 0.7;
}
.pad.with-img .pad-key {
  background: rgba(0, 0, 0, 0.45);
  border-color: transparent;
  opacity: 1;
}
.pad-key.static {
  position: static;
  display: inline-block;
}
.hide-hotkeys .pad .pad-key {
  display: none;
}
.pad-badges {
  position: absolute;
  top: 6px;
  right: 7px;
  z-index: 2;
  display: flex;
  gap: 2px;
  opacity: 0.65;
}
.pad.with-img .pad-badges {
  color: #fff;
  opacity: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}
.pad.missing {
  opacity: 0.5;
  border-style: dashed;
}
.pad-add {
  border: 2px dashed var(--border-strong);
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

/* Arrange mode */
.arranging .pad[data-pad] {
  cursor: grab;
  animation: none;
}
.pad-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: inherit;
  opacity: 0.75;
  touch-action: none;
  cursor: grab;
}
.pad.with-img .pad-handle {
  color: #fff;
}
.pad.drag-source {
  opacity: 0.3;
}
.pad-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: 0.92;
  box-shadow: var(--shadow-lg);
  transition: none;
}
.pad.drop-before {
  box-shadow: -8px 0 0 -3px var(--accent);
}
.pad.drop-after {
  box-shadow: 8px 0 0 -3px var(--accent);
}
.arrange-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--accent-soft);
}
.arrange-bar p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Things that show one icon while playing and another while not (the tick loop sets .playing). */
.when-playing {
  display: none !important;
}
.playing .when-playing {
  display: inline-block !important;
}
.playing .when-idle {
  display: none !important;
}

/* ---- Cue list ------------------------------------------------------------------------------ */
.cue-head {
  position: sticky;
  top: calc(var(--top-h) + env(safe-area-inset-top) + 8px);
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.btn-go {
  display: grid;
  place-items: center;
  align-content: center;
  width: 96px;
  height: 96px;
  border: 0;
  border-radius: 22px;
  background: var(--go);
  color: var(--on-go);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.07s;
}
.btn-go:active:not(:disabled) {
  transform: scale(0.96);
}
.btn-go:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: default;
}
.go-word {
  font-size: 1.8rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
}
.go-sub {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.8;
  margin-top: 4px;
}
.cue-next {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.cue-next-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cue-next-name {
  font-size: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cue-steps {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.cue-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.cue-row.next {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.cue-row.done {
  opacity: 0.6;
}
.cue-row.playing {
  border-color: var(--go);
  opacity: 1;
}
.cue-pick {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
}
.cue-num {
  width: 26px;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.cue-pick .swatch {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}
.cue-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.cue-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.cue-progress,
.lib-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: calc(var(--progress, 0) * 100%);
  background: var(--go);
  opacity: 0;
  pointer-events: none;
}
.playing > .cue-progress,
.playing > .lib-progress {
  opacity: 1;
}
@media (max-width: 599px) {
  .cue-head {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }
  .cue-steps {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .btn-go {
    width: 84px;
    height: 84px;
  }
  .cue-meta {
    display: none;
  }
}

/* ---- Now playing ------------------------------------------------------------------------------ */
.nowbar {
  position: fixed;
  left: var(--side-w);
  right: 0;
  bottom: var(--tab-h);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--now-h) + (env(safe-area-inset-bottom) * var(--now-safe, 0)));
  padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom) * var(--now-safe, 0)) max(12px, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
body:not([data-view='board']) .nowbar {
  display: none;
}
@media (min-width: 860px) {
  .nowbar {
    --now-safe: 1;
  }
}
.now-vol {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.master-range {
  display: none;
  width: 110px;
  margin: 0;
}
@media (min-width: 860px) {
  .master-range {
    display: block;
  }
}
@media (max-width: 859px) {
  .nowbar.show-volume .master-range {
    display: block;
    position: absolute;
    bottom: calc(100% + 14px);
    left: 0;
    width: min(260px, 70vw);
    padding: 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    box-sizing: content-box;
  }
}
.now-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.now-chips::-webkit-scrollbar {
  display: none;
}
.now-chip {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  max-width: 230px;
  padding: 0 4px 0 12px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.now-chip > *:not(.now-fill) {
  position: relative;
}
.now-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--progress, 0) * 100%);
  background: var(--accent-soft);
}
.now-chip.stopping {
  opacity: 0.55;
}
.now-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 600;
}
.now-time {
  flex: none;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.now-stop {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.now-stop:hover {
  background: var(--surface-3);
  color: var(--text);
}
.now-idle {
  white-space: nowrap;
}
@media (max-width: 420px) {
  .btn-stop span {
    display: none;
  }
  .btn-stop {
    width: 44px;
    padding: 0;
  }
}

/* ---- Library ------------------------------------------------------------------------------------- */
.library {
  display: grid;
  gap: 12px;
  max-width: 980px;
}
.lib-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.search-input {
  flex: 1 1 220px;
}
.lib-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lib-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lib-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-bottom: 1px solid var(--border);
}
.lib-row:last-child {
  border-bottom: 0;
}
.lib-check {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}
.lib-play {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 10px;
}
.lib-play-icon {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--surface);
}
.lib-play-icon .icon {
  width: 11px;
  height: 11px;
}
.lib-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 6px 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
}
.lib-name,
.lib-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-name {
  font-weight: 600;
}
.lib-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.bulk-bar {
  position: sticky;
  top: calc(var(--top-h) + env(safe-area-inset-top) + 6px);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.bulk-bar .check {
  margin: 0;
  align-items: center;
}
.swatch {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tint-bg, var(--surface-2));
  color: var(--tint-fg, var(--text));
  border: 1px solid var(--tint-border, var(--border));
  font-size: 1.3rem;
}
.swatch-wave {
  opacity: 0.45;
}
.swatch-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Menus, toasts ------------------------------------------------------------------------------ */
.menu {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px;
  z-index: 1000;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.menu-item.danger {
  color: var(--danger);
}
.menu-item:disabled {
  opacity: 0.45;
}
.menu-icon-gap {
  width: 18px;
  flex: none;
}
.menu-label {
  flex: 1;
  display: grid;
  min-width: 0;
}
.menu-label > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-sub {
  font-size: 0.78rem;
  color: var(--muted);
}
.menu-aside {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.menu-check {
  color: var(--accent);
}
.menu-heading {
  padding: 6px 10px 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}
.toasts {
  position: fixed;
  inset: auto;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--now-h) + 14px);
  transform: translateX(-50%);
  z-index: 2000;
  width: min(520px, calc(100vw - 24px));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transition:
    opacity 0.3s,
    transform 0.3s;
  animation: toast-in 0.2s ease-out;
  font-size: 0.92rem;
}
.toast .btn-text {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  flex: none;
}
.toast-error {
  background: var(--danger);
  color: #fff;
}
.toast-success {
  border-left: 4px solid var(--go);
}
.toast.out {
  opacity: 0;
  transform: translateY(6px);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- Dialogs --------------------------------------------------------------------------------- */
dialog.modal {
  width: min(560px, calc(100vw - 24px));
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.modal[open] {
  display: flex;
  flex-direction: column;
}
dialog.modal::backdrop {
  background: rgba(10, 12, 18, 0.5);
}
dialog.modal:focus {
  outline: none;
}
dialog.modal.modal-wide {
  width: min(840px, calc(100vw - 24px));
}
dialog.modal.modal-small {
  width: min(460px, calc(100vw - 24px));
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 6px 20px;
}
.modal-title {
  margin: 0;
  font-size: 1.1rem;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 18px;
  overscroll-behavior: contain;
}
.modal-body > p:first-child {
  margin-top: 0;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.modal-foot.inline {
  padding: 16px 0 0;
  border-top: 0;
}
.foot-left {
  margin-right: auto;
}
dialog.modal.modal-search {
  margin-top: 10vh;
  width: min(620px, calc(100vw - 24px));
}
@media (max-width: 599px) {
  /* Dialogs become sheets from the bottom of the screen. */
  dialog.modal.modal-sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 18px 18px 0 0;
  }
  dialog.modal.modal-search {
    margin-top: calc(12px + env(safe-area-inset-top));
  }
  .modal-foot .btn {
    flex: 1 1 auto;
  }
  .modal-foot .foot-left {
    flex: 0 0 auto;
  }
}

/* ---- Editor ------------------------------------------------------------------------------------ */
.editor {
  display: grid;
  gap: 20px;
}
.input-title {
  font-size: 1.15rem;
  font-weight: 650;
  min-height: 46px;
}
.editor-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.editor-section + .editor-section {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.editor-section h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wave {
  --wave-color: var(--accent);
  position: relative;
  height: 104px;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.wave-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.wave-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--shade);
  pointer-events: none;
}
.wave-shade.left {
  left: 0;
}
.wave-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  margin-left: -14px;
  cursor: ew-resize;
  touch-action: none;
  z-index: 2;
}
.wave-handle::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}
.wave-grip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.wave-handle.active .wave-grip,
.wave-handle:focus-visible .wave-grip {
  outline: 3px solid var(--accent-soft);
}
.wave-handle:focus-visible {
  outline: none;
}
.wave-head {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  pointer-events: none;
  z-index: 1;
}
.trim-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}
.mini-field {
  display: grid;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.input-time {
  width: 100px;
  font-variant-numeric: tabular-nums;
}
.slider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}
@media (max-width: 599px) {
  .slider-grid {
    grid-template-columns: 1fr;
  }
}
.slider-field {
  display: grid;
  gap: 0;
}
.slider-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider-top .label {
  flex: 1;
}
.slider-out {
  font-weight: 650;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.look-grid {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 599px) {
  .look-grid {
    grid-template-columns: 1fr;
  }
  .look-preview {
    justify-self: center;
  }
}
.look-preview .pad {
  width: 136px;
  cursor: default;
  --pad: 136px;
}
.look-preview .pad:active {
  transform: none;
}
.look-controls {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.color-swatch {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--tint-border);
  background: var(--tint-bg);
  cursor: pointer;
}
.color-swatch.tint-default {
  background: linear-gradient(135deg, var(--surface) 45%, var(--surface-3) 55%);
}
.color-swatch[aria-checked='true'] {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.input-emoji {
  width: 72px;
  text-align: center;
  font-size: 1.4rem;
  padding: 0;
}
.emoji-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.emoji-pick {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 1.3rem;
  cursor: pointer;
}
.emoji-pick:hover {
  background: var(--surface-2);
}
.key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.key-row > .label {
  min-width: 76px;
}
.key-out {
  min-width: 60px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 2px 2px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 0.86rem;
  font-weight: 550;
}
.tag-x {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.tag-input {
  flex: 1;
  min-width: 120px;
  min-height: 30px;
  border: 0;
  padding: 0 4px;
  background: transparent;
}
.tag-input:focus {
  outline: none;
  border: 0;
}
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
  font-size: 0.9rem;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---- Pickers, recorder, search ------------------------------------------------------------------- */
.pick-list {
  display: grid;
  gap: 2px;
  max-height: 56vh;
  overflow-y: auto;
  margin-top: 10px;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.pick-item:hover {
  background: var(--surface-2);
}
.pick-item > span:not(.swatch):not(.hint) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-item input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}
.pick-item.is-on {
  opacity: 0.55;
}
.pick-item .swatch {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}
.recorder {
  display: grid;
  gap: 16px;
  text-align: center;
}
.rec-time {
  font-size: 2.4rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  width: calc(var(--level, 0) * 100%);
  background: linear-gradient(90deg, var(--go), #eab308 70%, #ef4444);
  transition: width 0.06s linear;
}
.btn-rec {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
  min-height: 46px;
  padding: 0 20px;
}
.btn-rec:hover:not(:disabled) {
  background: var(--danger);
  filter: brightness(1.08);
}
.btn-rec.recording {
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 8px var(--danger-soft);
  }
}
.recorder .field {
  text-align: left;
}
.search-big {
  min-height: 48px;
  font-size: 17px;
}
.search-results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 52vh;
  overflow-y: auto;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.search-item.active {
  background: var(--surface-2);
}
.search-item .swatch {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}
.search-main {
  flex: 1;
  min-width: 0;
  display: grid;
}
.search-main > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-empty {
  padding: 12px 8px;
}
.search-tips {
  margin-top: 10px;
}
.manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.manage-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.manage-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}
.fail-list {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
}
.fail-list li {
  display: grid;
}
.drop-hint {
  position: fixed;
  inset: 8px;
  z-index: 3000;
  display: grid;
  place-items: center;
  border: 3px dashed var(--accent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: none;
}
.drop-hint > div {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 28px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--accent);
  font-weight: 650;
}
.drop-hint p {
  margin: 0;
  color: var(--text);
}

/* ---- Settings, help -------------------------------------------------------------------------------- */
.settings,
.help {
  display: grid;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}
.settings-card {
  display: grid;
  gap: 16px;
}
.settings-card h2,
.help h2 {
  margin: 0;
  font-size: 1.05rem;
}
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.set-label {
  display: grid;
  gap: 2px;
  font-weight: 550;
  flex: 1 1 220px;
}
.set-label .hint {
  font-weight: 400;
}
.set-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.set-control .select {
  width: auto;
  max-width: 100%;
}
.set-stack {
  display: grid;
  gap: 12px;
}
.slider-inline {
  width: min(320px, 100%);
  flex-wrap: nowrap;
}
.slider-inline output {
  min-width: 42px;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.about {
  text-align: center;
  padding: 8px 0 0;
}
.help-start ol {
  margin: 10px 0 0;
  padding-left: 1.3em;
  display: grid;
  gap: 6px;
}
.help-topic {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.help-topic summary {
  padding: 14px 18px;
  font-weight: 650;
  cursor: pointer;
  list-style-position: inside;
}
.help-body {
  padding: 0 18px 14px;
}
.help-body p {
  margin: 0 0 10px;
}
.help-body ul {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
