:root {
  color-scheme: light;
  --surface: #ffffff;
  --canvas: #f4f7f8;
  --ink: #142932;
  --muted: #526570;
  --line: #d4dfe3;
  --accent: #08675f;
  --accent-hover: #07514b;
  --signal: #e8f4f0;
  --error: #9b291f;
  --error-surface: #fff1ed;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.6; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1, h2, h3 { line-height: 1.33; }
h1 { font-size: clamp(1.65rem, 3.8vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
a { color: var(--accent); text-underline-offset: .2em; }
label { display: block; margin-bottom: .25rem; font-weight: 650; }
:focus-visible { outline: 3px solid #bd640d; outline-offset: 3px; }
.skip-link { position: absolute; top: -10rem; }
.skip-link:focus { top: .5rem; left: .5rem; padding: .5rem; background: var(--surface); z-index: 2; }

.site-header { background: #14313a; color: #fff; }
.header-inner, .workspace {
  max-width: 75rem;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}
.header-inner {
  min-height: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.brand { color: inherit; font-size: 1.12rem; font-weight: 750; text-decoration: none; }
.profile { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.profile-name { color: #ddedef; overflow-wrap: anywhere; font-size: .88rem; }
.logout { background: transparent; color: inherit; border: 1px solid #5b757d; white-space: nowrap; }
.logout:hover { background: #244952; }

.workspace { padding-block: clamp(1.35rem, 4vw, 3rem) 3rem; }
.page-heading { margin: 0 0 1.25rem; }
.page-heading > :last-child { margin-bottom: 0; }
.muted, .helptext { color: var(--muted); }
.helptext { display: block; font-size: .92rem; margin-top: .3rem; }
.toolbar, .actions, .local-nav { display: flex; flex-wrap: wrap; gap: .65rem; }
.toolbar { align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.toolbar > .page-heading, .toolbar > :last-child { margin-bottom: 0; }
.actions { align-items: flex-end; }
.local-nav { gap: 1rem; padding-block: .8rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.local-nav a[aria-current=page] { color: var(--ink); font-weight: 700; }
.field { min-width: 0; }
.field + .actions, form > .field + .button { margin-top: .75rem; }
.form-stack { display: grid; gap: .9rem; max-width: 39rem; }
.form-stack > .button { justify-self: start; }
.form-stack > p { margin: 0; }

input, button, select { font: inherit; }
input:not([type=hidden], [type=checkbox], [type=radio]), select {
  width: 100%;
  max-width: 32rem;
  min-height: 2.8rem;
  padding: .42rem .65rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid #9badb6;
  border-radius: .4rem;
}
input:is([type=checkbox], [type=radio]) { accent-color: var(--accent); }
input[type=number] { width: min(100%, 11rem); }
input[type=file] { height: auto; min-width: 0; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .45rem .85rem;
  border: 1px solid transparent;
  border-radius: .4rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
}
.button { background: var(--accent); color: #fff; }
.button:hover { background: var(--accent-hover); }
.button.secondary { background: var(--surface); color: var(--accent); border-color: var(--line); }
.button.secondary:hover { background: var(--signal); border-color: #a2c5bd; }
button:disabled, select:disabled { opacity: .57; cursor: default; }
summary { cursor: pointer; }
dialog {
  width: min(30rem, calc(100% - 2rem));
  color: var(--ink);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
}
dialog::backdrop { background: rgb(15 41 48 / 60%); }

.feedback {
  border-left: .25rem solid var(--accent);
  background: var(--signal);
  padding: .65rem .9rem;
  margin-bottom: .9rem;
}
.feedback.error { background: var(--error-surface); border-color: var(--error); color: var(--error); }
.feedback > :last-child { margin-bottom: 0; }
.errorlist { color: var(--error); margin: .3rem 0 .5rem; padding-left: 1.3rem; }
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .65rem;
  margin: clamp(1.5rem, 8vw, 5rem) auto 0;
  max-width: 27rem;
  padding: clamp(1.25rem, 4vw, 2rem);
}
.session-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .85rem;
  border-block: 1px solid var(--line);
  padding: 1rem 0;
  max-width: 43rem;
}
.session-entry h2 { margin: 0; }
.candidate-summary, #judge-page section.page-heading {
  padding: .85rem 1.1rem;
  border-left: .25rem solid var(--accent);
  background: var(--signal);
  margin-bottom: 1.25rem;
}
.candidate-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .25rem 1.25rem;
}
.candidate-summary p { margin: 0; }
.candidate-summary strong { font-size: 1.85rem; font-variant-numeric: tabular-nums; }

.question-list {
  list-style-position: outside;
  background: var(--surface);
  padding: .15rem 1.25rem .15rem 3.1rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  margin: 1rem 0 1.35rem;
}
.question-list > li { padding: 1rem .1rem; }
.question-list > li + li { border-top: 1px solid var(--line); }
.question-list > li::marker { font-weight: 750; color: var(--accent); }
.question-list > li > :last-child { margin-bottom: 0; }
.question-stem, .question-answer { white-space: pre-wrap; overflow-wrap: anywhere; }
.question-stem { font-size: clamp(1.04rem, 2vw, 1.2rem); line-height: 1.75; }
.handoff { margin-top: 1.5rem; }
.handoff form { margin-top: .55rem; }
#judge-progress { font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin: 0 0 1.2rem; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--line); }
thead { background: #ecf2f4; }
.summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: .7rem 1.1rem;
  margin-block: 1rem;
}
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; }
.summary-list + .actions { margin-bottom: 1.25rem; }
.entry-links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-bottom: 1.35rem; }
.entry-qr { display: block; width: min(12rem, 100%); height: auto; margin-bottom: .35rem; }
.workspace section + section { margin-top: 1.6rem; }

.bank-import { margin-bottom: 1.25rem; }
.bank-import summary { font-weight: 650; }
.bank-import form { margin-top: .9rem; }
.bank-filters { margin-bottom: .9rem; }
.bank-filters .field { flex: 1 1 9rem; }
.bank-filters .field:nth-child(3) { flex: 2 1 15rem; }
.bank-question-table :is(th, td), .bank-question-summary dd { overflow-wrap: anywhere; }
.bank-question-table td:nth-child(3) { white-space: nowrap; }
.bank-question-form textarea {
  width: 100%;
  min-height: 6rem;
  padding: .55rem .65rem;
  border: 1px solid #9badb6;
  border-radius: .4rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

@media (max-width: 37rem) {
  .toolbar { align-items: stretch; }
  .profile-name { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .question-list { padding-inline: 2.35rem .75rem; }
  th, td { padding: .5rem; }
}
