/*
 * Floating Label Input and Context Meter adapted from Bencho (bencho.dev).
 * MIT License
 * Copyright (c) 2026 Lorenzo Cabra
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/*
 * Glasswork material and rim refraction adapted for the login screen.
 * https://github.com/kubai087/glasswork
 *
 * MIT License
 *
 * Copyright (c) 2026 Kubai087
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

:root {
  color-scheme: light;
  --paper: #f0f2fa;
  --white: #fff;
  --ink: #222940;
  --muted: #535e77;
  --border: #d6daea;
  --field-border: #8791aa;
  --surface-tint: #f7f8ff;
  --accent: #4338a5;
  --accent-hover: #342b88;
  --accent-soft: #ebe9fa;
  --focus: #5549bd;
  --night: #20233f;
  --hero-text: #f7f6ff;
  --hero-muted: #dbd9f4;
  --hero-line: #73759e;
  --hero-surface: radial-gradient(ellipse at 14% 0%, #39346f, transparent 72%),
    linear-gradient(145deg, #2b2854, #191f37);
  --amber: #8e451f;
  --amber-bg: #fcf0e5;
  --score-a: #ada7ff;
  --score-a-ink: #594bb0;
  --score-b: #ffc393;
  --score-b-ink: #9e4b24;
  --number: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.55; }
body:has(:is(#login, #report):not([hidden])) {
  isolation: isolate;
  --portal-ink: #fff;
  --portal-muted: #e5e4e8;
  --portal-base: #141416;
  --portal-focus: #fff;
  --portal-rim: #ffffff50;
  --portal-polish: inset 0 1px 1px #ffffff1c, inset 0 -2px 4px #0003;
  --portal-control-radius: 12px;
  --portal-panel-radius: 26px;
  --portal-panel-line: #ffffff38;
  --portal-panel-sheen: linear-gradient(135deg, #ffffff1f, transparent 36%, #ffffff0c);
  --portal-panel-shadow: inset 0 1px #ffffff1c, 0 18px 48px #0006;
  --login-width: 960px;
  --login-page-gutter: clamp(24px, 4vw, 40px);
  background: radial-gradient(ellipse at 20% 15%, #2d2830, transparent 70%),
    radial-gradient(ellipse at 90% 74%, #322723, transparent 65%), var(--portal-base);
  background-image:
    radial-gradient(ellipse at 20% 15%, color-mix(in srgb, var(--login-background-cool, #5266b5) 28%, transparent), transparent 70%),
    radial-gradient(ellipse at 90% 74%, color-mix(in srgb, var(--login-background-warm, #ad5767) 28%, transparent), transparent 65%);
  color: var(--portal-ink);
}
.login-background { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
h1, h2, h3, h4, p { margin: 0; }
.wrap { width: min(1100px, calc(100% - 64px)); margin-inline: auto; }
.muted { color: var(--muted); }
.topbar { background: linear-gradient(110deg, var(--white) 45%, #eeecfb); border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 73px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 750; }
.header-account, .header-actions { display: flex; align-items: center; gap: 14px; font-size: .875rem; }
.header-link { text-decoration: none; }
.plain-button { background: none; border: 1px solid var(--border); color: var(--ink); border-radius: 7px; padding: 6px 12px; white-space: nowrap; }
.plain-button:hover { background: var(--accent-soft); }

body:has(:is(#login, #report):not([hidden])) .topbar {
  background: #14141663;
  border-color: #ffffff2b;
  -webkit-backdrop-filter: blur(8px) saturate(135%);
  backdrop-filter: blur(8px) saturate(135%);
}
body:has(:is(#login, #report):not([hidden])) .brand { color: var(--portal-ink); }
body:has(:is(#login, #report):not([hidden])) :focus-visible { outline-color: var(--portal-focus); }
body:has(#login:not([hidden])) :is(.topbar-inner, main.wrap) {
  width: min(var(--login-width), calc(100% - 2 * var(--login-page-gutter)));
}
body:has(#report:not([hidden])) :is(.topbar-inner, main.wrap) {
  width: min(960px, calc(100% - 2 * var(--login-page-gutter)));
}
.login {
  --login-divider: #ffffff1c;
  --login-padding: clamp(28px, 4.2vw, 44px);
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr);
  min-height: 430px;
  margin-block: clamp(32px, 8vh, 80px);
  border: 1px solid var(--portal-panel-line);
  border-radius: var(--portal-panel-radius);
  overflow: hidden;
  color-scheme: dark;
  color: var(--portal-ink);
  background: var(--portal-panel-sheen), #11111478;
  -webkit-backdrop-filter: blur(1.5px) saturate(135%) brightness(.80);
  backdrop-filter: blur(1.5px) saturate(135%) brightness(.80);
  box-shadow: var(--portal-panel-shadow);
}
.login-visual {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 28px;
  padding: var(--login-padding);
  text-shadow: 0 2px 15px #0006;
}
.login :is(.context, .muted, .field-hint), body:has(#login:not([hidden])) noscript .muted { color: var(--portal-muted); }
.context { font-size: .875rem; font-weight: 650; }
.login-visual h1 { font-size: clamp(2.875rem, 5.4vw, 4.25rem); letter-spacing: -.065em; line-height: 1.1; margin-block-start: 10px; }
.hero-matrix { width: clamp(78px, 8vw, 96px); aspect-ratio: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px;
  border-radius: 14px; border: 1px solid #ffffff38; background: #1414164d; box-shadow: var(--portal-polish); }
.hero-matrix i { border-radius: 50%; background: #ffffff2b; }
.hero-matrix .lit { background: #fff; box-shadow: 0 0 12px #ffffff60; }
.login-panel { display: grid; align-items: center; min-width: 0; padding: var(--login-padding);
  border-inline-start: 1px solid var(--login-divider); background: #11111345; }
.form-content h2 { font-size: 1.625rem; line-height: 1.25; margin-bottom: 4px; letter-spacing: -.035em; }
.auth-form { display: grid; gap: 17px; margin-top: 26px; }
.login .auth-form { gap: 12px; margin-top: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login .form-row { grid-template-columns: minmax(90px, 1fr) minmax(0, 1.45fr); }
label { display: grid; gap: 7px; font-size: .9rem; font-weight: 700; }
input, select { min-width: 0; width: 100%; min-height: 46px; padding: 9px 12px; color: var(--ink); background-color: var(--surface-tint);
  border: 1px solid var(--field-border); border-radius: 8px; font-size: 1rem; font-weight: 500; }
input::placeholder { color: var(--muted); }
.form-field { display: grid; gap: 7px; }
.field-hint { color: var(--muted); font-size: .875rem; }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle { position: absolute; inset: 2px 2px 2px auto; width: 42px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--accent); }
.password-toggle:hover { background: var(--accent-soft); }
.password-icon-library { position: absolute; pointer-events: none; }
.password-icon { width: 20px; height: 20px; pointer-events: none; }
.password-icon-hide, .password-toggle[aria-pressed="true"] .password-icon-show { display: none; }
.password-toggle[aria-pressed="true"] .password-icon-hide { display: inline; }
.eye { position: relative; width: 15px; height: 15px; display: grid; place-items: center;
  border: 1.75px solid currentColor; border-radius: 74% 0 74% 0; transform: rotate(45deg); }
.eye::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.admin-login .password-toggle[aria-pressed="true"]::after { content: ""; position: absolute; width: 23px; height: 2px;
  border-radius: 2px; background: currentColor; box-shadow: 0 0 0 1.5px var(--surface-tint); transform: rotate(-38deg); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 20px, calc(100% - 11px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }
.floating-field { position: relative; min-width: 0; }
.floating-field :is(input, select) { min-height: 54px; padding-inline-start: 15px; border-radius: 12px;
  border-color: var(--field-border); background-color: var(--white);
  transition: border-color 180ms ease, box-shadow 180ms ease; }
.floating-field select { padding-inline-end: 30px; background-position: calc(100% - 16px) 24px, calc(100% - 11px) 24px; }
.floating-field label { position: absolute; inset-block-start: 50%; inset-inline-start: 10px; display: block;
  padding-inline: 5px; color: var(--muted); background: var(--white); line-height: 1.2; cursor: text;
  transform: translateY(-50%); transform-origin: left center; white-space: nowrap;
  transition: inset-block-start 240ms cubic-bezier(.22, 1, .36, 1),
    transform 240ms cubic-bezier(.22, 1, .36, 1), color 180ms ease; }
.floating-field select + label,
.floating-field input:is(:focus, :not(:placeholder-shown)) + label {
  inset-block-start: 0; transform: translateY(-50%) scale(.84);
}
.floating-field :is(input, select):focus { border-color: var(--accent); }
.floating-field :is(input, select):focus + label { color: var(--accent); }
.floating-field :is(input, select):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.primary-button { min-height: 50px; margin-top: 3px; border: 0; border-radius: 8px; background: var(--accent); color: var(--white); font-weight: 750; }
.primary-button:hover { background: var(--accent-hover); }
.form-error { color: var(--amber); background: var(--amber-bg); padding: 9px 12px; border-radius: 7px; font-size: .9rem; }

/* The neutral glass tints and bevel use the Glasswork material. See license above. */
.login .floating-field :is(input, select) {
  height: 54px;
  padding-block: 18px 3px;
  border-color: var(--portal-rim);
  border-radius: var(--portal-control-radius);
  background-color: #ffffff12;
  color: var(--portal-ink);
  box-shadow: var(--portal-polish);
}
.login .floating-field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--portal-muted) 50%),
    linear-gradient(135deg, var(--portal-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 24px, calc(100% - 11px) 24px;
}
.login .floating-field select option { background: var(--portal-base); color: var(--portal-ink); }
.login .floating-field label { inset-inline-start: 15px; padding: 0; background: transparent; color: var(--portal-muted); }
.login .floating-field select + label,
.login .floating-field input:is(:focus, :not(:placeholder-shown), :autofill) + label {
  inset-block-start: 12px;
  transform: translateY(-50%) scale(.82);
}
.login .floating-field :is(input, select):focus { border-color: var(--portal-rim); }
.login .floating-field :is(input, select):focus + label,
.login .password-toggle { color: var(--portal-ink); }
.login .password-toggle:hover { background: #ffffff18; }
body:has(:is(#login, #report):not([hidden])) :where(.login-action, #exit, .topbar .header-link) {
  border: 1px solid #ffffff6b;
  border-radius: 999px;
  background: linear-gradient(142deg, #ffffff2d, #ffffff12 55%, #ffffff1c), #ffffff15;
  color: var(--portal-ink);
  box-shadow: var(--portal-polish), 0 5px 13px #0004;
  transition: box-shadow 160ms ease;
}
body:has(#login:not([hidden])) .login-action {
  min-height: 54px;
  margin-top: 0;
  border-radius: var(--portal-control-radius);
}
@media (hover: hover) {
  body:has(:is(#login, #report):not([hidden])) :where(.login-action, #exit, .topbar .header-link):not(:disabled):hover {
    translate: none;
    box-shadow: var(--portal-polish), inset 0 0 0 100px #ffffff0e, 0 7px 15px #0005;
  }
}
body:has(:is(#login, #report):not([hidden])) :where(.login-action, #exit, .topbar .header-link):not(:disabled):active {
  translate: none;
  box-shadow: var(--portal-polish), inset 0 0 0 100px #0002;
}

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .login,
  body:has(:is(#login, #report):not([hidden])) .topbar {
    background: #242426;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .login-panel { background: #29292c; }
  .login .floating-field :is(input, select), .hero-matrix { background-color: #353538; }
  body:has(:is(#login, #report):not([hidden])) :where(.login-action, #exit, .topbar .header-link) { background: #48484d; }
}
@media (forced-colors: active) {
  .login { --login-divider: CanvasText; }
  .login .floating-field select { appearance: auto; background-image: none; }
  .hero-matrix .lit { background: CanvasText; }
}

.glass-button {
  --glass-fill: #eeecfa;
  --glass-surface: linear-gradient(155deg, #fffe 4%, #e3dafa91 64%, #faf9fff0);
  --glass-edge: #9b91bf;
  --glass-glint: #fffe;
  --glass-rim: #62538940;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass-surface);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  backdrop-filter: blur(14px) saturate(145%);
  box-shadow: inset 0 1px 1px var(--glass-glint), inset 0 -1px 1px var(--glass-rim), 0 3px 9px #2f285c25;
  transition: translate 160ms ease, box-shadow 160ms ease;
}
.primary-button.glass-button {
  --glass-fill: var(--accent);
  --glass-surface: radial-gradient(ellipse at 28% -115%, #e1d5ff85 4%, transparent 78%),
    linear-gradient(157deg, #5447b0f5 8%, #493b9de8 52%, #332a7af7);
  --glass-edge: #504398;
  --glass-glint: #efeaff9e;
  --glass-rim: #150e4c90;
}
.plain-button.glass-button { padding-inline: 15px; }
.glass-button:not(:disabled):hover { background: var(--glass-surface); }
@media (hover: hover) {
  .glass-button:not(:disabled):hover {
    translate: 0 -1px;
    box-shadow: inset 0 1px 1px var(--glass-glint), inset 0 -1px 1px var(--glass-rim), 0 5px 13px #2f285c32;
  }
}
.glass-button:not(:disabled):active { translate: 0 1px; }
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .glass-button, .primary-button.glass-button {
    --glass-surface: var(--glass-fill);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .glass-button, .glass-button:not(:disabled):hover {
    box-shadow: none;
  }
}

.report { margin-block: 36px 64px; }
.report-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 29px 34px;
  border-radius: 16px; color: var(--hero-text); background: var(--hero-surface); }
.report-hero h1 { margin: 4px 0; font-size: clamp(2rem, 4.4vw, 3.2rem); letter-spacing: -.055em; line-height: 1.2; }
.report-hero p { color: var(--hero-muted); }
.total-score { display: grid; justify-items: end; align-self: stretch; align-content: center; padding-left: 24px; border-left: 1px solid var(--hero-line); min-width: min(35%, 220px); }
.total-score strong { font: 750 clamp(1.5rem, 4vw, 2.9rem)/1.15 var(--number); text-align: right; white-space: nowrap; }
.total-score > span { color: var(--hero-muted); margin-top: 6px; font-size: .875rem; }
.score-meter { display: flex; gap: 3px; width: 100%; height: 8px; margin-top: 13px; }
.score-meter-part { flex-basis: 0; min-width: 0; border-radius: 3px; transition: opacity 160ms ease; }
.score-meter-a { background: var(--score-a); }
.score-meter-b { background: var(--score-b); }
.score-meter-remainder { background: #52577e; }
.score-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-block: 16px 29px; }
.score-slip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 16px 19px; background: var(--white);
  border: 1px solid var(--border); border-radius: 11px; text-decoration: none; color: var(--ink); }
.score-slip:hover { border-color: var(--accent); }
#report:has(.score-meter[data-paper]) .score-slip[href="#section-a"] b::before,
#report:has(.score-meter) .score-slip[href="#section-b"] b::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 5px;
  vertical-align: .1em; border-radius: 2px; background: var(--part-color);
}
.score-slip[href="#section-a"] { --part-color: var(--score-a-ink); }
.score-slip[href="#section-b"] { --part-color: var(--score-b-ink); }
.score-medium { margin-inline-start: .3em; }
.score-hint { display: block; color: var(--muted); font-size: .875rem; }
.score-slip strong { font: 700 1.1rem var(--number); white-space: nowrap; }
.report-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.25fr); align-items: start; gap: 22px; }
.report-grid > section { scroll-margin-top: 16px; }
.block-title { font-size: 1.35rem; letter-spacing: -.035em; margin-bottom: 10px; }
.paper-section { padding: 17px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); }
.paper-section p { color: var(--muted); }
.wrong-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 11px 0 0; padding: 0; list-style: none; }
.wrong-chips li { background: var(--amber-bg); color: var(--amber); border-radius: 5px; padding: 4px 9px; font-size: .875rem; font-weight: 700; }
.paper-scans:not(:first-child) { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.paper-scans h3 { font-size: 1rem; }
.scan-status { font-size: .875rem; margin-top: 2px; }
.scan-open { display: inline-flex; align-items: center; margin-top: 8px; }
.scan-pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; list-style: none; margin: 9px 0 0; padding: 0; }
.scan-page { display: grid; place-items: center; min-height: 54px; aspect-ratio: 1.15; border: 1px dashed var(--field-border);
  border-radius: 6px; background: var(--surface-tint); color: var(--muted); font-size: .875rem; white-space: nowrap; }
.details-stack { display: grid; gap: 10px; }
.question { background: var(--white); border: 1px solid var(--border); border-radius: 10px; }
.question summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 15px; list-style: none; cursor: pointer; border-radius: 9px; }
.question summary::-webkit-details-marker { display: none; }
.question summary:hover { background: var(--surface-tint); }
.question[open] summary { border-bottom: 1px solid var(--border); border-radius: 9px 9px 0 0; }
.question summary::after { content: ""; width: 8px; height: 8px; margin: 0 3px; border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent); transform: rotate(45deg); }
.question[open] summary::after { transform: rotate(225deg); }
.question-id { font: 750 .9rem var(--number); color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 6px; }
.question-name { font-weight: 750; }
.question-meta { display: block; color: var(--muted); font-size: .83rem; font-weight: 500; }
.question-score { font: 750 .94rem var(--number); white-space: nowrap; }
.question-body { padding: 15px; display: grid; gap: 13px; }
.question-body > p { color: var(--muted); }
.standard-answers { margin-top: 22px; }
.answer-card summary { grid-template-columns: auto minmax(0, 1fr) auto; }
.answer-card .programming-evidence { width: min(100%, 550px); }
.answer-events { display: grid; gap: 10px; margin: 0; }
.answer-events dt { font-weight: 750; }
.answer-events dd { margin: 2px 0 0; }
.answer-events ol { margin: 0; padding-inline-start: 1.4rem; }
.answer-card figure.matrix-pair { align-items: center; margin: 0; }
.answer-fees { width: 100%; border-collapse: collapse; font-size: .875rem; }
.answer-fees th, .answer-fees td { padding: 6px 3px; border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.answer-fees th { background: var(--accent-soft); }
.programming-evidence { display: block; min-width: 0; border: 1px solid var(--border); border-radius: 7px; }
.programming-evidence-image { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.question-body .teacher-note { padding: 9px 11px; color: var(--ink); background: var(--accent-soft); border-radius: 6px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 10px 0; border-top: 1px solid var(--border); }
.checkline { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; }
.checkline h4 { font-size: .96rem; }
.check-score { margin-left: auto; font: 650 .85rem var(--number); color: var(--accent); white-space: nowrap; }
.needs-work .check-score { color: var(--amber); }
.checklist p { font-size: .9rem; margin-top: 3px; color: var(--muted); }
.checklist .observed { color: var(--amber); }
.matrix-pair { display: flex; flex-wrap: wrap; gap: 15px; background: var(--surface-tint); padding: 12px; border-radius: 8px; }
.matrix-pair figure { margin: 0; }
.matrix-pair figcaption { font-size: .82rem; margin-bottom: 5px; font-weight: 750; }
.mini-matrix { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 7px; width: 89px; aspect-ratio: 1;
  border-radius: 8px; background: var(--night); }
.mini-matrix i { aspect-ratio: 1; border-radius: 50%; background: #494e77; }
.mini-matrix .lit { background: var(--score-a); }
.mini-matrix .extra { background: var(--score-b); }
.mini-matrix .absent { background: transparent; border: 1px solid var(--score-b); }

/* Student report surfaces use the same glass material as sign-in. */
#report {
  --report-line: #ffffff30;
  --report-card: #ffffff0c;
  --report-hover: #ffffff15;
  --report-warning: #ffd4b0;
  --report-warning-fill: #ffbc8a20;
  --score-a: color-mix(in srgb, var(--login-background-cool, #5266b5) 51%, white);
  --score-b: color-mix(in srgb, var(--login-background-warm, #ad5767) 51%, white);
  --score-a-ink: var(--score-a);
  --score-b-ink: var(--score-b);
  color-scheme: dark;
  color: var(--portal-ink);
}
#report .report-hero,
#report .score-strip,
#report .report-grid > section {
  border: 1px solid var(--portal-panel-line);
  border-radius: var(--portal-panel-radius);
  -webkit-backdrop-filter: blur(5px) saturate(128%) brightness(.85);
  backdrop-filter: blur(5px) saturate(128%) brightness(.85);
  box-shadow: var(--portal-panel-shadow);
}
#report .report-hero {
  padding: clamp(22px, 4vw, 39px);
  color: var(--portal-ink);
  background: var(--portal-panel-sheen), #14141688;
}
#report .report-hero h1 {
  margin-block: 5px 8px;
  font-size: clamp(1.75rem, 4.3vw, 3rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
#report :is(.report-hero p, .total-score > span, .score-hint, .paper-section p, .muted, .scan-page, .question-meta, .question-body > p, .checklist p) {
  color: var(--portal-muted);
}
#report .total-score { border-color: var(--report-line); }
#report .total-score > span { order: -1; margin: 0 0 4px; }
#report .total-score strong { white-space: normal; overflow-wrap: anywhere; }
#report .score-meter { height: 5px; }
#report .score-meter-remainder { background: #ffffff22; }
#report .score-strip {
  gap: 0;
  margin-block: 14px 20px;
  padding: 0;
  background: #17171bc9;
  border-radius: 15px;
}
#report .score-slip {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--portal-ink);
}
#report .score-slip:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
#report .score-slip + .score-slip {
  border-inline-start: 1px solid var(--report-line);
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}
#report .score-slip:is(:hover, :focus-visible) { background: var(--report-hover); }
#report .score-slip:focus-visible { outline-offset: -3px; }
#report .report-grid { grid-template-columns: minmax(230px, .94fr) minmax(0, 2.06fr); gap: 16px; }
#report .report-grid > section {
  min-width: 0;
  padding: clamp(16px, 2.5vw, 24px);
  border-radius: 20px;
  background: #17171bd1;
}
#report .block-title { margin-bottom: 13px; }
#report .paper-section { padding: 0; border: 0; background: transparent; }
#report .paper-scans:not(:first-child),
#report .checklist li,
#report .question[open] summary { border-color: var(--report-line); }
#report .wrong-chips li { color: var(--report-warning); background: var(--report-warning-fill); border-radius: 8px; }
#report .scan-open {
  min-height: 44px;
  padding-inline: 14px;
  border-color: var(--portal-rim);
  border-radius: var(--portal-control-radius);
  background: linear-gradient(142deg, #ffffff24, #ffffff0a);
  color: var(--portal-ink);
  box-shadow: var(--portal-polish);
  white-space: normal;
}
#report .scan-open:hover { background: var(--report-hover); }
#report .scan-page { border-color: var(--portal-rim); border-radius: 8px; background: var(--report-card); }
#report .question {
  background: var(--report-card);
  border-color: var(--report-line);
  border-radius: var(--portal-control-radius);
  box-shadow: var(--portal-polish);
}
#report .question summary { min-width: 0; min-height: 52px; border-radius: 11px; }
#report .question[open] summary { border-radius: 11px 11px 0 0; }
#report .question summary:hover { background: var(--report-hover); }
#report .question summary::after { border-color: var(--portal-muted); }
#report .question-id {
  max-inline-size: 8ch;
  padding: 6px 7px;
  border-radius: 7px;
  background: #ffffff18;
  color: var(--portal-ink);
  overflow-wrap: anywhere;
}
#report :is(.question-name, .question-body) { min-width: 0; overflow-wrap: anywhere; }
#report :is(.question-score, .score-slip strong) { text-align: end; }
#report :is(.programming-evidence, .answer-fees :is(th, td)) { border-color: var(--report-line); }
#report .programming-evidence { width: fit-content; max-width: 100%; background: #fafafa; }
#report .answer-fees :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
#report .answer-fees th { background: var(--report-hover); }
#report .question-body .teacher-note { color: var(--portal-ink); background: var(--report-hover); }
#report .check-score { color: var(--portal-ink); }
#report :is(.needs-work .check-score, .checklist .observed) { color: var(--report-warning); }
#report .matrix-pair { background: var(--report-card); }
#report .mini-matrix { background: #101013; }
#report .mini-matrix i:not([class]) { background: #ffffff24; }

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  #report .report-hero,
  #report .score-strip,
  #report .report-grid > section {
    background: #242426;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #report .question { background: #2d2d31; }
  #report .scan-open { background: #48484d; }
}

@media (max-width: 780px) {
  body:has(#login:not([hidden])) {
    --login-width: 500px;
    --login-page-gutter: clamp(16px, 4vw, 26px);
  }
  body:has(#report:not([hidden])) { --login-page-gutter: clamp(16px, 4vw, 26px); }
  .login {
    --login-padding: clamp(20px, 5.4vw, 32px);
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    margin-block: clamp(20px, 4vw, 32px) 36px;
    border-radius: 22px;
  }
  .login-visual { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }
  .login-visual h1 { font-size: clamp(2rem, 7vw, 2.5rem); margin-block-start: 8px; }
  .hero-matrix { width: clamp(60px, 15vw, 76px); gap: 4px; padding: 7px; border-radius: 10px; }
  .login-panel { border-inline-start: 0; border-block-start: 1px solid var(--login-divider); }
}

@media (min-width: 460px) and (max-width: 780px) {
  .login-visual h1 br { display: none; }
}

@media (max-width: 459px) {
  .login { border-radius: 20px; }
  .login .context { font-size: .8125rem; }
  .form-content h2 { font-size: 1.5rem; }
}

@media (max-width: 750px) {
  .wrap { width: min(100% - 28px, 620px); }
  .topbar-inner { min-height: 62px; gap: 8px; }
  .header-actions, .header-account { gap: 8px; }
  .header-account span { display: none; }
  .plain-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
  .primary-button { min-height: 48px; }
  .password-toggle { width: 44px; inset-block: 1px; }
  .auth-form { margin-top: 24px; }
  .report { margin-block: 20px 40px; }
  .report-hero { padding: 19px; }
  #report .report-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; border-radius: 22px; }
  #report .total-score { grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    justify-items: start; gap: 8px 12px; border-left: 0; border-top: 1px solid var(--report-line); padding: 12px 0 0; }
  #report .total-score > span { grid-area: 1 / 1; margin: 0; text-align: left; }
  #report .total-score strong { grid-area: 1 / 2; font-size: clamp(1.5rem, 6vw, 2.1rem); }
  .score-meter { grid-column: 1 / -1; margin-top: 0; }
  .score-strip { gap: 8px; margin-block: 8px 18px; padding-block: 8px; }
  .score-slip { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 7px; padding: 9px 10px; }
  .score-slip > div { display: contents; }
  .score-slip b { font-size: .875rem; }
  .score-medium { display: none; }
  .score-hint { grid-column: 1 / -1; grid-row: 2; font-size: .78rem; }
  .score-slip strong { grid-area: 1 / 2; font-size: .94rem; }
  #report .report-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .question summary { min-height: 52px; gap: 7px; padding: 12px; }
  .answer-card .programming-evidence, .programming-evidence { width: 100%; }
}

@media (hover: hover) {
  #report:has(.score-slip[href="#section-a"]:is(:hover, :focus-visible)) .score-meter-b,
  #report:has(.score-slip[href="#section-b"]:is(:hover, :focus-visible)) .score-meter-a { opacity: .45; }
}

@media (prefers-reduced-motion: reduce) {
  .floating-field :is(input, select, label), .score-meter-part, .glass-button,
  body:has(:is(#login, #report):not([hidden])) :where(.login-action, #exit, .topbar .header-link) { transition: none; }
  .glass-button:not(:disabled):is(:hover, :active) { translate: none; }
}

@media (max-width: 750px) and (min-height: 520px) {
  #report .score-strip { position: sticky; top: 8px; z-index: 2; }
  .report-grid > section { scroll-margin-top: 86px; }
}

@media (max-width: 360px) {
  .header-actions .plain-button { padding-inline: 8px; }
  #report .score-slip { column-gap: 5px; padding-inline: 7px; }
  #report .score-slip b { font-size: .8125rem; white-space: nowrap; }
  #report .score-slip strong { font-size: .875rem; white-space: normal; overflow-wrap: anywhere; }
}
