:root {
    --tts-navy: #0f172a;
    --tts-purple: #10b981;
    --tts-pink: #059669;
    --tts-line: #e2e8f0;
    --tts-text: #475569;
    --tts-muted: #64748b;
    --tts-soft: #f8fafc;
}

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

.tts-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8fafc;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

.tts-shell {
    padding: 16px 0 32px;
    width: 100%;
    max-width: 100%;
}

.tts-breadcrumb {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tts-text);
}
.tts-breadcrumb a {
    color: var(--tts-purple);
    text-decoration: none;
    font-weight: 600;
}
.tts-breadcrumb strong {
    color: var(--tts-navy);
    font-weight: 600;
}

/* MAIN CARD CONTAINER */
.tts-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    min-height: 400px;
    border: 1px solid var(--tts-line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    width: 100%;
    max-width: 100%;
}

/* LEFT PANEL (BRIEF) */
.tts-brief {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.tts-brief-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tts-kicker {
    font-size: 12px;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tts-access {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tts-access.free {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.tts-access.premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.tts-title-block {
    margin-top: 16px;
}
.tts-title-block small {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #94a3b8;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}
.tts-title-block h1 {
    margin: 0 0 8px 0;
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 800;
    line-height: 1.25;
    color: #ffffff !important;
    word-break: break-word;
}
.tts-title-block p {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0 0;
}

/* FACTS SECTION */
.tts-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.tts-fact {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    min-width: 0;
}
.tts-fact span i {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    font-size: 13px;
    color: #10b981;
}
.tts-fact small {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}
.tts-fact strong {
    display: block;
    font-size: 12px;
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* WORKFLOW BAR */
.tts-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.tts-flow > div {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
}
.tts-flow > div.active { color: #ffffff; }
.tts-flow > div b { font-size: 20px; font-weight: 800; opacity: 0.4; }
.tts-flow > div.active b { color: #10b981; opacity: 1; }
.tts-flow > div span { display: flex; flex-direction: column; }
.tts-flow > div strong { font-size: 13px; font-weight: 700; line-height: 1.2; }
.tts-flow > div small { font-size: 11px; font-weight: 500; opacity: 0.7; }
.tts-flow > i { color: rgba(255, 255, 255, 0.2); font-size: 12px; }

/* RIGHT PANEL (CONSOLE FORM) */
.tts-console {
    padding: 20px 24px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tts-console-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tts-line);
    margin-bottom: 14px;
}
.tts-console-head > div:first-child > span {
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--tts-purple);
    font-weight: 800;
    text-transform: uppercase;
    display: block;
}
.tts-console-head h2 {
    margin: 2px 0 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--tts-navy);
}
.tts-console-head p {
    margin: 0;
    color: var(--tts-text);
    font-size: 12px;
}

.tts-status {
    padding: 3px 8px;
    border-radius: 99px;
    background: #ecfdf5;
    color: #059669;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.tts-status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

/* SECTION BOXES */
.tts-duration-box {
    margin-bottom: 14px;
    min-width: 0;
}
.tts-duration-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.tts-duration-head small {
    font-size: 12px;
    color: var(--tts-navy);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tts-duration-head > span {
    font-size: 13px;
    font-weight: 800;
    color: var(--tts-purple);
}

/* CHIP GRIDS */
.tts-duration-options {
    display: grid;
    gap: 6px;
    width: 100%;
}

.tts-duration-options.mode-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* TIME & SPEED ROW */
.tts-time-speed-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--tts-line);
}
.tts-sub-grid {
    grid-template-columns: repeat(3, 1fr);
}

.tts-native-select { display: none !important; }

/* CHIPS STYLING */
.tts-time-chip {
    padding: 7px 4px;
    border: 1px solid var(--tts-line);
    border-radius: 8px;
    background: #fff;
    color: var(--tts-navy);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    user-select: none;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.tts-time-chip b {
    display: block;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.tts-time-chip small {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--tts-muted);
    text-transform: uppercase;
    line-height: 1.1;
    margin-top: 2px;
    white-space: nowrap;
}
.tts-time-chip:hover {
    border-color: var(--tts-purple);
    background: #f8fafc;
}
.tts-time-chip.active {
    border-color: var(--tts-navy);
    background: var(--tts-navy);
    color: #fff;
}
.tts-time-chip.active small {
    color: rgba(255, 255, 255, 0.75);
}

/* CONTROLS & SWITCHES */
.tts-controls-box {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--tts-line);
}
.tts-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.tts-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--tts-line);
    border-radius: 8px;
    background: #fafafa;
    min-width: 0;
}
.tts-setting-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.tts-setting-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #e2e8f0;
    color: var(--tts-navy);
    display: grid;
    place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}
.tts-setting-copy strong {
    display: block;
    color: var(--tts-navy);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* SWITCH */
.tts-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    margin: 0;
}
.tts-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.tts-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 99px;
    cursor: pointer;
    transition: 0.2s;
}
.tts-slider::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: 0.2s;
}
.tts-switch input:checked + .tts-slider {
    background: var(--tts-purple);
}
.tts-switch input:checked + .tts-slider::before {
    transform: translateX(16px);
}

/* SUMMARY & START */
.tts-session-summary {
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--tts-line);
    text-align: center;
    margin-bottom: 12px;
}
.tts-session-summary strong {
    color: var(--tts-navy);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    display: block;
}

.tts-start-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: var(--tts-purple);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.tts-start-btn:hover {
    background: var(--tts-pink);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}
.tts-start-btn:active {
    transform: scale(0.98);
}
.tts-start-btn i {
    font-size: 15px;
    transition: transform 0.2s;
}
.tts-start-btn:hover i {
    transform: translateX(3px);
}

/* MOBILE & RESPONSIVE BREAKPOINTS */
@media (max-width: 991.98px) {
    .tts-layout {
        grid-template-columns: 1fr;
        border-radius: 14px;
    }
    .tts-brief {
        padding: 20px 16px;
    }
    .tts-flow {
        display: none; /* Hide 3-step timeline on tablet & mobile to save critical screen height */
    }
    .tts-console {
        padding: 18px 16px;
    }
}

@media (max-width: 767.98px) {
    .tts-shell {
        padding: 8px 0 24px;
    }
    .tts-brief {
        padding: 16px 14px;
    }
    .tts-title-block h1 {
        font-size: 20px;
    }
    .tts-facts {
        margin-top: 14px;
        padding-top: 12px;
        gap: 6px;
    }
    .tts-fact {
        padding: 8px 4px;
    }
    .tts-fact small {
        font-size: 10px;
    }
    .tts-fact strong {
        font-size: 11px;
    }

    /* Stack Time and Speed vertically so chips have 100% full width */
    .tts-time-speed-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    .tts-time-box {
        margin-bottom: 0;
        padding-bottom: 12px;
        border-bottom: 1px dashed var(--tts-line);
    }
    .tts-speed-box {
        margin-bottom: 0;
        padding-bottom: 0;
    }
    .tts-sub-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 5px;
    }
    .tts-sub-grid .tts-time-chip {
        padding: 6px 2px;
    }
    .tts-sub-grid .tts-time-chip b {
        font-size: 13px;
    }
    .tts-sub-grid .tts-time-chip small {
        font-size: 9px;
    }

    /* Switch list on mobile: clean single column */
    .tts-settings-grid {
        grid-template-columns: 1fr;
        gap: 7px;
    }
    .tts-setting-row {
        padding: 8px 10px;
    }
}

@media (max-width: 380px) {
    /* Very compact screens (iPhone SE, smaller androids) */
    .tts-sub-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .tts-duration-options.mode-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .tts-mode-chip b {
        font-size: 12px;
    }
    .tts-mode-chip small {
        font-size: 9px;
    }
}