.learn-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--header-height));
    background: var(--bg-dark);
    z-index: 1500;
    box-sizing: border-box;
    overflow-y: auto;
}

.learn-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 24px;
}

.learn-container {
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    perspective: 1000px;
}

.learn-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
}

.learn-title {
    font-size: 1.3em;
    font-weight: 700;
}

.learn-card-area {
    width: 100%;
    min-height: 320px;
    position: relative;
}

.learn-flashcard-wrapper {
    width: 100%;
    height: 300px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.learn-flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.learn-flashcard-wrapper.flipped .learn-flashcard-inner {
    transform: rotateY(180deg);
}

.learn-flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.learn-flashcard-front {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    color: var(--text-light);
}

.learn-flashcard-back {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15), rgba(var(--primary-rgb), 0.03));
    color: var(--text-light);
    transform: rotateY(180deg);
    border-color: rgba(var(--primary-rgb), 0.3);
}

.learn-card-label {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 700;
}

.learn-card-text {
    font-size: 2em;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.learn-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

.learn-mc-question-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-radius: 24px;
    padding: 30px 40px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    margin-bottom: 20px;
}

.learn-mc-options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    margin-bottom: 20px;
}

.learn-mc-option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    padding: 18px 24px;
    border-radius: 16px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    width: 100%;
    word-break: break-word;
}

.learn-mc-option-btn > span:not(.learn-mc-option-badge) {
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
}

.learn-mc-option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.learn-mc-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.learn-mc-option-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 700;
    flex-shrink: 0;
}

.learn-mc-option-btn.correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #10b981 !important;
}

.learn-mc-option-btn.correct .learn-mc-option-badge {
    background: #10b981 !important;
    color: #fff !important;
}

.learn-mc-option-btn.incorrect {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
}

.learn-mc-option-btn.incorrect .learn-mc-option-badge {
    background: #ef4444 !important;
    color: #fff !important;
}

.learn-sp-form {
    width: 100%;
}

.learn-sp-input-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.learn-sp-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px 24px;
    color: var(--text-light);
    font-size: 1.1em;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
    text-align: center;
}

.learn-sp-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.learn-sp-feedback-card {
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.learn-sp-feedback-card.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.learn-sp-feedback-card.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.learn-sp-feedback-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.1em;
}

.learn-sp-feedback-status.correct {
    color: #10b981;
}

.learn-sp-feedback-status.incorrect {
    color: #ef4444;
}

.learn-sp-feedback-detail {
    font-size: 1em;
    color: var(--text-light);
}

.learn-sp-feedback-original {
    text-decoration: line-through;
    opacity: 0.6;
    margin-right: 8px;
}

.learn-batch-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
    width: 100%;
}

.learn-batch-dot {
    width: 24px;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.learn-batch-dot.level-0 {
    background: #ef4444;
}

.learn-batch-dot.level-1 {
    background: #ffca28;
}

.learn-batch-dot.level-2 {
    background: #10b981;
}

.learn-speak-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.learn-speak-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary);
    transform: scale(1.1);
}

.learn-settings-panel {
    display: flex;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    background: rgba(22, 22, 30, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 18px;
    box-sizing: border-box;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 320px);
    max-height: min(600px, calc(100dvh - 320px));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    opacity: 0;
    transform: scale(0);
    transform-origin: calc(100% - 60px) 0px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, visibility 0.3s;
}

.learn-settings-panel::-webkit-scrollbar {
    width: 6px;
}

.learn-settings-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.learn-settings-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.learn-settings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.learn-settings-panel.active {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transform: scale(1);
}

.learn-settings-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.learn-setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.learn-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.learn-setting-label {
    cursor: pointer;
    color: var(--text-light);
    font-weight: 500;
}

.learn-setting-description {
    font-size: 0.85em;
    color: var(--text-muted);
}

.learn-settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
}

.learn-settings-actions button {
    flex: 1;
}
