/* =============================================
   FREE ENGLISH - FUN & SIMPLE DESIGN SYSTEM
   ============================================= */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Colors - Playful & Cheerful Palette */
    --primary-color: #F0C42A;
    /* Warm sunshine yellow */
    --secondary-color: #67C2E1;
    /* Bright sky blue */
    --accent-color: #1E6A3A;
    /* Fresh growth green */

    --success-color: #10b981;
    /* Success green */
    --error-color: #ef4444;
    /* Error red */
    --warning-color: #f59e0b;
    /* Warning orange */

    --text-color: #2d3748;
    /* Dark gray for readability */
    --text-light: #718096;
    /* Light gray for secondary text */
    --bg-color: #FFFFFF;
    /* Clean white background */
    --bg-light: #F7FAFC;
    /* Very light gray */
    --border-color: #E2E8F0;
    /* Subtle borders */

    /* Typography */
    --font-family: 'Rubik', Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Border Radius - Friendly & Rounded */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== GLOBAL RESETS & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: var(--font-size-base);
    height: 100%;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--accent-color);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
}

h2 {
    font-size: 2rem;
    margin-top: var(--spacing-xl);
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--accent-color);
}

strong {
    font-weight: 700;
    color: var(--accent-color);
}

/* ===== CONTAINER & LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (max-width: 1024px) {
    .container {
        padding: 0 var(--spacing-xs);
    }
}

.story-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.story-header h3 {
    margin: 0;
}

/* ===== HEADER & NAVIGATION ===== */
header {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--primary-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    transition: transform var(--transition-bounce);
    /* Logo on the left for LTR, right for RTL */
}

.logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-links a {
    font-weight: 600;
    font-size: 1.1rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    transition: all var(--transition-bounce);
    position: relative;
}

.nav-links a:hover {
    background: linear-gradient(135deg, var(--primary-color), #fcd34d);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.nav-links a.active {
    background: var(--secondary-color);
    color: white;
}

/* Hide mobile-only items on desktop */
.nav-links .mobile-only {
    display: none;
}

/* Dropdown for vocabulary sub-pages */
.nav-links li {
    position: relative;
}

.nav-links .submenu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    list-style: none;
    padding: var(--spacing-xs) 0;
    min-width: 190px;
    z-index: 1000;
}

.nav-links li:hover .submenu,
.nav-links li:focus-within .submenu {
    display: block;
}

.nav-links .submenu a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-md);
    color: var(--text-color);
    font-weight: 500;
    border-radius: 0;
}

.nav-links .submenu a:hover {
    background: var(--bg-light);
    color: var(--accent-color);
}

/* ===== MOBILE HAMBURGER MENU ===== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    z-index: 1002;
    /* Higher than overlay and nav */
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    margin: 6px auto;
    /* Centered */
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    border-radius: 2px;
}

/* Transform hamburger to X */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
    background: var(--primary-color);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
    background: var(--primary-color);
}

/* When menu is open, move the X button inside the menu on the LEFT side */
@media (max-width: 1024px) {
    .menu-toggle.active {
        position: fixed;
        top: 1rem;
        left: 1rem;
        /* Left side of the menu */
        right: auto;
        z-index: 1100;
        /* Above the menu */
    }
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
        /* Keep hamburger on the right (before logo in RTL) */
        order: -1;
        margin-left: 0;
        margin-right: -10px;
    }

    .header-content {
        align-items: center;
    }

    /* ===== Minimalist Side Drawer ===== */
    .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;

        background: #ffffff;

        flex-direction: column;
        padding: 0;
        gap: 0;

        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 1001;

        /* Animation: Slide from right */
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;

        overflow-y: auto;
    }

    .nav-links.active {
        transform: translateX(0);
        visibility: visible;
    }

    /* Menu Header with Site Name and Close Button */
    .nav-links::before {
        content: 'אנגלית חופשית';
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.25rem 1.5rem;
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary-color);
        background: var(--bg-light);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .nav-links li {
        width: 100%;
        opacity: 1;
        transform: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    /* Remove staggered animation for cleaner look */
    .nav-links.active li {
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        font-weight: 500;
        color: var(--text-color);
        text-decoration: none;
        position: relative;
        transition: all 0.2s ease;
    }

    /* Active indicator: colored bar on the right side */
    .nav-links a::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 4px;
        height: 100%;
        background: var(--primary-color);
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .nav-links a:hover,
    .nav-links a:focus {
        background: var(--bg-light);
        color: var(--primary-color);
    }

    .nav-links a:hover::before,
    .nav-links a.active::before {
        opacity: 1;
    }

    .nav-links a.active {
        background: linear-gradient(90deg, rgba(76, 175, 80, 0.1) 0%, transparent 100%);
        color: var(--primary-color);
        font-weight: 600;
    }

    /* Remove any ::after pseudo elements from previous design */
    .nav-links a::after {
        display: none;
    }

    /* Hide special button styles */
    .nav-links a.btn-cta,
    .nav-links .start-btn {
        background: none;
        color: var(--text-color);
        padding: 1rem 1.5rem;
        border-radius: 0;
        box-shadow: none;
        font-size: 1.05rem;
    }
}

@media (max-width: 1024px) {

    /* Submenu adjustments */
    .nav-links .submenu {
        position: static;
        display: none;
        background: transparent;
        box-shadow: none;
        padding-right: var(--spacing-lg);
        padding-top: 0;
        margin-top: 0;
        border: none;
    }

    .nav-links li:hover .submenu,
    .nav-links li:focus-within .submenu {
        display: block;
        animation: slideDown 0.3s ease;
    }

    .nav-links .submenu a {
        font-size: 1rem;
        padding: var(--spacing-sm);
        color: var(--text-light);
    }

    /* Overlay handling */
    .mobile-menu-overlay {
        display: block;
    }

    /* Show mobile only items */
    .nav-links .mobile-only {
        display: block;
    }
}

/* ===== VOCABULARY PAGES STYLES ===== */
.vocab-word {
    color: #667eea;
    font-weight: 700;
    font-size: 1.05em;
    position: relative;
    cursor: help;
    transition: color 0.2s ease;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.vocab-word:hover {
    color: #764ba2;
    background-color: rgba(102, 126, 234, 0.1);
    border-bottom-color: #764ba2;
    border-radius: 4px;
}

/* Tooltip for vocab words */
.vocab-word::before {
    content: attr(data-hebrew);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: rgba(45, 55, 72, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.vocab-word::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(1px);
    border: 6px solid transparent;
    border-top-color: rgba(45, 55, 72, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.vocab-word:hover::before,
.vocab-word:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

/* Vocabulary List Grid */
.vocab-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    /* Optimized for mobile to show 2 per row */
    gap: var(--spacing-md);
    margin: 2rem 0;
}

.vocab-item {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-bounce);
    cursor: pointer;
    position: relative;
    text-align: center;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    aspect-ratio: 1/1;
    /* Square cards look modern */
}

.vocab-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary-color);
}

.vocab-item::after {
    content: '🔊';
    position: absolute;
    top: 8px;
    left: 8px;
    /* RTL - actually right in RTL context but let's check direction. If dir=rtl, left is left. */
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vocab-item:hover::after {
    opacity: 1;
}

.vocab-item-english {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.vocab-item-hebrew {
    font-size: 1rem;
    color: var(--text-light);
}

/* Story Section */
.story-section {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    margin: 3rem 0;
    box-shadow: var(--shadow-md);
    line-height: 1.8;
    font-size: 1.1rem;
    position: relative;
    border: 3px solid #f97316;
    /* Orange frame */
}

.story-section h2 {
    color: #c2410c;
    /* Deep orange */
    margin-bottom: var(--spacing-lg);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    /* Removed flex-wrap to keep title and speaker button together */
}

.story-speaker {
    background: white;
    color: #c2410c;
    border: 2px solid #fdba74;
    padding: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.story-speaker:hover {
    background: #c2410c;
    color: white;
    border-color: #c2410c;
    transform: scale(1.1);
}

.story-speaker.playing {
    animation: pulse 1.5s infinite;
    background: #c2410c;
    color: white;
}

.story-text {
    background: rgba(255, 255, 255, 0.6);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    direction: ltr;
    /* English stories are LTR */
    text-align: left;
    font-family: 'Rubik';
}

.story-text p {
    margin-bottom: 1.5rem;
}

.section-divider {
    text-align: center;
    margin: 3rem 0;
    font-size: 2rem;
    opacity: 0.5;
}


/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #38bdf8 100%);
    color: white;
    padding: var(--spacing-2xl) var(--spacing-md);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '🌟';
    position: absolute;
    font-size: 15rem;
    opacity: 0.1;
    top: -4rem;
    right: -3rem;
    animation: float 6s ease-in-out infinite;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: var(--spacing-md);
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.95;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@media (max-width: 1024px) {
    .hero {
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color) 0%, #fcd34d 100%);
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.2rem;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-bounce);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
    color: var(--accent-color);
}

.btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* ===== CARDS & GRIDS ===== */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    margin: var(--spacing-md) auto 0;
    border-radius: var(--radius-full);
}

.grammar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-bounce);
    border: 3px solid transparent;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: var(--spacing-xl);
    /* Make room for progress bar */
    overflow: visible;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    /* border-color: var(--secondary-color);*/
}

.card h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
}

.card p {
    color: var(--text-light);
    margin: 0;
}

/* ===== CONTENT AREAS ===== */
main {
    margin-bottom: var(--spacing-2xl);
    flex: 1 0 auto;
    width: 100%;
}

footer {
    flex-shrink: 0;
    width: 100%;
}

.grammar-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 1rem auto;
}

.example-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 3px solid var(--secondary-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    border-left: 6px solid var(--accent-color);
}

.example-box strong {
    color: var(--accent-color);
}

.example-box ul {
    list-style: none;
    padding-left: var(--spacing-sm);
}

.example-box li {
    padding: var(--spacing-xs) 0;
    position: relative;
    padding-left: var(--spacing-lg);
}

.example-box li::before {
    content: '✓';
    color: var(--success-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* ===== QUIZ SECTION ===== */
.quiz-section {
    margin-top: var(--spacing-2xl);
    padding: var(--spacing-xl);
    border-top: 4px solid var(--secondary-color);
    background: #f8f9fa;
}

.quiz-section h2 {
    text-align: center;
    color: var(--secondary-color);
}

.quiz-container {
    margin-top: var(--spacing-lg);
}

.quiz-question {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 3px solid var(--secondary-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.quiz-question::before {
    content: '❓';
    position: absolute;
    bottom: 0;
    left: 0;
    font-size: 2rem;
    opacity: 0.2;
}

.quiz-question.answered {
    opacity: 0.7;
    transform: scale(0.98);
}

.quiz-question.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--success-color);
    animation: correctShake 0.5s ease;
}

.quiz-question.wrong {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--error-color);
    animation: wrongShake 0.5s ease;
}

@keyframes correctShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px) rotate(-2deg);
    }

    75% {
        transform: translateX(10px) rotate(2deg);
    }
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.quiz-question h3 {
    color: var(--accent-color);
    margin-bottom: var(--spacing-sm);
    font-size: 1.3rem;
}

.quiz-question p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.quiz-option {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-bounce);
    font-family: var(--font-family);
    color: var(--text-color);
}

.quiz-option:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.05);
    border-color: var(--secondary-color);
    box-shadow: 0 10px 20px rgba(103, 194, 225, 0.3);
}

.quiz-option:active:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-option.correct {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-color: #065f46;
    animation: pulse 0.5s ease;
}

.quiz-option.wrong {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
    border-color: #991b1b;
    animation: shake 0.5s ease;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.quiz-feedback {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.quiz-feedback.show {
    opacity: 1;
}

.quiz-feedback.correct {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid var(--success-color);
}

.quiz-feedback.wrong {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid var(--error-color);
}

.quiz-score {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    margin-top: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

.quiz-score h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

#score {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 700;
}

#score-message {
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: var(--spacing-xs);
    color: var(--text-light);
}

/* Confetti Animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    animation: confetti-fall 3s linear;
    z-index: 1000;
}

/* ===== FOOTER ===== */
footer {
    background: linear-gradient(135deg, var(--accent-color) 0%, #166534 100%);
    color: white;
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    margin-top: var(--spacing-2xl);
    border-top: 4px solid var(--primary-color);
}

footer p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .grammar-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .grammar-content {
        padding: var(--spacing-md);
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .quiz-question p {
        font-size: 1.1rem;
    }

    .quiz-option {
        font-size: 1rem;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-xs);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-lg);
}

.mt-5 {
    margin-top: var(--spacing-xl);
}

.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

.mb-5 {
    margin-bottom: var(--spacing-xl);
}

.break-word {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* Main Section Headings - for tense pages */
.main-section-heading {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.2rem 2rem;
    margin: 3rem -1rem 2rem -1rem;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 1024px) {
    .main-section-heading {
        font-size: 1.3rem;
        padding: 1rem 1.5rem;
        margin: 2rem -0.5rem 1.5rem -0.5rem;
    }
}

/* Speaker Button Alignment */
.speak-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin: 0 4px;
    position: relative;
    top: -2px;
    /* Slight adjustment for better optical alignment */
}

.speak-btn svg {
    width: 20px;
    height: 20px;
    fill: #4CAF50;
    transition: transform 0.2s ease;
}

.speak-btn:hover svg {
    transform: scale(1.2);
    fill: #45a049;
}

/* Usage Subheadings - for specific use cases under 'When to use' */
.usage-subheading {
    border-right: 5px solid #4CAF50;
    background-color: #f8f9fa;
    padding: 0.8rem 1.2rem;
    margin: 2.5rem 0 1.5rem 0;
    color: #2c3e50;
    border-radius: 4px 0 0 4px;
    /* Rounded on left side */
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.usage-subheading::before {
    content: '📌';
    margin-left: 10px;
    font-size: 1.1rem;
}

/* Structure Subheadings - for Positive, Negative, Question */
.structure-subheading {
    padding: 0.8rem 1.2rem;
    margin: 2rem 0 1rem 0;
    color: #2c3e50;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border-left: 5px solid #ccc;
    /* Default fallback */
}

.structure-subheading span {
    margin-right: 10px;
    /* Space for icon */
}

/* Positive Structure */
.structure-pos {
    border-left-color: #4CAF50;
    /* Green */
    background-color: #e8f5e9;
}

.structure-pos::before {
    content: '✅';
    margin-left: 10px;
}

/* Negative Structure */
.structure-neg {
    border-left-color: #f44336;
    /* Red */
    background-color: #ffebee;
}

.structure-neg::before {
    content: '❌';
    margin-left: 10px;
}

/* Question Structure */
.structure-ques {
    border-left-color: #ff9800;
    /* Orange */
    background-color: #fff3e0;
}

.structure-ques::before {
    content: '❓';
    margin-left: 10px;
}

/* Suffix Highlighting for Present Simple */
.suffix-s {
    color: #e91e63;
    /* Pink */
    font-weight: bold;
}

.suffix-es {
    color: #9c27b0;
    /* Purple */
    font-weight: bold;
}

.suffix-ies {
    color: #673ab7;
    /* Deep Purple */
    font-weight: bold;
}

/* ===== TIME EXPRESSIONS BOX ===== */
.time-expressions-box {
    background: linear-gradient(135deg, #f0c42a2b 0%, #f0c42a70 100%);
    border: 3px solid #f0c42a;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    position: relative;
    margin-top: 3rem;
}

.time-expressions-box::before {
    content: '⏰';
    position: absolute;
    top: -25px;
    right: 20px;
    font-size: 2.5rem;
    background: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 3px solid #f0c42a;
}

.time-expressions-box h3 {
    color: #000;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    border-bottom: 2px solid rgba(192, 57, 43, 0.2);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.time-expressions-box ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 0;
}

.time-expressions-box li {
    background: white;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    color: #000;
    text-align: center;
    transition: transform 0.2s;
    border: 1px solid #ffcccc;
}

.time-expressions-box li:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: #fff0f0;
}

/* ===== COMPARISON CARDS ===== */
.comparison-card {
    border-color: #9c27b0;
    /* Purple border to distinguish */
    background: linear-gradient(145deg, #ffffff, #f3e5f5);
    position: relative;
    overflow: hidden;
}

/*.comparison-card::before {
    content: 'VS';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #9c27b0;
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 10px 12px;
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 50%;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1;
}*/

.comparison-card:hover {
    border-color: #7b1fa2;
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 30px rgba(156, 39, 176, 0.2);
}

.comparison-card h3 {
    color: #7b1fa2;
    padding-right: 15px;
}

.comparison-card::after {
    content: '⚖️';
    /* Balance scale icon */
    position: absolute;
    top: 0;
    left: 10px;
    font-size: 3rem;
    opacity: 0.1;
    transform: rotate(-15deg);
    transition: all 0.3s ease;
}

.comparison-card:hover::after {
    opacity: 0.2;
    transform: rotate(0deg) scale(1.1);
}

/* New Comparison Card Styles */
.comparison-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 16px;
    width: 100%;
}

.tense-tag {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    flex: 1;
    text-align: center;
    white-space: nowrap;
    min-width: fit-content;
}

.vs-badge {
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    color: white;
    font-weight: 800;
    font-size: 0.7rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(156, 39, 176, 0.3);
}

.comparison-card .card-header h3 {
    margin-bottom: 0.5rem;
}

/* ===== MASTERY INDICATOR ===== */
.mastery-indicator {
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 12px;
    /* Slightly taller for better visibility */
    background-color: #e2e8f0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    /* Rounded corners only at bottom */
    overflow: visible;
    display: flex;
    align-items: center;
    margin-top: 0;
    /* Reset margin */
}

.mastery-progress {
    width: 100%;
    height: 100%;
    background-color: transparent;
    /* Background is now on container */
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.mastery-bar {
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    transition: width 1s ease-in-out, background-color 0.3s ease;
}

.mastery-score {
    display: none;
    /* Hide score text as per request for cleaner look, or keep it floating? User said "hover on progress bar area" */
}

/* Custom Tooltip Element */
.mastery-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    min-width: 220px;
    pointer-events: none;
    z-index: 10;
    margin-bottom: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform: translateX(-50%) translateY(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

/* Triangle for tooltip */
.mastery-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #212121;
}

/* Show tooltip on hover */
.mastery-indicator:hover .mastery-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .vocab-list {
        grid-template-columns: repeat(2, 1fr);
        /* Force 2 columns */
        gap: var(--spacing-sm);
    }

    .vocab-item {
        padding: var(--spacing-sm);
        aspect-ratio: auto;
        min-height: 100px;
    }

    .vocab-item-english {
        font-size: 1.1rem;
    }

    .story-section {
        padding: var(--spacing-md);
    }

    .story-text {
        padding: var(--spacing-md);
    }

    .quiz-section {
        padding: var(--spacing-xs);
    }

    .vocab-item-english {
        font-size: 1rem;
    }
}