:root {
  color-scheme: dark;

  --bg-canvas: #08090d;
  --bg-surface: #11131a;
  --bg-surface-2: #171a23;
  --bg-elevated: #1e222e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.17);

  --text-primary: #f4f5f8;
  --text-secondary: #a2a9b9;
  --text-muted: #6e7688;

  --accent-amber: #ffae2b;
  --accent-teal: #4ce6d4;
  --accent-rose: #ff6b98;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-card: 0 20px 55px rgba(0, 0, 0, 0.45);

  --scrollbar-track: #0d0f14;
  --scrollbar-thumb: #394052;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;

  accent-color: var(--accent-amber);
}

@supports not (scrollbar-color: auto) {
  :root,
  .studio-dialog {
    scrollbar-width: auto;
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
}

/* Fallback for browsers without native accent-color (modern-web-guidance: brand-consistent-forms) */
@supports not (accent-color: #ffae2b) {
  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
  }

  input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--accent-amber) var(--progress, 72%), #2f3545 var(--progress, 72%));
    border-radius: 999px;
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--accent-amber);
    cursor: pointer;
    margin-top: -4px;
  }

  input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #2f3545;
    border-radius: 999px;
  }

  input[type="range"]::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--accent-amber);
    border: none;
    cursor: pointer;
  }

  input[type="range"]::-moz-range-progress {
    background-color: var(--accent-amber);
    height: 6px;
    border-radius: 999px;
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 14% -8%, rgba(76, 230, 212, 0.08), transparent 60%),
    radial-gradient(900px 520px at 88% 0%, rgba(255, 174, 43, 0.08), transparent 60%),
    var(--bg-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 2px;
}

/* ==========================================================================
   HEADER & NAVIGATION BAR
   ========================================================================== */
.studio-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background: rgba(8, 9, 13, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner,
.toolbar-inner,
.studio-main,
.studio-footer {
  max-width: 1480px;
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 36px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px 12px;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eafffa 0%, #4ce6d4 48%, #0f6f75 100%);
  box-shadow: 0 0 18px rgba(76, 230, 212, 0.72);
  flex-shrink: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.71rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-teal);
  font-weight: 650;
}

.studio-header h1 {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 1.9vw, 1.44rem);
  font-weight: 660;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

/* Character Switcher Pills */
.char-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.81rem;
  font-weight: 560;
  transition: all 0.16s ease;
}

.nav-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.nav-pill.is-active {
  background: var(--text-primary);
  color: #090b10;
  border-color: var(--text-primary);
  font-weight: 660;
}

.nav-pill .pill-num {
  font-size: 0.71rem;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

/* Toolbar */
.toolbar {
  border-top: 1px solid var(--border-subtle);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
  flex-wrap: wrap;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 570;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #ffbe4d 0%, #ea9316 100%);
  color: #140c02;
  font-weight: 660;
  box-shadow: 0 6px 20px rgba(255, 166, 38, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffc966 0%, #f59f22 100%);
}

.btn-teal {
  background: linear-gradient(180deg, #62f2e0 0%, #2ec4b6 100%);
  color: #031918;
  font-weight: 660;
}

.btn-teal:hover {
  background: linear-gradient(180deg, #7cf6e7 0%, #38d2c3 100%);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-strong);
}

.btn-subtle {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-subtle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-subtle[aria-pressed="true"] {
  color: var(--text-primary);
  border-color: rgba(255, 174, 43, 0.48);
  background: rgba(255, 174, 43, 0.12);
}

.segmented {
  display: inline-flex;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 560;
  transition: all 0.15s ease;
}

.seg-btn.is-active {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text-primary);
}

/* Volume control */
.volume-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.volume-control input[type="range"] {
  width: 76px;
  margin: 0;
  cursor: pointer;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

body.motion-paused .pulse-dot {
  background: var(--text-muted);
  box-shadow: none;
}

/* ==========================================================================
   MAIN HUB VIEW (index.html — 4-Character Roster & Synced Emotion Tester)
   ========================================================================== */
.studio-main {
  padding-block: 22px 64px;
}

.hub-emotion-bar {
  background: linear-gradient(135deg, rgba(76, 230, 212, 0.08), rgba(18, 21, 29, 0.92) 55%);
  border: 1px solid rgba(76, 230, 212, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.hub-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.hub-bar-top p {
  margin: 0;
  font-size: 0.87rem;
  color: var(--text-secondary);
}

.hub-bar-top strong {
  color: var(--text-primary);
}

.quick-emo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-emo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(12, 14, 20, 0.72);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 570;
  transition: all 0.15s ease;
}

.quick-emo-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.quick-emo-btn.is-active {
  background: rgba(76, 230, 212, 0.16);
  border-color: rgba(76, 230, 212, 0.55);
  color: #a6fff4;
  font-weight: 650;
}

/* 2x2 Roster Grid */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

@media (max-width: 960px) {
  .roster-grid {
    grid-template-columns: 1fr;
  }
}

.roster-card {
  container-type: inline-size;
  background: linear-gradient(180deg, var(--bg-surface) 0%, #0c0e14 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2vw, 24px);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.roster-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.roster-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.iter-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding-inline: 8px;
  border-radius: 11px;
  background: rgba(76, 230, 212, 0.12);
  border: 1px solid rgba(76, 230, 212, 0.34);
  color: var(--accent-teal);
  font-weight: 720;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 670;
  letter-spacing: -0.015em;
}

.category-tag {
  font-size: 0.7rem;
  font-weight: 620;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.card-desc {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.roster-phone-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
}

.roster-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.roster-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Realistic iPhone Frame (Hub Cards) */
.phone-frame {
  position: relative;
  width: min(460px, 100%);
  aspect-ratio: 19.5 / 9.2;
  padding: 7px;
  border-radius: 30px;
  background: linear-gradient(145deg, #434855 0%, #1c1f27 35%, #0d0e13 68%, #313643 100%);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.68),
    inset 0 1px 1px rgba(255, 255, 255, 0.26),
    inset 0 -1px 1px rgba(0, 0, 0, 0.8);
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 23px;
  overflow: hidden;
  background: #040406;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.35s ease;
}

.dynamic-island {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 42px;
  border-radius: 999px;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 4;
  pointer-events: none;
}

.screen-gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.01) 34%, transparent 55%);
  pointer-events: none;
  z-index: 5;
}

.mini-stand {
  width: 52px;
  height: 12px;
  margin-top: -1px;
  background: linear-gradient(180deg, #2d313b 0%, #14161c 100%);
  border-radius: 0 0 11px 11px;
  opacity: 0.78;
}

.eye-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 440 / 210;
  display: block;
  user-select: none;
  position: relative;
  z-index: 2;
}

/* Portrait Handheld Mode Override */
body.mode-portrait .phone-frame {
  width: min(200px, 76%);
  aspect-ratio: 9 / 17.6;
  border-radius: 32px;
}

body.mode-portrait .phone-screen {
  border-radius: 25px;
  align-items: flex-start;
  padding-top: 34%;
}

body.mode-portrait .dynamic-island {
  left: 50%;
  top: 9px;
  transform: translateX(-50%);
  width: 48px;
  height: 12px;
}

body.mode-portrait .mini-stand,
body.mode-portrait .dock-hardware {
  display: none;
}

body.mode-portrait .hero-phone {
  max-width: 280px;
  aspect-ratio: 9 / 18.2;
  border-radius: 44px;
}

body.mode-portrait .hero-phone-bezel {
  border-radius: 35px;
}

body.mode-portrait .hero-phone-screen {
  border-radius: 32px;
  align-items: flex-start;
  padding-top: 38%;
}

body.mode-portrait .hero-dynamic-island {
  left: 50%;
  top: 13px;
  transform: translateX(-50%);
  width: 72px;
  height: 18px;
}

/* ==========================================================================
   INDIVIDUAL CHARACTER LAB WORKBENCH (aether.html / nori.html / suki.html / dusk.html)
   ========================================================================== */
.lab-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(380px, 1.12fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 1060px) {
  .lab-layout {
    grid-template-columns: 1fr;
  }
}

.stage-column {
  position: sticky;
  top: 124px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 1060px) {
  .stage-column {
    position: static;
  }
}

.dock-stage-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(620px 360px at 50% 40%, rgba(76, 230, 212, 0.08), transparent 70%),
    linear-gradient(180deg, #0d1017 0%, #121620 70%, #0a0c10 100%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-height: 440px;
}

.stage-top-strip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  z-index: 3;
}

.active-emo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 630;
}

.stage-ambient {
  position: absolute;
  width: 460px;
  height: 260px;
  border-radius: 50%;
  filter: blur(74px);
  opacity: 0.34;
  pointer-events: none;
  transition: background 0.45s ease;
}

.dock-assembly {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  width: 100%;
  max-width: 520px;
}

.hero-phone {
  width: 100%;
  aspect-ratio: 19.5 / 9.2;
  padding: 10px;
  border-radius: 42px;
  background: linear-gradient(145deg, #4f5463 0%, #21242d 32%, #0d0e13 65%, #393e4b 100%);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.78),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.3),
    inset 0 -2px 2px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 3;
  transition: transform 0.22s ease-out;
}

.hero-phone-bezel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 33px;
  background: #000;
  padding: 3px;
}

.hero-dynamic-island {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 62px;
  border-radius: 999px;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 6;
}

.hero-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease;
}

.hero-eye-canvas {
  width: 100%;
  height: auto;
  max-height: 100%;
}

/* Swivel Desk Dock */
.dock-hardware {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -6px;
  position: relative;
  z-index: 2;
}

.dock-neck {
  width: 34px;
  height: 26px;
  background: linear-gradient(90deg, #1b1d22 0%, #5c6270 32%, #1d2026 68%, #3c404a 100%);
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.7);
}

.dock-dome {
  width: 174px;
  height: 78px;
  margin-top: -4px;
  border-radius: 88px 88px 22px 22px / 70px 70px 16px 16px;
  background: radial-gradient(120% 90% at 36% 24%, #454954 0%, #24272f 42%, #121419 85%, #0c0d10 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.14),
    0 14px 30px rgba(0, 0, 0, 0.75);
  position: relative;
  overflow: hidden;
}

.dock-seam {
  position: absolute;
  top: 22px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.75) 20%, rgba(255, 255, 255, 0.12) 50%, rgba(0, 0, 0, 0.75) 80%, transparent);
}

.dock-base-collar {
  width: 160px;
  height: 17px;
  margin-top: -3px;
  background: linear-gradient(180deg, #101216 0%, #1c1f27 100%);
  border-radius: 0 0 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.usb-port {
  width: 12px;
  height: 5px;
  border-radius: 999px;
  background: #050507;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

.usb-port.wide {
  width: 18px;
}

.dock-shadow {
  width: 240px;
  height: 18px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.82), transparent 72%);
}

.stage-hint {
  margin: 16px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  z-index: 2;
  text-align: center;
}

/* Live Sound Meter & Quick Stage Controls Bar */
.stage-controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sound-meter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.meter-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  flex: 1 1 160px;
  max-width: 240px;
}

.meter-bar {
  flex: 1;
  min-height: 4px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #74f7e7 0%, #30a8c8 100%);
  opacity: 0.45;
  transition: height 0.06s linear, opacity 0.1s ease;
}

.recipe-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-card h3 {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .recipe-grid {
    grid-template-columns: 1fr;
  }
}

.recipe-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 11px 13px;
}

.recipe-box strong {
  display: block;
  font-size: 0.76rem;
  color: var(--accent-amber);
  margin-bottom: 4px;
}

.recipe-box p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   20-EMOTION TRIGGER DECK (Right Column on Individual Character Pages)
   ========================================================================== */
.deck-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.emo-category-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.emo-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.emo-cat-head h2 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
  font-weight: 680;
}

.emo-cat-count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.emo-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 9px;
}

.emo-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  text-align: left;
  transition: all 0.15s ease;
}

.emo-tile:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

.emo-tile.is-active {
  background: linear-gradient(145deg, rgba(76, 230, 212, 0.16), rgba(255, 174, 43, 0.09));
  border-color: rgba(76, 230, 212, 0.58);
  box-shadow: 0 0 0 1px rgba(76, 230, 212, 0.18);
}

.emo-tile-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.emo-tile-name {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--text-primary);
}

.emo-tile-icon {
  font-size: 0.96rem;
  line-height: 1;
}

.emo-tile-cue {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.32;
}

.emo-tile.is-active .emo-tile-cue {
  color: var(--text-secondary);
}

/* Notes block */
.notes-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.note-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 660;
}

.note-input {
  width: 100%;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: #0b0d13;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.note-input:focus {
  border-color: rgba(76, 230, 212, 0.55);
}

/* ==========================================================================
   NATIVE MODAL DIALOGS (modern-web-guidance compliant)
   ========================================================================== */
dialog.studio-dialog {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: #101218;
  color: var(--text-primary);
  max-width: min(1060px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  width: 100%;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.8);
}

dialog.studio-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog.studio-dialog:modal {
  overscroll-behavior: contain;
}

dialog.studio-dialog::backdrop {
  background: rgba(4, 5, 8, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 18, 24, 0.96);
  position: sticky;
  top: 0;
  z-index: 6;
}

.dialog-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-title-group h2 {
  margin: 0;
  font-size: 1.12rem;
}

.dialog-subtitle {
  margin: 2px 0 0;
  font-size: 0.81rem;
  color: var(--text-secondary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all 0.16s ease;
}

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

.catalog-body {
  padding: 20px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.catalog-table th,
.catalog-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.catalog-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.catalog-table td:first-child {
  white-space: nowrap;
  font-weight: 650;
  color: var(--text-primary);
}

.catalog-table td {
  color: var(--text-secondary);
}

.studio-footer {
  padding-block: 18px 36px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.77rem;
  border-top: 1px solid var(--border-subtle);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #f4f5f8;
  color: #08090d;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 99;
}

/* ==========================================================================
   ALICE LIVE CONVERSATION STAGE (wip/alice.html)
   ========================================================================== */
.visually-hidden {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.nav-pill.is-alice {
  border-color: rgba(255, 174, 43, 0.42);
  color: #ffd380;
  background: rgba(255, 174, 43, 0.1);
}

.nav-pill.is-alice.is-active {
  background: linear-gradient(180deg, #ffbe4d 0%, #ea9316 100%);
  color: #140c02;
  border-color: transparent;
}

.alice-eye-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
  z-index: 3;
  flex-wrap: wrap;
}

.mini-char-tabs {
  display: inline-flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
}

.mini-char-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  transition: all 0.15s ease;
}

.mini-char-tab:hover {
  color: var(--text-primary);
}

.mini-char-tab.is-active {
  background: rgba(76, 230, 212, 0.2);
  color: #9bfcf0;
}

.intent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.mic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(76, 230, 212, 0.48);
  background: linear-gradient(180deg, rgba(76, 230, 212, 0.22), rgba(20, 96, 102, 0.35));
  color: #d6fffa;
  font-weight: 650;
  font-size: 0.86rem;
  transition: all 0.16s ease;
}

.mic-btn:hover {
  background: linear-gradient(180deg, rgba(76, 230, 212, 0.32), rgba(26, 118, 124, 0.46));
}

.mic-btn.is-recording {
  border-color: #4ce6d4;
  background: linear-gradient(180deg, rgba(76, 230, 212, 0.34), rgba(18, 118, 114, 0.52));
  color: #ffffff;
  box-shadow: 0 0 24px rgba(76, 230, 212, 0.42);
}

.always-on-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.16s ease;
}

.always-on-pill.is-live {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.1);
  color: #bbf7d0;
}

.live-mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.always-on-pill.is-live .live-mic-dot {
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.9);
  animation: micPulse 1.6s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.28); opacity: 1; }
}

.voice-status-strip {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.voice-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.77rem;
  color: var(--text-secondary);
}

.live-heard-text {
  color: var(--text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72%;
}

.live-heard-text.is-active-speech {
  color: #a6fff4;
  font-style: normal;
}

.silence-timer-label {
  font-variant-numeric: tabular-nums;
  font-weight: 640;
  color: var(--accent-teal);
  flex-shrink: 0;
}

.silence-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.silence-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ce6d4 0%, #ffbe4d 100%);
  transition: width 0.08s linear;
}

.voice-select {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--text-primary);
}

/* Chat Panel */
.chat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: min(740px, calc(100dvh - 155px));
  min-height: 520px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.chat-starters {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.chat-starters-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 660;
}

.starter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.starter-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 0.76rem;
  transition: all 0.14s ease;
}

.starter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(76, 230, 212, 0.45);
  background: rgba(76, 230, 212, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  gap: 5px;
}

.msg-row.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.is-alice {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.48;
}

.msg-row.is-user .msg-bubble {
  background: linear-gradient(145deg, #273248, #1c2436);
  border: 1px solid rgba(114, 168, 255, 0.28);
  border-bottom-right-radius: 5px;
  color: var(--text-primary);
}

.msg-row.is-alice .msg-bubble {
  background: linear-gradient(145deg, #171c25, #12151d);
  border: 1px solid rgba(76, 230, 212, 0.24);
  border-bottom-left-radius: 5px;
  color: var(--text-primary);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.msg-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(76, 230, 212, 0.12);
  border: 1px solid rgba(76, 230, 212, 0.28);
  color: #88f7eb;
  font-weight: 600;
}

.msg-replay-btn {
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
}

.msg-replay-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.chat-empty-hint {
  margin: auto;
  text-align: center;
  max-width: 38ch;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.chat-empty-hint strong {
  color: var(--text-primary);
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(9, 11, 16, 0.92);
}

.chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 110px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: #12151d;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-input:focus {
  border-color: rgba(76, 230, 212, 0.55);
}

/* Alice Memory Card */
.memory-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-head h3 {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.memory-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.memory-chip {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 174, 43, 0.12);
  border: 1px solid rgba(255, 174, 43, 0.3);
  color: #ffd588;
}

.memory-empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   ELEVENLABS 10-VOICE AUDITION LAB (wip/voices.html)
   ========================================================================== */
.nav-pill.is-voices {
  border-color: rgba(162, 134, 255, 0.42);
  color: #d6c4ff;
  background: rgba(162, 134, 255, 0.1);
}

.nav-pill.is-voices.is-active {
  background: linear-gradient(180deg, #b894ff 0%, #8356f0 100%);
  color: #fff;
  border-color: transparent;
}

.connect-banner {
  background: linear-gradient(135deg, rgba(162, 134, 255, 0.12), rgba(18, 20, 29, 0.94) 60%);
  border: 1px solid rgba(162, 134, 255, 0.34);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.connect-banner h2 {
  margin: 0;
  font-size: 1.05rem;
}

.connect-banner p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.connect-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.text-field {
  flex: 1 1 320px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #0c0e14;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.text-field:focus {
  border-color: #a888ff;
}

.voice-lab-hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.35fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

@media (max-width: 920px) {
  .voice-lab-hero {
    grid-template-columns: 1fr;
  }
}

.voice-preview-stage {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.voice-controls-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.voice-card {
  background: linear-gradient(180deg, var(--bg-surface) 0%, #0d0f16 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

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

.voice-card.is-playing {
  border-color: rgba(76, 230, 212, 0.65);
  box-shadow: 0 0 0 1px rgba(76, 230, 212, 0.22), 0 14px 36px rgba(0, 0, 0, 0.45);
}

.voice-card.is-selected {
  border-color: rgba(255, 174, 43, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 174, 43, 0.22);
}

.voice-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.voice-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(162, 134, 255, 0.15);
  border: 1px solid rgba(162, 134, 255, 0.35);
  color: #d6c4ff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.voice-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 660;
}

.voice-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.voice-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.voice-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
