:root {
    --paper: #f7f8f4;
    --white: #fff;
    --ink: #142522;
    --muted: #536662;
    --line: #d5dfda;
    --accent: #00624e;
    --accent-dark: #004939;
    --mint: #e3f4ec;
    --amber: #fff0cd;
    --danger: #912d28;
    --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    color-scheme: light;
    font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; font-size: 16px; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-dark); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #007d62; outline-offset: 3px; }
h1, h2, h3 { line-height: 1.13; margin: 0; letter-spacing: -.035em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4.5vw, 3.35rem); font-weight: 760; }
h2 { font-size: clamp(1.45rem, 3vw, 2.12rem); font-weight: 730; }
h3 { font-size: clamp(1.12rem, 2.4vw, 1.48rem); font-weight: 700; }
p { margin: .65rem 0 0; overflow-wrap: anywhere; }
dl { margin: 0; }
dt { font-size: .85rem; color: var(--muted); }
dd { margin: .15rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
pre, code, .mono { font-family: var(--mono); }
fieldset { min-inline-size: 0; padding: 0; margin: 0; border: 0; }

.frame { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.page { padding-block: clamp(26px, 4vw, 52px) 64px; }
.narrow { max-width: 665px; }
.masthead { background: var(--white); border-bottom: 1px solid #e1e8e2; }
.masthead-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; gap: .68rem; align-items: center; color: var(--ink); font-size: 1.17rem; font-weight: 750; letter-spacing: -.04em; text-decoration: none; line-height: 1.2; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 34px; flex: none; border-radius: 9px; background: #004937; color: #f8faf7; font: 700 1.1rem var(--mono); letter-spacing: -.11em; padding-right: .08em; }
.teacher-link, .teacher-nav a, .text-link, .back { font-weight: 650; text-decoration: none; }
.teacher-link:hover, .teacher-nav a:hover, .text-link:hover, .back:hover { text-decoration: underline; }
.teacher-link { display: inline-block; font-size: .92rem; }
.teacher-link span { display: inline-block; margin-left: .12rem; }
.teacher-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.3rem; font-size: .91rem; }

.hero {
    background: #0b2826;
    color: #f6faf7;
    padding: clamp(28px, 4.2vw, 60px);
    border-radius: 15px;
    min-height: 268px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 54px);
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 0 36%;
    background-image: linear-gradient(#215752 1px, transparent 1px), linear-gradient(90deg, #215752 1px, transparent 1px);
    background-size: 27px 27px;
    mask-image: linear-gradient(90deg, transparent 0%, #000 78%);
    opacity: .66;
}
.hero h1 { font-size: clamp(2.55rem, 5.1vw, 4.35rem); letter-spacing: -.065em; line-height: 1; }
.hero p { margin-top: .9rem; font-size: clamp(1.04rem, 2vw, 1.42rem); color: #cfe1dc; }
.terminal { min-width: 0; width: 100%; justify-self: end; background: #102f2c; border: 1px solid #4c6c66; border-radius: 10px; }
.terminal-title { font: .76rem var(--mono); color: #a4c0b7; border-bottom: 1px solid #34534d; padding: .55rem .85rem; }
.terminal pre { color: #f6f9f7; margin: 0; padding: .85rem; font-size: clamp(.67rem, 1.12vw, .93rem); overflow-x: auto; line-height: 1.65; }
.terminal .syntax { color: #69e8ce; }
.terminal .comment { color: #9cbeb1; }
.catalog { margin-top: clamp(30px, 4.4vw, 54px); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem 1.1rem; margin: 0 0 1.2rem; padding-bottom: .78rem; border-bottom: 1px solid var(--line); }
.section-heading > span { color: var(--muted); font-size: .91rem; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 13px; }
.exam-card { min-width: 0; display: flex; flex-direction: column; padding: clamp(18px, 2.5vw, 27px); }
.card-heading, .heading-with-badge, .actions, .card-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; }
.card-heading { align-items: start; justify-content: space-between; flex-wrap: nowrap; }
.card-heading > :first-child { min-width: 0; }
.card-heading .badge { flex: none; }
.description { color: var(--muted); white-space: pre-line; }
.card .description { margin: .7rem 0 0; }
.exam-card .description { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.badge { display: inline-flex; align-items: center; min-height: 25px; white-space: nowrap; padding: .18rem .66rem; border-radius: 999px; font-size: .78rem; line-height: 1.3; font-weight: 680; background: #edf0ec; color: #40534d; }
.badge.open { background: #d5f2e4; color: #00533f; }
.badge.soon { background: var(--amber); color: #694800; }
.card-facts, .inline-facts { display: flex; flex-wrap: wrap; gap: .55rem 1.25rem; }
.card-facts { padding: .8rem 0; margin: 1rem 0 0; border-block: 1px solid var(--line); color: #304642; font-size: .94rem; }
.fact, .opening { display: inline-flex; align-items: center; gap: .55rem; }
.card-bottom { margin-top: auto; padding-top: .95rem; min-height: 58px; }
.opening { margin: 0; color: var(--muted); font-size: .92rem; }
.symbol { display: inline-block; position: relative; color: currentColor; flex: none; width: 14px; height: 14px; }
.symbol.clock { border: 1.5px solid currentColor; border-radius: 50%; }
.symbol.clock::after { content: ""; position: absolute; width: 4px; height: 5px; left: 5px; top: 2px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; transform-origin: left bottom; transform: rotate(16deg); }
.symbol.list { background: linear-gradient(currentColor, currentColor) right 2px / 9px 1.5px no-repeat, linear-gradient(currentColor, currentColor) right 6px / 9px 1.5px no-repeat, linear-gradient(currentColor, currentColor) right 10px / 9px 1.5px no-repeat; }
.symbol.list::before { content: ""; position: absolute; top: 2px; width: 2px; height: 2px; border-radius: 50%; background: currentColor; box-shadow: 0 4px currentColor, 0 8px currentColor; }
.symbol.calendar { height: 12px; border: 1.5px solid currentColor; border-radius: 3px; }
.symbol.calendar::after { position: absolute; content: ""; inset: 3px 0 auto; height: 1px; background: currentColor; }
.button {
    display: inline-flex; align-items: center; justify-content: center; text-align: center; gap: .55rem;
    padding: .56rem .95rem; min-height: 43px; border: 1px solid var(--accent);
    border-radius: 8px; background: var(--accent); color: var(--white); font-weight: 680;
    font-size: .94rem; line-height: 1.35; text-decoration: none;
    transition: background 130ms, border-color 130ms, color 130ms;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--white); }
.button.secondary { color: var(--accent); background: var(--white); border-color: #afc9bd; }
.button.secondary:hover { background: #eff7f1; }
.button:disabled { background: #deebe4; color: #536b60; border-color: #deebe4; }
.text-button { border: 0; background: none; padding: 0; font-weight: 650; color: var(--accent); }
.text-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.empty { padding: clamp(18px, 3vw, 30px); display: flex; align-items: center; gap: 16px; }
.empty p { color: var(--muted); margin: .35rem 0 0; }
.empty-icon { display: grid; place-items: center; background: var(--mint); color: var(--accent); border-radius: 10px; width: 46px; height: 46px; flex: none; }

.back { display: inline-block; margin-bottom: 1.15rem; font-size: .92rem; }
.intro-card { padding: clamp(20px, 5vw, 38px); }
.intro-card h1 { font-size: clamp(1.85rem, 4vw, 2.7rem); }
.schedule, .result-summary, .review-answers, .review-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.schedule { margin: 1.05rem 0; }
.receipt-facts { margin-block: 1.35rem; }
.rules { background: #f1f6f2; border-radius: 8px; padding: 1rem; margin: 1.35rem 0; }
.rules h2 { font-size: 1.04rem; letter-spacing: 0; }
.rules ul { padding-left: 1.2rem; margin: .58rem 0 0; color: #3e5550; font-size: .9rem; }
.rules li + li { margin-top: .24rem; }
.form { display: grid; gap: .56rem; }
.field-stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .38rem; min-width: 0; align-content: start; }
.form label, .form legend { font-size: .92rem; font-weight: 680; }
.form label .muted { font-weight: 450; }
.form input:not([type="radio"], [type="hidden"]), .form textarea {
    display: block; width: 100%; min-height: 44px; min-width: 0;
    background: var(--white); border: 1px solid #aabeb4; border-radius: 8px;
    padding: .59rem .68rem; color: var(--ink); line-height: 1.4;
}
.form input:disabled, .form textarea:disabled { color: #536662; background: #f4f6f2; opacity: 1; }
.form textarea { resize: vertical; }
.form .short-input { max-width: 120px; }
.form-actions { display: flex; align-items: baseline; flex-wrap: wrap; gap: .7rem 1.2rem; margin-top: .45rem; }
.fields-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.help { color: var(--muted); font-size: .87rem; margin: 0; }
.options-form { gap: .65rem; }
.options-form legend { padding: 0; margin: 0 0 .35rem; }
.option-editor { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: .75rem; }
input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.option-editor input[type="radio"] { margin: 0 0 .81rem .1rem; }
.notice { padding: .75rem .88rem; margin: 0 0 1.1rem; border-radius: 8px; color: #365147; background: #e9f2eb; }
.notice.error { background: #fbe9e4; color: var(--danger); }
.notice.success { background: var(--mint); color: #00533f; }
.intro-card .notice { margin: 1rem 0 0; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.45rem; }
.section-label { margin: 0 0 .45rem; font-size: .9rem; font-weight: 600; }
.muted { color: var(--muted); }
.compact { margin: .3rem 0 0; font-size: .9rem; }
.space-top { margin-top: 1.25rem; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.3rem; }
.tabs a { padding: .58rem 0; border-bottom: 2px solid transparent; font-size: .93rem; text-decoration: none; font-weight: 650; color: var(--muted); }
.tabs a:hover, .tabs a[aria-current] { color: var(--accent); border-color: var(--accent); }
.overview { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem 1.2rem; margin: 0 0 1.45rem; }
.overview p { margin: 0; font-size: .87rem; }
.topic-list { display: grid; gap: .95rem; }
.topic-card { padding: 1.15rem 1.4rem .28rem; }
.topic-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .9rem; padding-bottom: .7rem; }
.topic-heading .actions { font-size: .87rem; }
.question-list { padding: 0; margin: 0; list-style: none; }
.question-list li { border-top: 1px solid var(--line); }
.question-list a { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .66rem 0; text-decoration: none; overflow-wrap: anywhere; }
.question-list a:hover { text-decoration: underline; }
.no-questions { padding: .65rem 0 .8rem; font-size: .9rem; }
.table-wrap { margin-top: 1rem; overflow: auto; }
.results-tools { align-items: baseline; font-size: .91rem; }
.attempt-actions { display: grid; justify-items: start; gap: .25rem; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
td, th { padding: .78rem .95rem; border-bottom: 1px solid var(--line); }
thead { background: #eef4ef; }
tbody tr:last-child :is(td, th) { border-bottom: 0; }
td { white-space: nowrap; }
td:last-child { white-space: normal; }
tbody th { min-width: 140px; overflow-wrap: anywhere; }
.score { font: 700 clamp(1.8rem, 5vw, 3.1rem)/1 var(--mono); color: var(--accent); }
.score span { font-size: .55em; color: var(--muted); }
.result-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 1rem 1.4rem; }
.answer-review { padding: clamp(17px, 3.1vw, 27px); }
.answer-review h3, #question-prompt { white-space: pre-wrap; }
.review-answers { padding-block: 1rem; }
.review-answers dd { white-space: pre-wrap; }
.review-times { grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-top: .8rem; }

.exam-mode { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.exam-page { max-width: 930px; padding-top: clamp(22px, 3vw, 37px); }
.exam-heading { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: .8rem; margin-bottom: 1.15rem; }
.exam-title { grid-column: 2; text-align: center; }
.exam-title h1 { font-size: clamp(1.65rem, 4.15vw, 2.8rem); }
.exam-title p { margin: .38rem 0 0; }
.timer {
    justify-self: end; display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
    color: #00513e; background: #def2e6; border: 1px solid #c8e3d2; border-radius: 8px;
    font: 700 clamp(.96rem, 2.2vw, 1.22rem) var(--mono); padding: .57rem .7rem;
}
.timer.urgent { color: #8c3927; background: #fce9dc; border-color: #f1d3c4; }
.exam-progress { appearance: none; width: 100%; display: block; height: 7px; border: 0; border-radius: 999px; background: #dfe7e1; color: var(--accent); overflow: hidden; margin-bottom: 1.2rem; }
.exam-progress::-webkit-progress-bar { background: #dfe7e1; border-radius: 999px; }
.exam-progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.exam-progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.question-card, .exam-gate { padding: clamp(17px, 4.4vw, 32px); }
.exam-gate p { color: var(--muted); margin: .58rem 0 1rem; }
#question-prompt { outline: none; }
.code-block { margin: 1rem 0; border-radius: 8px; padding: .85rem 1rem; overflow: auto; background: #eaf2ee; color: #14352d; font-size: clamp(.84rem, 2vw, 1rem); tab-size: 4; }
.exam-options { display: grid; gap: .55rem; margin-top: 1rem; }
.option { display: flex; align-items: center; gap: .78rem; border: 1px solid #b9cbc2; min-height: 47px; padding: .65rem .83rem; border-radius: 8px; cursor: pointer; }
.option:hover { background: #f2f8f4; }
.option:has(:checked) { border-color: #77b3a1; background: #dff2e9; }
.option span { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.answer-footer { display: flex; justify-content: space-between; align-items: center; gap: .7rem 1rem; flex-wrap: wrap; margin-top: 1rem; }
.answer-footer .button { margin-left: auto; }
.feedback { font-size: .87rem; margin: .1rem 0; }
.feedback:empty { display: none; }
.virtual-pointer {
    position: fixed; z-index: 100; inset: 0 auto auto 0; width: 14px; height: 20px;
    pointer-events: none; background: #111b19;
    clip-path: polygon(0 0, 100% 62%, 59% 66%, 77% 91%, 58% 100%, 39% 73%, 0 99%);
    filter: drop-shadow(1px 1px 1px #fff);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 800px) {
    .frame { width: calc(100% - 40px); }
    .hero { gap: 1.2rem; }
    .hero h1 { font-size: clamp(2.3rem, 5.9vw, 3.15rem); }
    .exam-heading { grid-template-columns: minmax(0, 1fr) auto; }
    .exam-title { grid-column: 1; text-align: left; }
}

@media (max-width: 590px) {
    .frame { width: calc(100% - 28px); }
    .page { padding-top: 24px; }
    .masthead-inner { min-height: 60px; gap: .7rem; }
    .brand { font-size: 1rem; gap: .42rem; }
    .brand-icon { width: 29px; height: 29px; border-radius: 7px; font-size: .95rem; }
    .teacher-link, .teacher-nav { font-size: .76rem; line-height: 1.25; text-align: right; }
    .teacher-nav { justify-content: end; gap: .28rem .65rem; }
    .hero { min-height: 0; padding: 24px 17px; grid-template-columns: minmax(0, 1fr); border-radius: 12px; }
    .hero h1 { font-size: clamp(2.13rem, 9vw, 3rem); }
    .hero p { margin-top: .62rem; }
    .terminal { width: min(100%, 400px); justify-self: start; }
    .terminal pre { font-size: clamp(.65rem, 3vw, .83rem); }
    .cards, .fields-two { grid-template-columns: minmax(0, 1fr); }
    .section-heading { flex-wrap: wrap; }
    .section-heading > span { font-size: .8rem; }
    .exam-title h1 { font-size: 1.52rem; }
    .exam-heading { gap: .55rem; }
    .exam-heading p { font-size: .88rem; }
    .timer { padding: .44rem .48rem; }
    .timer .symbol { display: none; }
    .question-card, .exam-gate, .topic-card { padding-inline: 15px; }
    .result-summary, .review-times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

#capture-shield {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
}

.question-topic {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: .35rem 1rem;
    flex-wrap: wrap;
    background: var(--mint);
    border-radius: 8px;
    padding: .6rem .8rem;
    margin-bottom: 1rem;
    font-size: .86rem;
}
.question-topic p { margin: 0; }
#question-topic { color: var(--accent-dark); font-size: 1.16rem; font-weight: 720; }

.exam-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    border: 1px solid #f0d7a0;
    background: var(--amber);
    color: #5f4200;
}
.exam-warning p { margin: .15rem 0 0; }
.monitor-actions > span { display: inline-block; min-width: 1.2rem; margin-right: .5rem; }
.monitor-actions .button { min-height: 36px; font-size: .84rem; }

@media print {
    body.exam-mode { background: #000 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.exam-mode > * { display: none !important; }
}

.analytics-period { margin: 0 0 1rem; }
.analysis-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 1rem;
    padding: 1rem 1.2rem;
    margin-bottom: 1.1rem;
}
.analysis-summary dd { font-size: 1.35rem; }
.analysis-charts { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.analysis-card { min-width: 0; padding: 1rem; }
.analysis-card summary { font-weight: 650; cursor: pointer; }
.analysis-method, .pair-detail { margin-top: 1rem; }
.review-list:empty { display: none; }
.plot-label { margin: 1rem 0 .5rem; color: var(--muted); font-size: .83rem; }
.plot-label-x { text-align: center; margin: .35rem 0 0; }
.scatter {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr);
    grid-template-rows: 12rem auto;
    column-gap: .55rem;
    row-gap: .65rem;
    padding-right: .8rem;
    font-variant-numeric: tabular-nums;
}
.scatter-y {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    color: var(--muted);
    font-size: .76rem;
    margin-block: -.6rem;
}
.scatter-x { grid-column: 2; display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; }
.scatter-plot {
    position: relative;
    border: 1px solid var(--line);
    background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%),
        repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%);
}
.scatter-point {
    position: absolute;
    width: .78rem;
    height: .78rem;
    border: 1px solid white;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%, 50%);
}
.scatter-point:hover, .scatter-point:focus-visible { z-index: 2; outline: 2px solid var(--accent); outline-offset: 2px; }
.review-point, .plot-review-key { background: #9b4a00; border-radius: 3px; }
.plot-review-key { display: inline-block; width: .75rem; height: .75rem; }
.grade-plot { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: .25rem; height: 13rem; margin-top: 1.1rem; }
.grade-column { display: flex; flex-direction: column; justify-content: end; align-items: center; gap: .2rem; font-size: .75rem; min-width: 0; }
.grade-count { font-weight: 650; }
.grade-axis { color: var(--muted); }
.grade-bar { width: min(100%, 1.45rem); background: var(--accent); border-radius: 4px 4px 0 0; }
.grade-scale { max-width: 31rem; }

@media (max-width: 780px) {
    .analysis-charts { grid-template-columns: minmax(0, 1fr); }
}
