* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #e5e7eb;
}

/* Auth screen */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 45%),
                linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
}

.auth-card h1 {
    margin: 0 0 10px;
    font-size: 28px;
    color: #ffffff;
    text-align: center;
}

.auth-subtitle {
    margin: 0 0 22px;
    text-align: center;
    color: #cbd5e1;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    outline: none;
    font-size: 16px;
}

.auth-form input::placeholder {
    color: #94a3b8;
}

.auth-form input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* App layout */
#app-content {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    flex: 0 0 auto;
}

.menu {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.menu a {
    color: #dbeafe;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    transition: 0.2s ease;
    white-space: nowrap;
    font-size: 15px;
    flex: 0 0 auto;
}

.menu a:hover {
    background: rgba(96, 165, 250, 0.15);
    color: #ffffff;
}

.user-greeting {
    color: #f8fafc;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.25);
    white-space: nowrap;
    flex: 0 0 auto;
}

.page {
    width: min(1200px, calc(100% - 32px));
    margin: 24px auto 60px;
}

.hero,
.card-section,
.panel {
    background: rgba(17, 24, 39, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.hero {
    padding: 36px;
    margin-bottom: 22px;
}

.hero h1,
.card-section h2 {
    margin-top: 0;
    color: #ffffff;
}

.hero h1 {
    font-size: clamp(30px, 4vw, 48px);
    margin-bottom: 14px;
}

.hero p {
    max-width: 760px;
    color: #cbd5e1;
    line-height: 1.7;
    font-size: 18px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.card-section {
    padding: 24px;
    margin-bottom: 22px;
}

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

.card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 16px;
    color: #e2e8f0;
    line-height: 1.5;
}

.clickable {
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.clickable:hover {
    transform: translateY(-2px);
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(96, 165, 250, 0.35);
}

.panel {
    padding: 18px;
    color: #e5e7eb;
}

/* Buttons */
.btn,
.nav-btn,
.option-btn {
    border: none;
    cursor: pointer;
    transition: 0.2s ease;
    font-size: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Quiz */
.quiz-box {
    display: grid;
    gap: 18px;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.question-counter {
    margin: 0;
    color: #93c5fd;
    font-weight: 700;
}

.question-text {
    margin: 0;
    font-size: 20px;
    line-height: 1.6;
    color: #f8fafc;
}

.question-image {
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: block;
}

.options {
    display: grid;
    gap: 12px;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.95);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.option-btn:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.95);
}

.option-btn:disabled {
    opacity: 0.95;
    cursor: default;
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
    color: #bbf7d0;
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

#result {
    min-height: 28px;
}

/* Navigation buttons */
.nav-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(96, 165, 250, 0.15);
    color: #dbeafe;
    border: 1px solid rgba(96, 165, 250, 0.25);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(96, 165, 250, 0.24);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Question grid */
.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.question-square {
    min-width: 42px;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.95);
    color: #e5e7eb;
    cursor: pointer;
    font-weight: 700;
}

.question-square:hover {
    background: rgba(51, 65, 85, 0.95);
}

.question-square.active {
    outline: 2px solid #60a5fa;
    outline-offset: 1px;
}

.question-square.correct-answer {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
    color: #bbf7d0;
}

.question-square.wrong-answer {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
    color: #fecaca;
}

/* Responsive */
@media (max-width: 900px) {
    .topbar {
        padding: 10px 14px;
        gap: 10px;
    }

    .logo {
        font-size: 18px;
    }

    .menu a,
    .user-greeting {
        font-size: 14px;
        padding: 7px 10px;
    }

    .hero {
        padding: 24px;
    }

    .card-section {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 20px, 1200px);
        margin-top: 16px;
    }

    .auth-card {
        padding: 22px;
    }

    .auth-buttons {
        grid-template-columns: 1fr;
    }

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

    .btn,
    .nav-btn,
    .option-btn {
        width: 100%;
    }

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

    .question-grid {
        grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    }
}
