:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #e5e5e5;
    --primary: #2d2d2d;
    --primary-hover: #000000;
    --surface: #fafafa;
    --surface-hover: #f0f0f0;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #ffffff;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100%;
    margin: 0 auto;
    padding: 60px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Header */
header {
    margin-bottom: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--surface);
    color: var(--text);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    text-align: center;
}

p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Mode Selection Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.mode-card {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.mode-card:hover {
    border-color: var(--text);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.mode-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.mode-card p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.category-btn {
    background: var(--surface);
    border: 1px solid transparent;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.category-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

/* Quiz Interface */
.quiz-view {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.progress-container {
    margin-bottom: 40px;
}

.progress-bar {
    height: 4px;
    background: var(--surface-hover);
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--text);
    width: 0;
    transition: width 0.3s ease;
}

.quiz-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.question-image {
    margin-bottom: 32px;
    border-radius: var(--radius);
    border: none;
    max-height: 400px;
    width: auto;
    max-width: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;
    cursor: zoom-in;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.question-image:hover {
    transform: scale(1.01);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 20px 24px;
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text);
    position: relative;
}

.option-btn:hover:not(:disabled) {
    background: var(--surface);
    border-color: #ccc;
    transform: translateX(4px);
}

.option-btn.selected {
    border-color: var(--text);
    background: var(--surface);
    font-weight: 500;
}

.option-btn.correct {
    background: var(--success-bg);
    border-color: var(--success);
    color: #065f46;
}

.option-btn.incorrect {
    background: var(--error-bg);
    border-color: var(--error);
    color: #991b1b;
}

.option-btn:disabled {
    cursor: default;
    transform: none;
}

.feedback-section {
    margin-top: 32px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    border-left: 4px solid var(--text);
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feedback-section.hidden {
    display: none;
}

.feedback-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: block;
    opacity: 0.7;
}

.feedback-text {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0;
    line-height: 1.6;
}

.controls {
    margin-top: 40px;
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 16px 40px;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    letter-spacing: -0.01em;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results */
.results-view {
    text-align: center;
    padding-top: 60px;
    max-width: 600px;
    margin: 0 auto;
}

.score-display {
    font-size: 5rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.05em;
    line-height: 1;
}

.score-display.pass {
    color: var(--success);
}

.score-display.fail {
    color: var(--error);
}

.result-msg {
    font-size: 1.5rem;
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.action-row {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 32px;
    border-radius: 100px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--text);
    background: var(--surface);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease-out;
    backdrop-filter: blur(5px);
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Utilities */
.hidden {
    display: none !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}