:root {
    --bg: #f5f1ea;
    --card: #fffaf2;
    --text: #201a14;
    --muted: #75695d;
    --border: #e1d5c8;
    --primary: #33251b;
    --primary-hover: #1e1510;
    --green: #13795b;
    --red: #b42318;
    --shadow: 0 18px 50px rgba(41, 29, 18, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, #fff7e7 0, var(--bg) 42%, #eee5da 100%);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.quiz-shell {
    width: min(1050px, calc(100% - 32px));
    margin: 40px auto;
}

.quiz-header {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 300px);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin: 0 0 8px;
}

h1 {
    font-size: clamp(34px, 5vw, 56px);
    margin: 0;
    letter-spacing: -0.04em;
}

.intro {
    max-width: 720px;
    color: var(--muted);
    line-height: 1.7;
    font-size: 17px;
}

.card,
.stats-card {
    background: rgba(255, 250, 242, 0.92);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.card {
    padding: clamp(20px, 3vw, 34px);
    margin-bottom: 22px;
}

.stats-card {
    padding: 22px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    align-content: center;
}

.stats-card strong {
    font-size: 24px;
}

.stats-card span {
    color: var(--muted);
    align-self: center;
}

.question-card {
    min-height: 420px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 20px;
}

#questionText {
    font-size: clamp(25px, 4vw, 40px);
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin: 0 0 28px;
}

label,
.label {
    display: block;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    background: #fffdf8;
    color: var(--text);
    font: inherit;
    line-height: 1.5;
    outline: none;
}

textarea:focus {
    border-color: #9f8a75;
    box-shadow: 0 0 0 4px rgba(159, 138, 117, 0.16);
}

.actions,
.self-grade {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 13px 18px;
    font-weight: 850;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: .6;
    cursor: wait;
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.secondary-btn {
    background: #ede3d8;
    color: var(--text);
}

.correct-btn {
    background: var(--green);
    color: white;
}

.wrong-btn {
    background: var(--red);
    color: white;
}

.hidden {
    display: none !important;
}

.correction {
    display: grid;
    gap: 24px;
}

.answer-preview,
.correct-answer {
    background: #fffdf8;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    line-height: 1.6;
    margin: 0;
}

.correct-answer {
    font-size: 22px;
    font-weight: 850;
}

.hardest-list {
    display: grid;
    gap: 12px;
}

.hardest-item {
    display: grid;
    gap: 5px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.hardest-item:last-child {
    border-bottom: 0;
}

.hardest-item span {
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 760px) {
    .quiz-header {
        grid-template-columns: 1fr;
    }

    .quiz-shell {
        margin-top: 22px;
    }
}
