:root {
  color-scheme: dark;

  /* iOS 26 Dark Mode — Crisp Obsidian & Crystal-Clear Liquid Glass */
  --obsidian: #04060a;
  --obsidian-elevated: #11151d;
  --bg-canvas: #04060a;
  --surface-solid: #11151d;
  --surface-grouped: rgba(15, 19, 27, 0.44);
  --surface-elevated: rgba(24, 29, 39, 0.68);
  --surface-subtle: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --fill-subtle: rgba(140, 150, 170, 0.14);
  --fill-secondary: rgba(140, 150, 170, 0.25);
  --separator: rgba(165, 178, 202, 0.18);
  --separator-subtle: rgba(165, 178, 202, 0.12);

  /* Optical Backdrop Filters (Dark) */
  --backdrop-module: blur(18px) saturate(160%);
  --backdrop-card: blur(22px) saturate(170%);
  --backdrop-glass: blur(26px) saturate(180%);
  --backdrop-btn: blur(20px) saturate(170%);
  --backdrop-bar: blur(28px) saturate(190%);

  /* 3-Tier Water-Clear Liquid Glass Tokens (Dark) */
  --module-glass-bg: rgba(15, 19, 27, 0.44);
  --module-sheen: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(255, 255, 255, 0.015) 50%,
    rgba(190, 210, 240, 0.04) 100%
  );
  --module-rim: rgba(255, 255, 255, 0.14);
  --module-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.22),
    inset 1px 0 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.4),
    0 8px 22px rgba(0, 0, 0, 0.44),
    0 2px 6px rgba(0, 0, 0, 0.24);

  --card-glass-bg: rgba(19, 24, 34, 0.5);
  --card-sheen: linear-gradient(
    148deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(190, 212, 244, 0.055) 100%
  );
  --card-elevated-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.25),
    inset 1px 0 0 rgba(255, 255, 255, 0.11),
    inset 0 -1.5px 2px rgba(0, 0, 0, 0.44),
    0 12px 30px rgba(0, 0, 0, 0.54),
    0 2px 8px rgba(0, 0, 0, 0.3);

  --glass-bg: rgba(21, 26, 37, 0.54);
  --glass-card-bg: rgba(19, 24, 34, 0.52);
  --glass-sheet-bg: rgba(15, 19, 27, 0.82);
  --glass-popover-bg: rgba(20, 24, 34, 0.88);
  --glass-sheen: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.13) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(190, 212, 244, 0.055) 100%
  );
  --rim: rgba(255, 255, 255, 0.18);
  --rim-strong: rgba(255, 255, 255, 0.3);
  --specular-top: rgba(255, 255, 255, 0.28);
  --specular-left: rgba(255, 255, 255, 0.1);
  --specular-bottom: rgba(0, 0, 0, 0.4);
  --glass-shadow:
    0 12px 28px rgba(0, 0, 0, 0.52),
    0 2px 8px rgba(0, 0, 0, 0.3);
  --card-shadow: var(--card-elevated-shadow);

  /* Typography & Pure Monochrome / Matte Semantic Accents (Dark) */
  --ink: #ffffff;
  --ink-secondary: #ffffff;
  --ink-tertiary: #ffffff;
  --input-placeholder: rgba(205, 209, 218, 0.72);
  --ios-tint: #84a8cf;
  --ios-tint-top: #9cbce0;
  --ios-tint-deep: #6b8eb6;
  --ios-tint-text: #ffffff;
  --ios-tint-soft: rgba(132, 168, 207, 0.15);
  --ios-tint-border: rgba(155, 187, 224, 0.28);
  --ios-tint-glow: rgba(132, 168, 207, 0.22);
  --ios-indigo: #8a96b8;
  --ios-indigo-soft: rgba(138, 150, 184, 0.16);
  --ios-green: #4ea974;
  --ios-orange: #c9a679;
  --ios-red: #d97b76;
  --ios-red-soft: rgba(217, 123, 118, 0.16);
  --ios-red-border: rgba(217, 123, 118, 0.34);
  --on-tint: #ffffff;

  /* Compatibility aliases (used by owner-console.css) */
  --amber: #9bbbe0;
  --amber-deep: var(--ios-tint);
  --dusk-rose: var(--ios-indigo);
  --ivory: #f4f7fb;

  /* Water-Clear Primary CTA & Quieter Secondary Controls (Dark) */
  --cta-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 52%,
    rgba(255, 255, 255, 0.14) 100%
  );
  --cta-ink: #ffffff;
  --cta-border: rgba(255, 255, 255, 0.38);
  --cta-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.46),
    inset 0 -1.5px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px rgba(0, 0, 0, 0.52),
    0 2px 8px rgba(0, 0, 0, 0.3);
  --cta-icon-bg: rgba(255, 255, 255, 0.14);

  --hero-cta-bg: linear-gradient(
    180deg,
    rgba(122, 168, 224, 0.28) 0%,
    rgba(90, 134, 192, 0.2) 100%
  );
  --hero-cta-border: rgba(156, 194, 238, 0.36);
  --hero-cta-shadow:
    inset 0 1.5px 0 rgba(210, 232, 255, 0.34),
    inset 0 -1.5px 2px rgba(0, 0, 0, 0.38),
    0 10px 24px rgba(0, 0, 0, 0.48),
    0 2px 8px rgba(0, 0, 0, 0.28);

  --composer-halo-min:
    0 0 0 1px rgba(128, 184, 248, 0.16),
    0 0 14px 1px rgba(114, 174, 246, 0.16),
    0 0 28px 3px rgba(124, 160, 240, 0.09);
  --composer-halo-max:
    0 0 0 1.5px rgba(146, 198, 255, 0.32),
    0 0 24px 5px rgba(114, 176, 250, 0.3),
    0 0 46px 10px rgba(132, 168, 246, 0.16);

  --btn-dome-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(255, 255, 255, 0.025) 56%,
    rgba(255, 255, 255, 0.05) 100%
  ), rgba(21, 26, 37, 0.46);
  --btn-dome-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.32),
    0 3px 10px rgba(0, 0, 0, 0.28);

  --well-bg: rgba(5, 8, 14, 0.56);
  --well-rim: rgba(255, 255, 255, 0.09);
  --well-inset-shadow: rgba(0, 0, 0, 0.55);

  --segment-thumb-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  --segment-thumb-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 3px 10px rgba(0, 0, 0, 0.38);
  --tab-lens-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  --tab-lens-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.28),
    0 4px 12px rgba(0, 0, 0, 0.28);

  --icon-well-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  --icon-well-specular: rgba(255, 255, 255, 0.2);
  --icon-well-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);

  --backdrop-scrim: rgba(4, 6, 12, 0.62);
  --wave-idle: rgba(218, 226, 240, 0.22);
  --playhead-color: #f4f7fb;
  --playhead-shadow: 0 0 8px rgba(155, 187, 224, 0.55);
  --lyric-glow: 0 0 16px rgba(155, 187, 224, 0.22);
  --meter-bg: rgba(8, 11, 18, 0.5);
  --meter-filter: saturate(0.45) brightness(0.95);
  --grabber-color: rgba(218, 226, 240, 0.26);
  --switch-knob-shadow: 0 3px 8px rgba(0, 0, 0, 0.38), 0 1px 2px rgba(0, 0, 0, 0.22);

  /* Quiet Moonlit Silver-Slate Atmospheric Pools (Dark) */
  --welcome-wash:
    radial-gradient(ellipse 88% 48% at 50% 24%, rgba(122, 152, 196, 0.12), rgba(92, 112, 152, 0.055) 48%, transparent 74%),
    radial-gradient(ellipse 70% 38% at 15% 78%, rgba(112, 142, 186, 0.075), transparent 72%);
  --player-wash:
    radial-gradient(ellipse 90% 46% at 50% 18%, rgba(122, 152, 196, 0.12), rgba(92, 112, 152, 0.055) 46%, transparent 74%),
    radial-gradient(ellipse 74% 34% at 50% 92%, rgba(120, 146, 184, 0.08), transparent 72%);
  --shell-wash:
    radial-gradient(ellipse 76% 42% at 86% 6%, rgba(126, 156, 198, 0.12), rgba(92, 112, 152, 0.055) 48%, transparent 74%),
    radial-gradient(ellipse 68% 44% at 8% 44%, rgba(112, 140, 182, 0.08), transparent 74%),
    radial-gradient(ellipse 62% 38% at 92% 66%, rgba(102, 124, 166, 0.07), transparent 76%),
    radial-gradient(ellipse 84% 34% at 50% 96%, rgba(118, 146, 188, 0.09), transparent 74%);

  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Noto Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei UI", sans-serif;

  font: 16px/1.55 var(--font-ui);
  color: var(--ink);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

:root[data-theme="light"] {
  color-scheme: light;
  font-weight: 450;

  /* iOS 26 Light Mode — Bright Porcelain-Ice Daylight + Crystal-Clear Liquid Glass */
  --obsidian: #f8fafe;
  --obsidian-elevated: #ffffff;
  --bg-canvas: #f8fafe;
  --surface-solid: #ffffff;
  --surface-grouped: rgba(255, 255, 255, 0.56);
  --surface-elevated: rgba(255, 255, 255, 0.78);
  --surface-subtle: rgba(255, 255, 255, 0.58);
  --surface-hover: rgba(255, 255, 255, 0.84);
  --fill-subtle: rgba(110, 138, 174, 0.08);
  --fill-secondary: rgba(110, 138, 174, 0.14);
  --separator: rgba(15, 23, 42, 0.09);
  --separator-subtle: rgba(15, 23, 42, 0.06);

  /* Optical Backdrop Filters (Light — Bright & Crisp) */
  --backdrop-module: blur(14px) saturate(150%) brightness(1.03);
  --backdrop-card: blur(18px) saturate(160%) brightness(1.03);
  --backdrop-glass: blur(20px) saturate(170%) brightness(1.04);
  --backdrop-btn: blur(16px) saturate(160%) brightness(1.04);
  --backdrop-bar: blur(22px) saturate(175%) brightness(1.04);

  /* 3-Tier Crystal-Clear Liquid Glass (Light — Bright Specular Rims, Tight Shadows) */
  --module-glass-bg: rgba(255, 255, 255, 0.58);
  --module-sheen: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.24) 48%,
    rgba(255, 255, 255, 0.54) 100%
  );
  --module-rim: rgba(255, 255, 255, 0.94);
  --module-shadow:
    inset 0 1.5px 0 #ffffff,
    inset 1px 0 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 1px rgba(116, 146, 184, 0.07),
    0 4px 14px rgba(24, 52, 88, 0.045),
    0 1px 2.5px rgba(24, 52, 88, 0.03),
    0 0 0 0.5px rgba(120, 148, 184, 0.17);

  --card-glass-bg: rgba(255, 255, 255, 0.64);
  --card-sheen: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.3) 46%,
    rgba(255, 255, 255, 0.6) 100%
  );
  --card-elevated-shadow:
    inset 0 1.5px 0 #ffffff,
    inset 1px 0 0 rgba(255, 255, 255, 0.78),
    inset 0 -1px 1.5px rgba(116, 146, 184, 0.08),
    0 6px 20px rgba(24, 52, 88, 0.055),
    0 1.5px 4px rgba(24, 52, 88, 0.035),
    0 0 0 0.5px rgba(120, 148, 184, 0.19);

  --glass-bg: rgba(255, 255, 255, 0.68);
  --glass-card-bg: rgba(255, 255, 255, 0.66);
  --glass-sheet-bg: rgba(252, 254, 255, 0.86);
  --glass-popover-bg: rgba(255, 255, 255, 0.92);
  --glass-sheen: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.36) 50%,
    rgba(255, 255, 255, 0.64) 100%
  );
  --rim: rgba(255, 255, 255, 0.96);
  --rim-strong: rgba(100, 128, 164, 0.24);
  --specular-top: #ffffff;
  --specular-left: rgba(255, 255, 255, 0.8);
  --specular-bottom: rgba(116, 146, 184, 0.09);
  --glass-shadow:
    0 7px 20px rgba(24, 52, 88, 0.065),
    0 1.5px 4px rgba(24, 52, 88, 0.035),
    0 0 0 0.5px rgba(120, 148, 184, 0.2);
  --card-shadow: var(--card-elevated-shadow);

  /* Typography & Matte Semantic Accents (Light) */
  --ink: #313640;
  --ink-secondary: #4d535e;
  --ink-tertiary: #606773;
  --input-placeholder: rgba(46, 51, 59, 0.72);
  --ios-tint: #5b7fa6;
  --ios-tint-top: #7496ba;
  --ios-tint-deep: #436488;
  --ios-tint-text: var(--ink);
  --ios-tint-soft: rgba(91, 127, 166, 0.1);
  --ios-tint-border: rgba(91, 127, 166, 0.24);
  --ios-tint-glow: rgba(91, 127, 166, 0.18);
  --ios-indigo: #6b7ba2;
  --ios-indigo-soft: rgba(107, 123, 162, 0.11);
  --ios-green: #4cae74;
  --ios-orange: #b89872;
  --ios-red: #b84a45;
  --ios-red-soft: rgba(184, 74, 69, 0.1);
  --ios-red-border: rgba(184, 74, 69, 0.26);

  --amber: #3d5f82;
  --amber-deep: var(--ios-tint-deep);
  --dusk-rose: var(--ios-indigo);

  /* Crystal-Clear Achromatic Primary CTA & Quieter Secondary Controls (Light) */
  --cta-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 252, 255, 0.78) 52%,
    rgba(255, 255, 255, 0.92) 100%
  );
  --cta-ink: var(--ink);
  --cta-border: rgba(255, 255, 255, 0.98);
  --cta-shadow:
    inset 0 1.5px 0 #ffffff,
    inset 0 -1px 1.5px rgba(96, 128, 168, 0.14),
    0 6px 18px rgba(24, 52, 88, 0.08),
    0 1.5px 4px rgba(15, 23, 42, 0.05),
    0 0 0 0.5px rgba(100, 128, 164, 0.22);
  --cta-icon-bg: rgba(15, 23, 42, 0.055);

  --hero-cta-bg: linear-gradient(
    180deg,
    rgba(226, 240, 255, 0.88) 0%,
    rgba(208, 229, 252, 0.72) 100%
  );
  --hero-cta-border: rgba(148, 186, 228, 0.46);
  --hero-cta-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.94),
    inset 0 -1px 1.5px rgba(96, 138, 188, 0.14),
    0 6px 18px rgba(32, 72, 122, 0.08),
    0 1.5px 4px rgba(15, 23, 42, 0.045),
    0 0 0 0.5px rgba(120, 162, 212, 0.24);

  --composer-halo-min:
    0 0 0 1px rgba(114, 174, 242, 0.16),
    0 0 14px 1px rgba(108, 172, 244, 0.16),
    0 0 28px 2px rgba(142, 194, 252, 0.1);
  --composer-halo-max:
    0 0 0 1.5px rgba(104, 168, 240, 0.34),
    0 0 24px 5px rgba(104, 170, 244, 0.3),
    0 0 44px 10px rgba(146, 198, 254, 0.17);

  --btn-dome-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.58) 54%,
    rgba(252, 254, 255, 0.76) 100%
  );
  --btn-dome-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 1px rgba(116, 146, 184, 0.07),
    0 2.5px 8px rgba(24, 52, 88, 0.045),
    0 0 0 0.5px rgba(120, 148, 184, 0.17);

  --well-bg: rgba(118, 146, 182, 0.08);
  --well-rim: rgba(255, 255, 255, 0.88);
  --well-inset-shadow: rgba(24, 52, 88, 0.06);

  --segment-thumb-bg: linear-gradient(180deg, #ffffff 0%, rgba(252, 254, 255, 0.95) 100%);
  --segment-thumb-shadow:
    inset 0 1px 0 #ffffff,
    0 2px 7px rgba(24, 52, 88, 0.075),
    0 0 0 0.5px rgba(120, 148, 184, 0.14);
  --tab-lens-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 255, 0.86) 100%);
  --tab-lens-shadow:
    inset 0 1.5px 0 #ffffff,
    inset 0 -1px 1px rgba(116, 146, 184, 0.07),
    0 2.5px 8px rgba(24, 52, 88, 0.075),
    0 0 0 0.5px rgba(120, 148, 184, 0.15);

  --icon-well-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 255, 0.72));
  --icon-well-specular: #ffffff;
  --icon-well-shadow: 0 1.5px 4px rgba(24, 52, 88, 0.05), 0 0 0 0.5px rgba(120, 148, 184, 0.14);

  --backdrop-scrim: rgba(15, 23, 42, 0.18);
  --wave-idle: rgba(38, 48, 64, 0.18);
  --playhead-color: #0f172a;
  --playhead-shadow: 0 1px 6px rgba(15, 23, 42, 0.24);
  --lyric-glow: none;
  --meter-bg: rgba(118, 146, 182, 0.06);
  --meter-filter: saturate(0.25) brightness(0.45);
  --grabber-color: rgba(38, 48, 64, 0.2);
  --switch-knob-shadow: 0 2.5px 7px rgba(15, 23, 42, 0.15), 0 1px 2px rgba(15, 23, 42, 0.08);

  /* High-Luminance Crystal-Ice Sunlight Washes (Zero Gray Haze) */
  --welcome-wash:
    radial-gradient(ellipse 84% 48% at 50% 24%, rgba(255, 255, 255, 0.98), rgba(224, 240, 255, 0.28) 54%, transparent 78%);
  --player-wash:
    radial-gradient(ellipse 88% 46% at 50% 18%, rgba(255, 255, 255, 0.96), rgba(224, 240, 255, 0.24) 52%, transparent 76%),
    radial-gradient(ellipse 74% 34% at 50% 94%, rgba(228, 242, 255, 0.22), transparent 72%);
  --shell-wash:
    radial-gradient(ellipse 78% 42% at 86% 6%, rgba(218, 238, 255, 0.34), rgba(238, 247, 255, 0.14) 50%, transparent 76%),
    radial-gradient(ellipse 64% 42% at 10% 42%, rgba(230, 243, 255, 0.24), transparent 72%),
    radial-gradient(ellipse 76% 34% at 50% 96%, rgba(224, 240, 255, 0.26), transparent 74%);
}

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

html, body {
  margin: 0;
  min-width: 280px;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--ink);
  overflow-x: hidden;
  transition: background-color 240ms var(--ease-out), color 200ms var(--ease-out);
}

button, a {
  color: inherit;
  touch-action: manipulation;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  text-decoration: none;
}

h1, h2, h3, p {
  margin: 0;
}

svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

::selection {
  background: var(--ios-tint-soft);
  color: var(--ink);
}

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:not([type="text"]):focus-visible,
select:focus-visible,
.seek-track:focus-within {
  outline: 2px solid var(--ios-tint);
  outline-offset: 2px;
}

:is(textarea, input[type="text"], input:not([type]))::placeholder {
  color: var(--input-placeholder);
  opacity: 1;
}

:is(textarea, input[type="text"], input:not([type])):focus {
  outline: none;
  caret-color: var(--ink);
}

:is(textarea, input[type="text"], input:not([type])):focus::placeholder {
  color: transparent;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* =====================
   3-TIER WATER-CLEAR LIQUID GLASS MATERIALS
   ===================== */
.glass-surface {
  border: 1px solid var(--rim);
  background: var(--glass-sheen), var(--glass-bg);
  box-shadow:
    inset 0 1.5px 0 var(--specular-top),
    inset 1px 0 0 var(--specular-left),
    inset 0 -1px 1.5px var(--specular-bottom),
    var(--glass-shadow);
  -webkit-backdrop-filter: var(--backdrop-glass);
  backdrop-filter: var(--backdrop-glass);
}

.glass-card {
  position: relative;
  border: 1px solid var(--rim);
  background: var(--card-sheen), var(--card-glass-bg);
  box-shadow: var(--card-elevated-shadow);
  -webkit-backdrop-filter: var(--backdrop-card);
  backdrop-filter: var(--backdrop-card);
}

.grouped-card.glass-surface,
.quick-tool-card.glass-surface,
.voice-entry-banner.glass-card,
.voice-recorder-panel.glass-card,
.voice-action-card.glass-card:not(.is-primary),
.empty-glass.glass-surface,
.sync-status-bar.glass-surface,
.ambient-volume-row.glass-surface,
.voice-feedback-bar.glass-surface {
  border: 1px solid var(--module-rim);
  background: var(--module-sheen), var(--module-glass-bg);
  box-shadow: var(--module-shadow);
  -webkit-backdrop-filter: var(--backdrop-module);
  backdrop-filter: var(--backdrop-module);
}

.segmented-control.glass-surface {
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow:
    inset 0 1.5px 3.5px var(--well-inset-shadow),
    0 1px 0 var(--specular-top);
  -webkit-backdrop-filter: var(--backdrop-module);
  backdrop-filter: var(--backdrop-module);
}

.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 160ms var(--ease-ios), background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.glass-circle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--rim);
  border-radius: 50%;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--ink);
  transition: transform 160ms var(--ease-ios), background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.amber-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--cta-border);
  border-radius: 999px;
  background: var(--cta-gradient);
  -webkit-backdrop-filter: var(--backdrop-bar);
  backdrop-filter: var(--backdrop-bar);
  color: var(--cta-ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: var(--cta-shadow);
  white-space: nowrap;
  transition: transform 160ms var(--ease-ios), filter 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.amber-cta:disabled,
.glass-btn:disabled {
  opacity: 0.44;
  cursor: default;
}

.amber-cta:active:not(:disabled),
.glass-btn:active:not(:disabled),
.glass-circle:active,
.skip-btn:active,
.mini-play-btn:active,
.composer-plus:active,
.composer-send:active,
.model-switcher:active,
.voice-switcher:active,
.style-switcher:active,
.status-capsule:active,
.studio-chapter-pill:active,
.ambient-tile:active {
  transform: scale(0.965) translateY(1px);
}

@media (hover: hover) and (pointer: fine) {
  .amber-cta:hover:not(:disabled) {
    filter: brightness(1.03);
  }
  .glass-btn:hover:not(:disabled) {
    color: var(--ink);
    border-color: var(--rim-strong);
  }
  .glass-circle:hover,
  .status-capsule:hover,
  .model-switcher:hover,
  .voice-switcher:hover,
  .style-switcher:hover,
  .studio-chapter-pill:hover {
    border-color: var(--rim-strong);
    filter: brightness(1.02);
  }
  .quick-tool-card:hover,
  .voice-entry-banner:hover {
    border-color: var(--rim-strong);
  }
  .grouped-row:hover,
  .sheet-list button:hover,
  .attach-popover button:hover,
  .ambient-tile:hover {
    background-color: var(--surface-hover);
  }
}

/* =====================
   FRAME & HEADER
   ===================== */
.screen {
  min-height: 100svh;
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  background: var(--bg-canvas);
}

.frame {
  width: min(100%, 580px);
  margin-inline: auto;
  padding-inline: max(18px, env(safe-area-inset-left, 0px)) max(18px, env(safe-area-inset-right, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding-top: max(16px, calc(env(safe-area-inset-top, 0px) + 8px));
}

.app-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
}

.theme-toggle-btn svg {
  width: 17px;
  height: 17px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-orb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffffff, var(--ios-tint-top) 56%, var(--ios-tint-deep) 100%);
  box-shadow: 0 0 10px var(--ios-tint-glow), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  animation: orb-breathe 5.5s ease-in-out infinite;
}

.brand-quiet .brand-orb {
  width: 9px;
  height: 9px;
}

@keyframes orb-breathe {
  0%, 100% {
    opacity: 0.78;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  max-width: 58vw;
  overflow: hidden;
  transition: transform 160ms var(--ease-ios), border-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.status-capsule span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ios-tint);
  opacity: 0.72;
}

.status-capsule.is-live {
  color: var(--ink);
  border-color: var(--ios-tint-border);
}

.status-capsule.is-live .status-dot {
  opacity: 1;
  background: var(--ios-green);
  box-shadow: 0 0 8px rgba(114, 150, 132, 0.65);
  animation: status-pulse 2.6s ease-in-out infinite;
}

.status-capsule.has-timer .status-dot {
  opacity: 1;
  background: var(--ios-indigo);
  box-shadow: 0 0 8px rgba(107, 123, 162, 0.65);
}

@keyframes status-pulse {
  0%, 100% {
    opacity: 0.65;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.22);
  }
}

.ambient-field {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ambient-field.is-interactive {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

/* =====================
   1. WELCOME SCREEN
   ===================== */
.welcome {
  background: var(--welcome-wash), var(--bg-canvas);
  background-attachment: fixed;
}

.welcome-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding-top: max(18px, calc(env(safe-area-inset-top, 0px) + 10px));
  padding-bottom: max(36px, calc(env(safe-area-inset-bottom, 0px) + 26px));
}

.welcome-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  justify-items: center;
}

.welcome-header-spacer {
  width: 36px;
  height: 36px;
}

.welcome-header .theme-toggle-btn {
  justify-self: end;
}

.welcome-stage {
  position: relative;
  min-height: 230px;
  margin-inline: -18px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 80%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 80%, transparent);
}

.welcome-stage .ambient-field {
  position: absolute;
  inset: 0;
}

.welcome-copy {
  text-align: center;
  max-width: 340px;
  margin-inline: auto;
  width: 100%;
}

.welcome-copy h1 {
  font-size: clamp(32px, 8vw, 42px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.welcome-subtitle {
  margin-top: 10px;
  color: var(--ink-secondary);
  font-size: 14.5px;
  line-height: 1.6;
}

.welcome-actions {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.welcome-primary {
  width: 100%;
  min-height: 52px;
  position: relative;
  padding-inline: 36px;
}

.welcome-primary svg {
  position: absolute;
  right: 18px;
  width: 17px;
  height: 17px;
}

.welcome-secondary {
  min-height: 44px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.welcome-secondary:hover {
  color: var(--ink);
  background: var(--fill-subtle);
}

/* =====================
   2. LISTENING STUDIO (#player)
   ===================== */
.player {
  background: var(--player-wash), var(--bg-canvas);
  background-attachment: fixed;
}

.player-frame {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100svh;
  padding-bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
}

.player-topbar {
  position: relative;
  z-index: 4;
  min-width: 0;
}

.back-pill {
  min-height: 36px;
  padding: 0 13px 0 9px;
  gap: 3px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  flex-shrink: 0;
}

.back-pill svg {
  width: 17px;
  height: 17px;
}

.player-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.player-studio-grid {
  display: grid;
  grid-template-rows: minmax(150px, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.player-particle-stage {
  position: relative;
  height: 100%;
  min-height: 150px;
  margin-inline: -18px;
  overflow: hidden;
}

.player-particle-stage .ambient-field {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
}

.stage-mode-toggle {
  --segment-padding: 3px;
  --segment-gap: 2px;
  --segment-fill: var(--segment-thumb-bg);
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}

.stage-mode-toggle::before {
  box-shadow: var(--segment-thumb-shadow);
}

.stage-mode-toggle button {
  min-width: 54px;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: color 160ms var(--ease-out);
}

.stage-mode-toggle button.is-active {
  color: var(--ink);
}

.stage-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 12px;
  color: var(--ink-tertiary);
  pointer-events: none;
  white-space: nowrap;
}

/* Synced Lyrics View */
.lyrics-scroll {
  position: absolute;
  inset: 42px 18px 4px;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

.lyrics-scroll::-webkit-scrollbar {
  display: none;
}

.lyrics-list {
  display: grid;
  gap: 12px;
  padding: 26px 4px 36px;
}

.lyric-line {
  display: block;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 17px;
  line-height: 1.62;
  font-weight: 400;
  text-align: center;
  transition: color 240ms var(--ease-out), transform 240ms var(--ease-out);
}

.lyric-line.is-past {
  color: var(--ink-secondary);
}

.lyric-line.is-active {
  color: var(--ink);
  font-weight: 500;
  text-shadow: var(--lyric-glow);
}

.player-studio-core {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.studio-title-block {
  text-align: center;
}

.studio-heading-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.studio-heading-row h1 {
  font-size: clamp(23px, 6vw, 28px);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
}

.studio-sub-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.studio-chapter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-secondary);
  transition: transform 150ms var(--ease-ios), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.studio-chapter-pill svg {
  width: 13px;
  height: 13px;
  color: var(--ink-tertiary);
}

.studio-wave-block {
  display: grid;
  gap: 4px;
  padding-inline: 2px;
  min-width: 0;
}

.waveform {
  display: grid;
  grid-template-columns: repeat(72, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  height: 30px;
  width: 100%;
}

.waveform-compact {
  height: 24px;
}

.waveform i {
  height: max(3px, var(--height));
  min-width: 0;
  border-radius: 999px;
  background: var(--wave-idle);
  transition: background-color 140ms linear;
}

.waveform i[data-played] {
  background: var(--ios-tint);
}

.seek-track {
  position: relative;
  display: grid;
  align-items: center;
  height: 40px;
  padding-inline: 2px;
  border-radius: 10px;
  touch-action: none;
  cursor: pointer;
}

.seek-line {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ios-tint) var(--progress), var(--wave-idle) var(--progress));
  box-shadow: inset 0 1px 1.5px var(--well-inset-shadow);
}

.chapter-notch {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--ios-indigo);
  opacity: 0.65;
  pointer-events: none;
}

.seek-position {
  position: absolute;
  top: 50%;
  left: var(--progress);
  width: 3px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--playhead-color);
  box-shadow: var(--playhead-shadow);
  pointer-events: none;
  transition: transform 120ms var(--ease-out);
}

.seek-track.is-dragging .seek-position {
  transform: translate(-50%, -50%) scaleY(1.16);
}

.seek-track:has(.seek-line) .seek-position {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--ios-tint);
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.22);
}

.scrub-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--rim);
  background: var(--glass-popover-bg);
  box-shadow:
    inset 0 1px 0 var(--specular-top),
    var(--glass-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
}

.scrub-chapter {
  margin-left: 4px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.seek-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.seek-times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-tertiary);
}

.time-toggle {
  border: 0;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 12px;
  font-weight: 400;
}

.studio-transport-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.transport-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.studio-play-btn {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
}

.studio-play-btn svg {
  width: 21px;
  height: 21px;
}

.player[data-playing] .studio-play-btn {
  animation: playback-halo 5s ease-in-out infinite;
}

@keyframes playback-halo {
  0%, 100% {
    box-shadow: var(--cta-shadow);
  }
  50% {
    box-shadow:
      var(--cta-shadow),
      0 0 0 5px var(--ios-tint-soft);
  }
}

.skip-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-secondary);
  transition: transform 150ms var(--ease-ios), background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.skip-btn:hover {
  background: var(--fill-subtle);
  color: var(--ink);
}

.skip-btn svg {
  width: 26px;
  height: 26px;
}

.skip-btn span {
  position: absolute;
  inset: 3px 0 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mini-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 68px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 150ms var(--ease-ios), border-color 160ms var(--ease-out), color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.mini-chip-btn svg {
  width: 14px;
  height: 14px;
}

.mini-chip-btn.is-active-chip {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
}

.playback-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink-secondary);
  font-size: 12.5px;
  text-align: center;
}

.playback-feedback.is-error {
  color: var(--ios-red);
}

.playback-feedback button,
.playback-feedback a {
  padding: 4px 11px;
  border: 1px solid var(--ios-tint-border);
  border-radius: 999px;
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
  font-size: 12px;
  font-weight: 500;
}

.reading-original p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* =====================
   FLOATING LIQUID GLASS COMPOSER DOCK
   ===================== */
.composer-dock {
  position: relative;
  border-radius: 28px;
  padding: 12px 12px 10px 14px;
  display: grid;
  gap: 8px;
  min-width: 0;
  box-shadow: var(--card-elevated-shadow), var(--composer-halo-min);
  animation: composer-breath 4.6s ease-in-out infinite;
  transition: border-color 180ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

@keyframes composer-breath {
  0%, 100% {
    box-shadow: var(--card-elevated-shadow), var(--composer-halo-min);
  }
  50% {
    box-shadow: var(--card-elevated-shadow), var(--composer-halo-max);
  }
}

.attach-popover {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 10px);
  width: min(calc(100% - 16px), 280px);
  padding: 6px;
  border-radius: 22px;
  background: var(--glass-sheen), var(--glass-popover-bg);
  z-index: 20;
  display: grid;
  gap: 2px;
}

.attach-popover button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background-color 150ms var(--ease-out);
}

.attach-popover svg {
  width: 18px;
  height: 18px;
  color: var(--ios-tint-text);
}

.attach-popover strong {
  display: block;
  font-size: 14px;
  font-weight: 400;
}

.attach-popover small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 12px;
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  font-size: 12px;
  color: var(--ink);
}

.attachment-thumb {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  object-fit: cover;
}

.attachment-chip svg {
  width: 15px;
  height: 15px;
  color: var(--ios-tint-text);
}

.attachment-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill-secondary);
  color: var(--ink-secondary);
}

.attachment-remove svg {
  width: 12px;
  height: 12px;
  color: var(--ink-secondary);
}

.composer-input {
  width: 100%;
  min-height: 42px;
  max-height: 100px;
  padding: 2px 2px 0;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.composer-plus {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--rim);
  border-radius: 50%;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink);
  transition: transform 160ms var(--ease-ios), background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.composer-plus.is-open {
  transform: rotate(45deg);
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
}

.composer-plus svg {
  width: 17px;
  height: 17px;
}

.model-switcher,
.voice-switcher,
.style-switcher {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: transform 150ms var(--ease-ios), border-color 160ms var(--ease-out), color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.model-dot {
  width: 5.5px;
  height: 5.5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ios-tint);
}

.model-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-switcher-compact {
  display: none;
}

.model-switcher svg,
.voice-switcher svg,
.style-switcher svg {
  width: 13px;
  height: 13px;
  color: var(--ink-tertiary);
}

.voice-switcher {
  max-width: min(150px, 36%);
}

.voice-switcher svg {
  flex: 0 0 auto;
}

.voice-switcher-label {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .voice-switcher-value {
    display: none;
  }
}

.story-composer .composer-toolbar {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 5px;
}

.story-composer .composer-left { flex: 1; min-width: 0; gap: 4px; flex-wrap: nowrap; }
.story-composer .composer-actions { flex: none; gap: 4px; }
.story-composer .composer-plus, .story-composer .composer-send { flex: 0 0 36px; width: 36px; height: 36px; }
.story-composer .composer-input { min-height: 38px; }

.story-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 35px;
  padding: 0 7px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  color: var(--ink);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  font: inherit;
  font-size: 12px;
}
.story-model-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-model-trigger svg { flex: none; width: 10px; height: 10px; }

.story-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.story-select select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: 34px;
  line-height: 18px;
  padding: 7px 24px 7px 11px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink);
  color-scheme: inherit;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.story-select select::-ms-expand {
  display: none;
}

.story-select select::picker-icon {
  display: none;
}

.story-select select:disabled {
  cursor: default;
  opacity: 0.72;
}

.story-select svg {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--ink-secondary);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.story-composer .composer-actions {
  margin-left: auto;
}

.composer-plus.composer-random {
  width: 36px;
  height: 36px;
  color: var(--ink-secondary);
  background: var(--btn-dome-bg);
  border-color: var(--rim);
}

.composer-random:disabled {
  opacity: 0.52;
  cursor: default;
}

.story-length-estimate {
  margin-inline-end: 3px;
  white-space: nowrap;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 400;
}

.composer-send {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--rim);
  border-radius: 50%;
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink-tertiary);
  transition: transform 150ms var(--ease-ios), background-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.composer-send.is-ready {
  border-color: var(--cta-border);
  background: var(--cta-gradient);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--cta-ink);
  box-shadow: var(--cta-shadow);
}

.composer-send:disabled {
  cursor: default;
  opacity: 0.55;
}

.composer-send svg {
  width: 17px;
  height: 17px;
}

/* =====================
   3. 5-TAB APP SHELL
   ===================== */
.app-shell {
  background: var(--shell-wash), var(--bg-canvas);
  background-attachment: fixed;
}

html:has(.app-shell), body:has(.app-shell) { overflow-x: clip; }

.app-frame {
  padding-bottom: max(108px, calc(env(safe-area-inset-bottom, 0px) + 94px));
}

.app-shell.has-mini-dock .app-frame {
  padding-bottom: max(174px, calc(env(safe-area-inset-bottom, 0px) + 160px));
}

.app-shell.is-create-page .app-frame {
  padding-bottom: calc(var(--story-dock-height, 220px) + max(20px, env(safe-area-inset-bottom, 0px) + 16px));
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--separator-subtle);
  background: var(--obsidian);
}

@media (max-width: 580px) {
  .app-topbar {
    --header-left: max(18px, env(safe-area-inset-left, 0px));
    --header-right: max(18px, env(safe-area-inset-right, 0px));
    margin-inline: calc(-1 * var(--header-left)) calc(-1 * var(--header-right));
    padding-inline: var(--header-left) var(--header-right);
  }
}

@media (max-width: 375px) {
  .app-topbar {
    --header-left: max(14px, env(safe-area-inset-left, 0px));
    --header-right: max(14px, env(safe-area-inset-right, 0px));
  }
}

.tab-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.app-page-title {
  margin-top: 18px;
  min-width: 0;
}

.app-page-title h1 {
  font-size: 30px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.app-page-title p {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.app-title-with-action {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.app-title-with-action > div {
  min-width: 0;
  flex: 1 1 180px;
}

.library-import-btn {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
  color: var(--ink);
}

.library-import-btn svg {
  width: 15px;
  height: 15px;
}

.home-grid {
  display: grid;
  gap: 16px;
}

.home-side-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-card {
  overflow: hidden;
  border-radius: 28px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.hero-card-glow {
  position: absolute;
  inset: 0 0 auto 20%;
  height: 175px;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 22%, transparent 98%);
  mask-image: linear-gradient(180deg, #000 22%, transparent 98%);
}

.hero-card > :not(.hero-card-glow) {
  position: relative;
  z-index: 1;
}

.hero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-meta-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.hero-duration {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--well-bg);
  box-shadow: inset 0 1px 2px var(--well-inset-shadow), 0 1px 0 var(--specular-top);
}

.hero-card-body h2 {
  font-size: 21px;
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: -0.018em;
}

.hero-excerpt {
  margin-top: 7px;
  color: var(--ink-secondary);
  font-size: 13.5px;
  line-height: 1.62;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-wave-row {
  padding-top: 12px;
  border-top: 1px solid var(--separator-subtle);
  display: grid;
  gap: 8px;
}

.hero-wave-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-play-btn {
  flex: 1 1 auto;
  min-height: 46px;
  padding-inline: 18px;
  background: var(--hero-cta-bg);
  border-color: var(--hero-cta-border);
  box-shadow: var(--hero-cta-shadow);
}

.hero-play-btn svg {
  width: 16px;
  height: 16px;
}

.hero-text-btn {
  flex: 0 0 auto;
  min-height: 46px;
  padding-inline: 16px;
}

.hero-text-btn svg {
  width: 17px;
  height: 17px;
}

.quick-studio-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px 8px 12px;
  border-radius: 999px;
  text-align: left;
  transition: transform 150ms var(--ease-ios), border-color 180ms var(--ease-out);
}

.quick-plus,
.quick-send {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.quick-plus {
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink-secondary);
}

.quick-send {
  border: 1px solid var(--cta-border);
  background: var(--cta-gradient);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--cta-ink);
  box-shadow: var(--cta-shadow);
}

.quick-plus svg,
.quick-send svg {
  width: 15px;
  height: 15px;
}

.quick-placeholder {
  font-size: 13.5px;
  color: var(--input-placeholder);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 22px;
  text-align: left;
  min-width: 0;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 150ms var(--ease-ios);
}

.quick-tool-card:active {
  transform: scale(0.98);
}

.quick-tool-card.is-active-tool-card {
  border-color: var(--ios-tint-border) !important;
  box-shadow: var(--module-shadow), 0 0 0 1px var(--ios-tint-soft);
}

.quick-tool-card > div {
  min-width: 0;
}

.quick-tool-card strong {
  display: block;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
}

.quick-tool-card small {
  display: block;
  font-size: 12px;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grouped Lists & Sections (Quiet iOS Typography + Inset Dividers) */
.grouped-section {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-inline: 10px;
}

.section-head h2 {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-tertiary);
  letter-spacing: 0.02em;
}

.section-meta {
  font-size: 12px;
  color: var(--ink-tertiary);
}

.grouped-card {
  border-radius: 22px;
  overflow: hidden;
  min-width: 0;
}

.grouped-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  transition: background-color 160ms var(--ease-out);
}

.grouped-row + .grouped-row::before {
  content: "";
  position: absolute;
  left: 58px;
  right: 16px;
  top: 0;
  height: 1px;
  background: var(--separator-subtle);
  pointer-events: none;
}

.grouped-row.story-trash-row + .grouped-row.story-trash-row::before,
.grouped-row.voice-local-row + .grouped-row.voice-local-row::before,
.grouped-row.voice-row + .grouped-row.voice-row::before {
  left: 16px;
}

.row-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--well-bg);
  box-shadow: inset 0 1px 2px var(--well-inset-shadow), 0 1px 0 var(--specular-top);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
}

.grouped-row.is-current .row-index {
  background: var(--icon-well-bg);
  box-shadow: inset 0 1px 0 var(--icon-well-specular), var(--icon-well-shadow);
  color: var(--ink);
}

.row-icon-well {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--icon-well-bg);
  box-shadow: inset 0 1px 0 var(--icon-well-specular), var(--icon-well-shadow);
  color: var(--ink-secondary);
}

.row-icon-well svg {
  width: 15.5px;
  height: 15.5px;
}

.row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row-main strong {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.row-main small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-tertiary);
}

.row-trailing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-tertiary);
  font-size: 13px;
}

.row-trailing svg {
  width: 14px;
  height: 14px;
  opacity: 0.45;
}

.live-indicator {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--ios-green);
  box-shadow: 0 0 8px rgba(76, 174, 116, 0.55);
}

/* =====================
   LISTENER VOICE LIBRARY (#voices)
   ===================== */
.voice-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 12px 6px 8px;
}

.voice-select-hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 6px 7px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  min-width: 0;
}

.voice-mood-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.voice-mood-tags i {
  font-style: normal;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fill-subtle);
  font-size: 11px;
  color: var(--ink-secondary);
}

.voice-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.voice-audition-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.voice-audition-btn.is-playing {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
}

.voice-audition-btn svg {
  width: 14px;
  height: 14px;
}

.listener-footnote {
  text-align: center;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.voice-empty-card {
  display: grid;
}

.voice-empty-copy {
  display: grid;
  gap: 6px;
  padding: 15px 15px 12px;
}

.voice-empty-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-empty-top strong {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.voice-empty-copy p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-secondary);
}

.voice-preview-pill,
.model-status-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ios-tint-soft);
  border: 1px solid var(--ios-tint-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--ios-tint-text);
  white-space: nowrap;
}

.voice-sample-row {
  border-top: 1px solid var(--separator-subtle);
}

.voice-empty-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 15px 13px;
  border-top: 1px solid var(--separator-subtle);
  font-size: 12px;
  color: var(--ink-tertiary);
}

.voice-player-jump {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  gap: 4px;
}

.voice-player-jump svg {
  width: 14px;
  height: 14px;
}

.sync-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  min-width: 0;
}

.sync-status-bar button {
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.lyrics-state {
  min-height: 180px;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-secondary);
}

.lyrics-state .glass-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

/* Primary Voice Actions & Local/Online Library */
.voice-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.voice-action-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 80px;
  padding: 14px;
  border-radius: 24px;
  text-align: left;
  min-width: 0;
}

.voice-action-card:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.voice-action-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--cta-icon-bg);
  box-shadow: inset 0 1px 0 var(--icon-well-specular);
  color: var(--cta-ink);
  flex: 0 0 auto;
}

.voice-action-card:not(.is-primary) .voice-action-icon {
  background: var(--icon-well-bg);
  box-shadow: inset 0 1px 0 var(--icon-well-specular), var(--icon-well-shadow);
  color: var(--ink-secondary);
}

.voice-action-icon svg {
  width: 18px;
  height: 18px;
}

.voice-action-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.voice-action-copy strong {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.25;
}

.voice-action-copy small {
  font-size: 11.5px;
  line-height: 1.3;
  opacity: 0.78;
  overflow-wrap: anywhere;
}

.voice-recorder-panel {
  border-radius: 24px;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.voice-recorder-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
}

.voice-recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-tertiary);
}

.voice-recording-dot.is-live {
  background: var(--ios-red);
  box-shadow: 0 0 10px var(--ios-red-border);
  animation: orb-breathe 1.6s ease-in-out infinite;
}

.voice-script-box {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
  display: grid;
  gap: 6px;
}

.voice-script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.voice-script-box p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.voice-meter-wrap {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--well-rim);
  background: var(--meter-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
}

.voice-meter-canvas {
  width: 100%;
  height: 54px;
  display: block;
  filter: var(--meter-filter);
}

.voice-meter-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.voice-recorder-controls .amber-cta {
  width: 100%;
  min-height: 46px;
}

.voice-feedback-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.voice-feedback-bar.is-error {
  border-color: var(--ios-red-border) !important;
  background: var(--ios-red-soft) !important;
  color: var(--ios-red);
}

.voice-feedback-bar button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--fill-subtle);
  color: var(--ink-secondary);
}

.voice-feedback-bar button svg {
  width: 14px;
  height: 14px;
}

.voice-empty-state {
  padding: 26px 18px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.voice-empty-state strong {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.voice-empty-state p {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.voice-empty-state .glass-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
}

.voice-local-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px 11px 8px;
}

.voice-local-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.voice-local-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 7px;
}

.voice-name-editor {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.voice-name-editor input {
  flex: 1 1 9rem;
  min-width: 0;
  border: 1px solid var(--well-rim);
  border-radius: 12px;
  padding: 7px 10px;
  background: var(--well-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
  color: var(--ink);
}

.voice-name-error {
  flex: 1 1 100%;
  color: var(--ios-red);
}

.voice-upload-btn,
.voice-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.voice-upload-btn {
  border: 1px solid var(--ios-tint-border);
  background: var(--ios-tint-soft);
  box-shadow: inset 0 1px 0 var(--icon-well-specular);
  color: var(--ios-tint-text);
}

.voice-upload-btn:disabled {
  opacity: 0.55;
}

.voice-delete-btn {
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink-secondary);
}

.voice-upload-btn svg,
.voice-delete-btn svg {
  width: 14px;
  height: 14px;
}

.voice-mood-tags i.is-uploaded {
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
}

.library-empty-row {
  cursor: default;
}

/* Preset Chips & AI Create Tab */
.generating-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.empty-glass {
  padding: 24px 18px;
  border-radius: 24px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--ink-secondary);
  font-size: 13.5px;
}

.empty-glass svg {
  width: 24px;
  height: 24px;
  color: var(--ink-secondary);
}

.ai-story-list {
  display: grid;
  gap: 14px;
}

.ai-story-card {
  border-radius: 26px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.grouped-row.story-trash-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.story-trash-row .row-main small {
  color: var(--ink-secondary);
}

.story-trash-row .glass-btn {
  min-height: 34px;
}

.story-card-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.glass-circle.story-delete-btn {
  width: 34px;
  height: 34px;
  color: var(--ink-secondary);
}

.story-delete-btn svg {
  width: 15px;
  height: 15px;
}

.story-delete-btn:hover {
  color: var(--ios-red);
  border-color: var(--ios-red-border);
  background: var(--ios-red-soft);
}

.ai-story-card h3 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.ai-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.ai-card-actions .glass-btn,
.ai-card-actions .amber-cta {
  flex: 1 1 0;
  min-height: 42px;
  font-size: 13.5px;
  padding: 0 12px;
}

/* iOS 26 Segmented Controls (Recessed Well + 3D Raised Floating Thumb) */
.sliding-segments {
  isolation: isolate;
}

.sliding-segments:not(.stage-mode-toggle) {
  position: relative;
}

.sliding-segments::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: var(--segment-padding);
  bottom: var(--segment-padding);
  left: var(--segment-padding);
  width: calc((100% - 2 * var(--segment-padding) - (var(--segment-count) - 1) * var(--segment-gap)) / var(--segment-count));
  border-radius: var(--segment-radius, 999px);
  background: var(--segment-fill);
  opacity: var(--segment-visible);
  transform: translateX(calc(var(--segment-index) * (100% + var(--segment-gap))));
  transition: transform 250ms var(--ease-ios), opacity 150ms ease-out;
  pointer-events: none;
}

.sliding-segments > :is(button, a) {
  touch-action: manipulation;
}

.segmented-control {
  --segment-padding: 3px;
  --segment-gap: 3px;
  --segment-radius: 999px;
  --segment-fill: var(--segment-thumb-bg);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--segment-gap);
  padding: var(--segment-padding);
  border-radius: 999px;
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow:
    inset 0 1.5px 3.5px var(--well-inset-shadow),
    0 1px 0 var(--specular-top);
}

.segmented-control::before {
  box-shadow: var(--segment-thumb-shadow);
}

.rate-segments {
  --segment-gap: 2px;
}

.rate-segments button {
  padding-inline: 2px;
  white-space: nowrap;
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: color 160ms var(--ease-out);
}

.segmented-control button.is-active {
  color: var(--ink);
}

.theme-segmented {
  --segment-padding: 3px;
  --segment-gap: 2px;
  --segment-radius: 999px;
  --segment-fill: var(--segment-thumb-bg);
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(46px, 1fr));
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow:
    inset 0 1.5px 3px var(--well-inset-shadow),
    0 1px 0 var(--specular-top);
  flex: 0 0 auto;
}

.theme-segmented::before {
  box-shadow: var(--segment-thumb-shadow);
}

.theme-segmented button {
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 160ms var(--ease-out);
}

.theme-segmented button.is-active {
  color: var(--ink);
}

/* =====================
   PROFILE & AVATAR CUSTOMIZATION (#profile)
   ===================== */
.account-card {
  border-radius: 28px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.account-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-trigger {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 18px;
  flex: 0 0 auto;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 17px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 4px 12px rgba(15, 23, 42, 0.14);
  color: #ffffff;
}

.account-avatar.is-large {
  width: 68px;
  height: 68px;
  border-radius: 22px;
}

/* Refined Matte Avatars */
.account-avatar.preset-amber {
  background: linear-gradient(148deg, #dfad73, #bf834b);
}

.account-avatar.preset-moon {
  background: linear-gradient(148deg, #86b0d8, #5881ad);
}

.account-avatar.preset-rose {
  background: linear-gradient(148deg, #d698a5, #ae6c7b);
}

.account-avatar.preset-ink {
  background: linear-gradient(148deg, #5e6b82, #364154);
}

.account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-avatar-monogram {
  font-size: 20px;
  font-weight: 500;
  color: #ffffff;
}

.account-avatar.is-large .account-avatar-monogram {
  font-size: 25px;
}

.account-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.account-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.account-name-row h2 {
  font-size: 17.5px;
  font-weight: 500;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.account-badge {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.account-meta p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
}

.profile-edit-btn {
  min-height: 34px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 0 0 auto;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--separator-subtle);
  text-align: center;
}

.account-stats strong {
  display: block;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

.account-stats span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

.voice-entry-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 22px;
  text-align: left;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 150ms var(--ease-ios);
}

.sleep-fade-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sleep-fade-options button {
  min-width: 36px;
  min-height: 36px;
  padding-inline: 4px;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .sleep-fade-row {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .sleep-fade-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* Refined Matte Botanical-Jade iOS Switch */
.ios-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: 0 0 auto;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-secondary);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
  transition: background-color 200ms var(--ease-out);
}

.ios-switch.is-on {
  background: var(--ios-green);
  box-shadow: inset 0 1px 2px rgba(18, 56, 34, 0.2);
}

.ios-switch span {
  display: block;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--switch-knob-shadow);
  transition: transform 220ms var(--ease-ios);
}

.ios-switch.is-on span {
  transform: translateX(20px);
}

.profile-footer {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

/* Profile Edit Sheet */
.profile-editor {
  display: grid;
  gap: 14px;
}

.profile-editor-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-editor-avatar-actions {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.profile-editor-avatar-actions .glass-btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.profile-clear-img {
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--ios-tint-text);
  font-size: 12px;
  text-decoration: underline;
}

.profile-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.avatar-swatch {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 9px 4px;
  border-radius: 14px;
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.avatar-swatch.is-selected {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
  color: var(--ink);
}

.swatch-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.avatar-swatch.preset-amber .swatch-dot {
  background: linear-gradient(148deg, #dfad73, #bf834b);
}

.avatar-swatch.preset-moon .swatch-dot {
  background: linear-gradient(148deg, #86b0d8, #5881ad);
}

.avatar-swatch.preset-rose .swatch-dot {
  background: linear-gradient(148deg, #d698a5, #ae6c7b);
}

.avatar-swatch.preset-ink .swatch-dot {
  background: linear-gradient(148deg, #5e6b82, #364154);
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group span {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.field-group input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
  color: var(--ink);
  font-size: 15px;
}

.profile-save-btn {
  width: 100%;
  min-height: 48px;
}

/* =====================
   FLOATING LIQUID GLASS BOTTOM DOCK
   ===================== */
.bottom-dock {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  transform: translateX(-50%);
  width: min(calc(100% - 20px), 540px);
  display: grid;
  gap: 8px;
}

.is-create-page .bottom-dock {
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px) + 8px) + var(--keyboard-inset, 0px));
}

.create-composer-wrap { display: grid; gap: 6px; min-width: 0; }
.create-composer-wrap .playback-feedback { margin: 0; }

.mini-player {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 7px 10px 9px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.mini-orb {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--icon-well-bg);
  box-shadow: inset 0 1px 0 var(--icon-well-specular), var(--icon-well-shadow);
  color: var(--ink-secondary);
}

.mini-orb svg {
  width: 16px;
  height: 16px;
}

.mini-orb.is-playing {
  animation: orb-breathe 3.8s ease-in-out infinite;
}

.mini-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.mini-copy strong {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-copy small {
  font-size: 11.5px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-play-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rim);
  background: var(--btn-dome-bg);
  box-shadow: var(--btn-dome-shadow);
  color: var(--ink);
  transition: transform 150ms var(--ease-ios);
}

.mini-play-btn svg {
  width: 15px;
  height: 15px;
}

.mini-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 0;
  height: 2.5px;
  border-radius: 999px;
  background: var(--fill-subtle);
}

.mini-progress::after {
  content: "";
  display: block;
  width: var(--mini-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ios-tint), var(--ios-tint-top));
}

.tab-bar {
  --segment-padding: 5px;
  --segment-gap: 2px;
  --segment-radius: 999px;
  --segment-fill: var(--tab-lens-bg);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass-sheen), var(--glass-bg);
  box-shadow:
    inset 0 1.5px 0 var(--specular-top),
    inset 0 -1px 1.5px var(--specular-bottom),
    var(--glass-shadow);
  -webkit-backdrop-filter: var(--backdrop-bar);
  backdrop-filter: var(--backdrop-bar);
}

.tab-bar::before {
  box-shadow: var(--tab-lens-shadow);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 50px;
  padding: 4px 2px;
  border-radius: 999px;
  color: var(--ink-secondary);
  font-size: 10.5px;
  font-weight: 400;
  white-space: nowrap;
  transition: color 180ms var(--ease-out);
}

.tab-item svg {
  width: 18px;
  height: 18px;
}

.tab-item.is-active {
  color: var(--ink);
  font-weight: 500;
}

/* =====================
   4. BOTTOM SHEETS (<dialog>)
   ===================== */
.sheet {
  position: fixed;
  margin: auto auto max(12px, env(safe-area-inset-bottom, 0px));
  width: min(calc(100% - 20px), 460px);
  max-height: min(82svh, 640px);
  padding: 0;
  border-radius: 32px;
  background: var(--glass-sheen), var(--glass-sheet-bg);
  color: var(--ink);
  overflow: auto;
  scrollbar-color: var(--separator) transparent;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 260ms var(--ease-ios), transform 280ms var(--ease-ios);
}

.sheet[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  .sheet[open] {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
}

.sheet::backdrop {
  background: var(--backdrop-scrim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.story-delete-dialog {
  inset: 0;
  width: min(calc(100% - 28px), 370px);
  height: max-content;
  margin: auto;
  padding: 20px;
}

.story-delete-dialog h2 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
}

.story-delete-dialog p {
  margin: 8px 0 18px;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
}

.glass-btn.story-delete-confirm {
  color: var(--ios-red);
  border-color: var(--ios-red-border);
  background: var(--ios-red-soft);
  font-weight: 500;
}

.sheet-content {
  padding: 10px 18px 22px;
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: var(--grabber-color);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-header h2 {
  padding-left: 4px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.sheet-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-close {
  width: 34px;
  height: 34px;
}

.sheet-close svg {
  width: 15px;
  height: 15px;
}

.reading-size-switch {
  --segment-padding: 3px;
  --segment-gap: 0px;
  --segment-fill: var(--segment-thumb-bg);
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--well-rim);
  background: var(--well-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow), 0 1px 0 var(--specular-top);
}

.reading-size-switch::before {
  box-shadow: var(--segment-thumb-shadow);
}

.reading-size-switch button {
  min-width: 32px;
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
}

.reading-size-switch button.is-selected {
  color: var(--ink);
}

.sheet-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 20px;
  border: 1px solid var(--module-rim);
  background: var(--module-sheen), var(--module-glass-bg);
  box-shadow: var(--module-shadow);
  overflow: hidden;
}

.sheet-list li + li {
  border-top: 1px solid var(--separator-subtle);
}

.sheet-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 400;
  text-align: left;
  transition: background-color 150ms var(--ease-out);
}

.sheet-list button[aria-current="true"] {
  color: var(--ink);
  font-weight: 500;
}

.sheet-row-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sheet-row-left strong {
  display: block;
  font-weight: 400;
}

.sheet-row-left small {
  display: block;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.sheet-row-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-secondary);
  font-size: 13px;
}

.sheet-row-right svg {
  width: 16px;
  height: 16px;
  color: var(--ios-tint-text);
}

.sheet-danger {
  color: var(--ios-red) !important;
  font-weight: 500;
}

.sheet-footnote {
  margin: 12px 4px 0;
  font-size: 12px;
  color: var(--ink-tertiary);
}

/* Dedicated Model Selection Sheet */
.model-catalog {
  display: grid;
  gap: 12px;
}

.model-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--module-rim);
  background: var(--module-sheen), var(--module-glass-bg);
  box-shadow: var(--module-shadow);
  display: grid;
  gap: 14px;
}

.model-card-btn {
  width: 100%;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.model-card.is-selected {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
}

.model-card-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

@media (max-width: 480px) and (max-height: 680px) {
  .model-catalog {
    gap: 8px;
  }
  .model-catalog .model-card {
    padding: 10px 12px;
    gap: 7px;
  }
  .model-catalog .model-pricing-grid {
    padding-top: 6px;
  }
  .model-catalog .sheet-footnote {
    margin: 0;
  }
}

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

.model-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.model-title-line h3 {
  font-size: 17px;
  font-weight: 500;
}

.model-id-code {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--well-bg);
  color: var(--ink-secondary);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.model-check-circle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cta-gradient);
  border: 1px solid var(--cta-border);
  box-shadow: var(--btn-dome-shadow);
  color: var(--cta-ink);
}

.model-check-circle svg {
  width: 15px;
  height: 15px;
}

.model-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 100px), 1fr));
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--separator-subtle);
}

.model-id-code { overflow-wrap: anywhere; }

.wallet-sheet, .wallet-redeem { display: grid; gap: 12px; }
.wallet-total { display: grid; gap: 4px; padding-block: 4px 12px; border-bottom: 1px solid var(--separator-subtle); }
.wallet-total span, .wallet-redeem label, .wallet-recovery label { color: var(--ink-secondary); font-size: 13px; }
.wallet-total strong { color: var(--ink); font-size: 30px; overflow-wrap: anywhere; }
.wallet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet-actions [aria-pressed="true"] { color: var(--amber); border-color: var(--rim-strong); }
.wallet-redeem > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.wallet-sheet input { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--rim); border-radius: 12px; background: var(--surface-solid); color: var(--ink); font: inherit; font-size: 16px; }
.wallet-recovery { padding-top: 10px; border-top: 1px solid var(--separator-subtle); }
.wallet-recovery summary { cursor: pointer; color: var(--ink-secondary); }
.wallet-recovery input { margin-top: 4px; }
.wallet-entry .row-trailing { white-space: nowrap; }

.model-pricing-grid small {
  display: block;
  font-size: 11px;
  color: var(--ink-tertiary);
}

.model-pricing-grid strong {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

.model-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-features span {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--fill-subtle);
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.model-to-voices-btn {
  width: 100%;
  justify-content: space-between;
  padding: 0 16px;
}

/* Style & Ambient Sheets */
.model-sheet-body,
.ambient-sheet-body {
  display: grid;
  gap: 14px;
}

.model-rate-block {
  display: grid;
  gap: 8px;
  padding-inline: 2px;
}

.ambient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ambient-tile {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--module-rim);
  background: var(--module-sheen), var(--module-glass-bg);
  box-shadow: var(--module-shadow);
  -webkit-backdrop-filter: var(--backdrop-btn);
  backdrop-filter: var(--backdrop-btn);
  color: var(--ink);
  text-align: left;
  transition: transform 150ms var(--ease-ios), border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.ambient-tile svg {
  width: 19px;
  height: 19px;
  color: var(--ink-secondary);
  margin-bottom: 2px;
}

.ambient-tile strong {
  font-size: 14.5px;
  font-weight: 400;
}

.ambient-tile small {
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

.ambient-tile.is-selected {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
  box-shadow: var(--module-shadow), 0 0 0 1px var(--ios-tint-soft);
}

.ambient-tile.is-selected svg {
  color: var(--ios-tint-text);
}

.ambient-volume-row {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
}

.ambient-volume-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.ambient-volume-row input[type="range"] {
  width: 100%;
  accent-color: var(--ios-tint);
}

/* Reading Sheet */
.reading {
  display: grid;
  gap: 16px;
  padding: 4px 2px 4px;
}

.reading-section {
  padding: 15px;
  border-radius: 20px;
  border: 1px solid var(--module-rim);
  background: var(--module-sheen), var(--module-glass-bg);
  box-shadow: var(--module-shadow);
}

.draft-editor {
  display: grid;
  gap: 14px;
}

.draft-editor label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.draft-editor :is(input, textarea) {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--well-rim);
  border-radius: 14px;
  color: var(--ink);
  background: var(--well-bg);
  box-shadow: inset 0 1.5px 3px var(--well-inset-shadow);
}

.draft-editor textarea {
  line-height: 1.7;
  resize: vertical;
}

.reading-section.is-current {
  border-color: var(--ios-tint-border);
  background: var(--ios-tint-soft);
}

.reading-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.reading-jump-btn {
  padding: 4px 10px;
  border: 1px solid var(--ios-tint-border);
  border-radius: 999px;
  background: var(--ios-tint-soft);
  color: var(--ios-tint-text);
  font-size: 11.5px;
  font-weight: 500;
}

.reading p {
  color: var(--ink);
  line-height: 1.92;
}

.reading-section p + p {
  margin-top: 10px;
}

.reading-sm p { font-size: 14.5px; }
.reading-md p { font-size: 16px; }
.reading-lg p { font-size: 18px; }

/* =====================
   5. RESPONSIVE BREAKPOINTS
   ===================== */
@media (max-width: 375px) {
  .frame {
    padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px));
  }
  .player-topbar {
    gap: 6px;
  }
  .player-topbar .back-pill {
    min-height: 34px;
    padding: 0 10px 0 6px;
    font-size: 12.5px;
  }
  .player-topbar .status-capsule {
    min-height: 32px;
    padding: 0 9px;
    font-size: 11px;
    min-width: 0;
  }
  .player-top-actions {
    gap: 5px;
  }
  .player-topbar .glass-circle,
  .app-topbar .theme-toggle-btn {
    width: 34px;
    height: 34px;
  }
  .player-topbar .glass-circle svg,
  .app-topbar .theme-toggle-btn svg {
    width: 16px;
    height: 16px;
  }
  .app-topbar-actions {
    gap: 6px;
  }
  .player-particle-stage {
    min-height: 116px;
    margin-inline: -14px;
  }
  .player-studio-grid {
    grid-template-rows: minmax(116px, 1fr) auto;
    gap: 6px;
  }
  .player-studio-core {
    gap: 10px;
  }
  .studio-transport-row {
    gap: 4px;
  }
  .studio-play-btn {
    width: 48px;
    height: 48px;
  }
  .transport-cluster {
    gap: 6px;
  }
  .skip-btn {
    width: 38px;
    height: 38px;
  }
  .mini-chip-btn {
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
    gap: 4px;
  }
  .waveform {
    gap: 1.5px;
  }
  .composer-dock {
    border-radius: 24px;
    padding: 10px 10px 8px 12px;
    min-width: 0;
  }
  .composer-input {
    min-height: 36px;
    font-size: 14px;
  }
  .composer-left {
    gap: 4px;
  }
  .story-composer .composer-toolbar,
  .story-composer .composer-actions {
    gap: 4px;
  }
  .story-composer .composer-plus,
  .story-composer .composer-send {
    flex-basis: 33px;
    width: 33px;
    height: 34px;
  }
  .story-model-trigger { font-size: 11px; padding-inline: 6px; }
  .story-composer .story-length-estimate { margin-inline-end: 0; font-size: 10px; }
  .story-select select {
    padding-inline: 6px 16px;
    font-size: 11px;
  }
  .story-select svg {
    right: 6px;
    width: 9px;
    height: 9px;
  }
  .model-switcher,
  .voice-switcher,
  .style-switcher {
    padding: 0 8px;
    font-size: 11px;
    gap: 3px;
    flex: 0 0 auto;
  }
  .model-switcher-value,
  .model-switcher .model-dot,
  .model-switcher svg {
    display: none;
  }
  .model-switcher-compact {
    display: inline;
    white-space: nowrap;
  }
  .bottom-dock {
    width: calc(100% - 16px);
  }
  .tab-item {
    font-size: 10px;
  }
  .tab-item svg {
    width: 17px;
    height: 17px;
  }
  .quick-tools-grid {
    grid-template-columns: 1fr;
  }
  .account-top {
    flex-wrap: wrap;
  }
  .profile-swatches {
    grid-template-columns: repeat(2, 1fr);
  }
  .voice-primary-actions {
    grid-template-columns: 1fr;
  }
  .voice-action-card {
    min-height: 68px;
    padding: 12px 14px;
  }
  .voice-local-actions {
    justify-content: flex-start;
  }
  .theme-segmented button {
    padding: 0 8px;
    font-size: 11.5px;
  }
  .grouped-row + .grouped-row::before {
    left: 52px;
    right: 14px;
  }
}

@media (max-width: 335px) {
  .welcome-copy h1 {
    font-size: 29px;
  }
  .app-page-title h1 {
    font-size: 26px;
  }
}

@media (min-width: 820px) {
  .welcome-frame {
    width: min(100%, 1060px);
    grid-template-columns: 0.92fr 1.08fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header"
      "copy stage";
    column-gap: 48px;
    align-items: center;
    padding-inline: 36px;
  }
  .welcome-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .welcome-header-spacer {
    display: none;
  }
  .welcome-copy {
    grid-area: copy;
    text-align: left;
    margin-inline: 0;
    max-width: 410px;
  }
  .welcome-copy h1 {
    font-size: 50px;
  }
  .welcome-actions {
    align-items: flex-start;
  }
  .welcome-primary {
    max-width: 280px;
  }
  .welcome-stage {
    grid-area: stage;
    min-height: 500px;
    margin: 0;
    -webkit-mask-image: radial-gradient(ellipse 56% 56% at 50% 50%, #000 35%, transparent 94%);
    mask-image: radial-gradient(ellipse 56% 56% at 50% 50%, #000 35%, transparent 94%);
  }

  .app-frame {
    width: min(100%, 980px);
    padding-inline: 32px;
  }
  .app-page-title h1 {
    font-size: 34px;
  }
  .home-grid {
    grid-template-columns: 1.12fr 0.88fr;
    align-items: start;
    gap: 26px;
  }

  .player-frame {
    width: min(100%, 1080px);
    padding-inline: 36px;
    padding-bottom: 34px;
  }
  .player-studio-grid {
    grid-template-rows: 1fr;
    grid-template-columns: 1.05fr minmax(390px, 0.95fr);
    align-items: center;
    gap: clamp(28px, 4.5vw, 60px);
  }
  .player-particle-stage {
    height: min(60svh, 500px);
    margin: 0;
  }
  .player-particle-stage .ambient-field {
    -webkit-mask-image: radial-gradient(ellipse 55% 54% at 50% 50%, #000 38%, transparent 94%);
    mask-image: radial-gradient(ellipse 55% 54% at 50% 50%, #000 38%, transparent 94%);
  }
  .studio-heading-row {
    align-items: flex-start;
  }
  .studio-sub-pills {
    justify-content: flex-start;
  }
  .studio-title-block {
    text-align: left;
  }
  .studio-heading-row h1 {
    font-size: 34px;
  }
  .sheet {
    margin: auto;
    max-width: 480px;
  }
}

/* =====================
   6. REDUCED MOTION & TRANSPARENCY
   ===================== */
@media (prefers-reduced-motion: reduce) {
  html, body {
    transition: none;
  }
  .sliding-segments::before {
    transition: opacity 150ms ease-out;
  }
  .brand-orb,
  .status-capsule.is-live .status-dot,
  .mini-orb.is-playing,
  .player[data-playing] .studio-play-btn,
  .composer-dock,
  .voice-recording-dot.is-live {
    animation-play-state: paused !important;
  }
  .sheet,
  .amber-cta,
  .glass-btn,
  .glass-circle,
  .ios-switch span {
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-surface,
  .glass-btn,
  .glass-circle,
  .mini-chip-btn,
  .studio-chapter-pill,
  .tab-bar,
  .amber-cta,
  .grouped-card.glass-surface,
  .quick-tool-card.glass-surface,
  .empty-glass.glass-surface,
  .sync-status-bar.glass-surface,
  .ambient-volume-row.glass-surface,
  .voice-feedback-bar.glass-surface,
  .ambient-tile,
  .sheet-list,
  .model-card,
  .reading-section {
    background: #14171e;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .glass-card,
  .voice-entry-banner.glass-card,
  .voice-recorder-panel.glass-card,
  .voice-action-card.glass-card:not(.is-primary),
  .scrub-tooltip,
  .attach-popover {
    background: #1b1f29;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .sheet {
    background: #171a22;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  :root[data-theme="light"] .glass-surface,
  :root[data-theme="light"] .glass-btn,
  :root[data-theme="light"] .glass-circle,
  :root[data-theme="light"] .mini-chip-btn,
  :root[data-theme="light"] .studio-chapter-pill,
  :root[data-theme="light"] .tab-bar,
  :root[data-theme="light"] .amber-cta,
  :root[data-theme="light"] .grouped-card.glass-surface,
  :root[data-theme="light"] .quick-tool-card.glass-surface,
  :root[data-theme="light"] .empty-glass.glass-surface,
  :root[data-theme="light"] .sync-status-bar.glass-surface,
  :root[data-theme="light"] .ambient-volume-row.glass-surface,
  :root[data-theme="light"] .voice-feedback-bar.glass-surface,
  :root[data-theme="light"] .ambient-tile,
  :root[data-theme="light"] .sheet-list,
  :root[data-theme="light"] .model-card,
  :root[data-theme="light"] .reading-section,
  :root[data-theme="light"] .glass-card,
  :root[data-theme="light"] .voice-entry-banner.glass-card,
  :root[data-theme="light"] .voice-recorder-panel.glass-card,
  :root[data-theme="light"] .voice-action-card.glass-card:not(.is-primary),
  :root[data-theme="light"] .scrub-tooltip,
  :root[data-theme="light"] .attach-popover {
    background: #ffffff;
  }
  :root[data-theme="light"] .sheet {
    background: #f8fafe;
  }
}

.owner-shell {
  max-width: 1000px;
  min-height: 100vh;
  margin: auto;
  padding: 48px 28px 56px;
  background: radial-gradient(ellipse at 50% 0, rgba(201, 139, 79, 0.105), transparent 58%);
}

.owner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.owner-header h1 { display: flex; align-items: center; gap: 10px; font-size: clamp(26px, 5vw, 40px); line-height: 1.2; font-weight: 680; letter-spacing: -.035em; }
.owner-header .brand-orb { flex: none; }
.owner-header p { margin-top: 6px; color: var(--ink-secondary); font-size: 14px; }
.owner-shell h2 { font-size: 18px; font-weight: 640; margin-bottom: 12px; }
.owner-shell small { color: var(--ink-secondary); }
.owner-links, .owner-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.owner-filters { margin-bottom: 12px; }
.owner-filters a[aria-current="page"] { color: var(--amber); border-color: var(--rim-strong); }

.owner-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  border-radius: 23px;
  padding: 4px;
  margin-bottom: 16px;
}

.owner-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-secondary);
  font-size: 14px;
  white-space: nowrap;
}

.owner-nav a:is(:hover, [aria-current="page"]) { color: var(--amber); background: rgba(232, 192, 136, .12); }
.owner-card { padding: 20px 24px; border-radius: 25px; margin-top: 14px; }
.owner-note { margin: 8px 0 12px; color: var(--ink-secondary); font-size: 14px; }
.owner-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
.owner-stats a {
  display: grid;
  gap: 4px;
  padding: 10px 13px;
  border-left: 1px solid var(--rim);
}
.owner-stats a:hover { background: rgba(255, 244, 230, .035); }
.owner-stats strong { color: var(--amber); font-size: 26px; line-height: 1.22; }
.owner-stats span { color: var(--ink-secondary); font-size: 13px; }

.owner-rows { list-style: none; margin: 0; padding: 0; }
.owner-rows li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-height: 56px;
  padding: 10px 0;
  border-top: 1px solid var(--rim);
  overflow-wrap: anywhere;
}
.owner-rows small { display: block; margin-top: 3px; }
.owner-session-profile { display: flex; align-items: center; gap: 10px; min-width: 0; }
.owner-session-profile .account-avatar { width: 38px; height: 38px; border-radius: 13px; }
.owner-session-profile .account-avatar-monogram { font-size: 15px; }
.owner-session-link { min-height: 44px; border-radius: 13px; }
.owner-session-link:hover strong, .owner-session-link:focus-visible strong { color: var(--amber); text-decoration: underline; }
.owner-detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.owner-detail-heading h2 { margin-bottom: 4px; }
.owner-activity-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; margin: 12px 0; }
.owner-activity-stats div { padding: 8px 0; border-bottom: 1px solid var(--rim); }
.owner-activity-stats dt { font-size: 13px; color: var(--ink-secondary); }
.owner-activity-stats dd { margin: 2px 0 0; font-size: 20px; color: var(--amber); }
.owner-rows time, .owner-tag { color: var(--ink-secondary); font-size: 13px; }
.owner-tag { color: var(--amber); border: 1px solid var(--rim); border-radius: 99px; padding: 3px 9px; }

.owner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.owner-notice {
  margin: 12px 0;
  padding: 11px 14px;
  border: 1px solid var(--rim);
  border-radius: 16px;
  background: rgba(232, 192, 136, .095);
  color: var(--amber);
  overflow-wrap: anywhere;
}
.owner-notice code { display: block; margin-top: 6px; font-size: 14px; }
.owner-model-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.owner-model-form label { display: grid; gap: 6px; font-size: 14px; color: var(--ink-secondary); }
.owner-model-form input:not([type="checkbox"]) {
  min-height: 44px;
  min-width: 0;
  width: 100%;
  border-radius: 13px;
  padding: 9px 11px;
  border: 1px solid var(--rim-strong);
  background: var(--obsidian-elevated);
  color: var(--ink);
  font-size: 16px;
}
.owner-model-form input::placeholder { color: var(--ink-secondary); }
.owner-model-form button { justify-self: start; }
.owner-login-form { grid-template-columns: minmax(0, 1fr); }
.owner-audition { --gold: var(--amber); --muted: var(--ink-secondary); --line: var(--rim); }
.owner-audition .hero { padding: 22px; margin-bottom: 14px; border-radius: 25px; }
.owner-audition .hero::before, .owner-audition .section-title > span { display: none; }
.owner-audition .owner-back { margin-bottom: 15px; }
.owner-audition :is(h1, h2) { font-family: var(--font-ui); letter-spacing: -.025em; }
.owner-audition h1 { font-size: clamp(24px, 5vw, 36px); line-height: 1.18; }
.owner-audition :is(blockquote, .wave, .feedback, button, textarea, select) {
  border-color: var(--rim-strong);
  background: var(--obsidian-elevated);
  border-radius: 13px;
}
.owner-audition button { border-radius: 999px; }
.owner-audition button.primary {
  background: linear-gradient(180deg, #faf6ef, #eadcc6);
  color: var(--obsidian);
}

@media (max-width: 600px) {
  .owner-shell { padding: 28px 16px 40px; }
  .owner-card { padding: 16px; }
  .owner-nav a { padding-inline: 10px; }
  .owner-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .owner-model-form { grid-template-columns: minmax(0, 1fr); }
}

.owner-wallet-user {
  padding: 14px 0;
  border-top: 1px solid var(--separator-subtle);
}

.owner-listener-activity summary {
  cursor: pointer;
}

.owner-listener-activity {
  margin-block: 12px 16px;
}

.owner-wallet-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.owner-wallet-heading small { display: block; }
.owner-wallet-heading > strong { color: var(--amber); }
.owner-wallet-user form { display: inline-block; margin: 6px 8px 0 0; }

.owner-model-form select {
  width: 100%;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--well-rim);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface-solid);
  font: inherit;
}

@media (max-width: 600px) {
  .owner-nav a { padding-inline: 6px; }
}

@media (max-width: 350px) {
  .owner-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
}
