:root {
    --primary: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --background: #f8fafc;
    --text: #0f172a;
    --muted: #475569;
    --surface: #ffffff;
    --surface-soft: #eff6ff;
    --border: #dbe5f0;
    --warning: #b45309;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    --container: 900px;
    --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 32%),
        radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, var(--background) 34%, #eaf1fb 100%);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1,
h2,
h3 {
    color: var(--text);
    line-height: 1.1;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
    font-size: 1.45rem;
}

p {
    color: var(--muted);
}

ul {
    margin: 0.65rem 0 0;
    padding-left: 1.25rem;
}

.container {
    width: min(calc(100% - 2rem), var(--container));
    margin: 0 auto;
}

.stack-lg > * + * {
    margin-top: 1.5rem;
}

.stack-sm > * + * {
    margin-top: 0.75rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: rgba(248, 250, 252, 0.78);
    border-bottom: 1px solid rgba(219, 229, 240, 0.85);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.top-nav a {
    padding: 0.65rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.top-nav a:hover,
.top-nav a.is-active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

main.container {
    padding: 2rem 0 4rem;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 229, 240, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero {
    padding: 2rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.92));
}

.hero::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -90px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.16), transparent 70%);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.65rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.button-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

.button.secondary {
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.button.success {
    background: var(--success);
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.22);
}

.button.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 700;
}

.pill.primary {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.pill.success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.pill.danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.pill.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.form-grid {
    display: grid;
    gap: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

input[type="text"],
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.95rem 1rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

input[type="text"]:focus,
textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.4);
}

textarea {
    min-height: 320px;
    resize: vertical;
}

.help-text,
.footer-note {
    font-size: 0.94rem;
    color: var(--muted);
}

.alert {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.alert p {
    margin-top: 0.35rem;
}

.alert.success {
    background: rgba(22, 163, 74, 0.08);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.16);
}

.alert.danger {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.16);
}

.alert.warning {
    background: var(--warning-soft);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.2);
}

.alert.info {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.16);
}

.summary-list,
.exam-list,
.review-list,
.options-list,
.progress-shell,
.question-card,
.exam-card {
    display: grid;
    gap: 1rem;
}

.summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(219, 229, 240, 0.85);
}

.context-block {
    margin-top: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(191, 219, 254, 0.65);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.88), rgba(255, 255, 255, 0.98));
    white-space: pre-wrap;
    color: var(--text);
}

.table-like {
    font-family: "SFMono-Regular", Consolas, monospace;
}

.option-review {
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(219, 229, 240, 0.85);
    background: rgba(248, 250, 252, 0.76);
}

.option-review.is-correct {
    border-color: rgba(22, 163, 74, 0.3);
    background: rgba(22, 163, 74, 0.08);
}

.answer-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    border: 1px solid rgba(219, 229, 240, 0.95);
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.answer-card:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.06);
}

.answer-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.answer-card.is-selected {
    border-color: rgba(37, 99, 235, 0.56);
    background: rgba(239, 246, 255, 0.88);
}

.answer-card.is-correct {
    border-color: rgba(22, 163, 74, 0.46);
    background: rgba(22, 163, 74, 0.08);
}

.answer-card.is-wrong {
    border-color: rgba(220, 38, 38, 0.46);
    background: rgba(220, 38, 38, 0.08);
}

.answer-letter {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.06);
    font-weight: 800;
}

.answer-card.is-selected .answer-letter {
    background: rgba(37, 99, 235, 0.16);
    color: var(--primary);
}

.answer-card.is-correct .answer-letter {
    background: rgba(22, 163, 74, 0.18);
    color: var(--success);
}

.answer-card.is-wrong .answer-letter {
    background: rgba(220, 38, 38, 0.18);
    color: var(--danger);
}

.answer-text {
    display: grid;
    gap: 0.18rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.metric-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.metric-value {
    margin-top: 0.35rem;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.progress-bar {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.08);
}

.progress-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
}

.empty-state {
    padding: 2rem 1.5rem;
    text-align: center;
}

details {
    border-top: 1px solid rgba(219, 229, 240, 0.85);
    padding-top: 1rem;
}

details summary {
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 800px) {
    .grid.metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .site-header .container {
        align-items: flex-start;
        flex-direction: column;
    }

    main.container {
        padding-top: 1.25rem;
    }

    .card,
    .hero {
        padding: 1.25rem;
    }

    .summary-item,
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .button-row {
        width: 100%;
    }

    .button,
    button {
        width: 100%;
    }
}