:root {
    --primary-color: #6C63FF;
    /* Violet */
    --secondary-color: #00D2D3;
    /* Teal */
    --accent-color: #FF6B6B;
    /* Coral */
    --text-color: #ffffff;
    --text-muted: #e0e0e0;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

/* Background Animation Placeholder */
.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(108, 99, 255, 0.15), transparent 70%);
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 1rem;
}

header h1 {
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 1px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Glassmorphism Card */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s ease;
}

.large-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Typography & Layout */
h2 {
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    margin-bottom: 2rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.text-center {
    text-align: center;
}

/* Buttons */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1.5rem 2rem;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.btn-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.btn-desc {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.secondary {
    background: var(--secondary-color);
    color: #1a1a2e;
}

.btn.accent {
    background: var(--accent-color);
    color: white;
}

.btn.outline {
    background: transparent;
    border: 2px solid var(--glass-border);
    color: white;
}

.btn.outline:hover {
    border-color: var(--primary-color);
    background: rgba(108, 99, 255, 0.1);
}

.btn.full-width {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Screen Visibility */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Learning Screen */
.learning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.word-display-area {
    text-align: center;
    margin-bottom: 1rem;
}

#learn-word {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.pronunciation-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', Courier, monospace;
    /* Monospace for phonetic clarity */
    margin-top: -0.5rem;
}

.meaning-area {
    text-align: center;
    margin-bottom: 3rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
}

#learn-meaning {
    font-size: 1.5rem;
    font-weight: 600;
    transition: filter 0.3s ease;
}

.blur-text {
    filter: blur(8px);
    -webkit-filter: blur(8px);
}

.meaning-area:hover .blur-text,
.meaning-area.revealed .blur-text {
    filter: blur(0);
}

.hint-text {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.5);
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.progress-bar-container {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.question-area {
    text-align: center;
    margin-bottom: 2rem;
}

#quiz-word {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
}

.option-btn.correct {
    background: #00b894;
    /* Green */
    border-color: #00b894;
}

.option-btn.wrong {
    background: #d63031;
    /* Red */
    border-color: #d63031;
}

/* Result Screen and Scrollable */
.scrollable-card {
    max-height: 90vh;
    /* Prevent overflowing screen on small devices */
    overflow-y: auto;
    /* Hide scrollbar for aesthetics */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scrollable-card::-webkit-scrollbar {
    display: none;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 2rem auto;
    background: rgba(0, 210, 211, 0.1);
    box-shadow: 0 0 20px rgba(0, 210, 211, 0.4);
}

#final-score {
    font-size: 3rem;
    font-weight: 700;
}

.score-label {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Chart */
.chart-container {
    width: 100%;
    height: 250px;
    margin: 2rem 0;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 10px;
}

/* Extra Actions in Welcome Screen */
.extra-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.small-text {
    font-size: 0.9rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    opacity: 0.9;
}

/* Mastered Screen */
.mastered-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mastered-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

.mastered-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.m-word {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.m-mean {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tiny-btn {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
}

/* Utils */
.hidden {
    display: none !important;
}

/* Small Button */
.small-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    background: rgba(255, 99, 99, 0.2);
    color: rgba(255, 200, 200, 0.9);
}

.small-btn:hover {
    background: rgba(255, 99, 99, 0.8);
    color: white;
}

/* Filter Buttons */
/* Filter Buttons */
.filter-btn {
    width: auto !important;
    /* Override small-btn fixed width */
    height: auto !important;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.filter-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.filter-btn.active {
    opacity: 1;
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.4);
}

/* Custom Square Checkboxes */
.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--secondary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.custom-checkbox:hover {
    background: rgba(0, 210, 211, 0.2);
}

.custom-checkbox.checked {
    background: var(--secondary-color);
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.5);
}

.custom-checkbox.checked::after {
    content: '✔';
    display: flex;
    justify-content: center;
    align-items: center;
    color: #1a1a2e;
    font-size: 14px;
    font-weight: bold;
    height: 100%;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    header {
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.5rem 1rem;
    }

    .large-card {
        min-height: auto;
    }

    #learn-word {
        font-size: 2.2rem;
    }

    #quiz-word {
        font-size: 2rem;
    }

    .meaning-area {
        margin-bottom: 1.5rem;
    }

    .extra-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-title {
        font-size: 1.2rem;
    }

    .option-btn {
        padding: 1.2rem 0.8rem;
        font-size: 0.95rem;
    }

    .chart-container {
        height: 200px;
    }

    .score-circle {
        width: 120px;
        height: 120px;
        margin: 1rem auto;
    }

    #final-score {
        font-size: 2.5rem;
    }
}

@media (max-width: 400px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    #learn-word {
        font-size: 1.8rem;
    }
}