:root {
    color-scheme: light;
    --ink: #1e2428;
    --muted: #63707a;
    --line: #d8dee3;
    --panel: #ffffff;
    --canvas: #f4f7f6;
    --accent: #196a5a;
    --accent-dark: #114a3f;
    --warn: #9a4b16;
    --bad: #a83a3a;
    --good: #17724b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--canvas);
    color: var(--ink);
}

a {
    color: var(--accent);
}

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.narrow {
    width: min(760px, calc(100% - 32px));
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

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

h1 {
    font-size: 34px;
    line-height: 1.1;
    margin-bottom: 8px;
}

h2 {
    font-size: 22px;
}

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

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(29, 43, 52, 0.06);
}

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

button,
.link-button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    padding: 11px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

button:hover,
.link-button:hover {
    background: var(--accent-dark);
}

button:disabled {
    background: #9ba8a5;
    cursor: not-allowed;
}

.notice,
.error {
    border-left: 4px solid var(--warn);
    padding: 12px 14px;
    background: #fff7ed;
    color: #5d3212;
    margin: 0;
}

.error {
    border-color: var(--bad);
    background: #fff1f1;
    color: #6d2323;
}

.loading-card {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #f7fbfa 0%, #ffffff 100%);
    padding: 16px;
}

.loading-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.spinner {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 3px solid #cfe3dd;
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
    flex: 0 0 auto;
}

.loading-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.loading-step,
.loading-meta {
    color: var(--muted);
    margin-bottom: 0;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #e6efec;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0%, #2f8d79 100%);
    transition: width 0.8s ease;
}

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

.hidden {
    display: none;
}

#quizForm {
    margin-top: 20px;
}

.question-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
}

.question-card h3 {
    font-size: 17px;
    line-height: 1.35;
}

.option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
}

.submit-row {
    position: sticky;
    bottom: 0;
    background: rgba(244, 247, 246, 0.95);
    border-top: 1px solid var(--line);
    padding: 16px 0;
    display: flex;
    justify-content: flex-end;
}

.score {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent-dark);
    margin-bottom: 8px;
}

.review-item {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 14px;
}

.evidence-quote {
    padding-left: 12px;
    border-left: 3px solid #cfe3dd;
    color: #31423f;
    font-style: italic;
}

.correct {
    color: var(--good);
    font-weight: 700;
}

.incorrect {
    color: var(--bad);
    font-weight: 700;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 16px;
}

input[type="password"],
input[type="text"],
select,
input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px;
    font: inherit;
    background: white;
}

.auth-card {
    width: min(420px, 100%);
}

.upload-form {
    display: grid;
    gap: 8px;
}

.settings-form {
    margin-top: 18px;
}

.home-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.track-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.track-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 4px 14px rgba(29, 43, 52, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.track-card h2 {
    margin: 0;
}

.track-card p {
    margin: 0;
    color: var(--muted);
    flex: 1;
}

.track-card__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: #e8f3f0;
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    width: fit-content;
}

.track-card--cases:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(25, 106, 90, 0.12);
}

.track-card__cta {
    font-weight: 700;
    color: var(--accent);
    font-size: 15px;
    margin-top: 4px;
}

.track-card__cta-btn {
    margin-top: 4px;
    align-self: flex-start;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.link-button.secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-weight: 600;
}

.link-button.secondary:hover {
    background: #eef5f3;
}

.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 4px;
}

.case-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: var(--ink);
    display: block;
    box-shadow: 0 4px 14px rgba(29, 43, 52, 0.05);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.case-card:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(25, 106, 90, 0.12);
}

.case-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
    margin-top: 6px;
}

.case-topic {
    display: inline-block;
    background: #e8f3f0;
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
}

.case-scenario {
    line-height: 1.7;
}

.scenario-body {
    font-size: 16px;
    line-height: 1.75;
    margin-bottom: 12px;
}

.case-sections {
    font-size: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.model-answer {
    font-size: 15px;
    line-height: 1.75;
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    margin-bottom: 8px;
}

.key-points-box {
    background: #f4f9f7;
    border: 1px solid #cfe3dd;
    border-radius: 8px;
    padding: 18px;
}

.kp-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: grid;
    gap: 10px;
}

.kp-label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 0;
}

.kp-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--accent);
}

.kp-label.checked span {
    color: var(--good);
    text-decoration: line-through;
    text-decoration-color: var(--good);
}

.score-chip {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
}

.reveal-btn {
    background: var(--warn);
}

.reveal-btn:hover {
    background: #7a3a10;
}

@media (max-width: 700px) {
    .topbar,
    .quiz-intro,
    .home-header {
        display: grid;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

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

    h1 {
        font-size: 28px;
    }

    .panel {
        padding: 18px;
    }

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