/* ==========================================================================
   PureMP3 — 100% Fluid Intrinsic Design System (Zero Hardcoded Pixel Rules)
   Scales and self-aligns continuously across every viewport, container, and
   root font-size preference using rem, clamp(), cqi, auto-fit, and @container.
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg-app: #f6f8fb;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-hover: #eef2f6;
  --bg-accent-soft: rgba(79, 70, 229, 0.08);
  --bg-success-soft: rgba(16, 185, 129, 0.1);
  --bg-warning-soft: rgba(245, 158, 11, 0.1);
  --bg-danger-soft: rgba(220, 38, 38, 0.1);

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-accent: #4f46e5;
  --border-hairline: 0.0625rem;
  --border-thick: 0.125rem;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-on-accent: #ffffff;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  --shadow-xs: 0 0.0625rem 0.125rem rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 0.125rem 0.5rem -0.125rem rgba(15, 23, 42, 0.06);
  --shadow-md: 0 0.625rem 1.5rem -0.375rem rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 1.5rem 3rem -0.75rem rgba(15, 23, 42, 0.24);
  --shadow-accent: 0 0.125rem 0.5rem rgba(79, 70, 229, 0.26);

  --shell-max: min(96vw, 92rem);
  --space-page-x: clamp(0.875rem, 2.8vw, 2.5rem);
  --space-page-y: clamp(1.125rem, 2.8vw, 2.5rem);
  --space-card: clamp(1rem, 2.2vw, 1.625rem);
  --gap-layout: clamp(1rem, 2.2vw, 1.75rem);
  --gap-grid: clamp(0.75rem, 1.6vw, 1.25rem);

  --font-hero: clamp(1.5rem, 1.1rem + 2.1vw, 2.35rem);
  --font-ws-title: clamp(1.25rem, 1.02rem + 1.1vw, 1.75rem);
  --font-body: clamp(0.875rem, 0.84rem + 0.18vw, 0.95rem);

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-pill: 999rem;
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-subtle: #182234;
  --bg-elevated: #1e293b;
  --bg-hover: #1f2d44;
  --bg-accent-soft: rgba(99, 102, 241, 0.16);
  --bg-success-soft: rgba(16, 185, 129, 0.16);
  --bg-warning-soft: rgba(245, 158, 11, 0.15);
  --bg-danger-soft: rgba(248, 113, 113, 0.14);

  --border-subtle: #1e293b;
  --border-strong: #334155;
  --border-accent: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #10b981;
  --warning: #fbbf24;
  --danger: #f87171;

  --shadow-xs: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.28);
  --shadow-md: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Reusable Semantic Layout Primitives (Zero Inline Styles Needed) */
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.min-w-0 { min-width: 0; }
.flex-1 { flex: 1 1 0%; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.word-break { word-break: break-word; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.row-start-between {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.row-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.row-center-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.stack-xs { display: flex; flex-direction: column; gap: 0.35rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.65rem; }
.stack-md { display: flex; flex-direction: column; gap: 1rem; }

.text-xs { font-size: 0.76rem; }
.text-sm { font-size: 0.84rem; }
.text-md { font-size: 0.95rem; }
.text-lg { font-size: clamp(1rem, 0.94rem + 0.3vw, 1.15rem); }
.text-xl { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.underline { text-decoration: underline; }

/* Top Fluid Enterprise Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: var(--border-hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  container-type: inline-size;
}

.topbar-inner {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0.5rem var(--space-page-x);
  min-height: clamp(3.5rem, 5vw, 4rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  min-width: 0;
}

.brand-mark {
  width: clamp(2rem, 3vw, 2.3rem);
  height: clamp(2rem, 3vw, 2.3rem);
  border-radius: 0.625rem;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: var(--text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.brand-title {
  font-size: clamp(0.95rem, 0.88rem + 0.3vw, 1.08rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 1vw, 0.65rem);
  margin-left: auto;
}

.trust-pill {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

@container (min-width: 42rem) {
  .brand-sub { display: block; }
  .trust-pill { display: inline-flex; }
}

.status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--success);
}

.tool-strip-wrap {
  border-top: var(--border-hairline) solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-strip-wrap::-webkit-scrollbar { display: none; }

@container (min-width: 80rem) {
  .tool-strip-wrap { display: none; }
}

.tool-strip {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0.45rem var(--space-page-x);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.strip-tab {
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.strip-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.strip-tab.active {
  background: var(--bg-accent-soft);
  border-color: var(--border-accent);
  color: var(--accent);
  font-weight: 600;
}

/* Buttons, Checkboxes & Fluid Inputs */
.btn {
  min-height: 2.75rem;
  padding: 0.5rem clamp(0.85rem, 1.8vw, 1.15rem);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.btn-lg {
  min-height: 3rem;
  font-size: 0.92rem;
}

.btn-dashed-accent {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-pro {
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-accent-soft);
  border: var(--border-hairline) solid var(--border-accent);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-pro:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-pro.pro-unlocked {
  background: var(--bg-success-soft);
  border-color: var(--success);
  color: var(--success);
}

.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.input-field {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: max(1rem, 0.92rem);
  width: 100%;
  transition: border-color 0.15s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 0.1875rem var(--bg-accent-soft);
}

.select-compact {
  width: auto;
  min-height: 2.25rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.85rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

/* App Shell & Container Queries */
.app-shell {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-page-y) var(--space-page-x) clamp(2.5rem, 5vw, 4rem);
  container-type: inline-size;
}

.enterprise-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-layout);
  align-items: flex-start;
}

.desktop-sidebar { display: none; }

.main-stage {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  container-type: inline-size;
}

@container (min-width: 80rem) {
  .desktop-sidebar {
    display: block;
    flex: 0 0 clamp(14rem, 16cqi, 16rem);
    position: sticky;
    top: 5.25rem;
    background: var(--bg-surface);
    border: var(--border-hairline) solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.65rem;
    box-shadow: var(--shadow-xs);
  }
}

.sidebar-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.65rem 0.65rem 0.35rem;
}

.sidebar-nav-btn {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: all 0.14s ease;
}

.sidebar-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav-btn.active {
  background: var(--bg-accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Home Directory — Auto-Fit Bento Grid */
.home-hero {
  text-align: center;
  max-width: 46rem;
  margin: 0.25rem auto clamp(1.25rem, 3vw, 2rem);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--bg-accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hero-heading {
  font-size: var(--font-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
  line-height: 1.18;
  text-wrap: balance;
}

.hero-lead {
  font-size: clamp(0.88rem, 0.82rem + 0.25vw, 1rem);
  color: var(--text-secondary);
  margin: 0;
  text-wrap: pretty;
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.cat-pill {
  min-height: 2.3rem;
  padding: 0 0.95rem;
  border-radius: var(--radius-pill);
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cat-pill.active {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.tools-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr));
  gap: var(--gap-grid);
}

.tool-bento-card {
  background: var(--bg-surface);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-card);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  box-shadow: var(--shadow-xs);
}

.tool-bento-card:hover {
  transform: translateY(-0.125rem);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}

.tool-icon-box {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 0.7rem;
  background: var(--bg-accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.tool-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: var(--border-hairline) solid transparent;
}

.tool-card-badge.popular {
  background: var(--bg-success-soft);
  color: var(--success);
}

.tool-card-badge.interactive {
  cursor: pointer;
  color: var(--accent);
  border-color: var(--border-accent);
}

/* Active Tool Studio Workspace — Intrinsic Two-Zone Split */
.workspace-header {
  margin-bottom: clamp(1rem, 2vw, 1.4rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.workspace-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.breadcrumb-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
}

.workspace-title {
  font-size: var(--font-ws-title);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
}

.workspace-subtitle {
  font-size: clamp(0.85rem, 0.82rem + 0.18vw, 0.94rem);
  color: var(--text-secondary);
  margin: 0;
  max-width: 58rem;
}

.workspace-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-layout);
  align-items: flex-start;
}

.studio-canvas-col {
  flex: 999 1 32rem;
  min-width: min(100%, 32rem);
  display: flex;
  flex-direction: column;
  gap: var(--gap-grid);
  container-type: inline-size;
}

.inspector-sticky {
  flex: 1 1 20rem;
  min-width: min(100%, 19rem);
}

@container (min-width: 55rem) {
  .inspector-sticky {
    position: sticky;
    top: 5.5rem;
  }
}

.panel-card {
  background: var(--bg-surface);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-card);
  box-shadow: var(--shadow-sm);
  container-type: inline-size;
}

.panel-card.result-ready {
  border-color: var(--success);
}

.panel-section + .panel-section {
  margin-top: clamp(1rem, 2vw, 1.35rem);
  padding-top: clamp(1rem, 2vw, 1.35rem);
  border-top: var(--border-hairline) solid var(--border-subtle);
}

.sub-divider {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: var(--border-hairline) solid var(--border-subtle);
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Upload Dropzone & Waveform */
.dropzone {
  border: var(--border-thick) dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: clamp(1.35rem, 3.5vw, 2.25rem) clamp(1rem, 2.5vw, 1.5rem);
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

.dropzone-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--bg-surface);
  border: var(--border-hairline) solid var(--border-subtle);
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: var(--shadow-xs);
}

.loaded-file-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
}

.waveform-box {
  margin-top: 0.9rem;
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.waveform-canvas {
  width: 100%;
  height: clamp(4.25rem, 8vw, 5.25rem);
  display: block;
  border-radius: 0.375rem;
}

.audio-player {
  width: 100%;
  margin-top: 0.95rem;
}

/* Segmented Control & Multi-Timestamp Clip Rows */
.segmented-control {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: 0.625rem;
  padding: 0.2rem;
  gap: 0.2rem;
  width: 100%;
}

.seg-btn {
  flex: 1 1 11rem;
  min-height: 2.35rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.clip-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.clip-row {
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.clip-inputs-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  flex: 1 1 14rem;
}

.time-input-wrap {
  flex: 1 1 6.25rem;
  max-width: 9rem;
}

.time-input-wrap label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.time-input {
  min-height: 2.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: max(1rem, 0.88rem);
  font-weight: 600;
  width: 100%;
  text-align: center;
}

/* Intrinsic Auto-Fit Choice Grids */
.choice-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: 0.65rem;
}

.choice-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 6.5rem), 1fr));
  gap: 0.65rem;
}

.choice-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.65rem;
}

.bitrate-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr));
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

.choice-card {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: var(--border-thick) solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.choice-card:hover { border-color: var(--border-strong); }

.choice-card.selected {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

/* Summary Box, Error Box, Monetization & Modals */
.summary-box {
  background: var(--bg-subtle);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.error-box {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-danger-soft);
  border: var(--border-hairline) solid var(--danger);
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.ad-container {
  border: var(--border-hairline) dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 0.9rem 1rem;
  text-align: center;
  margin-top: 1.25rem;
}

.ad-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.partner-card {
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.progress-track {
  width: 100%;
  height: 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
  border: var(--border-hairline) solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(9, 13, 22, 0.65);
  backdrop-filter: blur(0.25rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
}

.modal-card {
  width: min(100%, 31rem);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: clamp(1.15rem, 3vw, 1.6rem);
  box-shadow: var(--shadow-modal);
}

.modal-card-wide {
  width: min(100%, 38rem);
}

.pro-perks-list {
  padding-left: 1.15rem;
  margin: 1rem 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.site-footer {
  border-top: var(--border-hairline) solid var(--border-subtle);
  background: var(--bg-surface);
  padding: clamp(1.15rem, 2.5vw, 1.6rem) var(--space-page-x);
  margin-top: auto;
}

.footer-inner {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links button {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
}

.footer-links button:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* A little color and movement, without getting in the way of the studio. */
:root,
[data-theme="light"] {
  --accent: #6045cf;
  --accent-hover: #4c35b4;
  --border-accent: #7960e5;
  --hero-bg: linear-gradient(125deg, #f1ecff 0%, #f9f4ff 48%, #e8f7f6 100%);
  --hero-glow: rgba(136, 108, 255, 0.19);
  --card-tint: rgba(132, 105, 255, 0.10);
  --card-highlight: #8a71ee;
}

[data-theme="dark"] {
  --accent: #b6a7ff;
  --accent-hover: #d0c7ff;
  --border-accent: #9c88f9;
  --hero-bg: linear-gradient(125deg, #211c43 0%, #171a36 50%, #102d35 100%);
  --hero-glow: rgba(143, 111, 255, 0.23);
  --card-tint: rgba(151, 124, 255, 0.13);
  --card-highlight: #aa96ff;
}

body {
  background-image: radial-gradient(ellipse at 75% 0%, var(--hero-glow), transparent 38rem);
}

.topbar {
  background: var(--bg-surface);
  box-shadow: 0 0.3rem 1.5rem rgba(32, 24, 67, 0.08);
}

.brand-mark {
  background: linear-gradient(135deg, #8c71ff, #6542d6 65%, #dd7bd3);
  box-shadow: 0 0.3rem 1rem rgba(117, 83, 229, 0.35);
}

.status-dot {
  box-shadow: 0 0 0 0.25rem var(--bg-success-soft);
}

.home-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  max-width: none;
  margin: 0 0 clamp(1.25rem, 3vw, 2rem);
  padding: clamp(2rem, 4vw, 3.75rem) clamp(1.25rem, 4vw, 3rem);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--hero-bg);
  box-shadow: var(--shadow-sm);
}

.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 14rem;
  aspect-ratio: 1;
  border: 1px solid var(--hero-glow);
  border-radius: 50%;
  pointer-events: none;
}

.home-hero::before {
  top: -8rem;
  left: -4rem;
  box-shadow: 0 0 0 2.5rem var(--hero-glow), 0 0 0 5rem var(--hero-glow);
}

.home-hero::after {
  right: -7rem;
  bottom: -10rem;
  box-shadow: 0 0 0 2.5rem var(--hero-glow), 0 0 0 5rem var(--hero-glow);
}

.home-hero .hero-eyebrow {
  border: 1px solid var(--hero-glow);
  letter-spacing: 0.02em;
}

.hero-heading {
  max-width: 20ch;
  margin-inline: auto;
  font-size: clamp(1.8rem, 1.3rem + 2.5vw, 3rem);
  letter-spacing: -0.045em;
}

.hero-lead {
  max-width: 42rem;
  margin-inline: auto;
  line-height: 1.65;
}

.hero-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 1.75rem;
  margin-bottom: 0.85rem;
}

.hero-wave span {
  width: 0.22rem;
  height: 35%;
  border-radius: var(--radius-pill);
  background: linear-gradient(#a68aff, #4bbfb9);
  animation: sound-wave 2.4s ease-in-out infinite alternate;
}

.hero-wave span:nth-child(3n) { height: 85%; animation-delay: -0.8s; }
.hero-wave span:nth-child(3n + 1) { height: 55%; animation-delay: -1.5s; }
.hero-wave span:nth-child(4n) { height: 100%; animation-delay: -0.4s; }

@keyframes sound-wave {
  from { transform: scaleY(0.55); opacity: 0.65; }
  to { transform: scaleY(1); opacity: 1; }
}

.cat-pill,
.sidebar-nav-btn,
.strip-tab,
.icon-btn,
.btn-pro {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.cat-pill:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.cat-pill.active {
  background: #6248cc;
  border-color: #6248cc;
  color: #fff;
  box-shadow: 0 0.3rem 0.8rem rgba(98, 72, 204, 0.25);
}

.tool-bento-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--card-tint), transparent 60%), var(--bg-surface);
  border-radius: var(--radius-xl);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.tool-bento-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--space-card);
  width: 2.5rem;
  height: 3px;
  border-radius: 0 0 1rem 1rem;
  background: var(--card-highlight);
}

.tool-bento-card:nth-child(3n + 2) {
  --card-tint: rgba(242, 125, 162, 0.11);
  --card-highlight: #ed8aaa;
}

.tool-bento-card:nth-child(3n) {
  --card-tint: rgba(65, 189, 180, 0.11);
  --card-highlight: #48b9b1;
}

.tool-bento-card:hover,
.tool-bento-card:focus-visible {
  transform: translateY(-0.3rem);
  border-color: var(--card-highlight);
  box-shadow: var(--shadow-md);
}

.tool-bento-card .tool-icon-box {
  background: var(--card-tint);
  border: 1px solid var(--card-tint);
  transition: transform 0.22s ease;
}

.tool-bento-card:hover .tool-icon-box,
.tool-bento-card:focus-visible .tool-icon-box {
  transform: rotate(-6deg) scale(1.08);
}

.tool-bento-card > .row-between span:last-child {
  transition: transform 0.2s ease;
}

.tool-bento-card:hover > .row-between span:last-child,
.tool-bento-card:focus-visible > .row-between span:last-child {
  transform: translateX(0.3rem);
}

.btn-primary {
  background: linear-gradient(135deg, #755ae4, #5840c2);
  border-color: #6248cc;
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6248cc, #4933a8);
}

.panel-card,
.desktop-sidebar {
  box-shadow: var(--shadow-sm);
}

.dropzone {
  background: linear-gradient(145deg, var(--bg-accent-soft), var(--bg-subtle));
}

:is(button, a, input, select, .tool-bento-card):focus-visible {
  outline: 3px solid var(--border-accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
