:root {
  color-scheme: light;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #25282c;
  background: #f8f9fb;
  font-synthesis: none;
  --blue: #245eea;
  --blue-hover: #194fcf;
  --navy: #214a74;
  --muted: #6d737a;
  --border: #e3e5e9;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.6; }
button, input { font: inherit; }
button, a, input, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input { outline-offset: 4px; }
:focus-visible { outline: 3px solid #93b9fa; }
button:disabled { opacity: .64; }
[hidden] { display: none !important; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.site-header { height: 60px; flex-shrink: 0; background: #fff; border-bottom: 1px solid #e7e9ec; box-shadow: 0 1px 2px #17233a03; }
.header-inner { max-width: 1600px; margin: 0 auto; padding: 0 24px; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: var(--navy); font-size: 21px; font-weight: 700; text-decoration: none; letter-spacing: .4px; }
.account { position: relative; }
.account-toggle { border: 0; padding: 8px 0 8px 12px; background: transparent; display: flex; align-items: center; gap: 9px; color: #282c32; font-size: 15px; font-weight: 600; }
.account-toggle .icon { width: 16px; height: 16px; }
.account-menu { z-index: 5; position: absolute; right: 0; top: calc(100% + 9px); width: 172px; padding: 8px; background: white; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 22px #1a28451a; }
.account-menu p { margin: 3px 8px 7px; color: var(--muted); font-size: 13px; }
.account-menu button { border: 0; background: transparent; padding: 9px 8px; display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border-radius: 4px; color: #333b47; }
.account-menu button:hover { background: #eff5ff; color: var(--navy); }
main { flex: 1; width: 100%; }
.loading-view { text-align: center; color: var(--muted); padding: 90px 24px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 3px 5px #16223712; }
.login-view { padding: 68px 20px 60px; }
.login-card { width: 480px; max-width: 100%; margin: 0 auto; padding: 25px 26px 26px; }
.login-card h1 { font-size: 26px; font-weight: 700; color: #202124; text-align: center; line-height: 1.4; margin: 0 0 24px; }
.form-field { margin-bottom: 17px; }
.form-field label { display: block; color: #4d5156; font-size: 17px; margin: 0 0 5px; }
.form-field input { height: 45px; width: 100%; padding: 9px 12px; border: 1px solid #d4d7dc; border-radius: 6px; box-shadow: inset 0 1px 2px #00000003; color: #25282c; background: #fff; transition: border-color .15s, box-shadow .15s; }
.form-field input:focus { border-color: #6295f3; box-shadow: 0 0 0 3px #2563eb16; outline: 0; }
.form-field input[aria-invalid="true"] { border-color: #d05050; }
.field-hint { font-size: 13px; color: #70757c; line-height: 1.5; margin: 5px 0 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 4px; padding: 8px 14px; min-height: 42px; font-size: 15px; font-weight: 500; line-height: 1.4; transition: background-color .15s, box-shadow .15s; }
.button-primary { background: var(--blue); color: #fff; border-color: #1d51cd; box-shadow: 0 1px 2px #173d7930; }
.button-primary:hover:not(:disabled) { background: var(--blue-hover); }
.button-primary:active:not(:disabled) { background: #1647b9; }
.login-button { width: 100%; margin-top: 6px; font-size: 17px; letter-spacing: 2px; }
.button-success { color: #fff; background: #14863e; border-color: #107537; }
.button-success:hover { background: #107537; }
.form-error { margin: 8px 0; color: #b53a3a; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.exam-view { max-width: 1240px; padding: 24px 20px 64px; margin: 0 auto; }
.exam-info { padding: 20px 22px 21px; }
.exam-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.exam-heading h1 { margin: 0; color: var(--navy); font-size: 22px; line-height: 1.5; font-weight: 700; }
.exam-status { color: #247440; background: #e9faef; border-radius: 20px; padding: 3px 13px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.exam-status.ended { background: #f0f1f3; color: #777c82; }
.exam-details { display: grid; grid-template-columns: 34% 1fr; gap: 0; }
.exam-details h2 { margin: 0 0 12px; font-size: 17px; line-height: 1.5; font-weight: 700; }
.student-info h2 { font-size: 19px; }
.exam-details ul { padding-left: 18px; margin: 0; }
.exam-details li { padding-left: 1px; line-height: 1.65; margin-bottom: 6px; }
.exam-details li:last-child { margin-bottom: 0; }
.exam-details li::marker { font-size: 10px; }
.download-link { color: var(--navy); font-size: 18px; font-weight: 700; padding: 0 5px; margin-left: 5px; background: none; border: 0; line-height: 1.5; }
.download-link:hover { color: var(--blue); text-decoration: underline; }
.exam-password { color: #994849; font-size: 18px; letter-spacing: .2px; }
.problem-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 24px; align-items: start; }
.problem-card { overflow: hidden; }
.problem-title { font-size: 18px; font-weight: 500; padding: 10px 13px; background: #f0f6ff; border-bottom: 1px solid #e3e9f1; margin: 0; line-height: 1.5; }
.problem-body { padding: 12px 13px 13px; }
.submission-status { display: flex; align-items: center; gap: 7px; color: #70757c; margin: 0 0 10px; line-height: 1.5; font-size: 14px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d0d2d5; flex-shrink: 0; }
.is-submitted .status-text { color: #367a56; }
.is-submitted .status-dot { background: #3db778; }
.resubmit-hint { font-size: 11px; color: #70757c; margin-left: -4px; }
.submission-meta { margin-top: -3px; margin-bottom: 10px; color: #737981; font-size: 12px; line-height: 1.6; }
.submission-meta p { display: flex; align-items: center; gap: 5px; margin: 0; min-width: 0; }
.submission-meta .icon { width: 13px; height: 13px; color: #8994a2; }
.submitted-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-picker { cursor: pointer; position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; background: #f1f9ff; border: 1px solid #bfceda; border-radius: 3px; box-shadow: 0 0 0 1px #e5edf1; overflow: hidden; transition: border-color .15s; }
.file-picker:hover { border-color: #75a1c6; background: #eaf5ff; }
.file-picker:focus-within { outline: 3px solid #93b9fa; outline-offset: 3px; }
.file-picker > .icon { color: #5684a3; width: 16px; height: 16px; }
.file-picker-label { white-space: nowrap; font-size: 14px; font-weight: 600; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.file-input:disabled { cursor: not-allowed; }
.selected-name { margin-left: auto; color: #65707d; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.file-picker > .chevron { width: 15px; height: 15px; stroke-width: 2.5; color: #36638c; }
.problem-actions { display: flex; gap: 8px; margin-top: 9px; }
.problem-actions .button { font-size: 14px; padding: 8px 7px; gap: 6px; }
.submit-button { width: 58%; }
.submit-button:disabled:not([aria-busy="true"]) { opacity: 1; background: #2b61df; }
.is-submitted .submit-button, .view-button { flex: 1; width: auto; }
.problem-actions .icon { width: 16px; height: 16px; }
.site-footer { flex-shrink: 0; text-align: center; padding: 17px 20px; border-top: 1px solid #e9eaed; color: #737980; font-size: 13px; background: #fff; }
.toast { position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%); padding: 11px 20px; color: #fff; background: #28475b; border-radius: 5px; box-shadow: 0 4px 16px #17233a26; max-width: calc(100% - 32px); z-index: 20; font-size: 14px; }
dialog { padding: 0; background: #fff; color: #25282c; border: 1px solid #d5d8dc; border-radius: 6px; box-shadow: 0 12px 40px #00000033; }
dialog::backdrop { background: #0007; }
.code-dialog { width: 800px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); }
.code-dialog[open] { display: flex; flex-direction: column; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border); gap: 12px; }
.dialog-header h2 { font-size: 15px; font-weight: 600; margin: 0; overflow-wrap: anywhere; min-width: 0; }
.icon-button { background: transparent; border: 0; color: #888d93; display: inline-flex; padding: 3px; border-radius: 3px; }
.icon-button:hover { color: #303844; background: #eef1f4; }
.code-body { min-height: 365px; padding: 13px; overflow: auto; }
.code-body pre { background: #292b2e; color: #e3e6e9; padding: 16px; font-family: Consolas, "Cascadia Code", monospace; font-size: 14px; line-height: 1.65; tab-size: 4; overflow: auto; margin: 0; border: 1px solid #17191b; }
.code-body code { font: inherit; }
.dialog-footer { display: flex; justify-content: flex-end; padding: 11px 14px; border-top: 1px solid var(--border); background: #fcfcfd; }
.dialog-footer .button { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.message-dialog { width: 380px; max-width: calc(100vw - 32px); }
.message-dialog > p { padding: 28px 24px; margin: 0; font-size: 15px; }
.noscript-notice { padding: 20px; text-align: center; }

@media (min-width: 1600px) { .header-inner { padding: 0; width: 81%; } }
@media (max-width: 1050px) {
  .problem-grid { gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-details { grid-template-columns: 32% 1fr; gap: 16px; }
}
@media (max-width: 640px) {
  .site-header { height: 58px; }
  .header-inner { padding: 0 16px; gap: 8px; }
  .brand { font-size: 17px; letter-spacing: 0; }
  .account-toggle { font-size: 12px; padding-left: 0; gap: 5px; }
  .account-toggle .icon { width: 14px; height: 14px; }
  .login-view { padding: 42px 18px; }
  .login-card { padding: 24px; }
  .login-card h1 { font-size: 24px; }
  .field-hint { font-size: 12px; }
  .exam-view { padding: 20px 16px 40px; }
  .exam-info { padding: 18px; }
  .exam-heading { align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 19px; }
  .exam-heading h1 { font-size: 20px; }
  .exam-status { font-size: 11px; padding: 3px 9px; }
  .exam-details { grid-template-columns: 1fr; gap: 24px; }
  .exam-details h2 { margin-bottom: 10px; }
  .exam-details li { font-size: 14px; }
  .exam-instructions { padding-top: 17px; border-top: 1px solid #eef0f3; }
  .problem-grid { grid-template-columns: 1fr; gap: 18px; margin-top: 20px; }
  .problem-body { padding: 13px 15px 15px; }
  .problem-title { padding-left: 15px; }
  .selected-name { max-width: 45%; }
  .code-body { min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
