:root {
  --background: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f1f3f5;
  --foreground: #14171a;
  --muted: #5d6874;
  --line: #d9dee5;
  --line-strong: #b9c0c9;
  --red: #c91824;
  --red-dark: #921923;
  --gold: #9d7132;
  --blue: #244f73;
  --green: #23704d;
  --shadow: 0 18px 60px rgba(20, 23, 26, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--background);
  overflow-x: hidden;
  width: 100%;
}

body {
  color: var(--foreground);
  font-family: Arial, Helvetica, "Noto Sans", "Apple SD Gothic Neo", "Microsoft YaHei", "PingFang SC", sans-serif;
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
  font-size: 1rem;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.loading-shell,
.site-shell {
  margin: 0 auto;
  max-width: 940px;
  min-height: 100svh;
  padding: 16px;
  width: 100%;
}

.loading-shell {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-weight: 850;
  justify-items: center;
}

.home-shell {
  display: flex;
  flex-direction: column;
}

.welcome-screen {
  align-items: center;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 18px;
  justify-content: center;
  min-height: 0;
  text-align: center;
}

.standard-notice {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.82rem;
  font-weight: 750;
  gap: 7px;
  justify-content: center;
  line-height: 1.25;
  padding: 10px 0 2px;
  text-align: center;
}

.standard-notice img {
  flex: 0 0 auto;
  height: 1.7em;
  width: auto;
}

.welcome-logo {
  height: auto;
  max-height: 210px;
  object-fit: contain;
  width: min(88vw, 460px);
}

.welcome-copy {
  display: grid;
  gap: 8px;
}

.welcome-copy h1 {
  font-size: clamp(2rem, 9vw, 4.25rem);
  font-weight: 850;
  line-height: 0.96;
  margin: 0;
}

.intro-text,
.result-copy,
.welcome-copy p {
  color: var(--muted);
  font-size: clamp(1rem, 3.2vw, 1.18rem);
  line-height: 1.55;
  margin: 0;
}

.language-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 620px);
}

.language-button,
.primary-action,
.secondary-action,
.text-action,
.secondary-link,
.admin-link,
.segmented,
.instructor-option {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  text-decoration: none;
}

.language-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--foreground);
  flex-direction: column;
  gap: 2px;
  min-height: 72px;
  padding: 12px;
}

.language-button span {
  font-size: 1.08rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.language-button small,
.report-row small,
.student-row small,
.panel-heading span,
.review-answer,
.review-status {
  color: var(--muted);
}

.welcome-links,
.staff-actions,
.exam-footer,
.submit-row,
.admin-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.welcome-links {
  justify-content: center;
  width: min(100%, 620px);
}

.admin-link,
.text-action {
  color: var(--blue);
  font-weight: 850;
  padding: 0 10px;
}

.exam-topbar,
.admin-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 auto 14px;
  max-width: 1180px;
}

.brand-button,
.admin-brand {
  align-items: center;
  color: var(--foreground);
  display: flex;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.brand-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 900;
  padding: 0;
}

.brand-mark,
.admin-brand img {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 52px;
  object-fit: contain;
  padding: 3px;
  width: 52px;
}

.language-picker {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px;
}

.language-picker span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.language-picker select {
  background: transparent;
  border: 0;
  color: var(--foreground);
  font-weight: 800;
  min-height: 34px;
}

.exam-panel,
.admin-panel,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.exam-panel {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 860px;
  padding: clamp(18px, 5vw, 34px);
}

.intro-panel {
  margin-top: clamp(16px, 6vw, 52px);
}

.eyebrow {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  letter-spacing: 0;
}

.exam-panel h1,
.admin-header h1 {
  font-size: clamp(1.55rem, 6vw, 3.35rem);
  font-weight: 850;
  line-height: 1.08;
  margin: 0;
}

.question-title {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.question-blank {
  border-bottom: 0.12em solid currentColor;
  display: inline-block;
  inline-size: clamp(5.5rem, 34vw, 11rem);
  margin: 0 0.08em;
  max-inline-size: 100%;
  transform: translateY(-0.08em);
  vertical-align: baseline;
}

.question-ad-slot,
.result-ad-list {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: 100%;
}

.question-ad-banner {
  border: 1px solid #0b0b0b;
  border-radius: 4px;
  display: block;
  height: auto;
  max-width: 640px;
  width: 100%;
}

.result-ad-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  max-width: 860px;
}

.result-ad-link {
  border-radius: 6px;
  display: block;
  outline-offset: 3px;
}

.result-ad-link:hover .question-ad-banner {
  border-color: var(--red);
}

.inactive-link {
  cursor: default;
}

.inline-notice,
.validation-message,
.notice-row {
  border-left: 4px solid var(--gold);
  color: #3d4650;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px;
}

.inline-notice,
.notice-row {
  background: #fff8ec;
}

.validation-message {
  background: #fff1f2;
  border-left-color: var(--red);
}

.action-feedback-slot {
  align-items: center;
  display: inline-flex;
  flex: 1 1 240px;
}

.action-feedback {
  display: inline-flex;
  margin: 0;
  min-height: 48px;
  width: 100%;
}

.registration-form,
.missed-review,
.missed-question-list,
.report-table,
.focus-list {
  display: grid;
  gap: 12px;
}

.registration-form label,
.instructor-picker label {
  display: grid;
  gap: 6px;
}

.registration-form label span,
.instructor-picker label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.registration-form input,
.registration-form select,
.registration-form textarea,
.instructor-picker input,
.analytics-toolbar select {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--foreground);
  min-height: 48px;
  padding: 0 12px;
  width: 100%;
}

.registration-form input:disabled,
.registration-form select:disabled,
.registration-form textarea:disabled {
  background: #f4f7fa;
  color: #5e6974;
  opacity: 1;
}

.registration-form textarea {
  line-height: 1.4;
  min-height: 132px;
  padding: 12px;
  resize: vertical;
}

.application-type-field,
.autofill-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
}

.application-type-field {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.application-type-field legend,
.autofill-settings legend {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
  padding: 0 6px;
}

.application-type-field label {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
}

.application-type-field input {
  accent-color: var(--red);
  height: 22px;
  min-height: 0;
  width: 22px;
}

.autofill-settings {
  background: #fbfcfd;
}

.license-template-card {
  border-color: var(--line-strong);
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 12px 12px;
}

.license-template-card legend {
  color: var(--foreground);
  font-size: 0.98rem;
}

.license-template-header {
  background: var(--foreground);
  border-radius: 8px;
  color: #fff;
  display: grid;
  gap: 2px;
  margin: 0 -12px 2px;
  padding: 12px;
  grid-column: 1 / -1;
}

.initial-template .license-template-header {
  border-top: 5px solid var(--red);
}

.renewal-template .license-template-header {
  border-top: 5px solid var(--gold);
}

.license-template-header strong {
  font-size: 1.1rem;
  font-weight: 950;
}

.license-template-header span,
.license-copy-row span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.license-copy-row {
  align-items: center;
  background: #fff8ec;
  border: 1px solid rgba(157, 113, 50, 0.28);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 10px;
}

.license-copy-row span {
  color: #73521f;
}

.scan-panel {
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  max-width: 760px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.scan-site-shell {
  max-width: 820px;
  overflow-x: hidden;
}

.scan-panel > .eyebrow,
.scan-panel > h1,
.scan-panel > .intro-text,
.scan-panel > .scan-mode-note,
.scan-panel > .scan-device-note,
.scan-fallbacks {
  max-width: 620px;
  min-width: 0;
  width: 100%;
}

.scan-column {
  display: grid;
  gap: 12px;
  justify-items: stretch;
  margin-inline: auto;
  max-width: 420px;
  min-width: 0;
  width: 100%;
}

.scan-mode-note {
  background: #f8fafc;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 900;
  margin: 0;
  padding: 10px 12px;
}

.scan-device-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  font-weight: 800;
  margin: 0;
  padding: 10px 12px;
}

.scan-camera-shell {
  align-self: center;
  background: #121619;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  height: min(56vh, 520px);
  height: min(56svh, 520px);
  width: 100%;
  justify-self: center;
  margin-inline: auto;
  min-height: 300px;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.scan-camera-shell video {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.scan-target {
  border: 3px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 0 20px rgba(157, 113, 50, 0.45);
  height: 32%;
  left: 50%;
  max-height: 160px;
  max-width: 350px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 84%;
}

.scan-fallbacks {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.scan-action-row,
.scan-continue-row,
.scan-upload,
#scan-status {
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.barcode-paste {
  display: grid;
  gap: 6px;
}

.barcode-manual-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.barcode-manual-entry[open] {
  display: grid;
  gap: 10px;
}

.barcode-manual-entry summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
  min-height: 44px;
  padding-block: 10px;
}

.barcode-manual-entry textarea {
  font-family: inherit;
}

.careful-id-entry {
  border: 2px solid var(--red);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px 12px;
}

.careful-id-entry h2 {
  color: var(--red);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.2;
  margin: 0;
  text-transform: uppercase;
}

.support-barcode-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.support-barcode-entry summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 850;
  min-height: 40px;
  padding-block: 9px;
}

.manual-entry-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  font-weight: 850;
  margin: 0;
  padding: 10px 12px;
}

.manual-id-form {
  margin-top: 8px;
}

.scan-upload {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  color: var(--foreground);
  display: grid;
  gap: 8px;
  padding: 12px;
}

#scan-status {
  display: grid;
  gap: 10px;
  min-width: 0;
}

#scan-status:empty {
  display: none;
}

.scan-upload span {
  color: var(--blue);
  font-weight: 850;
}

.scan-upload input {
  min-block-size: 44px;
}

.id-scan-preview,
.id-scan-review,
.form-autofill-review {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.scan-review-form,
.form-autofill-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scan-review-form .submit-row,
.form-autofill-form .submit-row,
.form-mode-field,
.form-mode-note,
.full-span {
  grid-column: 1 / -1;
}

.form-autofill-review {
  border-left-color: var(--red);
}

.form-capture-meta {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.cert-link,
.cert-download {
  min-height: 44px;
}

.cert-note {
  color: var(--gold);
  font-weight: 850;
}

.instructor-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.instructor-options {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  max-height: min(52svh, 360px);
  overflow-y: auto;
  padding: 6px;
}

.instructor-options p,
.selected-instructor {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  margin: 0;
}

.instructor-options p {
  padding: 10px;
}

.selected-instructor {
  background: #f5fbf8;
  border: 1px solid rgba(35, 112, 77, 0.26);
  border-radius: 8px;
  color: var(--green);
  padding: 10px 12px;
}

.instructor-option {
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--foreground);
  justify-content: flex-start;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  text-align: left;
}

.primary-action,
.secondary-action,
.secondary-link,
.segmented {
  border: 1px solid transparent;
  font-weight: 850;
  padding: 0 18px;
}

.primary-action {
  background: var(--red);
  color: #fff;
}

.primary-action:hover {
  background: var(--red-dark);
}

.secondary-action,
.secondary-link,
.segmented {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--foreground);
}

.secondary-action:hover,
.secondary-link:hover,
.segmented:hover,
.language-button:hover,
.answer-option:hover,
.review-item:hover,
.instructor-option:hover {
  border-color: var(--red);
}

.exam-facts,
.metric-grid,
.admin-grid {
  display: grid;
  gap: 12px;
}

.exam-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exam-facts div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  min-height: 86px;
  padding: 12px;
}

.exam-facts strong,
.metric-card span {
  color: var(--red);
  font-weight: 900;
  line-height: 1;
}

.exam-facts strong {
  font-size: clamp(1.45rem, 6vw, 2rem);
}

.exam-facts span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.2;
}

.progress-block {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.95rem;
  font-weight: 800;
  gap: 8px 14px;
  justify-content: space-between;
}

.progress-track {
  background: var(--surface-soft);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-track i {
  background: linear-gradient(90deg, var(--red), var(--gold));
  display: block;
  height: 100%;
}

.answer-list {
  border: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.answer-option {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 60px;
  padding: 14px;
}

.answer-option input {
  accent-color: var(--red);
  height: 22px;
  margin: 0;
  width: 22px;
}

.answer-option:has(input:checked) {
  background: #fff7f8;
  border-color: var(--red);
}

.answer-option span {
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.exam-footer {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  bottom: 0;
  justify-content: space-between;
  margin: 2px -34px 0;
  padding: 14px clamp(18px, 5vw, 34px);
  position: sticky;
}

.review-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 152px), 1fr));
}

.review-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--foreground);
  cursor: pointer;
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 12px;
  text-align: left;
}

.review-number {
  align-items: center;
  background: var(--foreground);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.results-panel {
  justify-items: center;
  text-align: center;
}

.score-ring {
  align-items: center;
  background: #fff7f8;
  border: 8px solid var(--red);
  border-radius: 999px;
  display: grid;
  height: 156px;
  justify-items: center;
  width: 156px;
}

.score-ring strong {
  color: var(--red);
  font-size: 2.7rem;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.missed-question {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.missed-question h4,
.missed-question p {
  margin: 0;
}

.english-reference {
  color: var(--muted);
}

.admin-shell {
  margin: 0 auto;
  max-width: 1180px;
  min-height: 100svh;
  padding: 16px;
}

.admin-brand p {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
  margin: 0 0 2px;
  text-transform: uppercase;
}

.admin-brand h1 {
  font-size: clamp(1.55rem, 6vw, 3rem);
  font-weight: 900;
  line-height: 1.05;
  margin: 0;
}

.staff-actions {
  justify-content: flex-end;
}

.staff-actions span {
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-controls {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.segmented.active {
  background: var(--foreground);
  border-color: var(--foreground);
  color: #fff;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  margin-bottom: 12px;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 18px;
}

.metric-card span {
  font-size: clamp(2rem, 8vw, 3rem);
}

.compact-metric-grid .metric-card {
  min-width: 0;
  padding: 14px;
}

.compact-metric-grid .metric-card span {
  color: var(--foreground);
  font-size: 0.98rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.metric-card p {
  color: var(--muted);
  font-weight: 850;
  margin: 0;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  margin-bottom: 12px;
}

.admin-panel {
  padding: 16px;
}

.access-panel {
  margin: clamp(18px, 8vw, 72px) auto 0;
  max-width: 720px;
}

.panel-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading h3 {
  font-size: clamp(1.1rem, 4vw, 1.45rem);
  font-weight: 900;
  margin: 0;
}

.result-detail-heading {
  align-items: flex-start;
}

.result-detail-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compact-action {
  min-height: 40px;
  padding: 8px 12px;
}

.active-result-button {
  color: var(--red);
  font-weight: 900;
}

.detail-collapse-row {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
}

.report-row,
.student-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  min-height: 52px;
  padding-bottom: 8px;
}

.report-row {
  grid-template-columns: minmax(0, 1.35fr) 0.55fr 0.7fr 0.6fr;
}

.access-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr) 0.42fr 0.42fr;
}

.student-row {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.95fr) 92px 70px minmax(0, 1fr);
}

.instructor-student-row {
  grid-template-columns: minmax(0, 1.45fr) 94px 70px minmax(0, 1fr);
}

.report-row > span,
.student-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-row strong,
.report-row small,
.student-row strong,
.student-row small {
  display: block;
}

.report-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-height: 32px;
  text-transform: uppercase;
}

.empty-state {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
  margin: 0;
  padding: 14px;
}

.result-actions {
  align-items: flex-start;
  display: grid;
  gap: 4px;
}

.result-detail-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.result-detail-meta span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.portal-link-grid {
  display: grid;
  gap: 12px;
}

.portal-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--foreground);
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 14px;
  text-decoration: none;
}

.portal-card:hover {
  border-color: var(--red);
}

.portal-card strong {
  font-size: 1.08rem;
}

.portal-card span {
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.license-instructions-panel {
  margin-bottom: 12px;
  padding: 0;
}

.license-instructions summary {
  align-items: center;
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  font-weight: 950;
  gap: 12px;
  justify-content: space-between;
  line-height: 1.25;
  list-style: none;
  min-height: 58px;
  padding: 16px;
}

.license-instructions summary::-webkit-details-marker {
  display: none;
}

.license-instructions summary:focus-visible {
  outline: 3px solid rgba(36, 86, 126, 0.28);
  outline-offset: -3px;
}

.summary-arrow {
  border-bottom: 3px solid var(--blue);
  border-right: 3px solid var(--blue);
  flex: 0 0 auto;
  height: 12px;
  transform: rotate(45deg);
  transition: transform 140ms ease;
  width: 12px;
}

.license-instructions[open] .summary-arrow {
  transform: rotate(225deg);
}

.license-instructions-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.license-instructions-body p {
  color: #3d4650;
  line-height: 1.5;
  margin: 0;
}

.license-instructions-body ol {
  color: #3d4650;
  display: grid;
  gap: 8px;
  line-height: 1.45;
  margin: 0;
  padding-left: 22px;
}

.license-instructions-closing {
  color: var(--blue) !important;
  font-weight: 950;
}

.license-overview-panel {
  margin-bottom: 12px;
}

.license-status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.license-status-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.license-status-card.complete {
  border-left-color: var(--green);
}

.license-status-card strong,
.license-status-card span {
  display: block;
}

.license-status-card strong {
  font-size: 1.1rem;
  font-weight: 900;
}

.license-status-card span {
  color: var(--muted);
  font-weight: 850;
  line-height: 1.35;
}

.missing-field-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.missing-field-list li {
  background: #fff;
  border: 1px solid rgba(201, 24, 36, 0.22);
  border-radius: 8px;
  color: var(--red);
  font-weight: 850;
  padding: 8px 10px;
}

.license-to-fill-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.license-to-fill-form .autofill-settings,
.license-to-fill-form .submit-row {
  grid-column: 1 / -1;
}

.instructor-manage-list {
  display: grid;
  gap: 12px;
}

.instructor-manage-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.ad-serve-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
}

.ad-group-card {
  min-width: 0;
}

.ad-preview-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.ad-delivery-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.ad-delivery-summary span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 850;
  gap: 2px;
  padding: 10px;
}

.ad-delivery-summary strong {
  color: var(--foreground);
  font-size: 1.35rem;
}

.ad-preview {
  background: #0b0b0b;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  min-height: 74px;
  overflow: hidden;
}

.ad-preview img {
  aspect-ratio: 6.4 / 1;
  display: block;
  object-fit: cover;
  width: 100%;
}

.ad-preview span {
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 0 8px 8px;
}

.empty-ad {
  align-content: center;
  background: var(--surface);
  border-style: dashed;
  justify-items: center;
}

.empty-ad span {
  color: var(--muted);
  padding: 8px;
}

.result-slot {
  border-color: var(--gold);
}

.ad-upload-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ad-upload-form label:nth-of-type(3),
.ad-upload-form label:nth-of-type(5),
.ad-upload-form label:nth-of-type(6),
.ad-upload-form .manage-actions {
  grid-column: 1 / -1;
}

.manage-card-head,
.manage-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
}

.manage-card-head strong,
.manage-card-head span {
  display: block;
}

.manage-card-head > div span {
  color: var(--muted);
  line-height: 1.4;
}

.instructor-manage-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.instructor-manage-form label:nth-of-type(4),
.instructor-manage-form .manage-actions {
  grid-column: 1 / -1;
}

.checkbox-field {
  align-items: center;
  display: flex !important;
  gap: 10px !important;
}

.checkbox-field input {
  height: 20px;
  min-height: 20px;
  width: 20px;
}

.danger-action {
  border-color: rgba(201, 24, 36, 0.42);
  color: var(--red);
}

.red-flag-action {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.red-flag-action:hover {
  background: #a9141f;
  border-color: #a9141f;
  color: #fff;
}

.live-red-flag-action {
  display: inline-flex;
  font-size: 0.72rem;
  line-height: 1;
  margin-top: 6px;
  min-height: 28px;
  padding: 5px 8px;
  width: auto;
}

.class-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.class-form label:nth-child(3),
.class-form label:nth-child(4),
.class-form button {
  grid-column: 1 / -1;
}

.classroom-panel {
  min-width: 0;
}

.classroom-list,
.roster-list,
.question-stat-list {
  display: grid;
  gap: 10px;
}

.classroom-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.classroom-title,
.class-counts,
.class-actions,
.analytics-toolbar,
.question-stat-main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.classroom-title strong,
.pin-line {
  display: block;
}

.pin-line {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.95rem;
  gap: 6px;
  margin-top: 4px;
}

.pin-line b {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--foreground);
  padding: 5px 8px;
}

.status-pill {
  background: #fff8ec;
  border: 1px solid rgba(157, 113, 50, 0.34);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 10px;
  text-transform: uppercase;
}

.status-pill.finished {
  background: #f5fbf8;
  border-color: rgba(35, 112, 77, 0.28);
  color: var(--green);
}

.class-meta {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.class-counts {
  justify-content: flex-start;
}

.class-counts span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  padding: 8px 10px;
}

.class-counts strong {
  color: var(--foreground);
}

.class-actions {
  justify-content: flex-start;
}

.class-feedback-slot {
  flex: 1 1 220px;
  max-width: 360px;
  min-width: min(100%, 220px);
}

.finished-class-actions {
  margin-bottom: 10px;
}

.class-actions small {
  color: var(--muted);
  font-weight: 800;
}

.live-class-actions {
  background: #fff;
  border: 1px solid rgba(35, 84, 124, 0.2);
  border-radius: 8px;
  padding: 8px;
}

.live-class-action {
  border-color: rgba(35, 84, 124, 0.38);
  color: var(--blue);
}

.disabled-action {
  cursor: default;
  opacity: 0.6;
}

.pending-roster,
.pending-class-cleanup,
.restore-class-panel {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.pending-roster summary,
.pending-class-cleanup summary,
.restore-class-panel summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 900;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
}

.pending-roster summary::-webkit-details-marker,
.pending-class-cleanup summary::-webkit-details-marker,
.restore-class-panel summary::-webkit-details-marker {
  display: none;
}

.pending-roster summary::after,
.pending-class-cleanup summary::after,
.restore-class-panel summary::after {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  height: 8px;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  width: 8px;
}

.pending-roster[open] summary::after,
.pending-class-cleanup[open] summary::after,
.restore-class-panel[open] summary::after {
  transform: rotate(225deg);
}

.pending-roster summary strong {
  color: var(--muted);
  font-size: 0.88rem;
}

.cleanup-actions,
.restore-class-form {
  margin-top: 10px;
}

.restore-class-panel {
  margin-top: 12px;
}

.pending-student-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.pending-student-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) auto;
  padding: 9px;
}

.pending-student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pending-student-row span,
.pending-student-row strong,
.pending-student-row small {
  display: block;
  min-width: 0;
}

.pending-student-row strong,
.pending-student-row small {
  overflow-wrap: anywhere;
}

.pending-student-row small {
  color: var(--muted);
  font-size: 0.82rem;
}

.red-flag-panel,
.red-flag-report-panel {
  border-color: rgba(201, 24, 36, 0.34);
}

.red-flag-heading h2 {
  color: var(--red);
}

.red-flag-reasons {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 12px;
}

.red-flag-reasons legend {
  color: var(--foreground);
  font-weight: 900;
  padding: 0 6px;
}

.wide-field {
  grid-column: 1 / -1;
}

.wide-field textarea {
  min-height: 130px;
  resize: vertical;
}

.red-flag-indicator {
  animation: red-flag-blink 1.1s ease-in-out infinite;
  align-items: center;
  background: var(--red);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  line-height: 1;
  margin-left: 7px;
  vertical-align: middle;
  width: 24px;
}

.birthday-indicator {
  align-items: center;
  animation: birthday-cake-pulse 1.35s ease-in-out infinite;
  background: #fdf1cd;
  border: 1px solid rgba(157, 113, 50, 0.34);
  border-radius: 6px;
  color: var(--gold);
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  line-height: 1;
  margin-left: 7px;
  vertical-align: middle;
  width: 24px;
}

@keyframes red-flag-blink {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(201, 24, 36, 0.44);
    opacity: 1;
  }

  50% {
    box-shadow: 0 0 0 5px rgba(201, 24, 36, 0);
    opacity: 0.45;
  }
}

@keyframes birthday-cake-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(157, 113, 50, 0.34);
    transform: translateY(0);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(157, 113, 50, 0);
    transform: translateY(-1px);
  }
}

.red-flag-report-body {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.red-flag-report-body h3 {
  font-size: 1rem;
  margin: 0;
}

.red-flag-report-body p {
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #3d4650;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px;
}

.admin-red-flag-section {
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
}

.admin-red-flag-section + .admin-red-flag-section {
  margin-top: 12px;
}

.admin-red-flag-section summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 900;
  justify-content: space-between;
  list-style: none;
}

.admin-red-flag-section summary::-webkit-details-marker {
  display: none;
}

.admin-red-flag-section summary strong {
  color: var(--muted);
}

.admin-red-flag-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.admin-red-flag-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr) minmax(128px, 0.4fr);
  padding: 10px;
}

.admin-red-flag-row strong,
.admin-red-flag-row small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-red-flag-row small {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-red-flag-row p {
  color: #3d4650;
  line-height: 1.45;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.admin-red-flag-actions {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(96px, 0.42fr) minmax(118px, 0.55fr);
  padding: 10px;
}

.roster-head {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-height: 36px;
  text-transform: uppercase;
}

.roster-head .mini-progress {
  display: none;
}

.roster-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.roster-row strong,
.roster-row small {
  display: block;
}

.roster-row small {
  color: var(--muted);
}

.live-waiting,
.live-review,
.live-blocked {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  padding: 7px 10px;
}

.live-waiting {
  animation: livePulse 1.15s ease-in-out infinite;
  background: #fff8ec;
  border: 1px solid rgba(157, 113, 50, 0.36);
  color: var(--gold);
}

.refresh-action {
  animation: refreshPulse 1.2s ease-in-out infinite;
  border-color: rgba(201, 24, 36, 0.42);
  box-shadow: 0 0 0 0 rgba(201, 24, 36, 0.36);
}

.live-review {
  background: #eef6ff;
  border: 1px solid rgba(29, 78, 116, 0.24);
  color: var(--blue);
}

.live-blocked {
  background: #fff1f2;
  border: 1px solid rgba(207, 24, 38, 0.24);
  color: var(--red);
}

.live-print-link {
  width: max-content;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.48;
    transform: scale(0.98);
  }
}

@keyframes refreshPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(201, 24, 36, 0.32);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(201, 24, 36, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .birthday-indicator,
  .live-waiting,
  .red-flag-indicator,
  .refresh-action {
    animation: none;
  }
}

.mini-progress,
.bar-track {
  background: var(--surface-soft);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.mini-progress {
  grid-column: 1 / -1;
}

.mini-progress i,
.bar-track i {
  background: linear-gradient(90deg, var(--red), var(--gold));
  display: block;
  height: 100%;
}

.question-analytics-panel {
  margin-bottom: 12px;
}

.analytics-toolbar {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.analytics-toolbar label {
  display: grid;
  flex: 1 1 260px;
  gap: 6px;
}

.analytics-toolbar label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.question-stat-summary {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 10px;
}

.question-stat-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 9px;
  padding: 10px;
}

.question-stat-main {
  align-items: flex-start;
}

.question-stat-main details {
  min-width: 0;
}

.question-stat-main summary {
  cursor: pointer;
  font-weight: 900;
}

.question-stat-main p {
  color: var(--muted);
  line-height: 1.45;
  margin: 8px 0 0;
}

.question-stat-main > span {
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .site-shell,
  .admin-shell {
    max-width: 100%;
    padding: 12px;
  }

  .welcome-logo {
    max-height: 165px;
  }

  .welcome-screen {
    gap: 14px;
    min-height: 0;
  }

  .standard-notice {
    font-size: 0.76rem;
    padding-top: 8px;
  }

  .exam-topbar,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-button,
  .language-picker,
  .admin-header .secondary-link,
  .admin-header .secondary-action {
    width: 100%;
  }

  .language-picker {
    justify-content: space-between;
  }

  .exam-panel {
    gap: 16px;
  }

  .scan-panel {
    gap: 14px;
    max-width: 100%;
    overflow: hidden;
    padding: 16px;
  }

  .scan-column {
    max-width: 360px;
    width: 100%;
  }

  .exam-panel h1 {
    font-size: clamp(1.35rem, 6.5vw, 2rem);
  }

  .question-blank {
    inline-size: min(58vw, 11rem);
  }

  .exam-facts {
    grid-template-columns: 1fr;
  }

  .application-type-field,
  .red-flag-reasons,
  .scan-review-form,
  .form-autofill-form,
  .license-to-fill-form,
  .license-template-card {
    grid-template-columns: 1fr;
  }

  .scan-camera-shell {
    height: clamp(260px, 44vh, 360px);
    height: clamp(260px, 44svh, 360px);
    min-height: 260px;
  }

  .scan-target {
    height: 32%;
    max-height: 136px;
    width: 86%;
  }

  .scan-action-row,
  .scan-continue-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    max-width: 100%;
    width: 100%;
  }

  .scan-action-row .primary-action,
  .scan-action-row .secondary-action,
  .scan-continue-row .primary-action,
  .scan-continue-row .secondary-action {
    min-width: 0;
    width: 100%;
  }

  .scan-upload input {
    max-width: 100%;
    min-width: 0;
  }

  .scan-fallbacks {
    margin-top: 2px;
  }

  .exam-footer {
    margin-inline: calc(clamp(18px, 5vw, 34px) * -1);
  }

  .ad-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .submit-row .primary-action,
  .submit-row .secondary-action,
  .submit-row .secondary-link {
    width: 100%;
  }

  .staff-actions {
    justify-content: stretch;
  }

  .staff-actions span {
    width: 100%;
  }

  .report-row,
  .access-row,
  .student-row,
  .instructor-student-row,
  .class-form,
  .ad-upload-form,
  .instructor-manage-form,
  .admin-red-flag-row,
  .pending-student-row,
  .roster-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .class-form label:nth-child(3),
  .class-form label:nth-child(4),
  .class-form button,
  .ad-upload-form label:nth-of-type(3),
  .ad-upload-form label:nth-of-type(5),
  .ad-upload-form label:nth-of-type(6),
  .ad-upload-form .manage-actions,
  .instructor-manage-form label:nth-of-type(4),
  .instructor-manage-form .manage-actions,
  .mini-progress {
    grid-column: auto;
  }

  .ad-delivery-summary {
    grid-template-columns: 1fr;
  }

  .analytics-toolbar .secondary-action {
    width: 100%;
  }

  .pending-student-actions {
    justify-content: stretch;
  }

  .pending-student-actions .secondary-action {
    width: 100%;
  }

  .admin-red-flag-actions .secondary-action {
    width: 100%;
  }

  .live-red-flag-action {
    width: auto;
  }

  .result-detail-actions,
  .detail-collapse-row {
    justify-content: stretch;
  }

  .result-detail-actions .secondary-action,
  .detail-collapse-row .secondary-action {
    width: 100%;
  }

  .report-head {
    display: none;
  }
}
