/*
 * AI Voice Generator. Everything is scoped under .aiv (style.css loads
 * after page styles, so the extra class keeps these rules winning) and
 * built on the site's colour tokens, so the light theme is clean white
 * cards with purple accents and the site's dark mode still works.
 */

@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/poppins-400-latin.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/poppins-500-latin.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/poppins-600-latin.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/poppins-700-latin.woff2') format('woff2'); }

.aiv {
    --aiv-accent: #7c3aed;
    --aiv-accent-strong: #6d28d9;
    --aiv-accent-soft: #f4effe;
    --aiv-accent-line: #e4d8fc;
    --aiv-card: var(--surface, #fff);
    --aiv-line: var(--border, #e3e5ec);
    --aiv-muted: var(--text-muted, #666a77);
    --aiv-field: #fbfbfe;
    --aiv-shadow: 0 1px 2px rgba(24, 16, 64, 0.04), 0 8px 24px rgba(24, 16, 64, 0.06);
    --aiv-radius: 18px;
    --aiv-danger: #c62f3c;
    --aiv-danger-soft: #fdeff0;
    --aiv-success: #138a52;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aiv {
        --aiv-accent: #a78bfa;
        --aiv-accent-strong: #c4b5fd;
        --aiv-accent-soft: rgba(167, 139, 250, 0.12);
        --aiv-accent-line: rgba(167, 139, 250, 0.35);
        --aiv-field: #171821;
        --aiv-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
        --aiv-danger: #ff8a93;
        --aiv-danger-soft: rgba(255, 138, 147, 0.12);
        --aiv-success: #6ee7a8;
    }
}

:root[data-theme="dark"] .aiv {
    --aiv-accent: #a78bfa;
    --aiv-accent-strong: #c4b5fd;
    --aiv-accent-soft: rgba(167, 139, 250, 0.12);
    --aiv-accent-line: rgba(167, 139, 250, 0.35);
    --aiv-field: #171821;
    --aiv-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --aiv-danger: #ff8a93;
    --aiv-danger-soft: rgba(255, 138, 147, 0.12);
    --aiv-success: #6ee7a8;
}

/* Components below set their own display; keep the hidden attribute authoritative. */
.aiv [hidden] {
    display: none !important;
}

.aiv button,
.aiv input,
.aiv select,
.aiv textarea {
    font-family: inherit;
}

.aiv .aiv-icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.aiv .aiv-icon--fill {
    fill: currentColor;
    stroke: none;
}

/* ---------- hero ---------- */

.aiv .aiv-hero {
    margin: 8px 0 28px;
}

.aiv .aiv-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.aiv .aiv-eyebrow .aiv-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    stroke: none;
}

.aiv .aiv-hero h1 {
    margin: 14px 0 10px;
    font-size: clamp(2rem, 4.5vw, 2.8rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.aiv .aiv-lead {
    max-width: 760px;
    margin: 0;
    color: var(--aiv-muted);
    font-size: 1.02rem;
    line-height: 1.7;
}

.aiv .aiv-hero-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 22px;
    margin-top: 18px;
}

.aiv .aiv-reset-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--aiv-line);
    border-radius: 999px;
    background: var(--aiv-card);
    color: var(--aiv-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: auto;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.aiv .aiv-reset-all:hover { border-color: var(--aiv-accent-line); color: var(--aiv-accent); }
.aiv .aiv-reset-all .aiv-icon { width: 16px; height: 16px; }

.aiv .aiv-hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.aiv .aiv-hero-points li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aiv .aiv-hero-points .aiv-icon {
    color: var(--aiv-accent);
}

/* ---------- layout + cards ---------- */

.aiv .aiv-workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "text" "voice" "settings";
    gap: 20px;
    align-items: start;
}

@media (min-width: 1000px) {
    .aiv .aiv-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        grid-template-areas: "text voice" "settings voice";
    }
}

.aiv .aiv-card--text { grid-area: text; }
.aiv .aiv-card--voice { grid-area: voice; }
.aiv .aiv-card--settings { grid-area: settings; }

.aiv .aiv-card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--aiv-line);
    border-radius: var(--aiv-radius);
    background: var(--aiv-card);
    box-shadow: var(--aiv-shadow);
}

.aiv .aiv-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.aiv .aiv-card__head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.aiv .aiv-step {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.aiv .aiv-link-btn {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--aiv-accent);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.aiv .aiv-link-btn:hover { color: var(--aiv-accent-strong); text-decoration: underline; }

.aiv :is(button, input, select, textarea, a, summary):focus-visible {
    outline: 3px solid var(--aiv-accent-line);
    outline-offset: 2px;
}

/* ---------- text ---------- */

.aiv .aiv-textarea {
    display: block;
    width: 100%;
    min-height: 220px;
    padding: 14px 16px;
    border: 1px solid var(--aiv-line);
    border-radius: 14px;
    background: var(--aiv-field);
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.aiv .aiv-textarea:focus {
    border-color: var(--aiv-accent);
    box-shadow: 0 0 0 4px var(--aiv-accent-soft);
    outline: none;
}

.aiv .aiv-text-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--aiv-muted);
    font-size: 0.82rem;
}

.aiv .aiv-text-meta .is-error { color: var(--aiv-danger); font-weight: 500; }

.aiv .aiv-count {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.aiv .aiv-count.is-near { color: #b7791f; }
.aiv .aiv-count.is-over { color: var(--aiv-danger); }

.aiv .aiv-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    color: var(--aiv-muted);
    font-size: 0.82rem;
}

.aiv .aiv-chip {
    padding: 6px 12px;
    border: 1px solid var(--aiv-line);
    border-radius: 999px;
    background: var(--aiv-card);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.aiv .aiv-chip:hover {
    border-color: var(--aiv-accent-line);
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
}

/* ---------- engine segment ---------- */

.aiv .aiv-segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--aiv-line);
    border-radius: 14px;
    background: var(--aiv-field);
}

.aiv .aiv-segment__btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.aiv .aiv-segment__btn strong { font-size: 0.9rem; font-weight: 600; }
.aiv .aiv-segment__btn small { color: var(--aiv-muted); font-size: 0.74rem; }

.aiv .aiv-segment__btn.is-active {
    border-color: var(--aiv-accent-line);
    background: var(--aiv-card);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

.aiv .aiv-segment__btn.is-active strong { color: var(--aiv-accent); }

/* ---------- fields ---------- */

.aiv .aiv-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.aiv .aiv-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.aiv .aiv-field > label,
.aiv .aiv-field__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.aiv .aiv-field select,
.aiv .aiv-search input,
.aiv .aiv-byok input[type="text"] {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--aiv-line);
    border-radius: 11px;
    background-color: var(--aiv-field);
    color: var(--text);
    font-size: 0.88rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.aiv .aiv-field select {
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 11px center;
    background-repeat: no-repeat;
    background-size: 16px;
    cursor: pointer;
}

.aiv .aiv-field select:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.aiv .aiv-field select:focus,
.aiv .aiv-search input:focus,
.aiv .aiv-byok input:focus {
    border-color: var(--aiv-accent);
    box-shadow: 0 0 0 4px var(--aiv-accent-soft);
    outline: none;
}

.aiv .aiv-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--aiv-line);
    border-radius: 11px;
    background: var(--aiv-field);
}

.aiv .aiv-pill {
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--aiv-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}

.aiv .aiv-pill.is-active {
    background: var(--aiv-accent);
    color: #fff;
    font-weight: 600;
}

.aiv .aiv-search {
    position: relative;
    margin-top: 14px;
}

.aiv .aiv-search .aiv-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--aiv-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.aiv .aiv-search input { padding-left: 38px; }

/* ---------- voice grid ---------- */

.aiv .aiv-voice-status {
    margin: 14px 0 10px;
    color: var(--aiv-muted);
    font-size: 0.8rem;
}

.aiv .aiv-voices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 520px;
    margin: 0 -4px;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.aiv .aiv-voice {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 74px;
    border: 1px solid var(--aiv-line);
    border-radius: 14px;
    background: var(--aiv-card);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.aiv .aiv-voice:hover {
    border-color: var(--aiv-accent-line);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.08);
}

.aiv .aiv-voice.is-selected {
    border-color: var(--aiv-accent);
    background: var(--aiv-accent-soft);
    box-shadow: 0 0 0 1px var(--aiv-accent);
}

.aiv .aiv-voice--skeleton {
    border-style: dashed;
    background: linear-gradient(90deg, var(--aiv-field) 25%, var(--aiv-accent-soft) 50%, var(--aiv-field) 75%);
    background-size: 200% 100%;
    animation: aiv-shimmer 1.2s linear infinite;
}

@keyframes aiv-shimmer {
    to { background-position: -200% 0; }
}

.aiv .aiv-voice__select {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 12px 6px 12px 12px;
    border: 0;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.aiv .aiv-voice__avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ede9fe, #e0e7ff);
    color: #5b21b6;
    font-size: 0.95rem;
    font-weight: 700;
}

.aiv .aiv-voice__avatar--female { background: linear-gradient(135deg, #fce7f3, #ede9fe); color: #9d174d; }
.aiv .aiv-voice__avatar--male { background: linear-gradient(135deg, #e0f2fe, #ede9fe); color: #1e40af; }

.aiv .aiv-voice__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.aiv .aiv-voice__body strong {
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aiv .aiv-voice__body span,
.aiv .aiv-voice__body small {
    overflow: hidden;
    color: var(--aiv-muted);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aiv .aiv-voice__body small { color: var(--aiv-accent); font-weight: 500; }

.aiv .aiv-voice__play {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    align-self: center;
    width: 36px;
    height: 36px;
    margin-right: 10px;
    border: 1px solid var(--aiv-accent-line);
    border-radius: 50%;
    background: var(--aiv-card);
    color: var(--aiv-accent);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.aiv .aiv-voice__play:hover:not(:disabled) { background: var(--aiv-accent); color: #fff; }
.aiv .aiv-voice__play:disabled { opacity: 0.35; cursor: not-allowed; }
.aiv .aiv-voice__play .aiv-icon { width: 15px; height: 15px; }
.aiv .aiv-voice__play .aiv-icon--pause,
.aiv .aiv-voice__play .aiv-spinner { display: none; }
.aiv .aiv-voice__play.is-playing { background: var(--aiv-accent); color: #fff; }
.aiv .aiv-voice__play.is-playing .aiv-icon--play { display: none; }
.aiv .aiv-voice__play.is-playing .aiv-icon--pause { display: block; }
.aiv .aiv-voice__play.is-loading .aiv-icon { display: none; }
.aiv .aiv-voice__play.is-loading .aiv-spinner { display: block; }

.aiv .aiv-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: aiv-spin 0.7s linear infinite;
}

@keyframes aiv-spin {
    to { transform: rotate(360deg); }
}

.aiv .aiv-more {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: 1px dashed var(--aiv-accent-line);
    border-radius: 12px;
    background: none;
    color: var(--aiv-accent);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.aiv .aiv-more:hover { background: var(--aiv-accent-soft); }

/* ---------- settings ---------- */

.aiv .aiv-sliders {
    display: grid;
    gap: 18px;
}

.aiv .aiv-range output {
    min-width: 52px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.aiv input[type="range"] {
    --fill: 50%;
    width: 100%;
    height: 6px;
    margin: 8px 0;
    border-radius: 999px;
    background: linear-gradient(to right, var(--aiv-accent) 0, var(--aiv-accent) var(--fill), var(--aiv-line) var(--fill));
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.aiv input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--aiv-accent);
    box-shadow: 0 1px 4px rgba(24, 16, 64, 0.3);
    -webkit-appearance: none;
}

.aiv input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--aiv-accent);
    box-shadow: 0 1px 4px rgba(24, 16, 64, 0.3);
}

.aiv .aiv-range__ends {
    display: flex;
    justify-content: space-between;
    color: var(--aiv-muted);
    font-size: 0.72rem;
}

.aiv .aiv-note {
    margin: 10px 0 0;
    color: var(--aiv-muted);
    font-size: 0.8rem;
    line-height: 1.55;
}

.aiv .aiv-field .aiv-note { margin-top: 4px; }

.aiv .aiv-byok {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid var(--aiv-line);
    border-radius: 14px;
    background: var(--aiv-field);
}

.aiv .aiv-byok summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}

.aiv .aiv-byok summary::-webkit-details-marker { display: none; }
.aiv .aiv-byok summary .aiv-icon { color: var(--aiv-accent); }

.aiv .aiv-byok summary::after {
    content: '';
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-right: 2px solid var(--aiv-muted);
    border-bottom: 2px solid var(--aiv-muted);
    transform: rotate(45deg);
    transition: transform 0.15s;
}

.aiv .aiv-byok[open] summary::after { transform: rotate(-135deg); }

.aiv .aiv-optional {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
    font-size: 0.7rem;
    font-weight: 600;
}

.aiv .aiv-byok__row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.aiv .aiv-byok__row input { flex: 1; min-width: 0; background: var(--aiv-card); }

/* Hides the key like a password field without being one (see index.php). */
.aiv .aiv-masked:not(:placeholder-shown) {
    -webkit-text-security: disc;
    text-security: disc;
}

.aiv .aiv-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.82rem;
    cursor: pointer;
}

.aiv .aiv-check input { accent-color: var(--aiv-accent); }

.aiv .aiv-note a { color: var(--aiv-accent); }

/* ---------- generate bar ---------- */

.aiv .aiv-generate {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid var(--aiv-accent-line);
    border-radius: var(--aiv-radius);
    background: var(--aiv-card);
    box-shadow: 0 10px 30px rgba(76, 29, 149, 0.12);
}

.aiv .aiv-generate__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.aiv .aiv-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    font-size: 0.9rem;
}

.aiv .aiv-selected span:not(.aiv-selected__dot) { color: var(--aiv-muted); font-size: 0.8rem; }

.aiv .aiv-selected__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aiv-success);
}

.aiv .aiv-usage {
    color: var(--aiv-muted);
    font-size: 0.78rem;
}

.aiv .aiv-usage.is-empty { color: var(--aiv-danger); font-weight: 600; }

.aiv .aiv-generate__actions {
    display: flex;
    gap: 10px;
}

.aiv .aiv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.aiv .aiv-btn:active:not(:disabled) { transform: translateY(1px); }
.aiv .aiv-btn:disabled { cursor: progress; opacity: 0.75; }

.aiv .aiv-btn--primary {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.28);
}

.aiv .aiv-btn--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #4f46e5);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.36);
}

.aiv .aiv-btn--ghost {
    border-color: var(--aiv-line);
    background: var(--aiv-card);
    color: var(--text);
}

.aiv .aiv-btn--ghost:hover:not(:disabled) { border-color: var(--aiv-accent-line); color: var(--aiv-accent); }

.aiv .aiv-btn.is-loading .aiv-icon { animation: aiv-pulse 0.9s ease-in-out infinite alternate; }

@keyframes aiv-pulse {
    to { opacity: 0.35; }
}

/* ---------- alert + progress ---------- */

.aiv .aiv-alert {
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px solid rgba(198, 47, 60, 0.25);
    border-radius: 14px;
    background: var(--aiv-danger-soft);
    color: var(--aiv-danger);
    font-size: 0.88rem;
    line-height: 1.55;
}

.aiv .aiv-progress {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid var(--aiv-line);
    border-radius: var(--aiv-radius);
    background: var(--aiv-card);
}

.aiv .aiv-progress__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.86rem;
    font-weight: 500;
}

.aiv #aiv-progress-pct { color: var(--aiv-accent); font-variant-numeric: tabular-nums; }

.aiv .aiv-progress__bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--aiv-accent-soft);
}

.aiv #aiv-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #6366f1);
    transition: width 0.2s linear;
}

/* ---------- result + player ---------- */

.aiv .aiv-result {
    margin-top: 16px;
    border-color: var(--aiv-accent-line);
}

.aiv .aiv-result h2 .aiv-icon {
    width: 22px;
    height: 22px;
    padding: 3px;
    border-radius: 50%;
    background: var(--aiv-success);
    color: #fff;
    stroke-width: 3;
}

.aiv .aiv-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--aiv-accent-soft);
    color: var(--aiv-accent);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.aiv .aiv-player {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--aiv-line);
    border-radius: 16px;
    background: var(--aiv-field);
}

.aiv .aiv-player__play {
    display: grid;
    flex: none;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3);
    cursor: pointer;
}

.aiv .aiv-player__play .aiv-icon { width: 20px; height: 20px; }
.aiv .aiv-player .aiv-icon--pause { display: none; }
.aiv .aiv-player.is-playing .aiv-player__play .aiv-icon--play { display: none; }
.aiv .aiv-player.is-playing .aiv-player__play .aiv-icon--pause { display: block; }

.aiv .aiv-player__track {
    flex: 1;
    min-width: 0;
}

.aiv .aiv-player__track input[type="range"] { --fill: 0%; margin: 6px 0 4px; }

.aiv .aiv-player__times {
    display: flex;
    justify-content: space-between;
    color: var(--aiv-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.aiv .aiv-player__volume {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    width: 140px;
}

.aiv .aiv-player__volume input[type="range"] { --fill: 100%; }

.aiv .aiv-player__mute {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--aiv-muted);
    cursor: pointer;
}

.aiv .aiv-player__mute:hover { background: var(--aiv-accent-soft); color: var(--aiv-accent); }
.aiv .aiv-player.is-muted .aiv-player__mute { color: var(--aiv-danger); }

.aiv .aiv-result__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* ---------- content ---------- */

.aiv .aiv-content p,
.aiv .aiv-content li {
    line-height: 1.75;
}

.aiv .aiv-content h2 {
    font-weight: 600;
}

.aiv .aiv-howto li { margin-bottom: 6px; }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
    .aiv .aiv-card { padding: 16px; border-radius: 16px; }
    .aiv .aiv-filters { grid-template-columns: 1fr; gap: 12px; }
    .aiv .aiv-voices { grid-template-columns: 1fr; max-height: 420px; }
    .aiv .aiv-segment__btn small { display: none; }
    .aiv .aiv-generate { position: static; padding: 14px; box-shadow: var(--aiv-shadow); }
    .aiv .aiv-generate__actions { width: 100%; }
    .aiv .aiv-generate__actions .aiv-btn { flex: 1; }
    .aiv .aiv-player { flex-wrap: wrap; }
    .aiv .aiv-player__volume { width: 100%; }
    .aiv .aiv-result__actions .aiv-btn { flex: 1; }
    .aiv .aiv-textarea { min-height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
    .aiv *,
    .aiv *::before,
    .aiv *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
