/* ============================================================
   Parlo v2 — Shared Styles
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Particles ---- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.6;
}

/* ---- Layout ---- */
.container {
    position: relative;
    z-index: 2;
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container--wide {
    max-width: 900px;
}

/* ---- App Nav ---- */
.app-nav {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.2rem 1.5rem 0;
}

.nav-logo {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-modes {
    display: flex;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-mode {
    padding: 0.4rem 1rem;
    border-radius: 7px;
    color: #8a8a9a;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-mode:hover {
    color: #b0b0c0;
    background: rgba(255, 255, 255, 0.05);
}

.nav-mode.active {
    background: rgba(102, 126, 234, 0.15);
    color: #a8b5ff;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.2);
}

/* ---- Header ---- */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.8s ease-out;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.95rem;
    color: #8a8a9a;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* ---- Landing mode cards ---- */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    align-content: center;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 2.5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 220px;
}

.mode-card:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
}

.mode-card--practice:hover {
    background: rgba(240, 147, 251, 0.08);
    border-color: rgba(240, 147, 251, 0.3);
    box-shadow: 0 12px 40px rgba(240, 147, 251, 0.15);
}

.mode-card__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    color: #a8b5ff;
    transition: all 0.3s ease;
}

.mode-card--practice .mode-card__icon {
    background: rgba(240, 147, 251, 0.12);
    border-color: rgba(240, 147, 251, 0.2);
    color: #f0b3fb;
}

.mode-card:hover .mode-card__icon {
    transform: scale(1.1);
}

.mode-card__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e8e8f0;
    letter-spacing: -0.01em;
}

.mode-card__desc {
    font-size: 0.85rem;
    color: #6a6a7a;
    line-height: 1.5;
}

/* ---- Shared controls row ---- */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #8a8a9a;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.3);
    color: #a8b5ff;
    transform: translateY(-1px);
}

.control-btn svg { width: 16px; height: 16px; }

.control-btn--danger {
    border-color: rgba(255, 107, 107, 0.15);
    color: #ff9999;
}
.control-btn--danger:hover {
    background: rgba(255, 107, 107, 0.08);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ffaaaa;
}

.progress {
    font-size: 0.9rem;
    color: #8a8a9a;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ---- Dropdowns ---- */
.level-selector, .tense-selector {
    flex: 1;
    max-width: 200px;
}

.level-dropdown {
    width: 100%;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #a8b5ff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.level-dropdown:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.3);
}

.level-dropdown option {
    background: #1a1a24;
    color: #e0e0e0;
}

/* ---- Mode tabs (flashcard direction) ---- */
.mode-selector {
    display: inline-flex;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #8a8a9a;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    color: #b0b0c0;
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: rgba(102, 126, 234, 0.15);
    color: #a8b5ff;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.2);
}

/* ---- Flashcard ---- */
.flashcard-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.flashcard {
    width: 100%;
    max-width: 550px;
    height: 380px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    touch-action: pan-y pinch-zoom;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-front {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.card-back {
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.08) 0%, rgba(240, 147, 251, 0.08) 100%);
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
    width: 100%;
}

.language-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #667eea;
    margin-bottom: 1.5rem;
    font-weight: 600;
    opacity: 0.7;
}

.card-front .language-label { color: #f093fb; }

.phrase-text {
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    font-weight: 600;
    color: #e8e8f0;
    margin-bottom: 1rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.pronunciation {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: #8a8a9a;
    font-style: italic;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.flip-hint {
    font-size: 0.8rem;
    color: #6a6a7a;
    margin-top: 2rem;
    opacity: 0.5;
    font-weight: 400;
}

.speaker-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #8a8a9a;
    z-index: 10;
}

.speaker-btn.hidden { display: none !important; }

.forvo-btn {
    position: absolute;
    top: 1.2rem;
    right: 4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #8a8a9a;
    z-index: 10;
    text-decoration: none;
}

.forvo-btn:hover {
    background: rgba(240, 147, 251, 0.15);
    border-color: rgba(240, 147, 251, 0.3);
    color: #f093fb;
    transform: scale(1.05);
}

.speaker-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    color: #a8b5ff;
    transform: scale(1.05);
}

.speaker-btn svg { width: 20px; height: 20px; }

/* ---- Navigation buttons ---- */
.navigation {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #8a8a9a;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn svg { width: 18px; height: 18px; }

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.3);
    color: #a8b5ff;
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.nav-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    color: #8a8a9a;
}

.nav-btn--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: white;
}

.nav-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    color: white;
}

.nav-btn--primary:disabled {
    background: rgba(102, 126, 234, 0.2);
    opacity: 0.4;
}

/* ---- Practice: AI toggle section ---- */
.ai-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.15s both;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.toggle-checkbox { display: none; }

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8a8a9a;
    top: 2px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-checkbox:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

.toggle-checkbox:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: white;
}

.toggle-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e0e0e0;
}

.ai-status {
    font-size: 0.85rem;
    color: #8a8a9a;
    flex: 1;
}

.ai-status.ready {
    color: #a8b5ff;
}

.ai-status.ready::before {
    content: '✓ ';
    color: #67e8a2;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    color: #a8b5ff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.3);
}

/* ---- Practice: builder ---- */
.builder {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.prompt-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.prompt-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #667eea;
    margin-bottom: 1rem;
    font-weight: 600;
    opacity: 0.7;
}

.prompt-text {
    font-size: clamp(1.2rem, 3vw, 1.7rem);
    font-weight: 600;
    color: #e8e8f0;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    min-height: 2.5em;
}

.prompt-meta {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge--tense {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #a8b5ff;
}

.badge--level {
    background: rgba(240, 147, 251, 0.15);
    border: 1px solid rgba(240, 147, 251, 0.2);
    color: #f0b3fb;
}

.answer-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-area textarea {
    width: 100%;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
    min-height: 100px;
}

.answer-area textarea:focus {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.answer-helpers {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-helper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: rgba(240, 147, 251, 0.1);
    border: 1px solid rgba(240, 147, 251, 0.2);
    border-radius: 8px;
    color: #f0b3fb;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-helper:hover {
    background: rgba(240, 147, 251, 0.15);
    border-color: rgba(240, 147, 251, 0.3);
    transform: translateY(-1px);
}

.btn-helper svg { width: 16px; height: 16px; }

.hint-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(103, 232, 162, 0.1);
    border: 1px solid rgba(103, 232, 162, 0.2);
    border-radius: 8px;
    flex: 1;
    animation: fadeInSlide 0.3s ease-out;
}

.hint-box span {
    font-size: 0.85rem;
    color: #9fefca;
    line-height: 1.3;
}

.action-buttons {
    display: flex;
    gap: 0.8rem;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action svg { width: 18px; height: 18px; }

.btn-action--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-action--primary:hover {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-action--secondary {
    background: rgba(255, 255, 255, 0.03);
    color: #8a8a9a;
}

.btn-action--secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #b0b0c0;
    transform: translateY(-1px);
}

/* ---- Tip box ---- */
.tip-box {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}

.tip-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a8b5ff;
    margin-bottom: 0.4rem;
}

.tip-text {
    color: #b0b0c0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ---- AI Feedback ---- */
.feedback-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.feedback-title {
    font-size: 1rem;
    font-weight: 600;
    color: #a8b5ff;
}

.btn-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #8a8a9a;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-close:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ff9999;
}

.feedback-content {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.feedback-content p { margin-bottom: 0.8rem; }
.feedback-content p:last-child { margin-bottom: 0; }
.feedback-content strong { color: #a8b5ff; }
.feedback-content em { color: #f0b3fb; font-style: italic; }

.feedback-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.btn-challenge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.2rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #ffc107;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-challenge:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    transform: translateY(-1px);
}

.btn-challenge svg { width: 16px; height: 16px; }

.btn-next {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #b0b0c0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-next:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
    color: #a8b5ff;
}

/* ---- Challenge section ---- */
.challenge-box {
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.challenge-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffc107;
    margin-bottom: 1rem;
}

.challenge-box textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.challenge-box textarea:focus {
    border-color: rgba(255, 193, 7, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.challenge-actions {
    display: flex;
    gap: 0.8rem;
}

/* ---- Example vocab ---- */
.vocab-section { margin-top: 0.5rem; }

.btn-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #8a8a9a;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(102, 126, 234, 0.2);
    color: #a8b5ff;
}

.btn-toggle svg { width: 16px; height: 16px; }

.vocab-content {
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 1.2rem;
    animation: fadeIn 0.3s ease-out;
}

.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
}

.vocab-item {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    padding: 0.8rem 1rem;
}

.vocab-italian {
    font-weight: 600;
    color: #e8e8f0;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.vocab-english {
    font-size: 0.8rem;
    color: #8a8a9a;
}

/* ---- Stats ---- */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.2rem 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #8a8a9a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ---- Footer ---- */
footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.back-link {
    color: #6a6a7a;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
    font-weight: 400;
}

.back-link:hover { color: #a8b5ff; }

/* ---- Modal ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, rgba(26, 26, 36, 0.98) 0%, rgba(18, 18, 28, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease-out;
}

.modal-content h3 {
    font-size: 1.5rem;
    color: #e8e8f0;
    margin-bottom: 0.8rem;
}

.modal-desc {
    font-size: 0.9rem;
    color: #8a8a9a;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.modal-link {
    margin-bottom: 1.5rem;
}

.modal-link a {
    color: #a8b5ff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.modal-link a:hover { color: #c8d5ff; }

.modal-content input {
    width: 100%;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.modal-content input:focus {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
}

.btn-modal {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #8a8a9a;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #b0b0c0;
}

.btn-modal--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-modal--primary:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    color: white;
}

/* ---- Loading spinner ---- */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(168, 181, 255, 0.3);
    border-top-color: #a8b5ff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Focus / selection ---- */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #fff;
}

/* ---- SRS Stats Bar ---- */
.srs-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.srs-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.srs-stat__num {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ff8080;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.srs-stat__num--new {
    color: #a8b5ff;
}

.srs-stat__num--mastered {
    color: #67e8a2;
}

.srs-stat__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6a6a7a;
    font-weight: 500;
}

.srs-reset {
    margin-left: auto;
    flex: none;
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
}

/* ---- SRS Reveal button ---- */
.srs-reveal {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.btn-show-answer {
    padding: 0.9rem 3rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #c0c0d0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.btn-show-answer:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
    color: #e0e0f0;
    transform: translateY(-1px);
}

/* ---- SRS Rating buttons ---- */
.srs-rating {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

.btn-srs {
    flex: 1;
    max-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.8rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-srs__label {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.btn-srs__interval {
    font-size: 0.72rem;
    opacity: 0.7;
    font-weight: 400;
}

.btn-again {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.2);
    color: #ff9090;
}
.btn-again:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.2);
}

.btn-hard {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}
.btn-hard:hover {
    background: rgba(255, 193, 7, 0.18);
    border-color: rgba(255, 193, 7, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.15);
}

.btn-good {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.2);
    color: #a8b5ff;
}
.btn-good:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.btn-easy {
    background: rgba(103, 232, 162, 0.1);
    border-color: rgba(103, 232, 162, 0.2);
    color: #67e8a2;
}
.btn-easy:hover {
    background: rgba(103, 232, 162, 0.18);
    border-color: rgba(103, 232, 162, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(103, 232, 162, 0.15);
}

/* ---- Session complete ---- */
.session-complete {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeInUp 0.5s ease-out;
}

.session-complete__icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.session-complete__title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.8rem;
}

.session-complete__sub {
    color: #b0b0c0;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.session-complete__next {
    color: #6a6a7a;
    font-size: 0.9rem;
}

/* ---- Utility ---- */
.hidden { display: none; }

/* ---- Session complete action button ---- */
.session-complete__action { margin-top: 1.5rem; }

/* ---- Mode cards: 3-up layout ---- */
.mode-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---- No API key banner ---- */
.no-key-banner {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #b0b0c0;
}
.no-key-banner a { color: #a8b5ff; }

/* ============================================================
   Conversation mode
   ============================================================ */

/* Scenario picker */
.scenario-group { margin-bottom: 2rem; }

.scenario-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #667eea;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.scenario-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.scenario-card:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.scenario-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 0.3rem;
}
.scenario-card__desc {
    font-size: 0.82rem;
    color: #8a8a9a;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}
.scenario-card__role {
    font-size: 0.78rem;
    color: #667eea;
}

/* Conversation header */
.conv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.conv-header__left { flex: 1; min-width: 0; }
.conv-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e0e0e0;
}
.conv-context {
    font-size: 0.82rem;
    color: #8a8a9a;
    margin-top: 0.2rem;
    line-height: 1.4;
}
.conv-header__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.turn-counter {
    font-size: 0.82rem;
    color: #8a8a9a;
    font-variant-numeric: tabular-nums;
}
.btn-end {
    background: rgba(255, 80, 80, 0.08);
    border: 1px solid rgba(255, 80, 80, 0.2);
    color: #ff8080;
    border-radius: 8px;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-end:hover { background: rgba(255, 80, 80, 0.15); }

/* Chat window */
.chat-window {
    flex: 1;
    min-height: 280px;
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0.5rem 0 1rem;
    scroll-behavior: smooth;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    animation: fadeInSlide 0.25s ease-out;
}
.chat-msg--ai { align-self: flex-start; }
.chat-msg--user { align-self: flex-end; }

.chat-bubble {
    padding: 0.7rem 1rem;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.chat-msg--ai .chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom-left-radius: 4px;
    color: #e0e0e0;
}
.chat-msg--user .chat-bubble {
    background: rgba(102, 126, 234, 0.18);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-bottom-right-radius: 4px;
    color: #d0d8ff;
}
.chat-bubble--thinking {
    opacity: 0.5;
    font-size: 1.2rem;
    letter-spacing: 0.15em;
}

.chat-feedback {
    font-size: 0.78rem;
    color: #8a8a9a;
    margin-top: 0.3rem;
    padding: 0 0.25rem;
    line-height: 1.4;
    align-self: flex-end;
}
.chat-corrected {
    font-size: 0.78rem;
    color: #a8b5ff;
    margin-top: 0.1rem;
    padding: 0 0.25rem;
    align-self: flex-end;
}

.chat-error {
    align-self: center;
    font-size: 0.82rem;
    color: #ff8080;
    background: rgba(255, 80, 80, 0.08);
    border: 1px solid rgba(255, 80, 80, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
}

/* Mic area */
.mic-area {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.timer-bar-wrap {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    transition: width 1s linear;
}
.mic-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.mic-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.08);
    color: #a8b5ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mic-btn:hover:not(:disabled) {
    border-color: rgba(102, 126, 234, 0.7);
    background: rgba(102, 126, 234, 0.15);
}
.mic-btn--active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    animation: pulse-ring 1.2s ease-out infinite;
}
.mic-btn--processing { opacity: 0.4; }
.mic-btn:disabled { cursor: not-allowed; }

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.mic-right { flex: 1; min-width: 0; }
.transcript-preview {
    font-size: 0.9rem;
    font-style: italic;
    color: #b0b0c0;
    min-height: 1.4rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.mic-status {
    font-size: 0.75rem;
    color: #6a6a7a;
    margin-top: 0.2rem;
}

/* Fallback textarea */
.fallback-note {
    font-size: 0.82rem;
    color: #8a8a9a;
    margin-bottom: 0.75rem;
}
.fallback-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e0e0e0;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0.75rem;
    font-family: inherit;
}
.fallback-textarea:focus {
    outline: 2px solid rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.4);
}

/* End / Summary */
.summary-content { width: 100%; max-width: 540px; margin-top: 1rem; }

.summary-list {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.summary-list li {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}
.summary-said {
    font-size: 0.9rem;
    color: #c0c0d0;
    font-style: italic;
    margin-bottom: 0.35rem;
}
.summary-feedback {
    font-size: 0.82rem;
    color: #8a8a9a;
    line-height: 1.4;
}
.summary-corrected {
    font-size: 0.82rem;
    color: #a8b5ff;
    margin-top: 0.25rem;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .app-nav { padding: 1rem 1rem 0; }

    .container { padding: 1.5rem 1rem; }

    header { margin-bottom: 2rem; }

    .mode-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .mode-card { min-height: 160px; flex-direction: row; text-align: left; padding: 1.5rem; }

    .mode-selector {
        flex-direction: column;
        width: 100%;
        gap: 0.3rem;
    }

    .mode-btn { width: 100%; padding: 0.7rem 1rem; }

    .flashcard { height: 320px; }

    .card-face { padding: 2rem 1.5rem; }

    .speaker-btn { top: 1rem; right: 1rem; width: 36px; height: 36px; }

    .navigation { flex-direction: column; gap: 0.6rem; }

    .nav-btn { width: 100%; justify-content: center; }

    .controls { flex-wrap: wrap; gap: 0.6rem; }

    .level-selector, .tense-selector { max-width: none; }

    .action-buttons { flex-direction: column; }

    .answer-helpers { flex-direction: column; align-items: stretch; }

    .btn-helper { justify-content: center; }

    .vocab-grid { grid-template-columns: 1fr; }

    .stats { grid-template-columns: 1fr; gap: 0.8rem; }

    .feedback-actions { flex-direction: column; }

    .challenge-actions { flex-direction: column; }
}
