:root {
  color-scheme: dark;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  --bg: var(--gray-950);
  --card: #090e1a;
  --card-border: var(--gray-900);
  --text: var(--gray-50);
  --text-muted: var(--gray-400);
  --text-faint: var(--gray-500);
  --border: var(--gray-800);
  --input-bg: var(--gray-950);
  --surface: var(--gray-900);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--gray-950);
  color: var(--gray-50);
  border-color: var(--border);
}

button.secondary:hover {
  background: rgba(17, 24, 39, 0.6);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

select {
  cursor: pointer;
}

select option {
  background: var(--card);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
}

.gate-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 20px 24px;
  margin-bottom: 12px;
}

.gate-panel h1,
.section-heading h1,
.job-header h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.gate-panel h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.muted {
  color: var(--text-muted);
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 16px;
  align-items: start;
}

.column-main,
.column-sidebar {
  min-width: 0;
}

.job-panel,
.annotation-panel,
.empty-state {
  padding: 24px;
}

.gate-copy {
  min-width: 0;
}

.gate-copy p {
  max-width: 720px;
}

.gate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.description-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.legend-pill--positive {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.18);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}

.legend-pill--restrictive {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.16);
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.3);
}

.job-description {
  min-height: 200px;
  display: grid;
  gap: 14px;
  word-break: break-word;
  line-height: 1.7;
  font-size: 1rem;
  color: var(--gray-300);
}

.job-description > * {
  margin: 0;
}

.job-description h1,
.job-description h2,
.job-description h3,
.job-description h4,
.job-description h5,
.job-description h6,
.job-description p,
.job-description li {
  white-space: pre-wrap;
}

.job-description h1,
.job-description h2,
.job-description h3,
.job-description h4,
.job-description h5,
.job-description h6 {
  color: var(--gray-50);
  font-weight: 700;
  line-height: 1.3;
}

.job-description h1 {
  font-size: 1.5rem;
}

.job-description h2 {
  font-size: 1.3rem;
}

.job-description h3 {
  font-size: 1.12rem;
}

.job-description ul {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.4rem;
}

.job-description li::marker {
  color: var(--text-muted);
}

.evidence-highlight {
  padding: 0 0.18em;
  border-radius: 0.3em;
  font-weight: 600;
}

.evidence-highlight--positive {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.22);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.32);
}

.evidence-highlight--restrictive {
  color: #ffedd5;
  background: rgba(234, 88, 12, 0.24);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.36);
}

.section-heading.compact {
  margin-bottom: 16px;
}

.section-heading h1 {
  font-size: 1.125rem;
}

.sidebar-hint {
  font-size: 0.8125rem;
  margin: 4px 0 0;
}

.form-section + .form-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-section h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.step-label {
  margin: 0 0 2px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.field-group {
  margin-top: 16px;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-help {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.checkbox-field {
  margin-top: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

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

.label-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.label-button {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  box-shadow: none;
}

.label-button:hover {
  background: rgba(31, 41, 55, 0.8);
}

.label-button.selected {
  background: var(--accent-muted);
  color: #60a5fa;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.label-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.label-button:disabled:hover {
  background: var(--surface);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--gray-800);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}

.info-icon:hover {
  background: var(--gray-700);
  color: var(--text);
}

.info-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: -8px;
  width: 260px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gray-800);
  color: var(--gray-200);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  z-index: 100;
  pointer-events: none;
}

.sidebar-buttons {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.sidebar-buttons button {
  width: 100%;
}

.final-call-section {
  padding: 16px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.12);
}

.hidden-signals {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.4);
}

.hidden-signals pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  color: var(--gray-300);
}

.hidden-signals p {
  margin: 0;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.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;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .gate-panel {
    flex-wrap: wrap;
  }

  .gate-actions {
    width: 100%;
    margin-left: 0;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .label-grid.two-up {
    grid-template-columns: 1fr;
  }
}

/* --- Gamification: sparkle particles --- */

.sparkle-particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  animation: sparkle-fly 700ms ease-out forwards;
}

.sparkle-particle:nth-child(odd) {
  background: #60a5fa;
}

.sparkle-particle:nth-child(3n) {
  background: #a78bfa;
  width: 4px;
  height: 4px;
}

@keyframes sparkle-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--sx), var(--sy)) scale(0);
  }
}

/* --- Gamification: completion confetti --- */

.confetti-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 1200ms ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--sx), var(--sy)) rotate(var(--rot)) scale(0.3);
  }
}

/* --- Phone layout of the review page: tabs "Advert" and "Answer" (below 760px only) --- */
.mobile-tabs,
.mobile-only {
  display: none;
}

@media (max-width: 759px) {
  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 8px 0;
    background: var(--bg);
  }

  .mobile-tabs button {
    min-height: 44px;
  }

  .mobile-tabs button[aria-selected='true'] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .mobile-only {
    display: inline-flex;
  }

  .go-to-answer {
    width: 100%;
    min-height: 44px;
    margin-top: 16px;
  }

  #review-panel[data-mobile-view='advert'] .column-sidebar,
  #review-panel[data-mobile-view='answer'] .column-main {
    display: none;
  }

  .job-panel,
  .annotation-panel {
    padding: 16px;
  }
}

/* --- Server pages: sign-in, your review work, admin --- */
.layout-narrow {
  max-width: 640px;
}

.page-panel {
  padding: 24px;
  margin-bottom: 16px;
}

.page-panel h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
}

.page-panel h2 {
  margin: 0 0 8px;
  font-size: 1.125rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-actions form,
.row-actions form {
  margin: 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.button-link.hidden {
  display: none;
}

.button-link.secondary {
  background: var(--gray-950);
  color: var(--gray-50);
  border-color: var(--border);
}

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

.notice {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  background: var(--accent-muted);
  font-size: 0.875rem;
}

.notice-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--danger-bg);
  color: #fecaca;
}

.stack-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.stack-form label {
  font-size: 0.875rem;
  font-weight: 500;
}

.queue-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.queue-item p {
  margin: 0;
}

.queue-title {
  font-weight: 600;
}

.queue-item form {
  margin: 0;
}

.invite-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}

.task-choices {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.task-choices legend {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.remove-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.remove-form .checkbox-label {
  gap: 4px;
  font-size: 0.8125rem;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.pill-active {
  color: #86efac;
}

.pill-paused {
  color: #fcd34d;
}

.pill-removed {
  color: var(--text-faint);
}

@media (max-width: 759px) {
  .invite-form {
    grid-template-columns: 1fr;
  }

  .queue-item {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tr {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }

  .admin-table td {
    display: flex;
    gap: 8px;
    border-bottom: 0;
    padding: 4px 0;
  }

  .admin-table td::before {
    content: attr(data-label);
    min-width: 96px;
    color: var(--text-muted);
  }
}

/* Overview pages: red marks a flag that needs attention. */
.pill-red {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
  background: var(--danger-bg);
}

.admin-table td.cell-red {
  color: #fca5a5;
  background: var(--danger-bg);
  font-weight: 600;
}

.overview-nav {
  flex-wrap: wrap;
}

/* ==========================================================================
   Reviewer screen: top bar, advert, answer steps, save bar, toasts.
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --focus-ring: #93c5fd;
  --ok: #22c55e;
  --ok-text: #bbf7d0;
  --ok-bg: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-text: #fde68a;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --bad: #f87171;
  --quote-bg: rgba(250, 204, 21, 0.22);
  --quote-line: rgba(250, 204, 21, 0.7);
}

/* Visible keyboard focus on every control. */
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.brand-eyebrow,
#gate-eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8125rem;
}

/* --- Start screen and first-time intro --- */
.gate-panel.is-intro {
  flex-direction: column;
  align-items: stretch;
  max-width: 560px;
  margin: 8vh auto 0;
  padding: 32px;
  gap: 20px;
}

.gate-panel.is-intro .gate-actions {
  justify-content: flex-start;
}

.gate-panel.is-intro #start-reviewing {
  min-width: 160px;
  min-height: 48px;
  font-size: 1rem;
  background: var(--primary);
}

.intro-lines {
  margin: 16px 0 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 10px;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--gray-200);
}

.intro-lines li::marker {
  color: var(--accent);
  font-weight: 700;
}

/* --- Toasts: only errors and saves --- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  justify-items: center;
  pointer-events: none;
  width: min(92vw, 480px);
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  background: var(--gray-800);
  color: var(--gray-50);
  box-shadow: var(--shadow-md);
  transition: opacity 250ms ease, transform 250ms ease;
}

.toast--saved {
  background: #14532d;
  color: var(--ok-text);
}

.toast--error {
  background: #7f1d1d;
  color: #fee2e2;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

/* --- Top bar --- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px 12px;
  margin-bottom: 12px;
}

.topbar-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-width: 0;
}

.topbar-task {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.topbar-progress {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
}

.text-link {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link:hover {
  color: #bfdbfe;
}

.text-link.hidden {
  display: none;
}

.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--ok);
  transition: width 400ms ease-out;
}

.more-menu {
  position: relative;
}

.more-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--gray-200);
}

.more-menu summary::-webkit-details-marker {
  display: none;
}

.more-menu summary::after {
  content: " \25BE";
  color: var(--text-muted);
}

.more-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: 260px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--gray-900);
  border: 1px solid var(--gray-700);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.more-menu-panel button {
  justify-content: flex-start;
  width: 100%;
}

.more-menu-meta {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.topbar-jump {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.topbar-jump label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.topbar-jump-row {
  display: flex;
  gap: 8px;
}

.topbar-jump-row input {
  flex: 1;
  min-width: 0;
}

/* --- Advert --- */
.job-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
}

.job-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.job-header .eyebrow {
  color: var(--text-muted);
}

.job-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 10px;
  font-size: 0.875rem;
}

.neutral-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.neutral-meta:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(156, 163, 175, 0.12);
  color: var(--gray-300);
  font-size: 0.8125rem;
}

.job-scroll {
  padding-top: 16px;
}

.job-description {
  max-width: 70ch;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--gray-200);
}

.job-description h1,
.job-description h2,
.job-description h3,
.job-description h4,
.job-description h5,
.job-description h6 {
  margin-top: 8px;
}

.quote-highlight {
  background: var(--quote-bg);
  color: #fef9c3;
  border-radius: 3px;
  box-shadow: 0 2px 0 var(--quote-line);
  padding: 0 1px;
}

/* --- Answer panel --- */
.annotation-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.answer-body {
  padding: 20px 22px 8px;
}

.steps {
  display: grid;
  gap: 22px;
}

.step + .step,
.steps > .optional-fields {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  font-size: 0.8125rem;
  font-weight: 700;
}

.step-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}

.ai-answer {
  padding-left: 36px;
}

.ai-answer p {
  margin: 0;
}

.ai-answer-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.ai-answer-guess {
  margin-top: 4px !important;
  color: var(--gray-300);
}

.ai-answer-evidence {
  margin-top: 8px !important;
  color: var(--gray-200);
  line-height: 1.5;
}

.ai-answer-evidence q {
  font-style: italic;
}

.ai-answer-evidence.is-empty {
  color: var(--text-muted);
}

.ai-answer-because {
  color: var(--text-muted);
}

.ai-answer .field-help {
  margin-top: 6px;
}

.link-button {
  margin-top: 6px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.875rem;
}

.link-button:hover {
  background: none;
  color: #bfdbfe;
}

.rule-summary {
  margin: -4px 0 12px;
  color: var(--gray-300);
  font-size: 0.875rem;
  line-height: 1.5;
}

.choice-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.choice-button {
  position: relative;
  justify-content: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--gray-700);
  border-radius: 8px;
  background: var(--gray-900);
  color: var(--gray-50);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  white-space: normal;
  box-shadow: none;
}

.choice-button:hover {
  background: var(--gray-800);
  border-color: var(--gray-500);
}

.choice-button[aria-pressed='true'] {
  background: rgba(37, 99, 235, 0.25);
  border-color: #60a5fa;
  box-shadow: inset 0 0 0 1px #60a5fa;
}

.choice-button:disabled {
  opacity: 0.55;
}

.choice-button:disabled:hover {
  background: var(--gray-900);
  border-color: var(--gray-700);
}

.choice-button[aria-pressed='true']:disabled {
  opacity: 0.9;
  background: rgba(37, 99, 235, 0.25);
}

.choice-grid--verdict .choice-button {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 76px;
  text-align: center;
  font-size: 1rem;
}

.choice-icon {
  font-size: 1.375rem;
  line-height: 1;
  font-weight: 700;
}

.choice-button--correct .choice-icon {
  color: #4ade80;
}

.choice-button--wrong .choice-icon {
  color: #f87171;
}

.choice-button--not_sure .choice-icon {
  color: #fbbf24;
}

.choice-button--correct[aria-pressed='true'] {
  background: var(--ok-bg);
  border-color: var(--ok);
  box-shadow: inset 0 0 0 1px var(--ok);
}

.choice-button--wrong[aria-pressed='true'] {
  background: rgba(248, 113, 113, 0.14);
  border-color: var(--bad);
  box-shadow: inset 0 0 0 1px var(--bad);
}

.choice-button--not_sure[aria-pressed='true'] {
  background: var(--warn-bg);
  border-color: var(--warn);
  box-shadow: inset 0 0 0 1px var(--warn);
}

/* Small key numbers. Shown only on the buttons that the number keys control now. */
.key-hint {
  display: none;
  margin-left: auto;
  padding: 0 5px;
  border: 1px solid var(--gray-700);
  border-radius: 4px;
  color: var(--gray-400);
  font-family: inherit;
  font-size: 0.6875rem;
  line-height: 1.5;
}

.show-keys .key-hint {
  display: inline-block;
}

.choice-grid--verdict .key-hint {
  position: absolute;
  top: 6px;
  right: 6px;
}

@media (hover: none) {
  .show-keys .key-hint {
    display: none;
  }
}

.nested-field {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}

.nested-label {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.nested-field .field-help {
  margin: 2px 0 10px;
}

.task-help,
.optional-fields {
  margin-top: 14px;
  font-size: 0.875rem;
}

.task-help summary,
.optional-fields summary {
  cursor: pointer;
  color: #93c5fd;
  font-weight: 500;
}

.task-help dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 10px 0 0;
}

.task-help dt {
  font-weight: 600;
}

.task-help dd {
  margin: 0;
  color: var(--gray-300);
}

.task-help .field-help {
  margin-top: 10px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.optional-fields .field-group {
  margin-top: 12px;
}

.optional-fields textarea {
  min-height: 64px;
}

/* Exactly one main button: "Save and next". It stays at the bottom of the answer panel. */
.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  gap: 6px;
  padding: 14px 22px 18px;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}

.save-bar.hidden {
  display: none;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
}

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

.primary-action:disabled {
  opacity: 1;
  background: var(--gray-800);
  color: var(--gray-400);
}

.save-reason {
  margin: 0;
  color: var(--gray-300);
  font-size: 0.8125rem;
  text-align: center;
}

.save-reason.hidden {
  display: none;
}

.hidden-fields-toggle {
  margin-top: 20px;
}

.hidden-fields-toggle.hidden {
  display: none;
}

/* Practice advert: the result after the save. */
.training-feedback {
  margin: 16px 16px 0;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.training-feedback:focus {
  outline: none;
}

.training-feedback.is-right {
  background: var(--ok-bg);
  border-color: var(--ok);
}

.training-feedback.is-wrong {
  background: var(--warn-bg);
  border-color: var(--warn);
}

.training-feedback p {
  margin: 0 0 6px;
}

.feedback-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-300);
}

.feedback-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.training-feedback.is-right .feedback-title {
  color: var(--ok-text);
}

.training-feedback.is-wrong .feedback-title {
  color: var(--warn-text);
}

.feedback-text {
  color: var(--gray-200);
  line-height: 1.5;
}

.training-feedback .primary-action {
  margin-top: 10px;
}

/* Desktop: the advert and the answer scroll on their own, so the save button never leaves the screen. */
@media (min-width: 760px) {
  .two-column {
    grid-template-columns: minmax(0, 1fr) 420px;
  }

  .job-panel,
  .annotation-panel {
    max-height: calc(100vh - 110px);
  }

  .job-scroll,
  .answer-body {
    overflow-y: auto;
    min-height: 0;
    flex: 1;
  }

  .job-scroll {
    margin-right: -16px;
    padding-right: 16px;
  }
}

/* Phone: the tabs stay; the main button stays at the bottom of the screen. */
@media (max-width: 759px) {
  .layout {
    padding: 8px 12px 96px;
  }

  .topbar {
    padding: 8px 12px 10px;
    margin-bottom: 4px;
  }

  .topbar-task {
    font-size: 0.9375rem;
  }

  .topbar-progress {
    font-size: 0.875rem;
  }

  .job-panel {
    padding: 16px;
  }

  .job-title {
    font-size: 1.25rem;
  }

  .job-description {
    font-size: 1rem;
  }

  .answer-body {
    padding: 16px 16px 8px;
  }

  .save-bar,
  .mobile-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
  }

  .mobile-bottom-bar {
    display: block;
  }

  .mobile-bottom-bar .go-to-answer {
    margin-top: 0;
    min-height: 48px;
    font-size: 1rem;
    background: var(--primary);
  }

  .training-feedback {
    margin: 12px 12px 0;
  }

  .ai-answer {
    padding-left: 0;
  }

  .choice-grid--verdict .choice-button {
    min-height: 68px;
  }
}

/* The AI level in the "Wrong" step: marked, and not available. */
.choice-button.is-ai-answer::after {
  content: "AI";
  margin-left: auto;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--gray-800);
  color: var(--gray-300);
  font-size: 0.6875rem;
  font-weight: 600;
}

.choice-button.is-ai-blocked .choice-text {
  text-decoration: line-through;
}

.show-keys .choice-button.is-ai-answer .key-hint {
  margin-left: 6px;
}

.show-keys .choice-button.is-ai-blocked .key-hint {
  display: none;
}

/* No line above the first visible step (a blind round has no AI step). */
.steps > .step--ai.hidden + .step {
  padding-top: 0;
  border-top: 0;
}

/* After a practice save the answers are locked, so the key numbers go away. */
.choice-button:disabled .key-hint {
  display: none !important;
}

.more-menu-panel .topbar-jump-row button {
  width: auto;
  flex: none;
}
