:root {
  --checkpoint-ink: #101418;
  --checkpoint-muted: #5a646b;
  --checkpoint-panel: rgba(255, 255, 255, 0.94);
  --checkpoint-line: #c9d2d2;
  --checkpoint-teal: #0d6f72;
  --checkpoint-teal-dark: #064a4e;
  --checkpoint-amber: #c88424;
  --checkpoint-red: #ae3e3b;
  --checkpoint-violet: #554a8f;
  --checkpoint-green: #2f7c59;
  --checkpoint-paper: #f5f6f2;
  --checkpoint-shadow: 0 18px 48px rgba(16, 20, 24, 0.15);
}

body.checkpoint-body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(13, 111, 114, 0.18), transparent 32rem),
    linear-gradient(240deg, rgba(174, 62, 59, 0.13), transparent 28rem),
    radial-gradient(circle at 72% 8%, rgba(200, 132, 36, 0.22), transparent 19rem),
    var(--checkpoint-paper);
}

.checkpoint-shell {
  width: min(100% - 1.5rem, 1340px);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.checkpoint-topbar {
  margin-bottom: 0.7rem;
}

.checkpoint-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 1rem;
  align-items: stretch;
}

.checkpoint-hero > div,
.checkpoint-panel {
  border: 1px solid var(--checkpoint-line);
  border-radius: 8px;
  background: var(--checkpoint-panel);
  box-shadow: var(--checkpoint-shadow);
}

.checkpoint-hero > div:first-child {
  min-height: 11rem;
  padding: 1.35rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.78)),
    repeating-linear-gradient(135deg, rgba(13, 111, 114, 0.11) 0 1px, transparent 1px 16px);
}

.checkpoint-hero h1 {
  max-width: 13ch;
  margin: 0;
  color: var(--checkpoint-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.checkpoint-hero p {
  max-width: 52rem;
  margin: 1rem 0 0;
  color: var(--checkpoint-muted);
  font-size: 1.03rem;
  line-height: 1.45;
}

.timer-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 1rem;
  text-align: center;
}

.timer-panel span {
  color: var(--checkpoint-muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timer-panel strong {
  color: var(--checkpoint-teal-dark);
  font-size: clamp(2.6rem, 5vw, 4.3rem);
  line-height: 1;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.8rem;
}

.timer-button {
  min-height: 2.45rem;
  border: 1px solid var(--checkpoint-line);
  border-radius: 8px;
  background: #fff;
  color: var(--checkpoint-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.checkpoint-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 0.46fr) minmax(31rem, 1.15fr) minmax(20rem, 0.64fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.checkpoint-panel {
  padding: 1rem;
}

.panel-heading,
.console-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.panel-heading h2,
.console-header h2,
.bot-card h2 {
  margin: 0;
  color: var(--checkpoint-ink);
  font-size: 1.1rem;
  line-height: 1.2;
}

.panel-heading span,
.console-label {
  color: var(--checkpoint-muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.checkpoint-round-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.checkpoint-round-button {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  min-height: 3.1rem;
  border: 1px solid var(--checkpoint-line);
  border-radius: 8px;
  background: #fff;
  color: var(--checkpoint-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.checkpoint-round-button span {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.45rem;
  border-radius: 50%;
  background: #edf4f2;
  color: var(--checkpoint-teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.checkpoint-round-button strong {
  line-height: 1.15;
}

.checkpoint-round-button em {
  margin-right: 0.5rem;
  color: var(--checkpoint-muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.checkpoint-round-button:hover,
.checkpoint-round-button[aria-pressed="true"] {
  border-color: var(--checkpoint-teal);
  outline: 3px solid rgba(13, 111, 114, 0.14);
}

.gate-state {
  min-width: 8.2rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: #edf4f2;
  color: var(--checkpoint-teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.gate-state[data-status="clear"] {
  background: #e3f3e8;
  color: var(--checkpoint-green);
}

.gate-state[data-status="hold"] {
  background: #fff0dc;
  color: #815113;
}

.checkpoint-visual {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem;
  gap: 0.75rem;
  align-items: stretch;
  min-height: 8.5rem;
  margin-top: 1rem;
}

.gate-tower,
.payload-card {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.gate-tower {
  background: var(--checkpoint-teal-dark);
  box-shadow: inset 0 -18px 0 rgba(0, 0, 0, 0.14);
}

.ai-tower {
  background: var(--checkpoint-violet);
}

.scanner-lane {
  position: relative;
  overflow: hidden;
  border: 1px solid #bcc9c9;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(13, 111, 114, 0.08), transparent 48%, rgba(85, 74, 143, 0.1)),
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(16, 20, 24, 0.06) 24px 25px);
}

.scanner-beam {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18%;
  width: 18%;
  background: linear-gradient(90deg, transparent, rgba(13, 111, 114, 0.27), transparent);
  animation: checkpoint-scan 2.8s linear infinite;
}

.payload-card {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 8.6rem;
  min-height: 4.4rem;
  padding: 0.7rem;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid var(--checkpoint-teal);
  color: var(--checkpoint-teal-dark);
  box-shadow: 0 13px 24px rgba(16, 20, 24, 0.14);
}

.payload-card[data-status="clear"] {
  border-color: var(--checkpoint-green);
  color: var(--checkpoint-green);
}

.payload-card[data-status="hold"] {
  border-color: var(--checkpoint-amber);
  color: #815113;
}

@keyframes checkpoint-scan {
  from { transform: translateX(-140%); }
  to { transform: translateX(520%); }
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.case-grid article {
  min-height: 8.1rem;
  padding: 0.9rem;
  border: 1px solid #d8e0e0;
  border-radius: 8px;
  background: #fff;
}

.case-grid h3,
.decision-zone h3,
.checkpoint-note {
  margin: 0;
  color: var(--checkpoint-ink);
  font-size: 0.88rem;
  font-weight: 900;
}

.case-grid p {
  margin: 0.4rem 0 0;
  color: var(--checkpoint-muted);
  line-height: 1.4;
}

.decision-zone {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.route-grid,
.reason-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

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

.checkpoint-choice {
  min-height: 4.4rem;
  padding: 0.75rem;
  border: 1px solid var(--checkpoint-line);
  border-radius: 8px;
  background: #fff;
  color: var(--checkpoint-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.checkpoint-choice strong,
.checkpoint-choice span,
.checkpoint-choice em {
  display: block;
}

.checkpoint-choice span {
  margin-top: 0.25rem;
  color: var(--checkpoint-muted);
  font-size: 0.85rem;
  line-height: 1.3;
}

.checkpoint-choice em {
  margin-top: 0.35rem;
  color: var(--checkpoint-amber);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.checkpoint-choice:hover,
.checkpoint-choice[aria-pressed="true"] {
  border-color: var(--checkpoint-teal);
  outline: 3px solid rgba(13, 111, 114, 0.14);
}

.checkpoint-choice.choice-good {
  border-color: var(--checkpoint-green);
  background: #eef8f1;
}

.checkpoint-choice.choice-warning {
  border-color: var(--checkpoint-amber);
  background: #fff8e8;
}

.checkpoint-note {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.checkpoint-note textarea {
  width: 100%;
  min-height: 4.7rem;
  resize: vertical;
  border: 1px solid var(--checkpoint-line);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--checkpoint-ink);
  font: inherit;
  line-height: 1.35;
}

.checkpoint-actions {
  margin-top: 0.85rem;
}

.checkpoint-actions button {
  min-height: 2.75rem;
}

.bot-panel {
  display: grid;
  gap: 1rem;
}

.bot-card {
  min-height: 12rem;
  padding: 1rem;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(85, 74, 143, 0.13), rgba(255, 255, 255, 0.95)),
    #fff;
}

.bot-avatar {
  display: grid;
  place-items: center;
  width: 4.1rem;
  height: 4.1rem;
  margin-bottom: 0.85rem;
  border-radius: 50%;
  background: var(--checkpoint-violet);
  color: #fff;
}

.bot-avatar svg {
  width: 2.8rem;
  height: 2.8rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.bot-card p:last-child {
  margin: 0.55rem 0 0;
  color: var(--checkpoint-muted);
  line-height: 1.4;
}

.score-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.checkpoint-score {
  min-height: 4.3rem;
  padding: 0.75rem;
  border: 1px solid #d8e0e0;
  border-radius: 8px;
  background: #fff;
}

.checkpoint-score span,
.checkpoint-score strong {
  display: block;
}

.checkpoint-score span {
  color: var(--checkpoint-muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.checkpoint-score strong {
  margin-top: 0.28rem;
  color: var(--checkpoint-ink);
  font-size: 1.08rem;
  line-height: 1.15;
}

.feed {
  margin-top: 0;
}

.feed-item p {
  white-space: pre-line;
}

@media (prefers-reduced-motion: reduce) {
  .scanner-beam {
    animation: none;
  }
}

@media (max-width: 1120px) {
  .checkpoint-layout {
    grid-template-columns: minmax(15rem, 0.42fr) minmax(0, 1fr);
  }

  .bot-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 820px) {
  .checkpoint-hero,
  .checkpoint-layout,
  .case-grid,
  .decision-zone,
  .reason-grid {
    grid-template-columns: 1fr;
  }

  .checkpoint-visual {
    grid-template-columns: 3.6rem minmax(0, 1fr) 3.6rem;
  }

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

@media (max-width: 560px) {
  .checkpoint-shell {
    width: min(100% - 0.75rem, 1340px);
  }

  .checkpoint-hero > div:first-child,
  .checkpoint-panel {
    padding: 0.85rem;
  }

  .checkpoint-round-button {
    grid-template-columns: 1.75rem 1fr;
  }

  .checkpoint-round-button em {
    grid-column: 2;
    margin: -0.45rem 0 0.45rem;
  }

  .score-stack {
    grid-template-columns: 1fr;
  }
}
