/* -- Study Mode -- */
#study-container {
    flex: 1;
    overflow-y: auto;
    /* Scroll ONLY the content */
    padding: 32px;
    padding-bottom: 120px;
    /* Space for player */
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Guide Box */
.guide-box {
    background: white;
    border: 1px solid var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.guide-box.hidden {
    display: none;
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.guide-content p {
    margin: 6px 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.guide-content .intent {
    font-weight: 600;
    color: var(--slate-800);
}

.guide-content .tips {
    color: var(--slate-600);
    background: var(--slate-50);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Sentences */
.sent-item {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sent-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.sent-item.active {
    border-color: var(--primary);
    background: #fdfdff;
    /* very subtle tint */
    box-shadow: 0 0 0 1px var(--primary);
}

.eng-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--slate-800);
}

.eng-text.hidden {
    display: none;
}

.kor-text {
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--slate-500);
}

.kor-text.hidden {
    display: none;
}

.sent-item.active .eng-text {
    color: var(--primary);
    font-weight: 600;
}


/* -- Memorize Mode -- */
.memorize-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-stack {
    width: 600px;
    height: 360px;
    perspective: 1200px;
    margin-bottom: 30px;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-content {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.card-content .front,
.card-content .back {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.card-content .back {
    transform: rotateY(180deg);
    border: 2px solid var(--primary);
}

.hint-text {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--slate-400);
    margin-bottom: 24px;
}

h3 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.5;
    font-weight: 600;
    color: var(--slate-800);
}

.tap-hint {
    margin-top: 32px;
    font-size: 0.8rem;
    color: var(--slate-400);
}

.controls-bar {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
}

.progress-indicator {
    font-family: monospace;
    color: var(--slate-400);
}


/* -- Shadowing Mode -- */
.shadowing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.active-sentence-display {
    max-width: 700px;
    margin-bottom: 60px;
    padding: 0 20px;
}

#shadow-eng {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0 0 20px 0;
    line-height: 1.4;
}

#shadow-kor {
    font-size: 1.1rem;
    color: var(--slate-500);
}

.player-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.speed-control {
    background: white;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
}

.speed-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-500);
    cursor: pointer;
}

.speed-btn.active {
    background: var(--slate-100);
    color: var(--primary);
}

.loop-control {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-600);
}


/* -- Exam Mode -- */
.exam-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.question-card {
    background: white;
    width: 600px;
    padding: 48px;
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-bottom: 40px;
}

.ava-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.question-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--slate-400);
    margin-bottom: 16px;
}

#exam-topic {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--slate-800);
}

.timer-display {
    font-size: 5rem;
    font-weight: 800;
    color: var(--slate-900);
    font-variant-numeric: tabular-nums;
    margin-bottom: 40px;
    letter-spacing: -2px;
}

.record-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 16px 36px;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 20px -5px rgba(239, 68, 68, 0.4);
    transition: all 0.2s;
}

.record-btn:active {
    transform: scale(0.96);
}

.record-btn.recording {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

#feedback-area {
    margin-top: 20px;
    text-align: center;
    width: 100%;
    max-width: 700px;
}

.answer-box {
    text-align: left;
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
    white-space: pre-wrap;
}

#btn-show-answer {
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    color: var(--slate-500);
}

.hidden {
    display: none !important;
}

/* --- Mobile Responsive --- */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    /* Layout */
    .app-container {
        flex-direction: column;
    }

    /* Sidebar (Drawer) */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
    }

    /* Overlay */
    .overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        backdrop-filter: blur(2px);
    }

    .overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Header */
    .top-bar {
        padding: 0 16px;
        justify-content: flex-start;
        gap: 12px;
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
        overflow: hidden;
    }

    .header-left h1 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .subtitle {
        display: none;
        /* Hide subtitle on mobile to save space */
    }

    #btn-hamburger {
        font-size: 1.2rem;
        color: var(--slate-800);
        padding: 8px;
        margin-left: -8px;
    }

    #btn-close-sidebar i {
        font-size: 1.5rem;
    }

    /* View Section */
    .view-section {
        padding: 16px;
    }

    #study-container {
        padding: 16px;
        padding-bottom: 160px;
        /* More space for player + nav */
    }

    /* Bottom Navigation */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: white;
        border-top: 1px solid var(--border-subtle);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 100;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav-tab {
        flex: 1;
        height: 100%;
        border: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: var(--slate-400);
        font-size: 0.7rem;
        font-weight: 500;
        cursor: pointer;
    }

    .nav-tab i {
        font-size: 1.4rem;
        margin-bottom: -2px;
    }

    .nav-tab.active {
        color: var(--primary);
    }

    /* Adjust Floating Player */
    .floating-player {
        bottom: 80px;
        /* Above Bottom Nav */
        width: 95%;
        padding: 10px 16px;
    }

    /* Adjust Cards */
    .card-stack {
        width: 100%;
        height: 300px;
    }

    .question-card {
        width: 100%;
        padding: 24px;
    }
}