/* style.css - Дополненные стили для тренажера испанского языка A1 */

:root {
    --primary: #e11d48; /* Испанский алый */
    --primary-hover: #be123c;
    --primary-light: #ffe4e6;
    
    --gold: #f59e0b; /* Золотистый / Солнечный */
    --gold-light: #fef3c7;
    --gold-dark: #b45309;

    --dark: #0f172a;
    --dark-surface: #1e293b;
    --gray-bg: #f8fafc;
    --gray-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;

    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.07);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #fefce8 0%, #f8fafc 250px);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Header */
.app-header {
    background: white;
    border-bottom: 2px solid var(--gray-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-flag {
    font-size: 2.2rem;
    line-height: 1;
}

.brand-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.speed-control-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gray-bg);
    border: 1px solid var(--gray-border);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
}

.speed-select {
    border: none;
    background: transparent;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    outline: none;
}

/* Nav Tabs */
.main-nav {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: var(--radius-pill);
    overflow-x: auto;
    max-width: 100%;
}

.nav-link-btn {
    border: none;
    background: transparent;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link-btn:hover {
    color: var(--primary);
}

.nav-link-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.15);
}

/* Main Layout */
.app-main {
    max-width: 1280px;
    margin: 24px auto;
    padding: 0 20px;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Banner */
.welcome-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #be123c 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-badge {
    background: var(--gold);
    color: #78350f;
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 900;
    margin-bottom: 12px;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 12px;
}

.welcome-sub {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 820px;
    line-height: 1.5;
}

.quick-stats-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.quick-stat-chip {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
}

/* SECTION 1: LESSONS CATALOG */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--dark);
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.lesson-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 22px;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.lesson-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.lesson-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.lesson-num {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
}

.lesson-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 800;
}

.lesson-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.35;
}

.lesson-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
}

.lesson-card-footer {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
}

/* SECTION 2: VERBS & CONJUGATION */
.verbs-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .verbs-layout {
        grid-template-columns: 1fr;
    }
}

.verbs-sidebar {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.verbs-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.verb-filter-btn {
    border: 1px solid var(--gray-border);
    background: var(--gray-bg);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.verb-filter-btn.active, .verb-filter-btn:hover {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
}

.search-input-box {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    margin-bottom: 14px;
}

.search-input-box:focus {
    border-color: var(--primary);
}

.verbs-list-scroll {
    max-height: 540px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.verb-list-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.verb-list-item:hover {
    background: var(--gray-bg);
}

.verb-list-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.verb-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.verb-item-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark);
}

.verb-item-trans {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Badges for verbs */
.badge {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 800;
}
.badge-ar { background: #fef3c7; color: #92400e; }
.badge-er { background: #e0f2fe; color: #0369a1; }
.badge-ir { background: #d1fae5; color: #065f46; }
.badge-irreg { background: #ede9fe; color: #5b21b6; }
.badge-refl { background: #ffe4e6; color: #9f1239; }

/* Verb Details View */
.verb-details-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.verb-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-bg);
    margin-bottom: 24px;
}

.verb-details-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.verb-details-trans {
    font-size: 1.15rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.verb-type-pill {
    background: var(--gold-light);
    color: var(--gold-dark);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 800;
}

.conjugation-table-wrapper {
    margin-bottom: 24px;
}

.table-caption {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conjugation-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.conjugation-row {
    background: var(--gray-bg);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conj-person {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.conj-form {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
}

.verb-example-box {
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 18px;
}

.example-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #166534;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.example-es {
    font-size: 1.2rem;
    font-weight: 800;
    color: #14532d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.example-ru {
    font-size: 1rem;
    color: #166534;
    margin-top: 4px;
}

/* Audio buttons */
.audio-btn-round {
    background: var(--gold-light);
    border: 1px solid var(--gold);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.audio-btn-round:hover {
    transform: scale(1.1);
    background: var(--gold);
}

.mini-audio-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.75;
    transition: opacity 0.15s, transform 0.15s;
}

.mini-audio-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Modal Windows */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 680px;
    width: 100%;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
}

/* CAR PLAYER (Режим в машине) */
.car-player-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 24px;
}

.car-display-screen {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 30px;
    margin: 20px 0;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.car-word-type {
    background: var(--gold);
    color: #78350f;
    font-size: 0.85rem;
    font-weight: 900;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.car-es-text {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #fde047;
    margin-bottom: 8px;
}

.car-pron-text {
    font-size: 1.3rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.car-ru-text {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
}

.car-ex-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    max-width: 600px;
}

.car-controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
}

.car-btn-big {
    background: var(--gold);
    color: #78350f;
    border: none;
    padding: 18px 42px;
    font-size: 1.5rem;
    font-weight: 900;
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: 0 6px 0 #b45309;
    transition: all 0.15s;
}

.car-btn-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #b45309;
}

.car-btn-big.playing {
    background: #10b981;
    color: white;
    box-shadow: 0 6px 0 #047857;
}

.car-btn-nav {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.car-btn-nav:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

/* GRAMMAR BATTLES */
.battles-menu-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.battle-tab-pill {
    background: white;
    border: 2px solid var(--gray-border);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.battle-tab-pill.active, .battle-tab-pill:hover {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
}

.battle-main-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.battle-sides-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .battle-sides-grid {
        grid-template-columns: 1fr;
    }
}

.battle-side-box {
    padding: 20px;
    border-radius: var(--radius-md);
}

.contrast-row-card {
    background: var(--gray-bg);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
}

.contrast-word-badge {
    display: inline-block;
    background: var(--dark);
    color: white;
    font-size: 0.8rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    margin-bottom: 10px;
}

.contrast-pair-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .contrast-pair-grid {
        grid-template-columns: 1fr;
    }
}

.contrast-half {
    background: white;
    border: 1px solid var(--gray-border);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.contrast-half.side-a { border-left: 4px solid #1e40af; }
.contrast-half.side-b { border-left: 4px solid #065f46; }

.contrast-es {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.contrast-ru {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* CUSTOM WORDS */
.custom-word-item {
    background: var(--gray-bg);
    border: 1px solid var(--gray-border);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* NUMBERS CARDS */
.numbers-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.number-chip-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.number-chip-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.num-digit {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
}

.num-spelling {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--dark);
}

.num-pron {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Common Interactive buttons */
.interactive-action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--primary-hover);
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.interactive-action-btn:hover {
    transform: translateY(-2px);
}

.interactive-action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--primary-hover);
}

.interactive-action-btn.secondary {
    background: white;
    color: var(--text-main);
    border: 2px solid var(--gray-border);
    box-shadow: 0 3px 0 var(--gray-border);
}

.interactive-action-btn.gold {
    background: var(--gold);
    color: #78350f;
    box-shadow: 0 4px 0 #b45309;
}

/* Tables */
.vocab-card, .prepositions-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.vocab-table, .prep-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.vocab-table th, .vocab-table td,
.prep-table th, .prep-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-border);
}

.vocab-table th, .prep-table th {
    background: var(--gray-bg);
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Flashcards */
.flashcards-container {
    max-width: 580px;
    margin: 0 auto;
    text-align: center;
}

.flashcard-categories-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.flashcard-cat-pill {
    background: white;
    border: 1px solid var(--gray-border);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.flashcard-cat-pill.active, .flashcard-cat-pill:hover {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
}

.card-perspective {
    perspective: 1000px;
    margin-bottom: 24px;
}

.flashcard-flipper {
    position: relative;
    width: 100%;
    height: 320px;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    background: white;
    border: 3px solid var(--gray-border);
    box-shadow: var(--shadow-md);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-back {
    transform: rotateY(180deg);
    background: #fdf4ff;
    border-color: #f0abfc;
}

.card-front-es {
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 12px;
}

.card-back-ru {
    font-size: 2rem;
    font-weight: 900;
    color: #86198f;
    margin-bottom: 6px;
}

.card-back-pron {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.card-back-ex {
    font-size: 1.05rem;
    color: #4a044e;
    background: rgba(255, 255, 255, 0.6);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.flash-ans-btn {
    flex: 1;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 900;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.15s;
}

.flash-ans-btn.dont-know {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #f87171;
}

.flash-ans-btn.know {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #34d399;
}

/* Dialogues */
.dialogue-tab-btn {
    background: white;
    border: 2px solid var(--gray-border);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.dialogue-tab-btn.active, .dialogue-tab-btn:hover {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
}

.dialogue-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.dialogue-chat-stream {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dialogue-bubble-row {
    display: flex;
}

.dialogue-bubble-row.user-side {
    justify-content: flex-end;
}

.dialogue-bubble {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.user-side .dialogue-bubble {
    background: #d1fae5;
    border-color: #6ee7b7;
}

.bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
}

.bubble-es {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.bubble-ru {
    font-size: 0.95rem;
    color: #475569;
}

/* Roadmap */
.roadmap-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.roadmap-week-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 24px;
    border-left: 6px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.roadmap-week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.roadmap-week-title {
    font-size: 1.25rem;
    font-weight: 900;
}

.roadmap-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.roadmap-checklist li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.05rem;
    font-weight: 600;
}

.roadmap-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ==========================================================================
   MULTI-USER PROFILE & AUTH STYLES
   ========================================================================== */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-bg);
    border: 1.5px solid var(--gray-border);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.user-profile-badge:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.user-avatar-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--dark);
}

.user-switch-hint {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
}

.user-modal-box {
    max-width: 640px !important;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.user-card-choice {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.user-card-choice:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.user-card-choice.active {
    border-color: var(--primary);
    background: #fff1f2;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.15);
}

.user-card-avatar {
    font-size: 2.2rem;
    margin-bottom: 4px;
}

.user-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.user-card-stats {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    text-align: left;
    background: rgba(0,0,0,0.02);
    padding: 6px 8px;
    border-radius: 8px;
    margin-top: 6px;
}

.user-auth-box {
    background: #f8fafc;
    border: 1.5px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 8px;
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    bottom: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.auth-error-banner {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
}

/* ==========================================================================
   MOBILE & RESPONSIVE DESIGN (IPHONE 8 / IPHONE 12 / COMPACT SCREENS)
   ========================================================================== */

/* Prevent horizontal page scroll globally */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    padding-bottom: max(60px, env(safe-area-inset-bottom));
}

/* Tablet & Mobile (<= 992px) */
@media (max-width: 992px) {
    .header-container {
        padding: 10px 16px;
    }

    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .verbs-layout {
        grid-template-columns: 1fr;
    }

    .welcome-hero {
        padding: 24px 20px;
    }
}

/* Mobile Screen (<= 768px) */
@media (max-width: 768px) {
    .app-main {
        margin: 16px auto;
        padding: 0 14px;
    }

    .header-container {
        gap: 10px;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .brand-sub {
        font-size: 0.72rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header-row .interactive-action-btn,
    .section-header-row button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .lessons-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 14px;
    }

    .card-perspective {
        height: 290px;
        max-width: 100%;
    }

    .card-front-es {
        font-size: 2.2rem;
    }

    .card-back-ru {
        font-size: 1.5rem;
    }

    .constructor-actions {
        flex-direction: column;
        width: 100%;
    }

    .constructor-actions button {
        width: 100%;
    }

    .modal-container {
        width: 95vw;
        max-height: 90vh;
        padding: 20px 16px;
    }
}

/* Compact Mobile (iPhone 8: 375px, iPhone 12/13/14: 390px, SE: 320-375px) */
@media (max-width: 480px) {
    /* Critical iOS input zoom fix */
    input, select, textarea {
        font-size: 16px !important;
    }

    .app-main {
        padding: 0 10px;
        margin: 12px auto;
    }

    /* Header Compact Mode */
    .header-container {
        padding: 8px 10px;
        gap: 8px;
    }

    .brand-block {
        gap: 8px;
    }

    .brand-flag {
        font-size: 1.7rem;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .brand-sub {
        display: none; /* Hide subtitle to keep header sleek */
    }

    .header-controls {
        display: flex;
        justify-content: space-between;
        width: 100%;
        order: 2;
        gap: 8px;
    }

    .user-profile-badge {
        padding: 5px 10px;
        flex-grow: 1;
    }

    .user-name {
        font-size: 0.8rem;
    }

    .speed-control-wrapper {
        padding: 5px 10px;
    }

    .speed-control-wrapper span {
        font-size: 0.8rem;
    }

    .main-nav {
        order: 3;
        width: 100%;
        padding: 4px;
        gap: 4px;
        border-radius: 12px;
    }

    .nav-link-btn {
        padding: 7px 11px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    /* Welcome Hero on Mobile */
    .welcome-hero {
        padding: 18px 14px;
        border-radius: 16px;
        margin-bottom: 18px;
    }

    .welcome-title {
        font-size: 1.35rem;
        line-height: 1.25;
        margin-bottom: 8px;
    }

    .welcome-sub {
        font-size: 0.88rem;
        line-height: 1.4;
    }

    .quick-stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 14px;
    }

    .quick-stat-chip {
        padding: 6px 8px;
        font-size: 0.78rem;
        text-align: center;
        border-radius: 10px;
    }

    /* Lessons Grid */
    .lessons-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lesson-card {
        padding: 16px 14px;
        border-radius: 14px;
    }

    .lesson-card-title {
        font-size: 1.05rem;
    }

    .lesson-card-desc {
        font-size: 0.85rem;
    }

    /* Verbs Catalog on Mobile */
    .verbs-sidebar {
        padding: 12px 10px;
    }

    .verbs-filter-row {
        gap: 4px;
    }

    .verb-filter-btn {
        padding: 6px 9px;
        font-size: 0.78rem;
        border-radius: 10px;
    }

    .verbs-list-scroll {
        max-height: 200px; /* Don't force user to scroll endlessly down */
    }

    .verb-item-row {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .conjugation-table th, 
    .conjugation-table td {
        padding: 8px 6px;
        font-size: 0.82rem;
    }

    /* Grammar Battles on Mobile */
    .battles-menu-row {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        scrollbar-width: none;
    }

    .battles-menu-row::-webkit-scrollbar {
        display: none;
    }

    .battle-btn-pill {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    /* Stack battle columns on mobile */
    div[style*="display:grid; grid-template-columns:1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
    }

    /* Car Audio Player on Mobile */
    .car-player-card {
        padding: 16px 12px;
        border-radius: 18px;
    }

    .car-display-screen {
        padding: 18px 10px;
        min-height: 220px;
    }

    .car-es-text {
        font-size: 1.85rem !important;
        line-height: 1.2;
        word-break: break-word;
    }

    .car-pron-text {
        font-size: 1.05rem !important;
    }

    .car-ru-text {
        font-size: 1.15rem !important;
    }

    .car-ex-box {
        padding: 10px 8px;
    }

    #car-display-ex-es {
        font-size: 0.95rem !important;
    }

    #car-display-ex-ru {
        font-size: 0.85rem !important;
    }

    .car-controls-row {
        gap: 8px;
    }

    .car-btn-big {
        font-size: 0.92rem;
        padding: 12px 14px;
        min-height: 48px;
        flex-grow: 1;
    }

    .car-btn-nav {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    /* Flashcards */
    .flashcard-categories-row {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        scrollbar-width: none;
    }

    .flashcard-categories-row::-webkit-scrollbar {
        display: none;
    }

    .flashcard-cat-pill {
        flex-shrink: 0;
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .card-perspective {
        height: 270px;
    }

    .card-face {
        padding: 18px 14px;
    }

    .card-front-es {
        font-size: 1.9rem !important;
    }

    .card-back-ru {
        font-size: 1.35rem !important;
    }

    .flashcard-controls {
        flex-direction: row;
        gap: 8px;
    }

    .flash-ans-btn {
        flex: 1;
        padding: 12px 8px;
        font-size: 0.88rem;
    }

    /* Constructor */
    .constructor-card {
        padding: 16px 12px;
        border-radius: 16px;
    }

    .prompt-ru-text {
        font-size: 1.1rem;
    }

    .word-chip {
        padding: 8px 11px;
        font-size: 0.92rem;
        min-height: 40px;
    }

    /* Numbers Grid */
    .numbers-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 6px;
    }

    .number-card {
        padding: 10px 6px;
    }

    .number-val {
        font-size: 1.25rem;
    }

    .number-words {
        font-size: 0.85rem;
    }

    /* Roadmap */
    .roadmap-week-card {
        padding: 16px 12px;
        border-radius: 14px;
    }

    .roadmap-week-title {
        font-size: 1.05rem;
    }

    .roadmap-checklist li {
        font-size: 0.92rem;
        gap: 8px;
    }

    /* User Modal Grid */
    .users-grid {
        grid-template-columns: 1fr;
    }

    .user-card-choice {
        padding: 12px 10px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }

    .user-card-avatar {
        font-size: 1.8rem;
        margin-bottom: 0;
    }

    .user-card-stats {
        margin-top: 2px;
        padding: 4px 6px;
        font-size: 0.72rem;
    }

    /* Dialogues */
    .dialogue-card {
        padding: 16px 12px;
    }

    .dialogue-bubble {
        max-width: 90%;
        padding: 12px 14px;
    }

    .bubble-es {
        font-size: 1rem;
    }

    .bubble-ru {
        font-size: 0.88rem;
    }
}

