:root {
  color-scheme: light;
  --page: #f3f4f1;
  --surface: #ffffff;
  --surface-muted: #eef0ec;
  --ink: #1d2420;
  --muted: #667069;
  --line: #d7dcd6;
  --line-strong: #b9c1ba;
  --fire: #c83d2e;
  --fire-dark: #982d23;
  --fire-soft: #fff0ed;
  --safe: #16705a;
  --safe-dark: #0f5846;
  --safe-soft: #e9f6f1;
  --amber: #a96608;
  --amber-soft: #fff5df;
  --focus: #1769aa;
  --stage: #111512;
  --shadow: 0 10px 30px rgba(21, 30, 24, 0.12);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.24);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
}

.hidden {
  display: none !important;
}

.access-shell {
  width: min(100% - 40px, 460px);
  margin: 10vh auto;
}

.access-form {
  display: grid;
  gap: 18px;
}

.access-form h1,
.access-form p {
  margin: 0;
}

.access-form > p {
  color: var(--muted);
}

.access-form .access-error {
  color: var(--fire-dark);
}

.shortcut-hint {
  color: var(--muted);
  font-size: 12px;
}

.example-image:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.page {
  min-height: 100vh;
}

.app-header {
  min-height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  z-index: 30;
}

.sticky-header {
  position: sticky;
  top: 0;
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand::before {
  width: 10px;
  height: 18px;
  margin-right: 9px;
  display: inline-block;
  vertical-align: -3px;
  border-radius: 2px 7px 7px 7px;
  background: var(--fire);
  content: "";
}

.header-context {
  color: var(--muted);
  white-space: nowrap;
}

.student-head-meta,
.admin-header-actions,
.admin-actions,
.zoom-tools,
.item-position,
.review-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-head-meta {
  min-width: 0;
}

.compact-badge,
.person-chip,
.save-state {
  min-height: 28px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  color: #465048;
  font-size: 12px;
  white-space: nowrap;
}

.person-chip {
  overflow: hidden;
  max-width: 160px;
  text-overflow: ellipsis;
}

.header-progress {
  width: min(360px, 34vw);
  margin-left: auto;
}

.progress-copy {
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.progress-copy strong {
  color: var(--ink);
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: #e4e7e3;
}

.progress-track > span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--safe);
  transition: width 180ms ease;
}

.guide-band {
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.guide-inner {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
}

.guide-inner details > summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.guide-inner details > summary::-webkit-details-marker,
.edge-details > summary::-webkit-details-marker {
  display: none;
}

.guide-inner details > summary span:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.guide-inner details > summary small,
.summary-state {
  color: var(--muted);
  font-size: 12px;
}

.summary-state::after {
  margin-left: 8px;
  color: var(--ink);
  content: "▾";
}

.guide-inner details:not([open]) .summary-state::after {
  content: "▸";
}

.definition-line {
  margin: 2px 0 16px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--fire);
  background: #f6f7f4;
}

.definition-line p {
  margin: 0;
}

.definition-mark {
  flex: 0 0 auto;
  color: var(--fire-dark);
  font-size: 12px;
  font-weight: 800;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--surface);
}

.rule-column {
  min-width: 0;
  padding: 14px 16px 12px;
}

.rule-column + .rule-column {
  border-left: 1px solid var(--line);
}

.rule-column h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.rule-symbol {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.rule-positive .rule-symbol {
  background: var(--fire);
}

.rule-negative .rule-symbol {
  background: var(--safe);
}

.rule-uncertain .rule-symbol {
  background: var(--amber);
}

.rule-column ul {
  margin: 0;
  padding-left: 18px;
  color: #4d574f;
  font-size: 13px;
}

.rule-column li + li {
  margin-top: 4px;
}

.examples-heading {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.examples-heading h2,
.examples-heading p {
  margin-bottom: 8px;
}

.examples-heading p {
  color: var(--muted);
  font-size: 12px;
}

.example-strip {
  padding-bottom: 8px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 8px;
  overflow-x: auto;
}

.example-item {
  min-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.example-image {
  width: 100%;
  padding: 0;
  height: 126px;
  position: relative;
  overflow: hidden;
  background: var(--stage);
  display: grid;
  place-items: center;
}

.example-media {
  position: relative;
  overflow: hidden;
}

.example-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.example-box {
  position: absolute;
  border: 2px solid #ff3b30;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.example-dialog {
  width: min(1200px, calc(100vw - 24px));
  height: min(900px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.example-dialog::backdrop {
  background: rgba(17, 21, 18, 0.75);
}

.example-dialog-content {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.example-dialog-header {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.example-dialog-header h2 {
  margin: 0;
}

.example-dialog-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.example-viewport {
  min-height: 0;
  overflow: auto;
  background: var(--stage);
  overscroll-behavior: contain;
}

.example-canvas {
  display: grid;
  place-items: center;
}

.example-dialog-caption {
  padding: 12px 16px;
  max-height: 30dvh;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.example-dialog-caption p {
  margin: 6px 0 0;
}

.example-dialog-caption .access-error {
  color: var(--fire-dark);
}

.example-copy {
  padding: 9px 10px 10px;
}

.example-copy strong {
  display: block;
  font-size: 13px;
}

.example-copy p {
  min-height: 50px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.example-label {
  margin-bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.example-label::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--safe);
  content: "";
}

.example-label.fire::before {
  background: var(--fire);
}

.reminder-line {
  margin: 8px 0 16px;
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  border: 1px solid #ead7a9;
  background: var(--amber-soft);
  color: #5e4b27;
  font-size: 13px;
}

.reminder-line strong {
  flex: 0 0 auto;
  color: #7d5008;
}

.annotation-workspace {
  width: min(1660px, calc(100% - 32px));
  min-height: 640px;
  margin: 16px auto 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 16px;
}

.image-tool,
.decision-tool {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.image-tool {
  display: grid;
  grid-template-rows: 48px minmax(560px, calc(100vh - 176px));
}

.image-toolbar {
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: #3f4942;
  font-size: 18px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.item-position label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.item-position input {
  width: 68px;
  height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: center;
}

#position-total {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.image-viewport {
  min-height: 0;
  position: relative;
  overflow: hidden;
  background-color: var(--stage);
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.image-viewport.dragging {
  cursor: grabbing;
}

.image-viewport img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform-origin: center;
  transition: opacity 120ms ease;
  will-change: transform;
  user-select: none;
}

.image-viewport img.loading {
  opacity: 0;
}

.image-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c9d0cb;
  font-size: 13px;
}

.decision-tool {
  padding: 18px;
  align-self: start;
}

.decision-heading {
  margin-bottom: 14px;
}

.decision-heading h2 {
  margin: 9px 0 0;
  font-size: 17px;
}

.save-state {
  color: var(--safe-dark);
  background: var(--safe-soft);
  border-color: #c0dfd3;
}

.save-state.saving {
  color: #75520f;
  background: var(--amber-soft);
  border-color: #ead7a9;
}

.save-state.error {
  color: var(--fire-dark);
  background: var(--fire-soft);
  border-color: #efc4bc;
}

.decision-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.decision-button {
  min-height: 82px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  text-align: left;
}

.decision-button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.decision-code {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8ebe8;
  font-size: 16px;
  font-weight: 900;
}

.decision-button strong,
.decision-button small {
  display: block;
}

.decision-button strong {
  font-size: 14px;
}

.decision-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.fire-decision .decision-code {
  color: #fff;
  background: var(--fire);
}

.no-fire-decision .decision-code {
  color: #fff;
  background: var(--safe);
}

.uncertain-decision .decision-code {
  color: #fff;
  background: var(--amber);
}

.bad-image-decision .decision-code {
  color: #fff;
  background: #59625c;
}

.decision-button.selected {
  box-shadow: 0 0 0 2px var(--focus);
}

.field-block {
  margin-top: 18px;
}

.field-label,
.text-field span,
.note-field span,
.split-form label > span {
  margin-bottom: 7px;
  display: block;
  color: #4f5952;
  font-size: 12px;
  font-weight: 700;
}

.segmented-control {
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
}

.segmented-control button {
  height: 34px;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(30, 40, 34, 0.1);
  font-weight: 700;
}

.edge-details {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.edge-details > summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  color: #4d574f;
  font-size: 13px;
  font-weight: 700;
}

.edge-details > summary::after {
  content: "+";
}

.edge-details[open] > summary::after {
  content: "−";
}

.tag-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tag-options label {
  min-height: 34px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #4c564f;
  font-size: 11px;
}

.tag-options input {
  margin: 0;
  accent-color: var(--focus);
}

.note-field {
  margin-top: 12px;
  display: block;
}

.note-field textarea,
.text-field input,
.split-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.note-field textarea {
  min-height: 72px;
  padding: 9px 10px;
  resize: vertical;
}

.existing-annotation {
  margin-top: 14px;
  padding: 9px 10px;
  border-left: 3px solid var(--focus);
  background: #eef5fa;
  color: #385267;
  font-size: 12px;
}

.completion-panel {
  width: min(540px, calc(100% - 32px));
  margin: 80px auto;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
}

.completion-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--safe-soft);
  color: var(--safe);
  font-size: 28px;
  font-weight: 900;
}

.completion-panel p {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(19, 25, 21, 0.68);
  z-index: 100;
}

.modal-panel {
  width: min(430px, 100%);
  padding: 26px;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-panel p {
  color: var(--muted);
}

.text-field {
  display: block;
  margin: 20px 0;
}

.text-field input {
  height: 44px;
  padding: 8px 10px;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.primary-button:hover {
  background: #313a34;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #3f4942;
}

.secondary-button:hover,
.text-button:hover {
  background: var(--surface-muted);
}

.text-button {
  padding-inline: 8px;
  background: transparent;
  color: var(--focus);
}

.eyebrow {
  color: var(--fire-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-shell {
  width: min(1100px, calc(100% - 40px));
  min-height: calc(100vh - 60px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.home-title {
  max-width: 620px;
}

.pool-claim-form {
  max-width: 420px;
  margin: 24px 0 16px;
  display: grid;
  gap: 14px;
}

.pool-claim-form p {
  margin: 0;
  font-size: 14px;
}

.pool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-title .shortcut-hint {
  font-size: 13px;
  line-height: 1.7;
}

#student-page > .app-header {
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.home-title h1 {
  margin-top: 10px;
  font-size: 38px;
}

.home-title p {
  color: var(--muted);
  font-size: 17px;
}

.home-status {
  width: 220px;
  padding: 28px 20px;
  border-left: 5px solid var(--fire);
  background: #fff;
}

.home-status span,
.home-status small {
  display: block;
}

.home-status span {
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.home-status small {
  color: var(--muted);
}

.admin-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 26px auto 50px;
}

.admin-header-actions {
  margin-left: auto;
}

.admin-title-row,
.band-heading,
.quality-notice,
.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-title-row {
  margin-bottom: 20px;
}

.admin-title-row h1 {
  margin: 4px 0 0;
}

.metric-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.metric-item {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.metric-item strong,
.metric-item span {
  display: block;
}

.metric-item strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.metric-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metric-item.alert strong {
  color: var(--fire);
}

.metric-item.warning strong {
  color: var(--amber);
}

.admin-band {
  margin-top: 14px;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.claim-settings-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
  margin-top: 16px;
}

.claim-settings-form .text-field {
  width: 180px;
  max-width: 100%;
  margin: 0;
}

.claim-settings-form button {
  min-height: 44px;
}

#claim-settings-status {
  margin: 0;
  padding: 10px 0;
  overflow-wrap: anywhere;
}

.band-heading h2,
.band-heading p {
  margin-bottom: 0;
}

.band-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.split-band {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 1.5fr);
  align-items: center;
  gap: 24px;
}

.split-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.split-form label {
  min-width: 0;
}

.split-form input[type="number"] {
  height: 40px;
  padding: 7px 9px;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 34px !important;
}

.input-suffix > span {
  position: absolute;
  right: 11px;
  top: 9px;
  color: var(--muted);
}

.force-reset {
  grid-column: 1 / -1;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fire-soft);
  color: var(--fire-dark);
  font-size: 12px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.batch-table th,
.batch-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.batch-table tr:last-child td {
  border-bottom: 0;
}

.batch-table th {
  background: #f5f6f3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.batch-progress-cell {
  min-width: 190px;
}

.batch-progress-copy {
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.link-cell {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--focus);
}

.quality-band {
  padding-bottom: 18px;
}

.quality-notice {
  margin-top: 16px;
  padding: 12px 14px;
  justify-content: flex-start;
  border-left: 4px solid var(--amber);
  background: var(--amber-soft);
  color: #604e2b;
  font-size: 13px;
}

.quality-notice strong {
  flex: 0 0 auto;
  color: #7d5008;
}

.export-row {
  margin-top: 8px;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.review-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(880px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(20, 28, 23, 0.18);
  z-index: 80;
}

.review-head {
  min-height: 72px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.review-head h2 {
  margin: 3px 0 0;
}

.review-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.review-content {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto;
  overflow: auto;
}

.review-image-panel {
  min-height: 320px;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  background: var(--stage);
}

.review-image-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  grid-template-rows: 46px minmax(0, 1fr);
}

.review-image-toolbar {
  padding: 5px 10px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.review-image-wrap {
  min-height: 0;
  padding: 10px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: var(--stage);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.review-image-wrap.dragging {
  cursor: grabbing;
}

.review-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
  transform-origin: center;
  will-change: transform;
  user-select: none;
}

.review-image-panel:fullscreen .review-image-wrap img {
  max-height: none;
}

.review-info {
  padding: 16px 18px 22px;
  border-top: 1px solid var(--line);
}

.review-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.review-meta span {
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--fire-soft);
  color: var(--fire-dark);
  font-size: 11px;
  font-weight: 800;
}

.review-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-meta small {
  color: var(--muted);
}

.review-annotations {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.review-annotation {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fafbf9;
  font-size: 12px;
}

.review-annotation strong,
.review-annotation span {
  display: block;
}

.review-annotation span {
  margin-top: 3px;
  color: var(--muted);
}

.review-decisions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  background: var(--fire);
}

.danger-button:hover {
  background: var(--fire-dark);
}

.safe-button {
  background: var(--safe);
}

.safe-button:hover {
  background: var(--safe-dark);
}

.review-nav {
  margin-top: 12px;
  justify-content: flex-end;
}

.toast {
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 14px;
  position: fixed;
  top: 74px;
  right: 16px;
  z-index: 200;
  border: 1px solid #b8d8cb;
  border-radius: 5px;
  background: var(--safe-soft);
  color: var(--safe-dark);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #efc4bc;
  background: var(--fire-soft);
  color: var(--fire-dark);
}

@media (max-width: 1120px) {
  .example-strip {
    grid-auto-columns: 220px;
  }

  .annotation-workspace {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .split-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  #student-page .header-progress {
    flex: 1 1 100%;
    width: 100%;
  }

  #finish-claim-button {
    margin-left: auto;
  }

  .app-header {
    min-height: 56px;
    padding: 0 12px;
    gap: 10px;
  }

  .header-context,
  .compact-badge,
  .summary-state,
  .person-chip {
    display: none;
  }

  .header-progress {
    width: min(210px, 48vw);
  }

  .guide-inner {
    width: calc(100% - 24px);
  }

  .rule-grid {
    grid-template-columns: 1fr;
  }

  .rule-column + .rule-column {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .definition-line,
  .reminder-line {
    align-items: flex-start;
  }

  .annotation-workspace {
    width: calc(100% - 16px);
    min-height: 0;
    margin-top: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .image-tool {
    grid-template-rows: 46px minmax(340px, 52vh);
  }

  .decision-tool {
    padding: 14px;
  }

  .decision-heading h2 {
    font-size: 15px;
  }

  .decision-button {
    min-height: 68px;
  }

  .admin-shell {
    width: calc(100% - 20px);
    margin-top: 16px;
  }

  .admin-title-row,
  .band-heading,
  .quality-notice,
  .export-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .split-form {
    grid-template-columns: 1fr 1fr;
  }

  .split-form .primary-button {
    grid-column: 1 / -1;
  }

  .review-content {
    grid-template-rows: 42vh auto;
  }

  .review-annotations {
    grid-template-columns: 1fr;
  }

  .home-shell {
    width: calc(100% - 32px);
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .home-title h1 {
    font-size: 30px;
  }
}

@media (max-width: 520px) {
  .progress-copy span {
    display: none;
  }

  .guide-inner details > summary small,
  .examples-heading p {
    display: none;
  }

  .definition-line,
  .reminder-line {
    flex-direction: column;
    gap: 5px;
  }

  .image-toolbar {
    padding-inline: 6px;
  }

  .item-position label > span,
  #position-total {
    display: none;
  }

  .zoom-tools {
    gap: 4px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .decision-buttons {
    gap: 6px;
  }

  .decision-button {
    min-width: 0;
    padding: 8px;
  }

  .decision-code {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .decision-button small {
    display: none;
  }

  .tag-options {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-band {
    padding: 15px;
  }

  .split-form {
    grid-template-columns: 1fr;
  }

  .split-form .primary-button,
  .force-reset {
    grid-column: auto;
  }

  .review-meta {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .review-meta small {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
