/* ===== Main Front-end Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Be Vietnam Pro', 'Nunito', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: #1e3a5f;
    text-decoration: none;
}

.nav-logo {
    font-size: 28px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #1e3a5f;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.nav-menu a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: #764ba2;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.username {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.btn-logout {
    background: #f0f0f0;
    color: #555;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #ffebee;
    color: #c62828;
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    min-height: calc(100vh - 160px);
}

/* Flash messages */
.flash-message {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.flash-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.flash-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Hero section */
.hero {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.hero h1 {
    font-size: 42px;
    font-weight: 800;
    color: #1e3a5f;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero .gradient-text {
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: #666;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    border-radius: 50px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

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

.btn-secondary {
    background: #f5f5f5;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 17px;
}

/* Tenses grid */
.tense-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.tense-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    border-top: 4px solid #667eea;
    text-decoration: none;
    color: #333;
    display: block;
}

.tense-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.tense-card .tense-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.tense-card h3 {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 8px;
    font-weight: 700;
}

.tense-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.tense-card .tense-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

/* Section title */
.section-title {
    text-align: center;
    font-size: 28px;
    color: white;
    margin-top: 40px;
    margin-bottom: 10px;
}

.section-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    margin-bottom: 20px;
}

/* Practice page */
.practice-header {
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.practice-header h1 {
    font-size: 22px;
    color: #1e3a5f;
}

.practice-header .tense-chip {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.practice-setup {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.practice-setup h2 {
    font-size: 20px;
    color: #1e3a5f;
    margin-bottom: 20px;
}

.setup-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.setup-item {
    flex: 1;
    min-width: 200px;
}

.setup-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

/* Question card */
.question-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.question-number {
    font-size: 13px;
    color: #888;
    font-weight: 600;
    margin-bottom: 5px;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 20px;
    line-height: 1.5;
}

.question-text .blank {
    display: inline-block;
    background: #e8eaf6;
    color: #667eea;
    padding: 2px 15px;
    border-radius: 8px;
    min-width: 100px;
    text-align: center;
    font-weight: 700;
    margin: 0 4px;
}

/* Multiple choice options */
.options-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.option-item {
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    font-size: 14px;
}

.option-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-item.selected {
    border-color: #667eea;
    background: #e8eaf6;
}

.option-item.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.option-item.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

.option-item.selected .option-letter,
.option-item.correct .option-letter {
    background: #667eea;
    color: white;
}

.option-item.incorrect .option-letter {
    background: #f44336;
    color: white;
}

/* Answer input */
.answer-input-group {
    margin-bottom: 20px;
}

.answer-input-group input {
    padding: 14px 18px;
    font-size: 16px;
}

.answer-feedback {
    padding: 12px 18px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.answer-feedback.correct {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.answer-feedback.incorrect {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.answer-feedback .explanation {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.8;
}

/* Question actions */
.question-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Progress bar */
.progressbar-container {
    background: #e8e8e8;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progressbar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.5s;
}

.progressbar-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8e8e8;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.loading-ai {
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    animation: shine 2s linear infinite;
}

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

@keyframes shine {
    to { background-position: 200% center; }
}

/* Result page */
.result-card {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.result-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.result-card h1 {
    font-size: 36px;
    color: #1e3a5f;
    margin-bottom: 10px;
}

.result-card .result-score {
    font-size: 60px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
}

.result-card .result-detail {
    color: #666;
    font-size: 16px;
    margin-bottom: 5px;
}

.result-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.result-stat {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px 25px;
    min-width: 120px;
}

.result-stat .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e3a5f;
}

.result-stat .stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Review answers */
.review-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.review-section h2 {
    font-size: 20px;
    color: #1e3a5f;
    margin-bottom: 20px;
}

.review-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.review-body {
    flex: 1;
}

.review-body .review-question {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.review-body .review-answer {
    font-size: 13px;
    color: #666;
}

.review-answer .correct {
    color: #4caf50;
    font-weight: 600;
}

.review-answer .wrong {
    color: #f44336;
    font-weight: 600;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

/* ===== Home Page ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    min-height: calc(100vh - 120px);
}

.highlight {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.hero-content h1 {
    font-size: 42px;
    color: #1e3a5f;
    margin-bottom: 15px;
    line-height: 1.3;
}

.hero-content p {
    font-size: 17px;
    color: #666;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.hero-content p strong {
    color: #667eea;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, #f5f7fa, #e8ecf1);
    border-radius: 12px;
    padding: 20px 30px;
    min-width: 140px;
    text-align: center;
    border: 1px solid #e0e5eb;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #1e3a5f;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.tenses-section {
    margin-bottom: 30px;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 28px;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.section-header p {
    color: rgba(255,255,255,0.9);
    font-size: 15px;
}

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

.tense-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
    border-left: 5px solid var(--tense-color, #667eea);
    position: relative;
}

.tense-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.tense-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.tense-info h3 {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 8px;
}

.tense-info p {
    font-size: 14px;
    color: #888;
    line-height: 1.5;
}

.tense-progress {
    margin-top: 15px;
}

.progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.5s;
}

.progress-text {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

.tense-arrow {
    position: absolute;
    bottom: 25px;
    right: 20px;
    color: #ccc;
    font-size: 18px;
    transition: color 0.3s;
}

.tense-card:hover .tense-arrow {
    color: #667eea;
}

.features-section {
    margin-bottom: 30px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.features-section .section-header h2 {
    color: #1e3a5f;
    text-shadow: none;
}

.features-section .section-header p {
    color: #888;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-card {
    text-align: center;
    padding: 25px 15px;
    border-radius: 12px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.feature-icon {
    display: inline-block;
    font-size: 48px;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
}

/* ===== Home - Intro Sections ===== */
.home-hero {
    position: relative;
    padding-top: 80px;
}

.home-hero .hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.home-hero .hero-content h1 {
    font-size: 44px;
}

/* How it works section */
.how-section {
    margin-bottom: 40px;
}

.how-section .section-header {
    margin-bottom: 35px;
}

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

.step-card {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 35px 25px 30px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
    border-top: 4px solid #667eea;
}

.step-card:nth-child(2) {
    border-top-color: #764ba2;
}

.step-card:nth-child(3) {
    border-top-color: #ff6b6b;
}

.step-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.step-number {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(102,126,234,0.4);
}

.step-card:nth-child(2) .step-number {
    background: linear-gradient(135deg, #764ba2, #ee6b6b);
}

.step-card:nth-child(3) .step-number {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
}

.step-icon {
    display: inline-block;
    font-size: 48px;
    margin-bottom: 15px;
}

.step-card h3 {
    font-size: 17px;
    color: #1e3a5f;
    margin-bottom: 10px;
    font-weight: 700;
}

.step-card p {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
}

/* ===== Practice Page ===== */
.practice-setup {
    margin-bottom: 30px;
}

.setup-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    max-width: 600px;
    margin: 0 auto;
}

.setup-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #f0f0f0;
    padding: 6px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    color: #1e3a5f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    transition: border-color 0.3s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.btn-lg {
    padding: 14px 30px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* Quiz Section */
.practice-quiz {
    margin-bottom: 30px;
}

.quiz-header {
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.quiz-header h2 {
    font-size: 22px;
    color: #1e3a5f;
}

.quiz-meta {
    display: flex;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.badge-easy {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-medium {
    background: #fff3e0;
    color: #f57c00;
}

.badge-hard {
    background: #fbe9e7;
    color: #c62828;
}

.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-card {
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.question-card:hover {
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
}

.question-number {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 15px;
}

.question-text {
    font-size: 17px;
    color: #1e3a5f;
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 500;
}

.options-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-item:hover {
    border-color: #667eea;
    background: #f8f7ff;
}

.option-item input[type="radio"] {
    display: none;
}

.option-item:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #f0edff;
}

.option-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #555;
    flex-shrink: 0;
    transition: all 0.3s;
}

.option-item:has(input[type="radio"]:checked) .option-letter {
    background: #667eea;
    color: white;
}

.option-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}

.alert-error {
    background: #fbe9e7;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* ===== Result Page ===== */
.result-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.result-card {
    background: white;
    border-radius: 24px;
    padding: 60px 50px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.result-emoji {
    font-size: 80px;
    margin-bottom: 20px;
}

.result-score {
    font-size: 56px;
    font-weight: 800;
    margin: 15px 0;
}

.score-excellent {
    color: #4CAF50;
}

.score-good {
    color: #2196F3;
}

.score-average {
    color: #FF9800;
}

.score-poor {
    color: #f44336;
}

.score-text-lg {
    font-size: 20px;
    color: #666;
    margin-bottom: 25px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
}

.result-stat {
    text-align: center;
}

.result-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1e3a5f;
}

.result-stat-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

/* Review Cards */
.review-card {
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 800px;
    width: 100%;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.review-header h2 {
    font-size: 22px;
    color: #1e3a5f;
}

.review-question {
    margin-bottom: 15px;
}

.review-q-text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin-bottom: 10px;
}

.review-options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-option {
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #e8e8e8;
    font-size: 14px;
    color: #555;
}

.review-option.correct {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 600;
}

.review-option.wrong {
    border-color: #f44336;
    background: #fbe9e7;
    color: #b71c1c;
}

.review-option.your-answer {
    border-color: #FF9800;
    background: #fff3e0;
    color: #e65100;
    font-weight: 600;
}

.review-explanation {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 15px 18px;
    border-radius: 0 8px 8px 0;
    margin-top: 15px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.result-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
}

/* Site footer */
.site-footer {
    background: white;
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    border-radius: 20px 20px 0 0;
}

.site-footer p {
    color: #888;
    font-size: 14px;
    line-height: 1.8;
}

/* ===== Result Details ===== */
.result-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 0;
}

.result-card {
    background: white;
    border-radius: 24px;
    padding: 50px 40px;
    text-align: center;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.result-icon {
    font-size: 70px;
    line-height: 1;
    margin-bottom: 15px;
}

.result-card h1 {
    font-size: 28px;
    color: #1e3a5f;
    margin-bottom: 8px;
}

.result-tense {
    color: #888;
    font-size: 16px;
    margin-bottom: 25px;
}

.score-ring {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-inner {
    background: white;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.score-number {
    font-size: 44px;
    font-weight: 800;
    color: #1e3a5f;
    line-height: 1.1;
}

.score-inner .score-label {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 15px;
    flex-wrap: wrap;
}

.stat-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px 30px;
    min-width: 140px;
}

.stat-item .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1e3a5f;
}

.stat-item .stat-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.result-message {
    font-size: 17px;
    color: #555;
    margin-bottom: 25px;
    font-weight: 500;
}

.result-details {
    text-align: left;
    border-top: 2px solid #f0f0f0;
    padding-top: 25px;
    margin-top: 25px;
}

.result-details h3 {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 15px;
}

.detail-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 15px;
    border-left: 4px solid #ccc;
}

.detail-item.correct {
    border-left-color: #4CAF50;
}

.detail-item.wrong {
    border-left-color: #f44336;
}

.detail-question {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.detail-icon {
    font-size: 18px;
}

.detail-answers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-answers p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.detail-answers .correct-answer {
    color: #2e7d32;
}

.detail-answers .user-answer {
    color: #555;
}

.detail-answers .explanation {
    background: #e8eaf6;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #444;
    line-height: 1.6;
    margin-top: 8px;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.result-actions .btn {
    padding: 12px 22px;
    font-size: 14px;
}

/* ===== Auth Pages (Login/Register) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: inline-block;
    font-size: 56px;
    margin-bottom: 15px;
}

.auth-header h1 {
    font-size: 26px;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.auth-header p {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-form .form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 14px;
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 13px 15px;
    padding-left: 45px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #333;
    background: white;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: 5px;
    padding: 14px;
    font-size: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.auth-footer p {
    margin-bottom: 5px;
}

.auth-footer a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.auth-hint {
    margin-top: 12px;
    font-size: 14px;
    color: #999;
}

.auth-hint code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 992px) {
    .nav-toggle {
        display: flex !important;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        color: #1e3a5f;
        transition: background 0.2s;
        z-index: 1001;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        background: none;
        border: none;
        cursor: pointer;
    }
    
    .nav-toggle:active {
        background: rgba(0,0,0,0.05);
    }
    
    .nav-container {
        padding: 10px 15px;
        position: relative;
        z-index: 1000;
    }
    
    .nav-brand {
        flex: 1;
        font-size: 18px;
    }
    
    /* ===== FULL-SCREEN MOBILE MENU ===== */
    .nav-menu {
        display: block !important;
        visibility: hidden;
        opacity: 0;
        transform: translateX(100%);
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(160deg, #667eea 0%, #764ba2 50%, #5a2d82 100%);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0;
        padding: 90px 25px 40px;
        list-style: none;
        margin: 0;
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: opacity 0.3s ease, transform 0.35s ease;
    }
    
    .nav-menu::before {
        content: '📚';
        position: absolute;
        top: 30px;
        left: 25px;
        font-size: 24px;
        color: rgba(255,255,255,0.7);
        font-family: sans-serif;
    }
    
    .nav-menu.active {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
    }
    
    .nav-menu li {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .nav-menu li:not(.nav-user) a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 16px 18px;
        font-size: 17px;
        border-radius: 14px;
        color: rgba(255,255,255,0.92);
        font-weight: 600;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        transition: background 0.2s, transform 0.2s;
    }
    
    .nav-menu li:not(.nav-user) a i {
        width: 26px;
        text-align: center;
        font-size: 18px;
        opacity: 0.85;
    }
    
    .nav-menu li:not(.nav-user) a:hover,
    .nav-menu li:not(.nav-user) a:active {
        background: rgba(255,255,255,0.12);
        color: white;
        transform: translateX(4px);
    }
    
    .nav-user {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        width: 100%;
        margin-top: 25px;
        padding: 20px;
        background: rgba(255,255,255,0.1);
        border-radius: 16px;
        backdrop-filter: blur(5px);
        border: 1px solid rgba(255,255,255,0.15);
    }
    
    .nav-user .user-avatar {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .nav-user .username {
        color: white;
        font-size: 16px;
    }
    
    .btn-logout {
        width: 100%;
        justify-content: center;
        background: rgba(255,82,82,0.9);
        color: white;
        padding: 14px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 700;
    }
    
    .btn-logout:hover {
        background: #f44336;
    }
    
    .hero {
        padding: 35px 20px;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .hero p {
        font-size: 15px;
    }
    
    .options-list {
        grid-template-columns: 1fr;
    }
    
    .result-card {
        padding: 40px 20px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .btn-lg {
        padding: 12px 22px;
        font-size: 14px;
    }
    
    .hero-actions .btn-lg {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Small phones */
@media (max-width: 480px) {
    .hero {
        padding: 25px 15px;
    }
    
    .hero h1 {
        font-size: 22px;
    }
    
    .hero p {
        font-size: 14px;
    }
    
    .nav-container {
        padding: 8px 12px;
    }
    
    .nav-logo {
        font-size: 24px;
    }
    
    .nav-brand {
        font-size: 16px;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hero-actions .btn-lg {
        width: 100%;
        justify-content: center;
    }
}
