/* ===================================
   RESET & BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: linear-gradient(rgb(10, 10, 15), rgb(26, 26, 46));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 20px 20px;
    position: relative;
}

/* ===================================
   STARS BACKGROUND
   =================================== */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: hsl(0, 0%, 100%);
    animation: twinkle ease-in-out infinite;
    will-change: opacity;
}

.star-small {
    width: 1px;
    height: 1px;
    box-shadow: 0 0 2px hsla(0, 0%, 100%, 0.8);
}

.star-medium {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 4px hsla(0, 0%, 100%, 0.8);
}

.star-large {
    width: 5px;
    height: 5px;
    box-shadow: 0 0 6px hsla(0, 0%, 100%, 0.9);
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.2;
    }
    50% {
        opacity: 1;
    }
}

@keyframes twinkleScale {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================
   CHAPTER HEADER
   =================================== */
.chapter-header {
    text-align: center;
    margin-bottom: 24px;
    z-index: 10;
}

.chapter-header h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.chapter-header h2 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 400;
    opacity: 0.9;
    color: #ffffff;
}

/* ===================================
   GENDER TOGGLE
   =================================== */
.gender-toggle {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.gender-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 100px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.gender-btn svg {
    width: 20px;
    height: 20px;
}

.gender-btn.active {
    background: hsl(180, 100%, 50%);
    color: #424141;
    box-shadow: 0 4px 12px hsla(180, 100%, 50%, 0.4);
}

.gender-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

/* ===================================
   PLAYER CARD
   =================================== */
.player-card {
    width: 100%;
    max-width: 450px;
    /* background: rgba(26, 35, 50, 0.85); */
    /* background-image: linear-gradient(to bottom, #1a3a4a, rgb(26 58 74 / 0), rgb(26 58 74 / 0), rgb(26 58 74 / 0)); */
    backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 60px 40px 42px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10;
    position: relative;
    overflow: hidden;
}

.card-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to bottom,  #1a3a4a, rgb(26 58 74 / 0));
    pointer-events: none;
    z-index: 1;
}

/* ===================================
   STARS IN CARD
   =================================== */
.stars-card-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 35%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.star-card {
    position: absolute;
    border-radius: 50%;
    background: #fbbf24;
    animation: twinkleScale ease-in-out infinite;
    will-change: opacity, transform;
}

.star-card.star-small {
    width: 2px;
    height: 2px;
    box-shadow: 0 0 3px rgba(251, 191, 36, 0.9);
}

.star-card.star-medium {
    width: 4px;
    height: 4px;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.9);
}

.star-card.star-large {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 8px rgba(251, 191, 36, 1);
}

/* ===================================
   PROGRESS SECTION
   =================================== */
.progress-section {        
    margin-bottom: 0px;
    margin-top: 46px;
    position: relative;
    z-index: 2;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    margin-bottom: 16px;
    cursor: pointer;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, hsl(180, 100%, 45%) 0%, hsl(180, 100%, 50%) 50%, hsl(180, 100%, 55%) 100%);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.progress-handle {
    position: absolute;
    left: 0%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: left 0.1s linear;
}

.progress-handle svg {
    display: none;
}

/* Small yellow round cursor */
.progress-handle::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0);
    opacity: 1;
    transition: box-shadow 0.3s ease, opacity 0.3s ease;
}

/* Glow animation when playing */
.progress-handle.playing::before {
    animation: cursorGlowPulse 2s ease-in-out infinite;
}

@keyframes cursorGlowPulse {
    0%, 100% {
        opacity: 0.4;
        box-shadow: 0 0 12px rgba(251, 191, 36, 0.5), 0 0 20px rgba(251, 191, 36, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 12px rgba(251, 191, 36, 1), 0 0 20px rgba(251, 191, 36, 0.6);
    }
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

/* ===================================
   PLAY BUTTON
   =================================== */
.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    border: 4px solid hsl(180, 100%, 50%);
    border-radius: 50%;
    background: hsla(180, 100%, 50%, 0.05);
    color: hsl(180, 100%, 50%);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 20px hsla(180, 100%, 50%, 0.5), 0 0 40px hsla(180, 100%, 50%, 0.3);
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px hsla(180, 100%, 50%, 0.6), 0 0 50px hsla(180, 100%, 50%, 0.4);
    background: hsla(180, 100%, 50%, 0.1);
}

.play-button:active {
    transform: scale(0.95);
}

.play-button svg {
    width: 58px;
    height: 58px;
}

.play-button .pause-icon {
    display: none;
}

.play-button.playing .play-icon {
    display: none;
}

.play-button.playing .pause-icon {
    display: block;
}

/* ===================================
   CONTROL BUTTONS (outside card)
   =================================== */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    margin-top: 40px;
    z-index: 10;
}

.control-btn {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-label {
    position: absolute;
    bottom: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
}

/* ===================================
   LOADING OVERLAY
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    gap: 1rem;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid hsl(180, 100%, 50%);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   ERROR OVERLAY
   =================================== */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ff6b6b;
    font-size: 16px;
    gap: 1rem;
    text-align: center;
    padding: 2rem;
    z-index: 100;
}

.error-overlay.hidden {
    display: none;
}

.error-icon {
    font-size: 3rem;
}

/* ===================================
   GENDER SELECTION MODAL
   =================================== */
.gender-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.gender-modal.hidden {
    display: none;
}

.gender-modal-content {
    background: rgba(26, 35, 50, 0.9);
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 400px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gender-modal h2 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.gender-modal p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 2rem;
}

.gender-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gender-option {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    outline: none;
}

.gender-option:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.gender-option:active {
    transform: translateY(0);
}

/* ===================================
   RESPONSIVE - MOBILE
   =================================== */
@media (max-width: 480px) {
    body {
        padding: 20px 16px 16px;
    }

    .chapter-header {
        margin-top: 15vh;
        margin-bottom: 20px;
    }

    .chapter-header h1 {
        font-size: 46px;
    }

    .chapter-header h2 {
        font-size: 1.75rem;
        line-height: 2rem;
    }

    .gender-toggle {
        margin-bottom: 28px;
    }

    .gender-btn {
        padding: 15px 15px;
        font-size: 16px;
    }

    .player-card {
        padding: 70px 28px 32px 28px;
    }

    .progress-section {
        margin-bottom: 4px;
        margin-top: 46px;
    }

    .play-button {
        width: 90px;
        height: 90px;
    }

    .controls {
        margin-top: 32px;
    }

    .play-button svg {
        width: 54px;
        height: 54px;
    }

    .controls {
        gap: 24px;
    }

    .control-btn {
        width: 52px;
        height: 52px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

    .gender-modal-content {
        padding: 2rem 1.5rem;
    }

    .gender-modal h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 360px) {
    .chapter-header h1 {
        margin-top: 10vh;
        font-size: 40px;
    }

    .chapter-header h2 {
        font-size: 18px;
    }

    .controls {
        gap: 16px;
    }

    .control-btn {
        width: 48px;
        height: 48px;
    }
}

/* ===================================
   REDUCED MOTION
   =================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .loading-spinner {
        animation: none;
    }
}

/* ===================================
   HIDDEN ELEMENTS
   =================================== */
audio {
    display: none;
}
