:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --teacher-bg: #f8f8f9;
  --teacher-surface: #ffffff;
  --teacher-surface-muted: #f5f5f6;
  --teacher-text: #18181b;
  --teacher-muted: #6b6b74;
  --teacher-subtle: #91919a;
  --teacher-border: #e4e4e7;
  --teacher-border-strong: #d4d4d8;
  --teacher-primary: #6d4ce9;
  --teacher-primary-hover: #5f3ddb;
  --teacher-primary-soft: #f3f0ff;
  --teacher-success: #137a52;
  --teacher-success-soft: #edf8f3;
  --teacher-danger: #b73343;
  --teacher-danger-soft: #fff1f2;
  --teacher-warning: #8b5b0b;
  --teacher-warning-soft: #fff8e7;
  --teacher-shadow: 0 18px 45px rgba(24, 24, 27, 0.06), 0 2px 8px rgba(24, 24, 27, 0.035);
  --teacher-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--teacher-bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--teacher-text);
  background: var(--teacher-bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.teacher-button,
.teacher-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms var(--teacher-ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.teacher-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 650;
}

.teacher-button svg,
.teacher-icon-button svg,
.teacher-brand-mark svg,
.login-icon svg,
.teacher-empty svg,
.search-control svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.teacher-button:active,
.teacher-icon-button:active,
.review-status-button:active {
  transform: scale(0.97);
}

.teacher-button:focus-visible,
.teacher-icon-button:focus-visible,
.review-status-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(109, 76, 233, 0.18);
  outline-offset: 2px;
}

.teacher-button-primary {
  color: #ffffff;
  background: var(--teacher-primary);
  border-color: var(--teacher-primary);
  box-shadow: 0 1px 2px rgba(61, 37, 148, 0.2);
}

.teacher-button-ghost {
  color: var(--teacher-muted);
  background: transparent;
}

.teacher-button-full {
  width: 100%;
}

.teacher-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.teacher-icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--teacher-muted);
  background: var(--teacher-surface);
  border-color: var(--teacher-border);
  border-radius: 8px;
}

.teacher-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 max(22px, calc((100% - 1180px) / 2));
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--teacher-border);
  backdrop-filter: blur(18px) saturate(140%);
}

.teacher-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--teacher-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.teacher-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--teacher-primary);
  background: var(--teacher-primary-soft);
  border: 1px solid #dcd4ff;
  border-radius: 9px;
}

.teacher-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.teacher-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.teacher-kicker {
  margin: 0 0 8px;
  color: var(--teacher-subtle);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.results-heading,
.review-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.results-heading h1,
.review-heading h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.3rem);
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 690;
}

.results-heading > div > p:last-child,
.review-heading > div > p:last-child {
  margin: 15px 0 0;
  color: var(--teacher-muted);
  font-size: 0.86rem;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border);
  border-radius: 11px;
}

.results-stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 17px 19px;
}

.results-stats div + div {
  border-left: 1px solid var(--teacher-border);
}

.results-stats span {
  color: var(--teacher-muted);
  font-size: 0.7rem;
}

.results-stats strong {
  font-size: 1.3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.results-panel {
  margin-top: 44px;
  overflow: hidden;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border);
  border-radius: 12px;
  box-shadow: var(--teacher-shadow);
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--teacher-border);
}

.results-toolbar h2,
.review-toolbar h2,
.review-summary h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.results-toolbar p,
.review-toolbar p,
.review-summary-copy p {
  margin: 4px 0 0;
  color: var(--teacher-muted);
  font-size: 0.74rem;
}

.search-control {
  position: relative;
  display: flex;
  align-items: center;
}

.search-control svg {
  position: absolute;
  left: 11px;
  color: var(--teacher-subtle);
  pointer-events: none;
}

.search-control input {
  width: 280px;
  height: 40px;
  padding: 0 12px 0 36px;
  color: var(--teacher-text);
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border-strong);
  border-radius: 8px;
  font-size: 0.8rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-control input::placeholder {
  color: var(--teacher-subtle);
}

.search-control input:focus {
  border-color: var(--teacher-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 76, 233, 0.12);
}

.results-table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th,
.results-table td {
  padding: 15px 22px;
  text-align: left;
  vertical-align: middle;
}

.results-table th {
  color: var(--teacher-muted);
  background: #fbfbfc;
  border-bottom: 1px solid var(--teacher-border);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.results-table td {
  border-bottom: 1px solid var(--teacher-border);
  font-size: 0.79rem;
}

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

.results-table th:first-child,
.results-table td:first-child {
  width: 38%;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  width: 24%;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
  width: 17%;
}

.results-table th:nth-child(4),
.results-table td:nth-child(4) {
  width: 13%;
}

.results-table th:last-child,
.results-table td:last-child {
  width: 8%;
  text-align: right;
}

.result-name {
  display: block;
  color: var(--teacher-text);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.result-slug {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--teacher-subtle);
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-table time {
  color: var(--teacher-muted);
  font-variant-numeric: tabular-nums;
}

.result-mark {
  font-size: 0.84rem;
}

.teacher-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 0.67rem;
  font-weight: 750;
}

.teacher-status-submitted {
  color: var(--teacher-warning);
  background: var(--teacher-warning-soft);
}

.teacher-status-reviewed {
  color: var(--teacher-success);
  background: var(--teacher-success-soft);
}

.teacher-empty {
  display: flex;
  min-height: 380px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.teacher-empty > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--teacher-primary);
  background: var(--teacher-primary-soft);
  border-radius: 12px;
}

.teacher-empty h1,
.teacher-empty h2 {
  margin: 18px 0 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.teacher-empty p {
  max-width: 420px;
  margin: 6px 0 20px;
  color: var(--teacher-muted);
  font-size: 0.8rem;
}

.teacher-empty-compact {
  min-height: 240px;
}

.teacher-empty-page {
  min-height: calc(100vh - 210px);
}

.review-heading {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--teacher-border-strong);
}

.review-heading .teacher-status {
  margin-bottom: 3px;
}

.review-heading p span {
  margin: 0 5px;
}

.review-summary {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  gap: 36px;
  margin-top: 24px;
  padding: 24px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border);
  border-radius: 12px;
  box-shadow: var(--teacher-shadow);
}

.review-summary-copy p {
  max-width: 350px;
  margin-top: 8px;
  line-height: 1.6;
}

.review-summary-fields {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
}

.teacher-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.teacher-field > span,
.question-note-label {
  color: var(--teacher-text);
  font-size: 0.73rem;
  font-weight: 650;
}

.teacher-field input,
.teacher-field textarea,
.question-note,
.question-status-select {
  width: 100%;
  color: var(--teacher-text);
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border-strong);
  border-radius: 8px;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.teacher-field input,
.question-status-select {
  height: 42px;
  padding: 0 11px;
}

.teacher-field textarea,
.question-note {
  min-height: 82px;
  padding: 10px 11px;
  resize: vertical;
}

.teacher-field input:focus,
.teacher-field textarea:focus,
.question-note:focus,
.question-status-select:focus {
  border-color: var(--teacher-primary);
  box-shadow: 0 0 0 3px rgba(109, 76, 233, 0.12);
}

.teacher-alert {
  padding: 10px 12px;
  border: 1px solid var(--teacher-border);
  border-radius: 8px;
  font-size: 0.77rem;
}

.teacher-alert-error {
  color: var(--teacher-danger);
  background: var(--teacher-danger-soft);
  border-color: #ffd5da;
}

.review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 44px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--teacher-border-strong);
}

.review-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-save-state {
  color: var(--teacher-muted);
  font-size: 0.72rem;
}

.review-save-state.is-error {
  color: var(--teacher-danger);
}

.review-save-state.is-success {
  color: var(--teacher-success);
}

.review-questions {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: 28px;
}

.review-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.review-section-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.review-section-header span {
  color: var(--teacher-muted);
  font-size: 0.7rem;
}

.review-answer-list {
  overflow: hidden;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border);
  border-radius: 11px;
}

.review-answer-item {
  border-bottom: 1px solid var(--teacher-border);
}

.review-answer-item:last-child {
  border-bottom: 0;
}

.review-answer-item summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 130px 20px;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  transition: background-color 160ms ease;
}

.review-answer-item summary::-webkit-details-marker {
  display: none;
}

.review-answer-item[open] summary {
  background: #fbfbfc;
  border-bottom: 1px solid var(--teacher-border);
}

.review-question-number {
  color: var(--teacher-subtle);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.review-question-copy {
  min-width: 0;
}

.review-question-copy strong {
  display: block;
  color: var(--teacher-text);
  font-size: 0.82rem;
  font-weight: 630;
  line-height: 1.45;
}

.review-question-copy span {
  display: block;
  max-width: 700px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--teacher-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-manual-state {
  justify-self: end;
  min-width: 104px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.67rem;
  font-weight: 750;
  text-align: center;
}

.review-manual-state-unmarked {
  color: var(--teacher-muted);
  background: var(--teacher-surface-muted);
}

.review-manual-state-correct {
  color: var(--teacher-success);
  background: var(--teacher-success-soft);
}

.review-manual-state-incorrect {
  color: var(--teacher-danger);
  background: var(--teacher-danger-soft);
}

.review-chevron {
  width: 17px;
  height: 17px;
  color: var(--teacher-subtle);
  stroke-width: 1.9;
  transition: transform 180ms var(--teacher-ease-out);
}

.review-answer-item[open] .review-chevron {
  transform: rotate(180deg);
}

.review-answer-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px;
  padding: 18px 20px 20px 72px;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--teacher-muted);
  background: #fafafa;
  border: 1px solid #ededee;
  border-radius: 7px;
  font-size: 0.74rem;
}

.answer-option > b {
  color: var(--teacher-subtle);
  text-transform: uppercase;
}

.answer-option.is-chosen {
  color: #3f2b92;
  background: var(--teacher-primary-soft);
  border-color: #dcd4ff;
}

.answer-option-tag {
  color: var(--teacher-primary);
  font-size: 0.6rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.answer-review-controls {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.question-status-field,
.question-note-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.question-status-field > span {
  font-size: 0.72rem;
  font-weight: 650;
}

.review-bottom-bar {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 30px;
  padding: 12px 14px 12px 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--teacher-border-strong);
  border-radius: 11px;
  box-shadow: 0 14px 45px rgba(24, 24, 27, 0.12);
  backdrop-filter: blur(14px);
}

.login-body {
  background: var(--teacher-surface);
}

.login-shell {
  display: flex;
  width: min(100% - 36px, 460px);
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  padding: 48px 0;
}

.login-shell > .teacher-brand {
  align-self: center;
  margin-bottom: 24px;
}

.login-panel {
  padding: 30px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-border);
  border-radius: 13px;
  box-shadow: var(--teacher-shadow);
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--teacher-primary);
  background: var(--teacher-primary-soft);
  border-radius: 11px;
}

.login-panel h1 {
  margin: 19px 0 0;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.login-panel > p {
  margin: 8px 0 0;
  color: var(--teacher-muted);
  font-size: 0.82rem;
}

.teacher-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

@media (hover: hover) and (pointer: fine) {
  .teacher-button-primary:hover {
    background: var(--teacher-primary-hover);
    border-color: var(--teacher-primary-hover);
  }

  .teacher-button-ghost:hover,
  .teacher-icon-button:hover {
    color: var(--teacher-text);
    background: var(--teacher-surface-muted);
  }

  .result-name:hover {
    color: var(--teacher-primary);
  }

  .results-table tbody tr:hover td,
  .review-answer-item summary:hover {
    background: #fbfbfc;
  }
}

@media (max-width: 820px) {
  .teacher-page {
    width: min(100% - 28px, 1180px);
    padding-top: 34px;
  }

  .results-heading,
  .review-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-summary {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .review-answer-item summary {
    grid-template-columns: 36px minmax(0, 1fr) 20px;
  }

  .review-manual-state {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .review-chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .review-answer-detail {
    grid-template-columns: 1fr;
    padding-left: 56px;
  }
}

@media (max-width: 640px) {
  .teacher-topbar {
    min-height: 60px;
    padding: 0 10px;
  }

  .teacher-topbar .teacher-brand span:last-child,
  .teacher-topbar-actions .teacher-button span,
  .teacher-topbar-actions .teacher-button {
    font-size: 0;
  }

  .teacher-topbar-actions .teacher-button {
    width: 38px;
    padding: 0;
  }

  .teacher-topbar-actions .teacher-button svg {
    width: 18px;
    height: 18px;
  }

  .teacher-page {
    width: min(100% - 20px, 1180px);
    padding-top: 26px;
  }

  .results-heading h1,
  .review-heading h1 {
    font-size: clamp(2.35rem, 13vw, 3.5rem);
  }

  .results-stats {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .search-control input {
    width: 100%;
  }

  .results-table,
  .results-table tbody,
  .results-table tr,
  .results-table td {
    display: block;
    width: 100% !important;
  }

  .results-table thead {
    display: none;
  }

  .results-table tr {
    position: relative;
    padding: 16px 56px 16px 17px;
    border-bottom: 1px solid var(--teacher-border);
  }

  .results-table tbody tr:last-child {
    border-bottom: 0;
  }

  .results-table td {
    padding: 0;
    border: 0;
  }

  .results-table td:nth-child(2) {
    margin-top: 7px;
  }

  .results-table td:nth-child(3),
  .results-table td:nth-child(4) {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    margin-right: 7px;
  }

  .results-table td:last-child {
    position: absolute;
    top: 18px;
    right: 14px;
  }

  .result-slug {
    max-width: 230px;
  }

  .review-summary,
  .login-panel {
    padding: 20px;
  }

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

  .review-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-toolbar-actions {
    display: none;
  }

  .review-answer-item summary {
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    padding: 12px;
  }

  .review-question-copy span {
    white-space: normal;
  }

  .review-answer-detail {
    padding: 16px 12px 18px;
  }

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

  .review-bottom-bar {
    bottom: 8px;
  }

  .review-bottom-bar .review-save-state {
    max-width: 170px;
  }
}

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

  .teacher-button,
  .teacher-icon-button,
  .review-chevron {
    transition-duration: 0.01ms !important;
    transform: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .teacher-topbar,
  .review-bottom-bar {
    background: var(--teacher-surface);
    backdrop-filter: none;
  }
}
