:root {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: #18242b;
  background: #eef3f4;
  --ink: #18242b;
  --paper: #f6f8f8;
  --surface: #ffffff;
  --rail: #16313d;
  --rail-deep: #071922;
  --signal-blue: #0a80b7;
  --signal-cyan: #5fd6cc;
  --signal-red: #d84a3a;
  --signal-yellow: #ffd966;
  --line: #d8e2e4;
  --muted: #62717a;
  --shadow: 0 18px 46px rgba(20, 41, 49, .1);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(10, 128, 183, .08) 0 1px, transparent 1px 100%),
    var(--paper);
  background-size: 28px 28px;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1, h2, strong { letter-spacing: 0; }
h1 { font-size: 32px; line-height: 1.3; }
h2 { margin-bottom: 12px; font-size: 20px; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 3px solid rgba(10, 128, 183, .38);
  outline-offset: 3px;
}

.site-footer {
  padding: 18px 24px 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.auth-page .site-footer {
  position: static;
  align-self: end;
}
.screen-footer {
  position: relative;
  z-index: 1;
  color: rgba(70, 89, 98, .72);
  flex: 0 0 auto;
  padding: 2px 24px 8px;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.35;
}

.button {
  max-width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--rail);
  color: #fff;
  font: inherit;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.button:hover {
  background: #0e2631;
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(14, 38, 49, .16);
}
.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--rail);
}
.button.danger { background: var(--signal-red); }
.button:disabled {
  opacity: .58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: 24px 24px 0;
  background:
    linear-gradient(135deg, rgba(10, 128, 183, .14), transparent 36%),
    linear-gradient(315deg, rgba(216, 74, 58, .1), transparent 34%),
    var(--paper);
}
.auth-box {
  container-type: inline-size;
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid rgba(22, 49, 61, .12);
  border-top: 5px solid var(--signal-blue);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.register-box {
  width: min(560px, 100%);
  margin: 20px 0 12px;
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}
.auth-title {
  max-width: 100%;
  margin-bottom: 0;
  font-size: clamp(19px, 6.2cqw, 30px);
  line-height: 1.18;
  text-align: center;
  white-space: nowrap;
}
.auth-brand + .muted { text-align: center; }
.register-page .auth-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}
.register-page .auth-logo {
  width: 44px;
  height: 44px;
}
.register-page .auth-title {
  width: 100%;
  max-width: 100%;
  font-size: 28px;
  line-height: 1.22;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.register-activity-image {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 14px 0 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  overflow: hidden;
}
.register-activity-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  background: transparent;
}

.form-stack { display: grid; gap: 16px; min-width: 0; }
.form-stack > * { min-width: 0; }
.field {
  min-width: 0;
  display: grid;
  gap: 8px;
  color: #223039;
  font-size: 14px;
  font-weight: 800;
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.draw-form input,
.round-picker select {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.draw-form input,
.round-picker select { height: 44px; }
.field textarea {
  min-height: 112px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}
.field input[type="file"] {
  height: auto;
  padding: 11px;
}
.field select { appearance: auto; }
.alert {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #b9e6dc;
  border-radius: 6px;
  background: #e6f7f3;
  color: #075d53;
}
.alert.error {
  border-color: #f0b6aa;
  background: #fff0eb;
  color: #9b2d13;
}

.topbar {
  min-height: 68px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rail);
  font-size: 18px;
  flex-shrink: 0;
  max-width: 100%;
  line-height: 1.4;
}
.brand-mark span { min-width: 0; overflow-wrap: anywhere; }
.topbar > .actions { margin-left: auto; }
.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: contain;
}
.auth-logo {
  width: 48px;
  height: 48px;
}
.actions {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.container {
  width: min(1180px, calc(100% - 32px));
  margin: auto;
  padding: 30px 0 50px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head > div { flex: 1 1 280px; min-width: 0; }
.page-head h1 { margin-bottom: 12px; }
.page-head p { margin-bottom: 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(20, 41, 49, .05);
}
.stat {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  padding: 18px 20px;
  border-top: 4px solid var(--signal-blue);
}
.stat:nth-child(2) { border-top-color: var(--signal-cyan); }
.stat:nth-child(3) { border-top-color: var(--signal-red); }
.stat span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.stat strong {
  display: block;
  color: var(--rail);
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid > .backup-import-panel { grid-column: 1 / -1; }
.panel { padding: 20px; }
.panel p { line-height: 1.65; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.module-card {
  min-width: 0;
  position: relative;
  overflow: hidden;
  min-height: 252px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(10, 128, 183, .08), rgba(255, 255, 255, .72) 48%),
    #fff;
  box-shadow: 0 12px 32px rgba(20, 41, 49, .06);
}
.module-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: var(--signal-blue);
}
.module-card-lottery::after { background: var(--signal-red); }
.module-card-exam::after { background: var(--signal-cyan); }
.module-card-match::after { background: var(--signal-cyan); }
.module-card h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}
.module-card p {
  margin: 0;
  max-width: 34em;
  color: var(--muted);
  line-height: 1.75;
}
.module-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.module-meta span,
.fixed-fields span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6f8;
  color: #164b58;
  font-size: 12px;
  font-weight: 900;
}
.current-activity-card { margin-top: 16px; }
.current-activity-name {
  display: block;
  margin-bottom: 12px;
  color: var(--rail);
  font-size: 22px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.home-create-panel { margin: 16px 0; }
.home-create-panel .compact-form {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr) auto;
}
.activity-settings-panel { margin: 16px 0; }
.activity-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 24px;
}
.activity-settings-grid > form + form {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.activity-settings-grid > form { align-content: start; }
.activity-settings-grid p { margin: 0; }
.activity-settings-grid .button { justify-self: start; padding: 8px 16px; }
.module-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.module-checks .confirm-check { margin-top: 0; flex: 0 0 auto; max-width: 100%; }
.module-checks .confirm-check span { min-width: 0; line-height: 1.5; }
.home-activity-list { margin-top: 16px; }
.activity-description-text,
.register-description {
  white-space: normal;
  tab-size: 4;
  overflow-wrap: anywhere;
}
.draw-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title > * { min-width: 0; max-width: 100%; }
.section-title h2 { margin: 0; flex-shrink: 0; line-height: 1.4; }
.section-title > .actions { flex: 1 1 auto; justify-content: flex-end; }
.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-panel { margin-bottom: 16px; }
.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
}
.activity-main {
  display: grid;
  gap: 16px;
}
.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}
.qr-card {
  min-width: 0;
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.qr-card img {
  width: min(180px, 100%);
  height: auto;
  aspect-ratio: 1;
  border-radius: 6px;
}
.qr-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.qr-card small {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  word-break: break-all;
}
.activity-image-preview {
  margin: -4px 0 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.activity-image-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.activity-image-preview label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-image-preview input {
  width: auto;
  height: auto;
}
.activity-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.compact-list { margin-top: 12px; }
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.activity-row strong,
.activity-row small { display: block; }
.activity-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #0f5d6b;
  background: #e5f7fa;
  font-size: 13px;
  font-weight: 900;
}
.mini-pill {
  min-height: 24px;
  margin-left: 6px;
  padding: 0 8px;
  font-size: 12px;
}
.fixed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.field-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
}
.confirm-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--signal-blue);
}
.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin-top: 14px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.participant-table { min-width: 920px; }
.activity-table { min-width: 980px; }
.activity-table td:first-child { min-width: 180px; }
.activity-table td:nth-child(2) { min-width: 128px; }
.activity-table td:nth-child(3),
.activity-table td:nth-child(6) { white-space: nowrap; }
.activity-table td:nth-child(4),
.activity-table td:nth-child(5) { min-width: 112px; }
.activity-table td:last-child { min-width: 240px; }
.participant-table tr.is-winner-row td {
  background: #f4fbff;
}
.participant-table tr.is-inactive-row td {
  background: #f7f8f9;
  color: var(--muted);
}
.participant-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(26, 132, 92, .2);
  border-radius: 999px;
  background: rgba(26, 132, 92, .08);
  color: #176b4d;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.participant-status.is-inactive {
  border-color: var(--line);
  background: #f1f3f5;
  color: var(--muted);
}
.participant-search {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto auto;
  align-items: end;
  justify-content: start;
  gap: 10px;
  margin-top: 14px;
}
.participant-editor { border-top: 3px solid var(--rail); }
.participant-edit-form { margin-top: 18px; }
.participant-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.participant-edit-grid .is-wide { grid-column: 1 / -1; }
.participant-reason-field { max-width: 760px; }
.participant-history {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.participant-history h3 { margin: 0 0 12px; }
.participant-audit-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.participant-audit-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}
.participant-audit-list li > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.participant-audit-list span,
.participant-audit-list small {
  color: var(--muted);
  font-size: 12px;
}
.participant-audit-list p {
  margin: 7px 0 5px;
  color: var(--ink);
  font-size: 13px;
  word-break: break-word;
}
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.table-actions > form { flex: 0 0 auto; margin: 0; }
.table-actions .button { white-space: nowrap; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-detail summary {
  color: var(--rail);
  font-weight: 900;
  cursor: pointer;
}
.activity-detail p {
  margin: 8px 0 6px;
  color: var(--muted);
}
.activity-detail small {
  display: block;
  max-width: 360px;
  color: var(--muted);
  word-break: break-all;
}
.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
.winner-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(10, 128, 183, .22);
  border-radius: 999px;
  background: rgba(10, 128, 183, .08);
  color: #0a5f7f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.winner-badge.is-empty {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
}
.inline-confirm summary.button {
  list-style: none;
  cursor: pointer;
}
.inline-confirm summary.button::-webkit-details-marker {
  display: none;
}
.inline-confirm-panel {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #efc2b7;
  border-radius: 7px;
  background: #fff8f6;
}
.inline-confirm-panel span {
  color: #7f321f;
  font-size: 12px;
  font-weight: 800;
}
.register-description {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  line-height: 1.7;
}
.register-page .muted {
  line-height: 1.65;
}
.register-page .form-stack {
  gap: 14px;
}
.register-page .button[type="submit"] {
  width: 100%;
  min-height: 46px;
}

.match-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.match-input-panel {
  border-top: 4px solid var(--signal-blue);
}
.match-input-panel-right {
  border-top-color: var(--signal-cyan);
}
.match-input-panel textarea {
  min-height: 420px;
  line-height: 1.75;
}
.match-result-panel {
  margin-top: 16px;
}
.match-message {
  min-height: 26px;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.match-message[data-state="success"] {
  color: #0f5d6b;
}
.match-message[data-state="error"] {
  color: #9b2d13;
}
.match-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfb;
}
.match-sort label {
  cursor: pointer;
}
.match-sort input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.match-sort span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.match-sort input:checked + span {
  background: var(--rail);
  color: #fff;
}
.match-sort input:focus-visible + span {
  outline: 3px solid rgba(10, 128, 183, .38);
  outline-offset: 2px;
}
.match-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.match-empty {
  grid-column: 1 / -1;
  margin: 0;
}
.match-result-card {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--signal-blue);
  border-radius: 7px;
  background: #fbfcfd;
}
.match-result-card:nth-child(2n) {
  border-left-color: var(--signal-cyan);
}
.match-pair-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.match-result-card strong {
  color: var(--rail);
  font-size: 18px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}
.match-result-card span:last-child {
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.exam-setting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.exam-readiness-panel,
.exam-question-import,
.exam-question-editor,
.exam-question-list,
.exam-candidates-panel,
.exam-results-panel { margin-top: 16px; }
.exam-question-cards { display: grid; gap: 12px; }
.exam-admin-question {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}
.exam-admin-question header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.exam-admin-question header strong {
  white-space: pre-wrap;
  line-height: 1.65;
}
.exam-admin-question header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.exam-option-list {
  margin: 12px 0;
  padding-left: 30px;
  color: var(--muted);
  line-height: 1.75;
}
.exam-option-list .is-correct {
  color: #087266;
  font-weight: 900;
}
.exam-list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px auto auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}
.exam-list-toolbar .field { min-width: 0; }
.exam-list-toolbar .button { white-space: nowrap; }
.exam-page-size-field select { min-width: 140px; }
.exam-candidate-editor {
  margin-top: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.exam-candidate-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.exam-candidate-table { min-width: 980px; }
.exam-result-table { min-width: 1120px; }
.attempt-remaining {
  color: #087266;
  font-weight: 900;
}
.attempt-remaining.is-empty { color: var(--signal-red); }
.status-note,
.void-audit {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.exam-result-table tr.is-voided-row td {
  background: #fff8f6;
  color: #76554d;
}
.exam-result-table th:last-child,
.exam-result-table td:last-child {
  width: 76px;
  white-space: nowrap;
}
.exam-result-table td:last-child form { margin: 0; }
.exam-void-dialog {
  width: min(520px, calc(100% - 32px));
  color: var(--ink);
}
.exam-void-dialog .dialog-panel { text-align: left; }
.exam-void-dialog h2 {
  margin: 0 0 14px;
  text-align: center;
}
.exam-void-summary {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fa;
  color: var(--ink) !important;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55 !important;
  text-align: center;
  overflow-wrap: anywhere;
}
.dialog-reason-field {
  margin-top: 16px;
  text-align: left;
}
.dialog-reason-field textarea { min-height: 104px; }
.exam-void-help {
  margin: 8px 0 0;
  line-height: 1.55 !important;
  text-align: left;
}
.exam-import-rules {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.exam-import-rules strong { color: var(--ink); }

.exam-public-page {
  place-items: start center;
}
.exam-public-box {
  width: min(780px, 100%);
  margin: 24px 0 16px;
}
.exam-instructions {
  white-space: pre-wrap;
}
.exam-taking-toolbar {
  position: sticky;
  z-index: 4;
  top: 0;
  margin: 0 -10px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 20px rgba(20, 41, 49, .07);
}
.exam-taking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
.exam-taking-head strong,
.exam-taking-head small { display: block; }
.exam-taking-summary { min-width: 0; }
.exam-taking-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
}
.exam-taking-head small {
  margin-top: 5px;
  color: var(--muted);
}
.exam-taking-meta span {
  color: var(--signal-blue);
  font-size: 12px;
  font-weight: 900;
}
.exam-timer {
  min-width: 104px;
  color: var(--rail);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  text-align: right;
}
.exam-timer.is-warning { color: var(--signal-red); }
.exam-progress-track {
  display: block;
  width: 100%;
  height: 5px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #e7eef0;
  overflow: hidden;
  appearance: none;
}
.exam-progress-track::-webkit-progress-bar { background: #e7eef0; }
.exam-progress-track::-webkit-progress-value { background: var(--signal-blue); }
.exam-progress-track::-moz-progress-bar { background: var(--signal-blue); }
.exam-save-status {
  min-height: 28px;
  padding: 8px 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.exam-save-status.is-error { color: var(--signal-red); }
.exam-paper {
  display: grid;
  gap: 14px;
  text-align: left;
}
.exam-question {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.exam-question-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.65;
  text-align: left;
  white-space: normal;
}
.exam-question-number {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--signal-blue);
  color: #fff;
  font-size: 14px;
  line-height: 1;
}
.exam-question-title {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
  text-align: left;
}
.exam-question-head small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.exam-public-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.exam-public-options label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 50px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  line-height: 1.55;
  cursor: pointer;
}
.exam-public-options label:has(input:checked) {
  border-color: var(--signal-blue);
  background: rgba(10, 128, 183, .07);
}
.exam-public-options input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: var(--signal-blue);
}
.exam-option-label {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--rail);
  line-height: 1;
}
.exam-option-text {
  min-width: 0;
  padding-top: 2px;
  overflow-wrap: anywhere;
}
.exam-public-options label:has(input:checked) .exam-option-label {
  border-color: var(--signal-blue);
  background: var(--signal-blue);
  color: #fff;
}
.exam-submit-button {
  min-height: 50px;
  margin-top: 8px;
}
.exam-candidate-summary { display: grid; gap: 14px; }
.exam-candidate-summary .section-title,
.exam-candidate-summary p { margin-bottom: 0; }
.exam-best-result {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 20px;
  border: 1px solid #b9e6dc;
  border-radius: 8px;
  background: #eaf8f5;
}
.exam-best-result span,
.exam-best-result small { color: var(--muted); }
.exam-best-result strong {
  color: #087266;
  font-size: 36px;
}
.exam-attempt-list { display: grid; gap: 8px; }
.exam-attempt-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.exam-attempt-list span { color: var(--muted); }
.exam-attempt-list a {
  color: var(--signal-blue);
  font-size: 13px;
  font-weight: 900;
}
.exam-review {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.exam-review .section-title { margin-bottom: 0; }
.exam-review-list { display: grid; gap: 12px; }
.exam-review-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfd;
}
.exam-review-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.exam-review-item header strong {
  line-height: 1.65;
  white-space: pre-wrap;
}
.exam-review-item header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.exam-review-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.exam-review-answer-grid > div {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 8px;
}
.exam-review-answer-grid .is-correct {
  border: 1px solid #b9e6dc;
  background: #eaf8f5;
  color: #075d53;
}
.exam-review-answer-grid .is-selected {
  border: 1px solid #f0c6bc;
  background: #fff3ef;
  color: #8a321e;
}
.exam-review-answer-grid ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  line-height: 1.55;
}
.exam-review-answer-grid p { margin: 8px 0 0; }
.exam-forget-form .button { width: 100%; }
.round-list { display: grid; gap: 10px; }
.round-history { margin-top: 16px; }
.round-detail {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}
.round-detail header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.round-detail header strong,
.round-detail header span { display: block; }
.backend-winners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
}
.backend-winners > span {
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--signal-blue);
  border-radius: 6px;
  background: #fff;
}
.backend-winner strong,
.backend-winner small { display: block; }
.backend-winner strong {
  margin-bottom: 5px;
  color: var(--rail);
  font-size: 16px;
}
.backend-winner small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.danger-zone {
  margin-top: 18px;
  border: 1px solid #efc2b7;
  border-radius: var(--radius);
  background: #fff8f6;
}
.danger-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}
.danger-content p {
  margin: 5px 0 0;
  color: #7f321f;
  line-height: 1.65;
}
.batch-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
}
.batch-toolbar form { flex: 1 1 420px; }
.batch-select-field { width: min(100%, 560px); }
.batch-select-field select { width: 100%; }
.maintenance-zone { padding: 20px; }
.maintenance-zone .section-title { margin-bottom: 14px; }
.maintenance-list { display: grid; gap: 12px; }
.maintenance-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.3fr) auto auto;
  align-items: end;
  gap: 14px;
  padding: 14px;
  border: 1px solid #efc2b7;
  border-radius: 6px;
  background: #fff;
}
.maintenance-item > div { align-self: center; min-width: 0; }
.maintenance-item strong,
.maintenance-item small { display: block; }
.maintenance-item small { margin-top: 5px; color: var(--muted); }
.maintenance-item .confirm-check { align-self: center; margin: 0; }
.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(11, 31, 51, .28);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
.confirm-dialog::backdrop { background: rgba(7, 25, 34, .72); }
.dialog-panel { padding: 28px; text-align: center; }
.dialog-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff0eb;
  color: var(--signal-red);
  font-size: 26px;
  font-weight: 950;
}
.dialog-panel h2 { margin-bottom: 10px; }
.dialog-panel p { color: var(--muted); line-height: 1.65; }
.participant-status-dialog .dialog-panel { text-align: left; }
.participant-status-dialog .dialog-icon { margin-left: 0; }
.participant-status-dialog h2 { text-align: left; }
.participant-status-help { margin-top: 8px; }

.account-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.account-password-panel .button {
  justify-self: start;
}

.audit-table td:nth-child(1),
.audit-table td:nth-child(2),
.audit-table td:nth-child(5),
.audit-table td:nth-child(6) {
  white-space: nowrap;
}

.audit-table td:nth-child(4) {
  min-width: 240px;
}
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.screen-page {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #edf3f4;
  color: var(--ink);
  --screen-valid: var(--signal-blue);
  --screen-eligible: var(--signal-cyan);
  --screen-winner: var(--signal-red);
  --screen-primary: var(--screen-valid);
  --screen-primary-soft: rgba(10, 128, 183, .1);
  --screen-primary-line: rgba(10, 128, 183, .22);
  --screen-control: var(--screen-eligible);
  --screen-control-soft: rgba(95, 214, 204, .16);
  --screen-warn: #b57d00;
  --screen-warn-soft: rgba(181, 125, 0, .12);
  --screen-danger: var(--screen-winner);
}
.screen-shell {
  position: relative;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #edf2f3 0%, #f7f9f9 48%, #eef3f4 100%);
}
.screen-shell::before {
  content: "";
  position: fixed;
  inset: 68px 0 auto;
  z-index: -1;
  height: 220px;
  background: linear-gradient(90deg, rgba(10, 128, 183, .04), transparent 42%, rgba(216, 74, 58, .025));
  pointer-events: none;
}
.screen-shell::after {
  content: none;
}
@supports (height: 100dvh) {
  .screen-page,
  .screen-shell {
    height: 100dvh;
  }
}
.screen-header {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  box-shadow: 0 3px 12px rgba(20, 41, 49, .035);
}
.screen-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.screen-brand > div { min-width: 0; }
.screen-logo {
  width: 36px;
  height: 36px;
}
.screen-header h1 {
  margin: 0;
  color: var(--rail);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}
.screen-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(72vw, 760px);
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--screen-primary);
  box-shadow: 0 0 18px rgba(10, 128, 183, .34);
}
.is-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}
.screen-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, .68fr) minmax(0, 1.32fr);
  align-items: stretch;
  gap: clamp(10px, 1.3vw, 16px);
  padding: clamp(10px, 1.8vh, 16px) 28px clamp(8px, 1.2vh, 12px);
}
.screen-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.3vw, 16px);
}
.screen-panel {
  min-width: 0;
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: clamp(13px, 1.6vw, 18px);
  border: 1px solid rgba(22, 49, 61, .11);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 41, 49, .055);
}
.control-panel,
.rolling-panel,
.result-panel {
  display: flex;
  flex-direction: column;
}
.control-panel {
  flex: 0 0 auto;
}
.control-panel { background: #fff; }
.rolling-panel { flex: 1; background: #fff; }
.result-panel { background: #fff; }
.result-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(10px, 1.6vh, 14px);
}
.result-titlebar .panel-label {
  flex: 1 1 auto;
  width: auto;
  min-width: 160px;
  margin-bottom: 0;
}
.screen-activity-chip {
  width: min(52%, 430px);
  min-width: 210px;
  max-width: 430px;
  flex: 0 1 430px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-top: 0;
  color: var(--muted);
}
.screen-activity-chip span {
  flex: 0 0 auto;
  color: var(--screen-valid);
  font-size: clamp(11px, .85vw, 13px);
  font-weight: 850;
}
.screen-activity-chip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rail);
  max-width: 100%;
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.25;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-panel::after {
  content: none;
}
.panel-label {
  --panel-accent: var(--screen-primary);
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -1px 0 clamp(10px, 1.6vh, 14px);
  padding: 0 0 11px;
  border-bottom: 1px solid rgba(22, 49, 61, .1);
  border-radius: 0;
  background: transparent;
  color: var(--rail);
  font-size: clamp(18px, 1.55vw, 23px);
  line-height: 1.1;
  font-weight: 950;
}
.panel-label::before {
  content: "";
  width: 4px;
  height: 1em;
  flex: 0 0 4px;
  background: var(--panel-accent);
}
.control-panel .panel-label {
  --panel-accent: var(--screen-control);
}
.panel-label-roll {
  --panel-accent: var(--screen-warn);
}
.panel-label-hot {
  --panel-accent: var(--screen-valid);
}
.round-picker { margin-bottom: clamp(8px, 1.4vh, 12px); }
.round-picker label {
  display: grid;
  gap: 8px;
  color: var(--rail);
  font-size: 13px;
  font-weight: 950;
}
.round-picker select {
  height: 44px;
  border-color: rgba(22, 49, 61, .16);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
.screen-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1.1vw, 10px);
  margin-bottom: clamp(8px, 1.4vh, 12px);
}
.screen-stats > div {
  min-height: clamp(66px, 9.8vh, 82px);
  display: grid;
  align-content: space-between;
  padding: clamp(10px, 1.4vh, 13px) 14px;
  border: 1px solid rgba(22, 49, 61, .1);
  border-left: 4px solid var(--screen-primary);
  border-radius: 7px;
  background: #f7f9f9;
}
.screen-stats > div:nth-child(2) { border-left-color: var(--screen-control); }
.screen-stats span,
.result-card span {
  display: block;
  color: var(--muted);
}
.screen-stats strong {
  display: block;
  color: var(--screen-primary);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1;
}
.screen-stats > div:nth-child(2) strong { color: var(--screen-control); }
.draw-round-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}
.draw-round-form [data-start] { min-width: 128px; }
.round-summary {
  min-height: clamp(38px, 5.8vh, 46px);
  display: flex;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid rgba(22, 49, 61, .12);
  border-radius: 6px;
  background: #f7f9f9;
  color: var(--muted);
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 750;
  line-height: 1.5;
}
.screen-message {
  min-height: 22px;
  display: flex;
  align-items: center;
  padding: 2px 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(98, 113, 122, .86);
  font-size: clamp(11px, .95vw, 13px);
  font-weight: 800;
  line-height: 1.3;
}
.screen-message:empty { visibility: hidden; }
.screen-message[data-state="success"] {
  color: rgba(15, 93, 107, .78);
}
.screen-message[data-state="error"] {
  color: rgba(155, 45, 19, .82);
}
.rolling-stage {
  position: relative;
  container-type: size;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  margin-top: 0;
  border: 1px solid rgba(22, 49, 61, .11);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f8fafa);
  overflow: hidden;
}
.rolling-stage::before {
  content: none;
}
.rolling-name {
  max-width: 100%;
  padding: 8px;
  color: #53656e;
  font-size: clamp(18px, min(14cqw, 35cqh), 52px);
  line-height: 1.2;
  font-weight: 950;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: none;
}
.screen-shell.is-drawing .rolling-name,
.screen-shell.has-drawn .rolling-name {
  color: var(--screen-warn);
  font-size: clamp(18px, min(16cqw, 35cqh), 86px);
  text-shadow: 0 8px 24px rgba(181, 125, 0, .13);
}
.screen-shell.is-drawing .rolling-stage,
.screen-shell.has-drawn .rolling-stage {
  border-color: rgba(181, 125, 0, .32);
  box-shadow: inset 0 0 36px rgba(181, 125, 0, .055);
}
.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  margin-bottom: clamp(10px, 1.5vh, 14px);
  padding-bottom: clamp(10px, 1.5vh, 14px);
  border-bottom: 1px solid rgba(22, 49, 61, .09);
}
.result-heading > div { min-width: 0; }
.result-heading h3 {
  margin: 0;
  color: var(--rail);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.3;
}
.round-progress {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.round-progress span {
  color: var(--muted);
  font-size: clamp(11px, .9vw, 13px);
  font-weight: 800;
}
.round-progress strong {
  color: var(--screen-valid);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(25px, 2.8vw, 36px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  align-content: start;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: rgba(22, 49, 61, .22) transparent;
  scrollbar-width: thin;
}
.result-card {
  position: relative;
  min-height: clamp(108px, 14vh, 118px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(22, 49, 61, .12);
  border-left: 4px solid var(--screen-valid);
  border-radius: 7px;
  background: #fff;
}
.result-card-body {
  min-width: 0;
}
.result-card-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-card:nth-child(3n + 2),
.result-card:nth-child(3n) { border-left-color: var(--screen-valid); }
.result-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--rail);
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.result-card .button {
  position: relative;
  justify-self: end;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}
.result-card .button::before {
  content: "";
  position: absolute;
  inset: -6px;
}
.screen-page .button {
  background: var(--rail);
  color: #fff;
}
.screen-page .button:hover { background: #0e2631; }
.screen-page [data-start] { background: var(--screen-primary); }
.screen-page [data-start]:hover { background: #076f9e; }
.screen-page .button.secondary {
  border: 1px solid rgba(22, 49, 61, .14);
  background: #fff;
  color: var(--rail);
}
.screen-page .button.danger {
  border: 1px solid rgba(216, 74, 58, .24);
  background: #fff7f5;
  color: #ad3528;
}
.screen-page .button.danger:hover {
  background: #ffede8;
  box-shadow: none;
}

@media (max-width: 980px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .screen-control-stack {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .rolling-stage { min-height: 0; }
  .screen-header h1 { font-size: 18px; }
  .result-titlebar {
    flex-direction: column;
    gap: 8px;
  }
  .screen-activity-chip {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-basis: auto;
    align-items: flex-start;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .account-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .stats,
  .grid,
  .home-grid,
  .match-layout,
  .activity-layout,
  .activity-settings-grid,
  .compact-form,
  .home-create-panel .compact-form { grid-template-columns: 1fr; }
  .activity-settings-grid > form + form {
    padding-top: 20px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .exam-setting-grid { grid-template-columns: 1fr; }
  .exam-list-toolbar { grid-template-columns: 1fr; }
  .batch-toolbar { align-items: stretch; flex-direction: column; }
  .batch-toolbar form { flex-basis: auto; }
  .maintenance-item { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .participant-search,
  .participant-edit-grid { grid-template-columns: 1fr; }
  .participant-edit-grid .is-wide { grid-column: auto; }
  .exam-page-size-field select { width: 100%; }
  .exam-candidate-edit-grid { grid-template-columns: 1fr; }
  .page-head,
  .topbar,
  .danger-content {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .page-head > div { flex-basis: auto; }
  .screen-main,
  .screen-header {
    padding-left: 16px;
    padding-right: 16px;
  }
  .draw-form:not(.draw-round-form),
  .dialog-actions { grid-template-columns: 1fr; }
  .round-detail header {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions { width: 100%; }
  .actions .button,
  .actions form,
  .actions button { width: 100%; }
  .topbar { gap: 12px; padding: 12px 16px; }
  .topbar > .actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }
  .topbar > .actions .button { padding: 8px; font-size: 14px; }
  .section-title > .actions { justify-content: flex-start; }
  .auth-page .site-footer { position: static; }
  .participant-audit-list li > div {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  h1 { font-size: 28px; }
  .container { width: min(100% - 24px, 1180px); }
  .panel,
  .auth-box,
  .screen-panel { padding: 16px; }
  .register-page {
    place-items: start center;
    padding: 12px 12px 0;
  }
  .register-box {
    width: 100%;
    margin: 10px 0 8px;
    padding: 18px;
  }
  .register-page .auth-brand {
    gap: 8px;
    margin-bottom: 12px;
  }
  .register-page .auth-logo {
    width: 38px;
    height: 38px;
  }
  .register-page .auth-title {
    font-size: 22px;
    line-height: 1.24;
  }
  .register-activity-image {
    aspect-ratio: 16 / 9;
    margin: 12px 0 14px;
    border-radius: 6px;
  }
  .register-description {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.65;
  }
  .register-page .field {
    gap: 6px;
    font-size: 13px;
  }
  .register-page .field input,
  .register-page .field select {
    height: 42px;
  }
  .register-page .field textarea {
    min-height: 104px;
  }
  .register-page .site-footer {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.45;
  }
  .exam-public-page {
    display: block;
    padding: 0;
    background: #f3f6f7;
  }
  .exam-public-box {
    min-height: 100vh;
    margin: 0;
    padding: 18px 14px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 4px solid var(--signal-blue);
    border-radius: 0;
    box-shadow: none;
  }
  .exam-public-page .site-footer { display: none; }
  .exam-taking-page .exam-public-box {
    padding-top: 18px;
  }
  .exam-taking-toolbar {
    top: 0;
    margin: -18px -14px 0;
  }
  .exam-taking-head {
    padding: calc(11px + env(safe-area-inset-top)) 14px 11px;
    box-shadow: 0 8px 20px rgba(20, 41, 49, .09);
  }
  .exam-taking-head strong { font-size: 14px; }
  .exam-taking-meta small { display: none; }
  .exam-progress-track {
    width: 100%;
    border-radius: 0;
  }
  .exam-save-status {
    padding-top: 10px;
    text-align: left;
  }
  .exam-timer {
    min-width: 76px;
    font-size: 24px;
  }
  .exam-paper { gap: 12px; }
  .exam-question {
    padding: 14px 12px;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(20, 41, 49, .04);
  }
  .exam-question-head {
    gap: 9px;
    font-size: 16px;
    line-height: 1.6;
  }
  .exam-question-number {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .exam-public-options { gap: 9px; }
  .exam-public-options label {
    min-height: 52px;
    align-items: center;
    padding: 10px;
    border-radius: 9px;
    font-size: 15px;
  }
  .exam-public-options input { margin-top: 0; }
  .exam-option-text { padding-top: 0; }
  .exam-submit-button {
    position: sticky;
    z-index: 2;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: 100%;
    border: 2px solid #fff;
    box-shadow: 0 10px 30px rgba(7, 25, 34, .25);
  }
  .exam-attempt-list > div {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .exam-review-answer-grid { grid-template-columns: 1fr; }
  .exam-review-item { padding: 12px; }
  .exam-review-item header { flex-direction: column; }
  .exam-admin-question header { flex-direction: column; }
  .screen-header { padding: 10px 12px; gap: 10px; }
  .screen-header h1 { font-size: 16px; line-height: 1.4; }
  .screen-header > .button { flex: 0 0 auto; min-height: 36px; padding: 6px 10px; font-size: 12px; }
  .screen-logo { width: 30px; height: 30px; }
  .screen-brand { gap: 8px; }
  .screen-main { padding: 10px 12px 8px; gap: 10px; }
  .screen-control-stack { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .screen-panel { padding: 12px; }
  .screen-panel .panel-label { font-size: 18px; margin-bottom: 8px; padding-bottom: 6px; }
  .round-picker { margin-bottom: 8px; }
  .round-picker label { gap: 4px; }
  .round-picker select { height: 36px; }
  .screen-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
  .screen-stats > div { min-height: 60px; padding: 8px 10px; }
  .screen-stats span { font-size: 12px; }
  .screen-stats strong { font-size: 26px; }
  .draw-round-form { gap: 8px; }
  .draw-round-form .button { padding: 6px 10px; font-size: 12px; }
  .round-summary { min-height: 38px; padding: 6px 8px; font-size: 12px; }
  .screen-message { min-height: 18px; font-size: 11px; }
  .rolling-panel { min-height: 106px; }
  .rolling-stage { min-height: 48px; }
  .rolling-name { font-size: clamp(18px, min(14cqw, 35cqh), 26px); }
  .result-grid { grid-template-columns: minmax(0, 1fr); }
  .result-titlebar { gap: 4px; margin-bottom: 8px; }
  .result-titlebar .panel-label { margin-bottom: 0; }
  .result-heading { gap: 8px; margin-bottom: 8px; }
  .result-heading h3 { font-size: 18px; line-height: 1.4; }
  .round-progress { gap: 6px; }
  .round-progress strong { font-size: 26px; }
  .screen-shell.is-drawing .rolling-name,
  .screen-shell.has-drawn .rolling-name { font-size: clamp(18px, min(16cqw, 35cqh), 32px); }
  .result-card { min-height: 108px; }
  .result-card strong { font-size: 22px; }
}

@media (max-height: 620px) {
  .screen-control-stack { overflow-y: auto; }
  .screen-main { grid-template-rows: minmax(0, 1fr); }
  .screen-main > .screen-control-stack { min-height: 0; }
  .screen-control-stack .rolling-panel { flex: 0 0 150px; }
}

@media (max-height: 620px) and (min-width: 561px) and (max-width: 980px) {
  .screen-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .screen-control-stack { display: flex; }
  .result-titlebar { align-items: stretch; }
  .result-titlebar .panel-label { min-width: 0; width: 100%; }
  .result-heading { flex-wrap: wrap; }
}

@media (max-height: 740px) and (max-width: 560px) {
  .screen-main { grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr); }
  .screen-control-stack { display: flex; overflow-y: auto; }
  .screen-control-stack .rolling-panel { flex: 0 0 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
