/* Text to Voice — professional dashboard UI */
.tool-widget:has(.ttv-app) {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.ttv-app {
    --ttv-accent: #00aeef;
    --ttv-accent-2: #38bdf8;
    --ttv-card: rgba(15, 23, 42, 0.82);
    --ttv-border: rgba(148, 163, 184, 0.16);
    --ttv-muted: #94a3b8;
    width: 100%;
}

.ttv-app [hidden] {
    display: none !important;
}

.ttv-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.ttv-shell {
    border: 1px solid var(--ttv-border);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 70% 45% at 0% 0%, rgba(0, 174, 239, .14), transparent 50%),
        radial-gradient(ellipse 50% 35% at 100% 0%, rgba(167, 139, 250, .08), transparent 45%),
        linear-gradient(180deg, #111827 0%, #0b1220 100%);
    padding: 1.15rem 1.2rem 1.35rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.ttv-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .95rem;
}

.ttv-trust-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--ttv-border);
    background: rgba(2, 8, 20, .45);
    font-size: .72rem;
    font-weight: 700;
    color: #e2e8f0;
}

.ttv-step {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    margin-right: .15rem;
    font-size: .72rem;
    font-weight: 800;
    color: #0b1220;
    background: linear-gradient(145deg, #38bdf8, #0ea5e9);
}

.ttv-layout {
    display: grid;
    grid-template-columns: minmax(220px, 270px) 1fr;
    gap: 1.1rem;
    align-items: start;
}

.ttv-intro {
    position: sticky;
    top: 1rem;
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--ttv-border);
    background:
        radial-gradient(circle at top left, rgba(0, 174, 239, .18), transparent 55%),
        linear-gradient(165deg, #111827, #0b1220 70%);
}

.ttv-kicker {
    margin: 0 0 .45rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ttv-accent-2);
}

.ttv-intro-title {
    margin: 0 0 .7rem;
    font-size: 1.45rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #e0f2fe, #7dd3fc 45%, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ttv-intro-text {
    margin: 0 0 1rem;
    color: var(--ttv-muted);
    font-size: .9rem;
    line-height: 1.6;
}

.ttv-cta {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin-bottom: 1rem;
    min-height: 46px;
    font-weight: 800;
}

.ttv-why {
    padding: 1rem;
    border-radius: 14px;
    background: rgba(0, 174, 239, .07);
    border: 1px solid rgba(0, 174, 239, .18);
}

.ttv-why h3 {
    margin: 0 0 .55rem;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    color: #e2e8f0;
}

.ttv-why ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--ttv-muted);
    font-size: .84rem;
    line-height: 1.55;
}

.ttv-why li + li {
    margin-top: .28rem;
}

.ttv-workspace {
    min-width: 0;
}

.ttv-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--ttv-border);
}

.ttv-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ttv-muted);
    font-size: .88rem;
    font-weight: 700;
    padding: .65rem .9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.ttv-tab:hover {
    color: #e2e8f0;
}

.ttv-tab.active {
    color: var(--ttv-accent-2);
    border-bottom-color: var(--ttv-accent);
}

.ttv-panel {
    display: none;
}

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

.ttv-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, .9fr);
    gap: 1rem;
    align-items: start;
}

.ttv-col-input,
.ttv-col-preview {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    min-width: 0;
}

.ttv-card {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid var(--ttv-border);
    background: var(--ttv-card);
}

.ttv-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}

.ttv-card-head h3 {
    margin: 0;
    font-size: .92rem;
    font-weight: 800;
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.ttv-link-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ttv-accent-2);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: 0;
}

.ttv-link-btn:hover {
    color: #e0f2fe;
}

.ttv-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--ttv-border);
    background: rgba(2, 8, 20, .55);
    color: #e2e8f0;
    padding: .85rem 1rem;
    font-size: .93rem;
    line-height: 1.55;
    font-family: inherit;
}

.ttv-textarea:focus {
    outline: none;
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}

.ttv-text-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .65rem;
    font-size: .78rem;
    color: var(--ttv-muted);
}

.ttv-text-actions {
    display: flex;
    gap: .35rem;
}

.ttv-icon-btn {
    min-height: 34px;
    padding: 0 .65rem;
    border-radius: 10px;
    border: 1px solid var(--ttv-border);
    background: rgba(30, 41, 59, .7);
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}

.ttv-icon-btn:hover {
    border-color: rgba(56, 189, 248, .45);
    color: #e0f2fe;
}

.ttv-icon-btn:focus-visible,
.ttv-link-btn:focus-visible,
.ttv-tab:focus-visible,
.ttv-play-btn:focus-visible,
.ttv-preset:focus-visible,
.ttv-voice-row:focus-visible {
    outline: 3px solid rgba(56, 189, 248, .42);
    outline-offset: 2px;
}

.ttv-voice-search {
    margin-bottom: .8rem;
}

.ttv-actions .btn:disabled,
.ttv-result-actions .btn:disabled {
    opacity: .48;
    cursor: not-allowed;
    filter: grayscale(.25);
}

.ttv-action-note {
    margin: .65rem 0 0;
    color: var(--ttv-muted);
    font-size: .76rem;
    line-height: 1.5;
    text-align: center;
}

.ttv-generate-card {
    border-color: rgba(56, 189, 248, .3);
    background:
        linear-gradient(145deg, rgba(14, 165, 233, .1), rgba(15, 23, 42, .86));
}

.ttv-generate-copy {
    margin: 0;
    color: var(--ttv-muted);
    font-size: .82rem;
    line-height: 1.55;
}

.ttv-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem;
    margin-top: .8rem;
}

.ttv-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: .9rem;
}

.ttv-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.ttv-field label {
    font-size: .78rem;
    font-weight: 700;
    color: #cbd5e1;
}

.ttv-select,
.ttv-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--ttv-border);
    background: rgba(2, 8, 20, .55);
    color: #e2e8f0;
    padding: .55rem .7rem;
    font-size: .88rem;
    font-family: inherit;
}

.ttv-select:focus,
.ttv-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, .55);
}

.ttv-sliders {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.ttv-slider-row {
    display: grid;
    grid-template-columns: 64px 1fr 52px;
    align-items: center;
    gap: .65rem;
}

.ttv-slider-row label {
    font-size: .78rem;
    font-weight: 700;
    color: #cbd5e1;
}

.ttv-slider-row span {
    font-size: .78rem;
    font-weight: 700;
    color: var(--ttv-accent-2);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ttv-range {
    width: 100%;
    accent-color: #0ea5e9;
}

.ttv-advanced {
    margin-top: .9rem;
    border-top: 1px solid var(--ttv-border);
    padding-top: .75rem;
}

.ttv-advanced summary {
    cursor: pointer;
    font-size: .82rem;
    font-weight: 700;
    color: var(--ttv-accent-2);
    list-style: none;
}

.ttv-advanced summary::-webkit-details-marker {
    display: none;
}

.ttv-advanced-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-top: .75rem;
}

.ttv-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: #cbd5e1;
    cursor: pointer;
    grid-column: 1 / -1;
}

.ttv-preview-card {
    min-height: 160px;
}

.ttv-player-ui {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: .65rem 1rem;
    align-items: center;
    padding: .9rem 1rem;
    border-radius: 14px;
    background:
        radial-gradient(circle at 20% 30%, rgba(56, 189, 248, .18), transparent 50%),
        linear-gradient(145deg, rgba(8, 47, 73, .45), rgba(15, 23, 42, .8));
    border: 1px solid rgba(56, 189, 248, .22);
}

.ttv-play-btn {
    grid-row: 1 / 3;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(145deg, #0284c7, #38bdf8);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1rem;
    box-shadow: 0 8px 20px rgba(14, 165, 233, .35);
}

.ttv-play-btn:hover {
    filter: brightness(1.08);
}

.ttv-play-btn .ttv-ico-pause {
    display: none;
}

.ttv-play-btn.is-playing .ttv-ico-play {
    display: none;
}

.ttv-play-btn.is-playing .ttv-ico-pause {
    display: block;
}

.ttv-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 36px;
}

.ttv-wave span {
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, #7dd3fc, #0284c7);
    opacity: .55;
    height: 30%;
    animation: none;
}

.ttv-player-ui.is-active .ttv-wave span {
    animation: ttvWave 1s ease-in-out infinite;
}

.ttv-wave span:nth-child(1) { height: 35%; animation-delay: 0s; }
.ttv-wave span:nth-child(2) { height: 55%; animation-delay: .05s; }
.ttv-wave span:nth-child(3) { height: 80%; animation-delay: .1s; }
.ttv-wave span:nth-child(4) { height: 45%; animation-delay: .15s; }
.ttv-wave span:nth-child(5) { height: 70%; animation-delay: .2s; }
.ttv-wave span:nth-child(6) { height: 90%; animation-delay: .25s; }
.ttv-wave span:nth-child(7) { height: 50%; animation-delay: .3s; }
.ttv-wave span:nth-child(8) { height: 65%; animation-delay: .35s; }
.ttv-wave span:nth-child(9) { height: 40%; animation-delay: .4s; }
.ttv-wave span:nth-child(10) { height: 75%; animation-delay: .45s; }
.ttv-wave span:nth-child(11) { height: 55%; animation-delay: .5s; }
.ttv-wave span:nth-child(12) { height: 85%; animation-delay: .55s; }
.ttv-wave span:nth-child(13) { height: 45%; animation-delay: .6s; }
.ttv-wave span:nth-child(14) { height: 60%; animation-delay: .65s; }
.ttv-wave span:nth-child(15) { height: 35%; animation-delay: .7s; }

@keyframes ttvWave {
    0%, 100% { transform: scaleY(.45); }
    50% { transform: scaleY(1); }
}

.ttv-time {
    font-size: .8rem;
    font-weight: 700;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}

.ttv-progress {
    margin-top: .9rem;
    padding: .8rem .85rem;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, .25);
    background: rgba(8, 47, 73, .35);
}

.ttv-progress-head {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
    font-size: .84rem;
    color: #e2e8f0;
}

.ttv-progress-track {
    height: 9px;
    border-radius: 999px;
    background: rgba(15, 23, 41, .85);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .2);
}

.ttv-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0284c7, #38bdf8, #7dd3fc);
    transition: width .25s ease;
}

.ttv-progress-step {
    margin: .5rem 0 0;
    font-size: .76rem;
    color: var(--ttv-muted);
}

.ttv-status {
    margin: .7rem 0 0;
    min-height: 1.2rem;
    font-size: .84rem;
    color: var(--ttv-muted);
}

.ttv-status.is-error { color: #fca5a5; }
.ttv-status.is-ok { color: #86efac; }

.ttv-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.ttv-preset {
    appearance: none;
    border: 1px solid var(--ttv-border);
    background: rgba(30, 41, 59, .65);
    color: #cbd5e1;
    font-size: .78rem;
    font-weight: 700;
    border-radius: 999px;
    padding: .4rem .8rem;
    cursor: pointer;
}

.ttv-preset:hover {
    border-color: rgba(56, 189, 248, .4);
    color: #e0f2fe;
}

.ttv-preset.active {
    background: rgba(14, 165, 233, .2);
    border-color: rgba(56, 189, 248, .55);
    color: #7dd3fc;
}

.ttv-popular,
.ttv-library {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.ttv-voice-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .7rem;
    align-items: center;
    padding: .55rem .65rem;
    border-radius: 12px;
    border: 1px solid var(--ttv-border);
    background: rgba(2, 8, 20, .35);
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    width: 100%;
}

.ttv-voice-row:hover,
.ttv-voice-row.is-active {
    border-color: rgba(56, 189, 248, .45);
    background: rgba(8, 47, 73, .35);
}

.ttv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 800;
    color: #e0f2fe;
    background: linear-gradient(145deg, rgba(2, 132, 199, .7), rgba(56, 189, 248, .35));
}

.ttv-voice-meta strong {
    display: block;
    font-size: .86rem;
    color: #e2e8f0;
}

.ttv-voice-meta span {
    font-size: .72rem;
    color: var(--ttv-muted);
}

.ttv-voice-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--ttv-border);
    background: rgba(30, 41, 59, .8);
    color: var(--ttv-accent-2);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.ttv-voice-play:hover {
    border-color: rgba(56, 189, 248, .5);
}

.ttv-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .65rem;
}

.ttv-pill {
    font-size: .72rem;
    font-weight: 700;
    color: #7dd3fc;
    background: rgba(56, 189, 248, .12);
    border: 1px solid rgba(56, 189, 248, .28);
    border-radius: 999px;
    padding: .28rem .65rem;
}

.ttv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1rem;
}

.ttv-generate-card .ttv-actions {
    margin-top: .8rem;
}

.ttv-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 42px;
    font-weight: 700;
}

.ttv-features {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .65rem;
    margin-top: 1.1rem;
}

.ttv-feature {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .85rem .75rem;
    border-radius: 14px;
    border: 1px solid var(--ttv-border);
    background: rgba(15, 23, 42, .55);
}

.ttv-feature strong {
    display: block;
    font-size: .8rem;
    color: #e2e8f0;
}

.ttv-feature span {
    font-size: .72rem;
    color: var(--ttv-muted);
    line-height: 1.4;
}

.ttv-howto h3 {
    margin: 0 0 .75rem;
    font-size: 1rem;
}

.ttv-howto ol {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--ttv-muted);
    font-size: .9rem;
    line-height: 1.65;
}

.ttv-howto li + li {
    margin-top: .35rem;
}

.ttv-related {
    margin: 1rem 0 0;
    font-size: .84rem;
    color: var(--ttv-muted);
}

.ttv-related a {
    color: #7dd3fc;
    font-weight: 700;
}

.ttv-history-item {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: center;
    padding: .7rem .8rem;
    border-radius: 12px;
    border: 1px solid var(--ttv-border);
    background: rgba(2, 8, 20, .35);
    margin-bottom: .5rem;
}

.ttv-history-item p {
    margin: 0;
    font-size: .84rem;
    color: #e2e8f0;
}

.ttv-history-item small {
    color: var(--ttv-muted);
    font-size: .72rem;
}

.ttv-empty {
    margin: 0;
    color: var(--ttv-muted);
    font-size: .88rem;
}

@media (max-width: 1100px) {
    .ttv-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .ttv-intro {
        position: static;
    }

    .ttv-main-grid {
        grid-template-columns: 1fr;
    }

    .ttv-advanced-body {
        grid-template-columns: 1fr;
    }

    .ttv-features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ttv-result-actions {
        grid-template-columns: 1fr;
    }
    .ttv-settings-row {
        grid-template-columns: 1fr;
    }

    .ttv-slider-row {
        grid-template-columns: 56px 1fr 48px;
    }

    .ttv-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .ttv-actions .btn {
        flex: none;
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }
}
