/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {

    min-height: 100vh;

    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(111, 76, 255, 0.15),
            transparent 35%
        ),
        radial-gradient(
            circle at 80% 70%,
            rgba(0, 183, 255, 0.10),
            transparent 35%
        ),
        #08090d;

    color: #f4f4f5;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    overflow-x: hidden;
}


/* =========================================================
   BACKGROUND
========================================================= */

.background-glow {

    position: fixed;

    width: 500px;
    height: 500px;

    border-radius: 50%;

    filter: blur(120px);

    opacity: 0.15;

    pointer-events: none;

    z-index: -1;
}


.glow-1 {

    top: -250px;
    left: -200px;

    background: #7657ff;
}


.glow-2 {

    bottom: -300px;
    right: -200px;

    background: #1d9bf0;
}


/* =========================================================
   CONTAINER
========================================================= */

.container {

    width: min(900px, 92%);

    margin: auto;

    padding: 70px 0 30px;
}


/* =========================================================
   HERO
========================================================= */

.hero {

    text-align: center;

    margin-bottom: 50px;
}


.logo {

    width: 52px;
    height: 52px;

    margin: auto;
    margin-bottom: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            rgba(135, 99, 255, 0.35),
            rgba(55, 172, 255, 0.18)
        );

    border: 1px solid rgba(255,255,255,0.12);

    font-size: 25px;

    box-shadow:
        0 0 40px rgba(122, 91, 255, 0.2);
}


.eyebrow {

    font-size: 11px;

    letter-spacing: 4px;

    color: #8d8f9b;

    margin-bottom: 12px;
}


.hero h1 {

    font-size: clamp(42px, 7vw, 72px);

    line-height: 1.05;

    letter-spacing: -3px;

    font-weight: 700;
}


.hero h1 span {

    display: block;

    background:
        linear-gradient(
            90deg,
            #a78bfa,
            #67d4ff
        );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;
}


.subtitle {

    max-width: 560px;

    margin: 22px auto 0;

    color: #989ba7;

    font-size: 16px;

    line-height: 1.7;
}


/* =========================================================
   GENERATOR CARD
========================================================= */

.generator-card {

    background:
        rgba(255,255,255,0.035);

    border:
        1px solid rgba(255,255,255,0.08);

    border-radius: 24px;

    padding: 25px;

    backdrop-filter: blur(20px);

    box-shadow:
        0 30px 80px rgba(0,0,0,0.25);
}


.generator-card label {

    display: block;

    margin-bottom: 14px;

    font-size: 14px;

    font-weight: 600;

    color: #d6d7dc;
}


textarea {

    width: 100%;

    resize: vertical;

    min-height: 150px;

    padding: 18px;

    border-radius: 16px;

    border:
        1px solid rgba(255,255,255,0.08);

    background:
        rgba(0,0,0,0.25);

    color: white;

    outline: none;

    font-size: 15px;

    line-height: 1.6;

    font-family: inherit;

    transition: 0.2s;
}


textarea::placeholder {

    color: #656874;
}


textarea:focus {

    border-color:
        rgba(140,110,255,0.6);

    box-shadow:
        0 0 0 3px rgba(140,110,255,0.08);
}


.input-footer {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-top: 15px;
}


#character-count {

    color: #6f727e;

    font-size: 12px;
}


#generate-btn {

    border: none;

    border-radius: 13px;

    padding: 13px 20px;

    color: white;

    font-weight: 600;

    cursor: pointer;

    background:
        linear-gradient(
            135deg,
            #7657ff,
            #477dff
        );

    box-shadow:
        0 10px 30px rgba(90,80,255,0.25);

    transition: 0.2s;
}


#generate-btn:hover {

    transform: translateY(-2px);

    box-shadow:
        0 15px 35px rgba(90,80,255,0.35);
}


#generate-btn:disabled {

    opacity: 0.5;

    cursor: not-allowed;

    transform: none;
}


.btn-icon {

    margin-right: 7px;
}


/* =========================================================
   STATUS
========================================================= */

.status {

    margin: 25px 0;

    padding: 16px;

    border-radius: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    color: #b7b9c3;

    background:
        rgba(255,255,255,0.03);
}


.hidden {

    display: none !important;
}


.loader {

    width: 17px;
    height: 17px;

    border-radius: 50%;

    border:
        2px solid rgba(255,255,255,0.15);

    border-top-color: #9a82ff;

    animation:
        spin 0.8s linear infinite;
}


@keyframes spin {

    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   STORY
========================================================= */

.story-section {

    margin-top: 35px;

    padding: 32px;

    border-radius: 24px;

    background:
        rgba(255,255,255,0.025);

    border:
        1px solid rgba(255,255,255,0.07);
}


.section-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 28px;
}


.section-label {

    color: #8e91a0;

    font-size: 10px;

    letter-spacing: 3px;

    font-weight: 700;

    margin-bottom: 7px;
}


.section-header h2,
.audio-header h2 {

    font-size: 22px;

    letter-spacing: -0.5px;
}


.story-badge {

    font-size: 11px;

    padding: 7px 11px;

    border-radius: 20px;

    background:
        rgba(118,87,255,0.12);

    border:
        1px solid rgba(118,87,255,0.2);

    color: #b3a4ff;
}


/* =========================================================
   STORY TEXT
========================================================= */

.story {

    color: #bfc1ca;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 19px;

    text-align: justify;
    line-height: 1.9;
}


.story-line {

    display: inline;

    cursor: pointer;

    border-radius: 5px;

    transition:
        color 0.2s ease,
        opacity 0.2s ease,
        background 0.2s ease;

}


.story-line:hover {

    color: white;

    background:
        rgba(255,255,255,0.04);
}


.story-line.active {

    color: white;

    font-weight: 700;

    background:
        linear-gradient(
            90deg,
            rgba(118,87,255,0.14),
            transparent
        );
}


/* =========================================================
   AUDIO
========================================================= */

.audio-section {

    margin-top: 25px;

    padding: 28px;

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            rgba(118,87,255,0.08),
            rgba(255,255,255,0.025)
        );

    border:
        1px solid rgba(255,255,255,0.08);
}


.audio-header {

    display: flex;

    justify-content: space-between;

    align-items: center;
}


.language {

    font-size: 12px;

    padding: 8px 12px;

    border-radius: 20px;

    background:
        rgba(255,255,255,0.05);

    color: #aeb0ba;
}


/* =========================================================
   PROGRESS
========================================================= */

.progress-container {

    margin-top: 30px;
}


#progress {

    width: 100%;

    appearance: none;

    height: 4px;

    border-radius: 10px;

    background: #292b34;

    cursor: pointer;
}


#progress::-webkit-slider-thumb {

    appearance: none;

    width: 14px;
    height: 14px;

    border-radius: 50%;

    background: #a78bfa;

    box-shadow:
        0 0 12px rgba(167,139,250,0.7);

    cursor: pointer;
}


.time-row {

    display: flex;

    justify-content: space-between;

    color: #777a86;

    font-size: 11px;

    margin-top: 8px;
}


/* =========================================================
   CONTROLS
========================================================= */

.controls {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 18px;

    margin-top: 25px;
}


.play-btn {

    width: 58px;
    height: 58px;

    border-radius: 50%;

    border: none;

    cursor: pointer;

    background:
        linear-gradient(
            135deg,
            #8c6cff,
            #4e7fff
        );

    color: white;

    font-size: 20px;

    box-shadow:
        0 10px 35px rgba(100,90,255,0.3);

    transition: 0.2s;
}


.play-btn:hover {

    transform: scale(1.06);
}


.secondary-control {

    width: 40px;
    height: 40px;

    border-radius: 50%;

    border:
        1px solid rgba(255,255,255,0.08);

    background:
        rgba(255,255,255,0.04);

    color: #aaa;

    cursor: pointer;

    font-size: 17px;

    transition: 0.2s;
}


.secondary-control:hover {

    color: white;

    background:
        rgba(255,255,255,0.08);
}


.audio-hint {

    text-align: center;

    margin-top: 22px;

    font-size: 12px;

    color: #686b77;
}


/* =========================================================
   FOOTER
========================================================= */

footer {

    display: flex;

    justify-content: center;

    gap: 12px;

    margin-top: 50px;

    color: #555864;

    font-size: 11px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .container {

        padding-top: 40px;
    }


    .hero h1 {

        letter-spacing: -2px;
    }


    .generator-card,
    .story-section,
    .audio-section {

        padding: 20px;

        border-radius: 18px;
    }


    .input-footer {

        align-items: flex-end;

        gap: 15px;
    }


    #generate-btn {

        padding: 11px 14px;
    }


    .story {

        font-size: 17px;

        line-height: 1.8;
    }


    .section-header {

        align-items: flex-start;

        gap: 15px;
    }


    .story-badge {

        display: none;
    }

}

/* =========================================================
   PLAYBACK SPEED
   ========================================================= */

.speed-control {
    margin-top: 28px;
    padding: 18px 20px;

    background: rgba(255, 255, 255, 0.035);

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-radius: 16px;

    backdrop-filter: blur(10px);
}


.speed-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 14px;
}


.speed-label {
    font-size: 0.85rem;

    font-weight: 500;

    color: rgba(255, 255, 255, 0.72);

    letter-spacing: 0.02em;
}


.speed-value {
    min-width: 48px;

    padding: 5px 9px;

    text-align: center;

    border-radius: 8px;

    background: rgba(255, 255, 255, 0.08);

    color: #ffffff;

    font-size: 0.8rem;

    font-weight: 600;
}


.speed-slider-wrapper {
    display: flex;

    align-items: center;

    gap: 12px;
}


.speed-min,
.speed-max {
    font-size: 0.7rem;

    color: rgba(255, 255, 255, 0.38);

    white-space: nowrap;
}


#speed {
    flex: 1;

    height: 5px;

    appearance: none;

    -webkit-appearance: none;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.12);

    outline: none;

    cursor: pointer;
}


/* Chrome / Edge / Safari */

#speed::-webkit-slider-thumb {

    appearance: none;

    -webkit-appearance: none;

    width: 16px;

    height: 16px;

    border-radius: 50%;

    background: #ffffff;

    border: 3px solid rgba(255, 255, 255, 0.2);

    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.05),
        0 3px 10px rgba(0, 0, 0, 0.3);

    cursor: grab;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


#speed::-webkit-slider-thumb:hover {

    transform: scale(1.15);

    box-shadow:
        0 0 0 6px rgba(255, 255, 255, 0.07),
        0 3px 12px rgba(0, 0, 0, 0.35);
}


#speed::-webkit-slider-thumb:active {

    cursor: grabbing;

    transform: scale(1.05);
}


/* Firefox */

#speed::-moz-range-thumb {

    width: 16px;

    height: 16px;

    border-radius: 50%;

    background: #ffffff;

    border: 3px solid rgba(255, 255, 255, 0.2);

    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.05),
        0 3px 10px rgba(0, 0, 0, 0.3);

    cursor: grab;
}