/* ============================================
   CastBuddy — Clean Design System
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Apple-style Colors — Dark Mode */
    --bg-primary: #000000;
    --bg-elevated: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --bg-grouped: #1c1c1e;

    --fill-primary: rgba(120, 120, 128, 0.36);
    --fill-secondary: rgba(120, 120, 128, 0.32);
    --fill-tertiary: rgba(120, 120, 128, 0.24);
    --fill-quaternary: rgba(120, 120, 128, 0.18);

    --separator: rgba(84, 84, 88, 0.65);
    --separator-opaque: #38383a;

    --label-primary: #ffffff;
    --label-secondary: rgba(235, 235, 245, 0.6);
    --label-tertiary: rgba(235, 235, 245, 0.3);
    --label-quaternary: rgba(235, 235, 245, 0.18);

    /* System Colors */
    --system-blue: #0a84ff;
    --system-green: #30d158;
    --system-orange: #ff9f0a;
    --system-red: #ff453a;
    --system-yellow: #ffd60a;
    --system-purple: #bf5af2;
    --system-pink: #ff375f;
    --system-teal: #64d2ff;
    --system-indigo: #5e5ce6;

    /* Accent — Blue */
    --accent: #0a84ff;
    --accent-dim: rgba(10, 132, 255, 0.12);
    --accent-medium: rgba(10, 132, 255, 0.25);
    --accent-glow: rgba(10, 132, 255, 0.15);
    --accent-green: #30d158;

    /* Character palette */
    --char-1: #ffd60a;
    --char-2: #0a84ff;
    --char-3: #ff375f;
    --char-4: #30d158;
    --char-5: #bf5af2;
    --char-6: #ff9f0a;
    --char-7: #64d2ff;
    --char-8: #5e5ce6;

    /* Typography */
    --font: "Onest", -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    --font-rounded: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Inter', sans-serif;

    /* Spacing (4px grid) */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 20px;
    --s6: 24px;
    --s7: 28px;
    --s8: 32px;
    --s10: 40px;
    --s12: 48px;
    --s16: 64px;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl: 28px;
    --r-full: 9999px;

    /* Animations */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 200ms;
    --dur-base: 350ms;
    --dur-slow: 500ms;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font);
    background:
      linear-gradient(145deg, rgba(0, 122, 255, 0.16), rgba(99, 91, 255, 0.05) 34%, rgba(255, 159, 10, 0.06) 68%, rgba(5, 6, 10, 0) 100%),
      linear-gradient(180deg, #0b0c12 0%, #05060a 54%, #020308 100%),
      #05060a;
    color: var(--label-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.47;
    letter-spacing: -0.022em;
}

/* ---------- Vibrancy Background ---------- */
.bg-grain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(150px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.bg-glow--1 {
    width: 500px;
    height: 500px;
    background: rgba(10, 132, 255, 0.06);
    top: -150px;
    right: -50px;
    animation: glow 20s ease-in-out infinite;
}

.bg-glow--2 {
    width: 400px;
    height: 400px;
    background: rgba(94, 92, 230, 0.04);
    bottom: -100px;
    left: -80px;
    animation: glow 25s ease-in-out infinite reverse;
}

@keyframes glow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -15px) scale(1.05); }
}

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 var(--s8);
    background: transparent;
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: var(--s2);
    flex-shrink: 0;
    min-width: 140px;
}

.header__logo-icon { color: var(--accent); }

.header__logo-text {
    font-family: 'Unbounded', sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.header__logo-accent { color: var(--accent); }
.header__spacer { width: 140px; flex-shrink: 0; }

/* Segmented Control (Step Nav chevrons) */
.header__steps {
    display: flex;
    align-items: center;
    min-width: 420px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 2px;
    gap: 0;
    overflow: hidden;
}

.step-indicator {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-width: 0;
    margin-left: -10px;
    padding: 0 22px 0 28px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: rgba(236, 240, 247, 0.45);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 160ms ease;
    position: relative;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
}

.step-indicator:first-of-type {
    margin-left: 0;
    padding-left: 18px;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.step-indicator:last-of-type {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    padding-right: 18px;
}

.step-indicator:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.045);
}

.step-indicator--active {
    background: rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.18);
}

.step-indicator__icon {
    width: 14px;
    height: 14px;
    display: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 6px;
}

.step-indicator--completed {
    background: rgba(48, 209, 88, 0.11);
    color: rgba(120, 220, 150, 0.86);
}

.step-indicator--completed .step-indicator__icon {
    display: none;
}

.step-indicator__line { display: none; }

/* ---------- Main ---------- */
.main {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 60px);
}

/* ---------- Steps ---------- */
.step {
    display: none;
    animation: stepIn var(--dur-slow) var(--ease);
}

.step--active { display: block; }

#step3.step--active {
    height: calc(100vh - 60px);
    overflow: hidden;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.step__container {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--s10) var(--s6) 120px;
}

.step__container--wide { max-width: 1180px; }
.step__container--upload {
    max-width: 920px;
    margin: 0 auto;
    padding: var(--s8) var(--s6) 120px;
}

.step__container--full {
    max-width: 100%;
    height: calc(100vh - 60px);
    min-height: 0;
    padding: 0 var(--s6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.step__header {
    text-align: center;
    margin-bottom: var(--s5);
}

.step__title {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.12;
    margin-bottom: var(--s2);
}

.step__subtitle {
    font-size: 17px;
    color: var(--label-secondary);
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.47;
}

.text-gradient {
    background: linear-gradient(135deg, #0a84ff 0%, #64d2ff 50%, #5e5ce6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-white {
    color: rgba(255, 255, 255, 0.94);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

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

.btn--primary {
    background: var(--accent);
    color: #fff;
}

.btn--primary:hover { filter: brightness(1.1); }

.btn--primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: none;
    transform: none;
}

.btn--outline {
    background: transparent;
    color: var(--label-primary);
    border: 1px solid var(--separator);
}

.btn--outline:hover { background: var(--fill-quaternary); }

.btn--ghost {
    background: transparent;
    color: var(--system-blue);
}

.btn--ghost:hover { background: var(--fill-quaternary); }

.btn--soft {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(245, 247, 251, 0.9);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
}

.btn--soft:hover {
    background: rgba(255, 255, 255, 0.11);
}

.btn--danger {
    background: var(--system-red);
    color: white;
}

.btn--lg {
    padding: 14px 28px;
    font-size: 17px;
    border-radius: var(--r-lg);
    min-height: 50px;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn--mini {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

/* ---------- Upload Area ---------- */
.upload-area {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.upload-tabs {
    display: flex;
    max-width: 380px;
    margin: 0 auto var(--s4);
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    gap: 4px;
    position: relative;
}

.upload-tabs::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 12px) / 2);
    border-radius: 999px;
    background: #0a84ff;
    border: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 122, 255, 0.12);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-tabs.is-file::before {
    transform: translateX(calc(100% + 4px));
}

.upload-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(236, 240, 247, 0.6);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 160ms ease;
    position: relative;
    z-index: 1;
}

.upload-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.upload-tab--active, .upload-tab--active:hover {
    background: transparent;
    color: #fff;
    border: none;
    box-shadow: none;
}

.upload-panel {
    display: none;
    padding: 0;
}

.upload-panel--active {
    display: block;
}

/* Textarea */
.script-textarea {
    width: 100%;
    height: 400px;
    padding: var(--s4);
    background: rgba(18, 21, 29, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 20px;
    color: rgba(245, 247, 251, 0.94);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    backdrop-filter: blur(20px) saturate(1.08);
}

.script-textarea:focus {
    border-color: rgba(132, 190, 255, 0.52);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.script-textarea::placeholder {
    color: rgba(166, 175, 189, 0.38);
}

.script-textarea__hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--s3);
    font-size: 13px;
    color: rgba(166, 175, 189, 0.6);
}

/* Dropzone (GPT style) */
.drop-zone {
    --drop-dash: rgba(132, 190, 255, 0.42);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    gap: 24px;
    height: 400px;
    min-height: 400px;
    border: 0;
    border-radius: 34px;
    padding: 24px 24px 72px;
    background:
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 13px),
        rgba(18, 21, 29, 0.58);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.09),
        0 24px 70px rgba(0, 0, 0, 0.28);
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
    overflow: hidden;
    backdrop-filter: blur(20px) saturate(1.08);
    cursor: pointer;
}

.drop-zone::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    background:
        linear-gradient(90deg, var(--drop-dash) 0 18px, transparent 18px 30px) top left / 30px 2px repeat-x,
        linear-gradient(90deg, var(--drop-dash) 0 18px, transparent 18px 30px) bottom left / 30px 2px repeat-x,
        linear-gradient(180deg, var(--drop-dash) 0 18px, transparent 18px 30px) top left / 2px 30px repeat-y,
        linear-gradient(180deg, var(--drop-dash) 0 18px, transparent 18px 30px) top right / 2px 30px repeat-y;
    pointer-events: none;
}

.drop-zone::after {
    content: "";
    position: absolute;
    inset: auto 16% -36px;
    height: 86px;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.1);
    filter: blur(36px);
    pointer-events: none;
    z-index: -1;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    --drop-dash: rgba(88, 166, 255, 0.88);
    transform: translateY(-2px);
    background:
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 13px),
        rgba(26, 34, 50, 0.78);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 0 0 1px rgba(88, 166, 255, 0.16),
        0 30px 84px rgba(0, 122, 255, 0.18),
        0 28px 78px rgba(0, 0, 0, 0.34);
}

.drop-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Format Fan */
.format-fan {
    position: relative;
    align-self: center;
    width: min(960px, 100%);
    height: 250px;
    transform: translateY(-10px);
    z-index: 1;
}

.format-card {
    --card-radius: 20px;
    --card-inset: 7px;
    position: absolute;
    left: 50%;
    top: 6px;
    display: grid;
    place-items: center;
    width: 140px;
    height: 190px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--card-line, rgba(255, 255, 255, 0.18));
    border-radius: var(--card-radius);
    background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 22px 44px rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: clamp(24px, 1.8vw, 28px);
    line-height: 1;
    font-weight: 650;
    font-variation-settings: "wght" 650;
    letter-spacing: -0.01em;
    text-align: center;
    transform-origin: 50% 280px;
    transform: translateX(calc(-50% + var(--fan-x-start, 0px))) rotate(0deg) translateY(0);
    animation: fanGlow 8s ease-in-out infinite;
    animation-delay: calc(1.65s + var(--glow-delay, 0s));
    backdrop-filter: blur(18px) saturate(1.1);
    cursor: default;
    will-change: transform;
    transition: transform 160ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.format-card > span {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    color: #fff;
    font-size: inherit;
    font-weight: inherit;
    font-variation-settings: inherit;
    line-height: 1;
    translate: 0 0;
}

.format-card::before {
    content: "";
    position: absolute;
    inset: var(--card-inset);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: calc(var(--card-radius) - var(--card-inset));
    pointer-events: none;
}

.format-card:nth-child(1) {
    --fan-x: -180px;
    --fan-r: -25deg;
    --fan-y: 25px;
    --card-top: rgba(255, 159, 10, 0.86);
    --card-bottom: rgba(156, 92, 9, 0.76);
    --card-line: rgba(255, 201, 96, 0.42);
    --glow-delay: 0s;
    z-index: 1;
}

.format-card:nth-child(2) {
    --fan-x: -90px;
    --fan-r: -12deg;
    --fan-y: 8px;
    --card-top: rgba(255, 214, 10, 0.82);
    --card-bottom: rgba(159, 125, 10, 0.74);
    --card-line: rgba(255, 232, 117, 0.4);
    --glow-delay: -1.5s;
    z-index: 2;
}

.format-card:nth-child(3) {
    --fan-x: 0px;
    --fan-r: 0deg;
    --fan-y: 0px;
    --card-top: rgba(255, 255, 255, 0.16);
    --card-bottom: rgba(255, 255, 255, 0.07);
    --card-line: rgba(255, 255, 255, 0.18);
    --glow-delay: -3s;
    z-index: 5;
}

.format-card-plus {
    color: #fff;
    font-size: clamp(56px, 3.8vw, 68px);
    font-weight: 260;
    font-variation-settings: "wght" 260;
    cursor: pointer;
}

.format-card-plus > span {
    translate: 0 -12px;
}

.format-card-plus:hover,
.format-card-plus:focus-visible {
    --card-top: rgba(88, 166, 255, 0.98);
    --card-bottom: rgba(0, 122, 255, 0.96);
    --card-line: rgba(149, 204, 255, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 24px 56px rgba(0, 122, 255, 0.36);
    outline: none;
}

.format-card-plus::after {
    content: "Выбрать файл";
    position: absolute;
    left: 50%;
    bottom: 18px;
    z-index: 6;
    width: max-content;
    border: 0;
    padding: 0;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 480;
    font-variation-settings: "wght" 480;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.format-card-plus:hover::after,
.format-card-plus:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.format-card:nth-child(4) {
    --fan-x: 90px;
    --fan-r: 12deg;
    --fan-y: 8px;
    --card-top: rgba(71, 145, 255, 0.78);
    --card-bottom: rgba(24, 70, 156, 0.7);
    --card-line: rgba(129, 184, 255, 0.44);
    --glow-delay: -4.5s;
    z-index: 3;
}

.format-card:nth-child(5) {
    --fan-x: 180px;
    --fan-r: 25deg;
    --fan-y: 25px;
    --card-top: rgba(172, 103, 255, 0.78);
    --card-bottom: rgba(90, 47, 150, 0.72);
    --card-line: rgba(202, 153, 255, 0.4);
    --glow-delay: -6s;
    z-index: 1;
}

@keyframes fanGlow {
    0%, 100% { filter: brightness(0.96); }
    50% { filter: brightness(1.08); }
}

.drop-zone .drop-hint {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 72px;
    margin: 0 auto;
    max-width: none;
    color: rgba(190, 198, 210, 0.15);
    font-size: 15px;
    line-height: 1.34;
    font-weight: 300;
    white-space: normal;
    text-wrap: balance;
    transition: color 160ms ease, opacity 160ms ease;
}

.drop-zone:hover .drop-hint,
.drop-zone.is-dragging .drop-hint {
    color: rgba(225, 234, 246, 0.42);
}

.drop-ready-check {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 50%;
    background: #30d158;
    color: #fff;
    font-size: 13px;
    font-weight: 780;
    line-height: 1;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        0 10px 24px rgba(48, 209, 88, 0.24);
}

.drop-zone .drop-ready-check {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 780;
    opacity: 0;
    transform: scale(0.74);
    transition: opacity 160ms ease, transform 160ms ease;
}

.drop-zone.is-complete .drop-ready-check {
    opacity: 1;
    transform: scale(1);
}

.upload-meta {
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin-top: 18px;
    margin-bottom: 22px;
    background: transparent;
    color: rgba(166, 175, 189, 0.82);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    display: block;
}

.upload-meta.has-file {
    color: #30d158;
}

.select-file-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    min-height: 60px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0 38px;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.94), rgba(0, 122, 255, 0.94)), #007aff;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 18px 42px rgba(0, 122, 255, 0.3);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
    cursor: pointer;
}

.select-file-button:hover {
    transform: translateY(-1px);
    filter: saturate(1.06);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        0 22px 48px rgba(0, 122, 255, 0.38);
}

/* OCR Progress */
.ocr-progress {
    margin-top: var(--s4);
}

.ocr-progress__bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--r-full);
    overflow: hidden;
}

.ocr-progress__fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--r-full);
    width: 0%;
    transition: width 0.3s ease;
}

.ocr-progress__text {
    margin-top: var(--s2);
    font-size: 13px;
    color: rgba(166, 175, 189, 0.8);
    text-align: center;
}

/* Demo & Actions */
.demo-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.16);
    color: #84beff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 160ms ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.demo-btn:hover {
    background: rgba(0, 122, 255, 0.28);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.step__actions {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(5, 6, 10, 0.72) 58%, rgba(5, 6, 10, 0.88) 100%);
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--s4);
    z-index: 1000;
    border-top: none;
    backdrop-filter: none;
    margin: 0;
}

#continueToStep2 {
    min-height: 56px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
    transition: all 160ms ease;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.94), rgba(0, 122, 255, 0.94)), #007aff;
    color: #fff;
    box-shadow: 0 12px 28px rgba(0, 122, 255, 0.24);
    padding: 0 42px;
}

#continueToStep2:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(0, 122, 255, 0.35);
}

#continueToStep2:disabled {
    opacity: 1;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(190, 198, 210, 0.35);
    box-shadow: none;
    cursor: not-allowed;
}

#continueToStep3 {
    min-height: 56px;
    min-width: 220px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
    transition: all 160ms ease;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.94), rgba(0, 122, 255, 0.94)), #007aff;
    color: #fff;
    box-shadow: 0 12px 28px rgba(0, 122, 255, 0.24);
    padding: 0 42px;
}

#continueToStep3:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(0, 122, 255, 0.35);
}

#continueToStep3:disabled {
    opacity: 1;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(190, 198, 210, 0.35);
    box-shadow: none;
    cursor: not-allowed;
}

#continueToStep3.btn--danger {
    background: linear-gradient(180deg, rgba(255, 105, 97, 0.96), rgba(255, 69, 58, 0.96)), var(--system-red);
    color: #fff;
    box-shadow: 0 14px 34px rgba(255, 69, 58, 0.24);
}

#continueToStep3.btn--danger:hover:not(:disabled) {
    box-shadow: 0 18px 42px rgba(255, 69, 58, 0.32);
}

/* ---------- Badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 600;
    background: var(--fill-tertiary);
    color: var(--label-secondary);
}

.badge--auto {
    background: var(--accent-dim);
    color: var(--accent);
}

.badge--warning {
    background: rgba(255, 159, 10, 0.14);
    color: var(--system-orange);
}

/* ---------- Setup Layout ---------- */
.setup-layout {
    display: grid;
    grid-template-columns: minmax(0, 18fr) minmax(260px, 7fr);
    gap: 0;
    align-items: stretch;
    height: min(620px, calc(100vh - 260px));
    min-height: min(520px, calc(100vh - 250px));
    overflow: hidden;
    background: var(--bg-elevated);
    border: 0.5px solid var(--separator);
    border-radius: var(--r-xl);
}

.setup-panel {
    min-height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: var(--s5);
}

.setup-panel--script,
.setup-panel--settings {
    display: flex;
    flex-direction: column;
}

.setup-panel--settings {
    border-left: 0.5px solid var(--separator);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.setup-mode-switch {
    display: flex;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 3px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    gap: 3px;
    position: relative;
    flex-shrink: 0;
}

.setup-mode-switch::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 9px) / 2);
    border-radius: 999px;
    background: #0a84ff;
    border: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 122, 255, 0.12);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.setup-mode-switch.is-manual::before {
    transform: translateX(calc(100% + 3px));
}

.setup-mode-card {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 6px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(236, 240, 247, 0.6);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 160ms ease;
    position: relative;
    z-index: 1;
}

.setup-mode-card:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.setup-mode-card--active,
.setup-mode-card--active:hover {
    background: transparent;
    color: #fff;
    border: none;
    box-shadow: none;
}

.setup-mode-panel[hidden] {
    display: none;
}

.setup-mode-panel .setting-group:last-child,
.setting-group--manual-recording {
    margin-bottom: 0;
}

.manual-recording-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
    padding: var(--s4);
    border-radius: var(--r-lg);
    background: rgba(255, 255, 255, 0.055);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
}

.manual-recording-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: 3px;
}

.manual-recording-card__text {
    font-size: 13px;
    line-height: 1.42;
    color: var(--label-secondary);
}

.recording-settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
}

.empty-hint {
    padding: var(--s4);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.04);
    color: var(--label-tertiary);
    font-size: 13px;
    line-height: 1.45;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s4);
}

.panel-header--section {
    margin-bottom: var(--s3);
}

.panel-header--script-sticky {
    position: relative;
    z-index: 2;
    margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4);
    padding: var(--s5) var(--s5) var(--s4);
    background: linear-gradient(180deg, var(--bg-elevated) 70%, rgba(20, 22, 28, 0));
}

.panel-header--voice-sticky {
    position: sticky;
    top: calc(-1 * var(--s5));
    z-index: 3;
    align-items: stretch;
    flex-direction: column;
    gap: var(--s3);
    margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s5);
    padding: var(--s5) var(--s5) var(--s4);
    background: linear-gradient(180deg, var(--bg-elevated) 70%, rgba(20, 22, 28, 0));
}

.voice-mode-control {
    display: grid;
    gap: 7px;
}

.voice-mode-label {
    color: var(--label-tertiary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.panel-header__title {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.panel-header--compact {
    margin-bottom: var(--s3);
}

.setting-group--role {
    margin-bottom: var(--s5);
}

.setting-group--genre {
    margin-bottom: var(--s5);
}

.setting-group--genre[hidden] {
    display: none;
}

.voice-section {
    min-height: 0;
}

.role-select,
.genre-select,
.voice-preset-select,
.bulk-reassign select {
    width: 100%;
    min-height: 40px;
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.065);
    color: rgba(245, 247, 251, 0.92);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    padding: 0 38px 0 12px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='rgba(235,235,245,0.58)' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
}

.role-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s2);
    margin-top: var(--s2);
}

.bulk-reassign {
    display: grid;
    gap: var(--s3);
    margin-top: var(--s3);
    padding: var(--s3);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
}

.bulk-reassign[hidden] {
    display: none;
}

.bulk-reassign__field {
    display: grid;
    gap: 6px;
}

.bulk-reassign__field span {
    color: var(--label-tertiary);
    font-size: 12px;
    font-weight: 650;
}

.bulk-reassign__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s2);
}

/* Script Preview */
.script-preview {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -10px;
    padding-left: 10px;
    padding-right: 2px;
}

.script-preview::-webkit-scrollbar { width: 3px; }
.script-preview::-webkit-scrollbar-track { background: transparent; }
.script-preview::-webkit-scrollbar-thumb { background: var(--fill-secondary); border-radius: 3px; }

.script-line {
    padding: 11px 92px 11px 0;
    border-radius: 8px;
    margin-bottom: 2px;
    background: transparent;
    font-size: 16px;
    line-height: 1.5;
    transition: all var(--dur-fast) var(--ease);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    isolation: isolate;
}

.script-line::before {
    content: "";
    position: absolute;
    top: 2px;
    right: 0;
    bottom: 2px;
    left: -8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    z-index: 0;
}

.script-line:hover::before {
    opacity: 1;
}

.script-line--partner-line {
    border-left-color: transparent;
}

.script-line--partner-line .script-line__text {
    color: var(--label-secondary);
}

.script-line--unassigned {
    border-left-color: rgba(255, 255, 255, 0.16);
}

.script-line--low-confidence::before {
    opacity: 1;
    background: rgba(255, 159, 10, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 159, 10, 0.28);
}

.script-line__confidence-flag {
    color: var(--system-orange);
    font-size: 12px;
    margin-left: 2px;
}

.script-line--manual-muted {
    background: transparent;
}

.script-line--manual-muted::before {
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
}

.script-line--manual-muted .script-line__text,
.script-line--manual-muted .script-line__char-select {
    color: var(--label-tertiary) !important;
}

.script-line--batch-current {
    background: transparent;
    box-shadow: none;
}

.script-line--batch-current::before {
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line-color, var(--accent)) 25%, transparent);
}

.script-line__avatar {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-top: 1px;
    background: color-mix(in srgb, var(--line-color, rgba(255, 255, 255, 0.2)) 22%, rgba(255, 255, 255, 0.06));
    color: color-mix(in srgb, var(--line-color, rgba(245, 247, 251, 0.8)) 74%, white);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.script-line__avatar,
.script-line__content,
.script-line__actions {
    position: relative;
    z-index: 1;
}

.script-line--direction .script-line__avatar,
.script-line--unassigned .script-line__avatar {
    background: rgba(255, 255, 255, 0.06);
    color: var(--label-tertiary);
}

.script-line__content {
    min-width: 0;
    flex: 1;
}

.script-line__speaker {
    margin-bottom: 3px;
    color: var(--label-tertiary);
    font-size: 12px;
    font-weight: 650;
}

/* Actions container (right side) */
.script-line__actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.script-line:hover .script-line__actions {
    opacity: 1;
}

/* Always show actions when recording or has recording */
.script-line--recording .script-line__actions {
    opacity: 1;
}

.script-line__record-btn,
.script-line__play-btn,
.script-line__stop-btn,
.script-line__edit-btn,
.script-line__type-control {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.055);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    color: var(--label-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.script-line__type-control {
    position: relative;
    overflow: hidden;
}

.script-line__type-control > svg {
    width: 15px;
    height: 15px;
    opacity: 0.86;
}

.script-line__edit-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.9;
}

.script-line__edit-btn:hover {
    color: var(--label-primary);
    background: rgba(255, 255, 255, 0.09);
}

.script-line__record-btn:hover {
    color: var(--system-red);
    background: rgba(255, 69, 58, 0.1);
}

.script-line__record-btn--rerecord {
    color: var(--system-orange);
}

.script-line__play-btn:hover {
    color: var(--accent-green);
    background: rgba(48, 209, 88, 0.1);
}

.script-line__stop-btn {
    color: var(--system-red);
    background: rgba(255, 69, 58, 0.15);
}

.script-line__stop-btn:hover {
    background: rgba(255, 69, 58, 0.25);
}

/* Recording indicator (pulsing dot + REC) */
.script-line__recording-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--system-red);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--system-red);
    animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* Recording state */
.script-line--recording {
    background: transparent;
    box-shadow: none;
}

.script-line--recording::before {
    opacity: 1;
    background: rgba(255, 69, 58, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.24);
}

/* Recorded state */
.script-line--recorded {
    box-shadow: inset -2px 0 0 rgba(48, 209, 88, 0.45);
}

/* Karaoke highlighting */
.karaoke-word {
    color: inherit;
    opacity: 1;
    transition: color 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.karaoke-spoken {
    color: #ffffff;
    opacity: 1;
    transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1), color 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.karaoke-linear-char {
    color: rgba(255, 255, 255, 0.4);
}

.karaoke-linear-char--spoken {
    color: rgba(255, 255, 255, 0.92);
}

.karaoke-linear-char--partial {
    color: transparent;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.92) 0%,
        rgba(255, 255, 255, 0.92) var(--char-fill, 0%),
        rgba(255, 255, 255, 0.4) var(--char-fill, 0%),
        rgba(255, 255, 255, 0.4) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
}

.script-line__char-select {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

.script-line__text--direction {
    font-size: 14px;
    font-style: italic;
    color: var(--label-tertiary);
}

.script-line__text {
    font-size: 15.5px;
    line-height: 1.5;
    color: var(--label-secondary);
    border-radius: 7px;
    outline: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.script-line__text[contenteditable="true"] {
    cursor: text;
}

.script-line__text[contenteditable="true"]:focus,
.script-line__text.is-editing {
    background: rgba(255, 255, 255, 0.08);
    color: var(--label-primary);
}

.script-line--mine {
    background: transparent;
}

.script-line--mine::before {
    opacity: 1;
    background: rgba(255, 255, 255, 0.028);
}

.script-line--mine .script-line__text {
    color: var(--label-secondary);
    font-weight: 500;
}

/* Partner text — neutral */
.script-line__text--partner {
    color: var(--label-secondary);
}

/* Stage directions */
.script-line--direction {
    background: transparent;
}
.script-line--direction .script-line__text {
    font-size: 14px;
    font-style: italic;
    color: var(--label-tertiary);
}

/* Voice select optgroup */
.voice-preset-select optgroup {
    font-weight: 600;
    color: var(--label-secondary);
    font-style: normal;
}

/* Settings */
.setting-group { margin-bottom: var(--s6); }
.setting-group:last-child { margin-bottom: 0; }

/* Genre */
.genre-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
}

.genre-chip {
    padding: 7px 14px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-full);
    background: transparent;
    color: var(--label-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.genre-chip:hover { background: var(--fill-quaternary); }

.genre-chip--active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

/* Character Selector */
.character-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
}

.character-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.character-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    background: var(--bg-secondary);
    color: var(--label-secondary);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.character-btn__count,
.voice-card__count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.075);
    color: var(--label-tertiary);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.character-btn__count {
    height: 18px;
    min-width: 18px;
    padding: 0 5px;
    font-size: 10px;
}

.character-btn--add {
    margin-top: var(--s3);
    width: fit-content;
    border-style: dashed;
    color: var(--label-tertiary);
}

.character-btn:hover {
    background: var(--fill-tertiary);
    transform: translateY(-1px);
}

.character-btn--selected {
    background: rgba(10, 132, 255, 0.15);
    color: #0a84ff;
    border: 1px solid rgba(10, 132, 255, 0.3);
    box-shadow: none;
}

/* Voice Cards */
.voice-settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
}

.voice-card {
    background: var(--bg-secondary);
    border: 0.5px solid var(--separator);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all var(--dur-fast) var(--ease);
    cursor: pointer;
}

.voice-card:hover {
    background: color-mix(in srgb, var(--bg-secondary) 88%, white);
    border-color: rgba(255, 255, 255, 0.14);
}

.voice-card--mine { opacity: 1; pointer-events: auto; }

.voice-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--s4);
    gap: var(--s3);
}

.voice-card__name {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-weight: 600;
    font-size: 14px;
    min-width: 0;
}

.voice-card__name > span:not(.voice-card__count) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-card__sub {
    color: var(--label-secondary);
    font-size: 12px;
    font-weight: 550;
}

.voice-card__color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.voice-card .btn--mini {
    width: 34px;
    height: 34px;
    min-height: 34px;
    min-width: 34px;
    border-radius: 999px;
    font-size: 12px;
}

.voice-card__controls {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    flex-shrink: 0;
}

.voice-card__play {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.voice-card__play svg {
    display: block;
    flex: 0 0 auto;
}

.voice-card__play.is-playing {
    color: var(--system-red);
    background: rgba(255, 69, 58, 0.12);
    border-color: rgba(255, 69, 58, 0.2);
}

.voice-card__chevron {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--label-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.voice-card__chevron:hover {
    color: var(--label-primary);
    background: rgba(255, 255, 255, 0.06);
}

.voice-card__chevron.is-open {
    transform: rotate(180deg);
    color: var(--label-secondary);
}

.voice-card__toggle {
    background: none;
    border: none;
    color: var(--label-tertiary);
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease);
    padding: 4px;
}

.voice-card__toggle--open { transform: rotate(180deg); }

.voice-card__body {
    display: none;
    margin-top: 2px;
    padding: var(--s4);
    border-top: 0.5px solid rgba(255, 255, 255, 0.08);
    cursor: default;
}

.voice-card__body--open { display: block; }

.voice-setting { margin-bottom: var(--s4); }
.voice-setting:last-child { margin-bottom: 0; }

.voice-setting__label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--label-secondary);
    margin-bottom: var(--s1);
}

.voice-setting__value {
    font-weight: 600;
    color: var(--label-primary);
    font-variant-numeric: tabular-nums;
}

/* Gender Toggle — Apple Segmented */
.gender-toggle {
    display: flex;
    background: var(--fill-tertiary);
    border-radius: 12px;
    padding: 2px;
}

.gender-option {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--label-tertiary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.gender-option--active {
    background: rgba(255, 255, 255, 0.16);
    color: var(--label-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.26);
}

/* Sliders — Apple style */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--fill-tertiary);
    border-radius: var(--r-full);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(0,0,0,0.1);
    transition: transform var(--dur-fast) var(--ease);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.voice-card__actions {
    display: flex;
    gap: var(--s2);
    margin-top: var(--s3);
}

/* ---------- Performance View ---------- */
.perform-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--s3);
    border-bottom: 0.5px solid var(--separator);
    flex-shrink: 0;
}

.perform-progress__text {
    min-width: 42px;
    text-align: right;
    font-size: 12px;
    color: var(--label-tertiary);
    font-variant-numeric: tabular-nums;
}

.perform-status {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: 13px;
    color: var(--label-secondary);
    font-weight: 500;
}

.perform-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--label-tertiary);
    transition: background var(--dur-fast) var(--ease);
}

.perform-status--listening .perform-status__dot { background: var(--system-green); animation: pulse 1.5s ease-in-out infinite; }
.perform-status--speaking .perform-status__dot { background: var(--system-blue); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.5); }
}

/* Teleprompter */
#teleprompter {
    --prompter-font-scale: 1;
}

.teleprompter {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--s16) var(--s8) var(--s10);
    text-align: center;
    position: relative;
    transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.teleprompter__line {
    max-width: 720px;
    width: 100%;
    transition: font-size 280ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms cubic-bezier(0.16, 1, 0.3, 1), color 260ms cubic-bezier(0.16, 1, 0.3, 1), transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 30px;
}

.teleprompter__line--prev {
    font-size: calc(17px * var(--prompter-font-scale));
    color: var(--label-quaternary);
    margin-bottom: var(--s16);
}

.teleprompter__current-wrapper {
    width: 100%;
    max-width: 720px;
}

.teleprompter.is-scrubbing .teleprompter__line,
.teleprompter.is-scrubbing .teleprompter__line--current,
.teleprompter.is-scrubbing .teleprompter__line--prev,
.teleprompter.is-scrubbing .teleprompter__line--next {
    font-size: calc(21px * var(--prompter-font-scale)) !important;
    line-height: 1.38;
    opacity: 0.72;
    margin-top: var(--s4);
    margin-bottom: var(--s4);
}

.teleprompter.is-scrubbing .teleprompter__speaker,
.teleprompter.is-scrubbing .teleprompter__cue-indicator {
    opacity: 0;
}

.teleprompter__speaker { margin-bottom: var(--s3); }

.teleprompter__speaker-label {
    display: inline-block;
    color: var(--label-tertiary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.teleprompter__line--current {
    font-size: calc(36px * var(--prompter-font-scale));
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--label-primary);
    transition: font-size 280ms cubic-bezier(0.16, 1, 0.3, 1), color var(--dur-base) var(--ease), transform 360ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.teleprompter__line--current.is-direction-line {
    font-size: calc(20px * var(--prompter-font-scale));
}

.teleprompter__line--current.is-my-line {
    color: rgba(255, 255, 255, 0.34);
}

.teleprompter__line--current.is-my-line .karaoke-word {
    color: rgba(255, 255, 255, 0.34);
}

.teleprompter__line--current.is-my-line .karaoke-spoken {
    color: #ffffff;
    opacity: 1;
    animation: none;
    transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1), color 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes spokenWordIn {
    from { color: rgba(255, 255, 255, 0.34); }
    to { color: #ffffff; }
}

.teleprompter__line--current.is-other-line {
    color: rgba(255, 255, 255, 0.4);
}

.teleprompter__line--current.is-other-line.is-linear-highlight {
    color: rgba(255, 255, 255, 0.4);
}

.teleprompter__line--current.is-other-line .karaoke-spoken {
    color: rgba(255, 255, 255, 0.78);
}

.teleprompter__cue-indicator {
    margin-top: var(--s6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s2);
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease);
}

.teleprompter__cue-indicator.is-active { opacity: 1; }

.cue-indicator__waves {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.cue-indicator__waves span {
    width: 3px;
    height: 6px;
    background: var(--system-green);
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
}

.cue-indicator__waves span:nth-child(1) { animation-delay: 0s; }
.cue-indicator__waves span:nth-child(2) { animation-delay: 0.1s; }
.cue-indicator__waves span:nth-child(3) { animation-delay: 0.2s; }
.cue-indicator__waves span:nth-child(4) { animation-delay: 0.3s; }
.cue-indicator__waves span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 6px; }
    50% { height: 20px; }
}

.cue-indicator__text {
    font-size: 13px;
    color: var(--system-green);
    font-weight: 500;
}

/* Timeout-подсказка: молчание слишком долго */
.teleprompter__cue-indicator.cue-indicator--hint .cue-indicator__waves span {
    background: var(--system-orange, #ff9f0a);
    animation-play-state: paused;
    height: 6px;
}
.teleprompter__cue-indicator.cue-indicator--hint .cue-indicator__text {
    color: var(--system-orange, #ff9f0a);
}

.teleprompter__line--next {
    font-size: calc(17px * var(--prompter-font-scale));
    color: var(--label-quaternary);
    margin-top: var(--s16);
    opacity: 0.5;
}

.perform-bottom {
    width: min(720px, calc(100% - 32px));
    margin: 0 auto 24px;
    position: sticky;
    bottom: 24px;
    z-index: 5;
    padding: var(--s4) var(--s6);
    background: rgba(18, 21, 29, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 20px 48px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 260ms var(--ease);
}

.perform-bottom.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.perform-scrubber {
    display: block;
    align-items: center;
    margin-bottom: var(--s4);
}

.perform-scrubber .perform-progress__text {
    display: none;
}

.perform-scrubber__track {
    position: relative;
    height: 40px;
}

.perform-scrubber__track::after {
    content: '';
    position: absolute;
    top: 1px;
    bottom: 1px;
    left: var(--hover-x, 0%);
    width: 1px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.72);
    opacity: 0;
    transform: translateX(-0.5px);
    transition: opacity 160ms var(--ease);
    pointer-events: none;
}

.perform-scrubber__track:hover::after {
    opacity: 1;
}

.perform-scrubber__track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    border-radius: var(--r-full);
    background: var(--fill-tertiary);
    transform: translateY(-50%);
    display: none;
}

.perform-scrubber .perform-progress__fill {
    position: absolute;
    left: 0;
    top: 50%;
    height: 2px;
    width: 0%;
    border-radius: var(--r-full);
    background: var(--label-secondary);
    transform: translateY(-50%);
    transition: width var(--dur-base) var(--ease);
    pointer-events: none;
    display: none;
}

.perform-scrubber__markers {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    pointer-events: none;
}

.perform-scrubber__segment {
    flex: 1 1 0;
    min-width: 6px;
    height: 7px;
    border-radius: 6px;
    background: rgba(235, 235, 245, 0.16);
    opacity: 1;
    transition: height var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.perform-scrubber__segment--mine {
    height: 18px;
    background: rgba(235, 235, 245, 0.28);
}

.perform-scrubber__segment--other,
.perform-scrubber__segment--partner,
.perform-scrubber__segment--direction {
    height: 7px;
    opacity: 0.78;
}

.perform-scrubber__segment.is-complete {
    background: rgba(235, 235, 245, 0.38);
}

.perform-scrubber__segment.is-current {
    background: rgba(255, 255, 255, 0.82);
    transform: scaleY(1.2);
}

.perform-scrubber__range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 40px;
    margin: 0;
    opacity: 1;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

.perform-scrubber__range::-webkit-slider-runnable-track {
    height: 40px;
    background: transparent;
}

.perform-scrubber__range::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 1px;
    height: 40px;
    margin-top: 0;
    border-radius: 1px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: none;
    opacity: 0;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.perform-scrubber__range:hover::-webkit-slider-thumb {
    opacity: 0;
    transform: none;
    box-shadow: none;
}

.perform-scrubber__range::-moz-range-track {
    height: 40px;
    background: transparent;
}

.perform-scrubber__range::-moz-range-thumb {
    width: 1px;
    height: 40px;
    border-radius: 1px;
    border: none;
    background: transparent;
    box-shadow: none;
}

.teleprompter.is-seeking-forward {
    animation: teleprompterSeekForward 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.teleprompter.is-seeking-backward {
    animation: teleprompterSeekBackward 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes teleprompterSeekForward {
    from { opacity: 0.4; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes teleprompterSeekBackward {
    from { opacity: 0.4; transform: translateY(-22px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Controls */
.perform-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s9);
    padding: var(--s5) 0;
    flex-shrink: 0;
}

.control-btn {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--label-secondary);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.control-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--separator);
    color: var(--label-primary);
    transform: scale(1.06);
}

.control-btn:active { transform: scale(0.95); }

.control-btn:disabled {
    opacity: 0.38;
    cursor: default;
    transform: none;
}

.control-btn:not(.control-btn--main):disabled:hover {
    background: transparent;
    border-color: transparent;
    color: var(--label-secondary);
    transform: none;
}

.control-btn--main:disabled:hover {
    border: none;
    filter: none;
    transform: none;
}

.control-btn--main {
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: #fff;
    border: none;
}

.control-btn--main:hover {
    transform: scale(1.06);
    border: none;
}

.control-btn--main.is-active {
    background: var(--system-red);
}

.control-btn--main.is-finished {
    background: var(--bg-elevated);
    color: var(--label-primary);
    border: 0.5px solid var(--separator);
}

.control-btn--main:not(.is-active):not(.is-finished) svg {
    margin-left: 4px;
}

.control-btn--font {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0;
}

/* Onboarding */
.onboarding-hint {
    --hint-arrow-left: 50%;
    position: fixed;
    z-index: 650;
    width: min(360px, calc(100vw - 32px));
    padding: var(--s4);
    background: var(--bg-secondary);
    border: 0.5px solid var(--separator);
    border-radius: var(--r-lg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 18px 48px rgba(0, 0, 0, 0.34);
    color: var(--label-primary);
    animation: hintIn 180ms var(--ease);
}

.onboarding-hint::after {
    content: "";
    position: absolute;
    left: var(--hint-arrow-left);
    transform: translateX(-50%);
    width: 0;
    height: 0;
}

.onboarding-hint--above::after {
    bottom: -8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--bg-secondary);
}

.onboarding-hint--below::after {
    top: -8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--bg-secondary);
}

.onboarding-hint__close,
.onboarding-step3__close {
    position: absolute;
    top: var(--s3);
    right: var(--s3);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--fill-tertiary);
    color: var(--label-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.onboarding-hint__close:hover,
.onboarding-step3__close:hover {
    background: var(--fill-secondary);
    color: var(--label-primary);
}

.onboarding-hint__text {
    margin: 0 34px var(--s4) 0;
    color: var(--label-secondary);
    font-size: 14px;
    line-height: 1.45;
}

.onboarding-step3-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s6);
    background: rgba(6, 8, 12, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 180ms var(--ease);
}

.onboarding-step3 {
    position: relative;
    width: min(520px, 100%);
    padding: var(--s7);
    background: var(--bg-elevated);
    border: 0.5px solid var(--separator);
    border-radius: var(--r-2xl);
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.52);
    text-align: left;
}

.onboarding-step3__title {
    margin: 0 36px var(--s5) 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--label-primary);
}

.onboarding-step3__lines {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    margin-bottom: var(--s6);
}

.onboarding-step3__lines p {
    margin: 0;
    color: var(--label-secondary);
    font-size: 16px;
    line-height: 1.5;
}

@keyframes hintIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hint */
.perform-mode-badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.05em;
    border: 1px solid var(--accent-medium);
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--s2);
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    background: rgba(28, 28, 30, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-full);
    color: rgba(245, 247, 251, 0.92);
    font-size: 14px;
    font-weight: 560;
    letter-spacing: 0;
    box-shadow: 0 16px 50px rgba(0,0,0,0.34);
    animation: toastIn var(--dur-base) var(--ease);
    backdrop-filter: saturate(160%) blur(24px);
    -webkit-backdrop-filter: saturate(160%) blur(24px);
    max-width: 400px;
    text-align: left;
    pointer-events: auto;
}

.toast--success,
.toast--error,
.toast--info,
.toast--warning {
    border-color: rgba(255, 255, 255, 0.08);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast--exit {
    animation: toastOut 0.25s var(--ease) forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal[hidden] {
    display: none !important;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal__content {
    position: relative;
    width: 90%;
    max-width: 440px;
    background: var(--bg-elevated);
    border: 0.5px solid var(--separator);
    border-radius: var(--r-2xl);
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    overflow: hidden;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s5);
    border-bottom: 0.5px solid var(--separator);
}

.modal__header h3 { font-size: 17px; font-weight: 600; }

.modal__close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--fill-tertiary);
    color: var(--label-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.modal__close:hover { background: var(--fill-secondary); color: var(--label-primary); }

.modal__body { padding: var(--s5); }

.modal__line-text {
    padding: var(--s3);
    background: var(--bg-secondary);
    border-radius: var(--r-md);
    font-size: 14px;
    font-style: italic;
    color: var(--label-secondary);
    margin-bottom: var(--s5);
}

.record-controls {
    display: flex;
    gap: var(--s2);
    align-items: center;
}

.record-btn { display: flex; align-items: center; gap: 6px; }

.record-btn__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.record-btn.is-recording .record-btn__dot {
    background: white;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .setup-layout {
        grid-template-columns: minmax(0, 3fr) minmax(240px, 1.2fr);
    }

    .setup-panel {
        padding: var(--s4);
    }

    .panel-header--script-sticky,
    .panel-header--voice-sticky {
        margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) var(--s4);
        padding: var(--s4) var(--s4) var(--s3);
    }

    .script-line {
        padding-right: 82px;
    }
}

@media (max-width: 768px) {
    .header { padding: 0 var(--s3); }
    .header__spacer { display: none; }
    .header__steps {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 220px;
        border-radius: 10px;
        overflow: hidden;
    }
    .step-indicator {
        margin-left: 0;
        padding: 0 10px;
        clip-path: none;
        border-radius: 0;
    }
    .step-indicator:first-of-type {
        padding-left: 10px;
        clip-path: none;
    }
    .step-indicator__label {
        display: inline;
        font-size: 0;
    }
    .step-indicator::after {
        content: attr(data-step);
        font-size: 13px;
        letter-spacing: 0;
    }
    .step__container { padding: var(--s6) var(--s4); }
    .step__container--full {
        height: calc(100vh - 60px);
        padding: 0 var(--s4);
    }
    .step__title { font-size: 28px; }
    .panel-header--voice-sticky {
        align-items: flex-start;
        flex-direction: column;
    }
    .setup-mode-switch {
        width: 100%;
        max-width: none;
    }
    .setup-mode-card {
        padding: 0 10px;
        font-size: 11px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }
    .setup-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    .setup-panel--settings {
        border-left: none;
        border-top: 0.5px solid var(--separator);
    }
    .toast-container {
        top: 64px;
        right: 12px;
        left: 12px;
        align-items: stretch;
    }
    .toast {
        max-width: none;
    }
    .script-preview {
        max-height: 420px;
    }
    .manual-recording-card {
        align-items: stretch;
        flex-direction: column;
    }
    .teleprompter__line--current { font-size: calc(24px * var(--prompter-font-scale)); }
    .teleprompter { padding: var(--s8) var(--s2) var(--s6); }
    .perform-bottom {
        width: calc(100% - 24px);
        margin-bottom: 16px;
        bottom: 16px;
        padding: var(--s3) var(--s4);
    }
    .perform-scrubber__segment { min-width: 4px; }
    /* На мобильной ширине кнопка "Сообщить о проблеме" геометрически перекрывает
       .perform-bottom (обе привязаны к низу экрана) — переносим её наверх. */
    .feedback-fab {
        top: 12px;
        bottom: auto;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .step__title { font-size: 24px; }
    .step__subtitle { font-size: 15px; }
    .perform-controls { gap: var(--s4); }
    .control-btn--main { width: 56px; height: 56px; }
}

/* ---------- Account (вход, баланс) ---------- */
.header__account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--s2);
    min-width: 140px;
    flex-shrink: 0;
}

.account-btn {
    padding: 6px 14px;
    border: 1px solid var(--separator);
    border-radius: 980px;
    background: transparent;
    color: var(--label-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-btn:hover { background: var(--fill-tertiary); }

.account-chip {
    padding: 4px 10px;
    border-radius: 980px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.account-row { display: flex; gap: var(--s2); margin: var(--s3) 0; }

.account-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--separator);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--label-primary);
    font-size: 14px;
    outline: none;
}

.account-input:focus { border-color: var(--accent); }

.account-hint { font-size: 13px; color: var(--label-secondary); line-height: 1.45; }
.account-hint--status { margin-top: var(--s2); }
.account-hint a { color: var(--accent); }

.account-email { font-size: 15px; font-weight: 600; }
.account-balance { font-size: 13px; color: var(--label-secondary); margin: 4px 0 var(--s3); }
.account-logout { margin-top: var(--s3); }

@media (max-width: 720px) {
    .header__account { min-width: 0; }
    .account-chip { display: none; }
}

/* ---------- Feedback (сообщить о проблеме) ---------- */
.feedback-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 90;
    padding: 8px 14px;
    border: 1px solid var(--separator);
    border-radius: 980px;
    background: var(--bg-elevated);
    color: var(--label-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.feedback-fab:hover { color: var(--label-primary); border-color: var(--label-tertiary); }

.feedback-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--separator);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--label-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    margin-bottom: var(--s2);
}

.feedback-textarea:focus { border-color: var(--accent); }
