:root {
  --bg-page: #F7F6F2;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-muted: #F8FAFC;

  --border-main: #E2E8F0;
  --border-strong: #CBD5E1;

  --text-ink: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;

  --amber-600: #D97706;
  --amber-500: #F59E0B;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;

  --emerald-600: #059669;
  --emerald-500: #10B981;
  --emerald-bg: #ECFDF5;
  --emerald-border: #A7F3D0;

  --rose-600: #DC2626;
  --rose-bg: #FEF2F2;
  --rose-border: #FECACA;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  background-color: var(--bg-page);
  color: var(--text-ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================
   MINIMAL TOP HEADER
   ========================================== */
.lab-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-main);
  position: sticky;
  top: 0;
  z-index: 20;
}

.lab-header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
}

.brand-cube {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
}

.brand-title {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text-ink);
}

.header-progress-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  background: var(--bg-subtle);
  border: 1px solid var(--border-main);
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
}

/* ==========================================
   MAIN VIEWPORT CONTAINER
   ========================================== */
.lab-main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.lab-screen {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.lab-screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   SHARED BADGES & BUTTONS
   ========================================== */
.eyebrow-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  color: var(--amber-600);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
}

.emerald-eyebrow {
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
}

.telemetry-status-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-primary,
.btn-secondary,
.btn-emerald {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn-large {
  font-size: 1rem;
  padding: 0.9rem 1.75rem;
}

.btn-primary {
  background: var(--text-ink);
  color: #FFFFFF;
  border: 1px solid var(--text-ink);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.btn-primary:hover:not(:disabled) {
  background: #1E293B;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-ink);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--text-ink);
}

.btn-emerald {
  background: var(--emerald-600);
  color: #FFFFFF;
  border: 1px solid var(--emerald-600);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

.btn-emerald:hover:not(:disabled) {
  background: #047857;
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================
   SCREEN 0: FOCUSED BRIEFING SCREEN
   ========================================== */
.briefing-card {
  max-width: 640px;
  margin: 1.5rem auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.briefing-headline {
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-ink);
  margin: 1rem 0 0.85rem;
}

.briefing-subhead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-body);
  margin-bottom: 1.5rem;
}

.briefing-rules-list {
  list-style: none;
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.briefing-rules-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-body);
}

.briefing-rules-list strong {
  color: var(--text-ink);
}

.rule-bullet {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber-600);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.12rem;
}

.briefing-cta-row {
  display: flex;
}

.briefing-cta-row .btn-primary {
  width: 100%;
}

/* ==========================================
   ROUND HEADER & PROBE BUDGET
   ========================================== */
.round-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.round-header-left {
  flex: 1;
  min-width: 240px;
}

.round-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-ink);
  margin: 0.35rem 0 0.25rem;
}

.round-scenario-briefing {
  font-size: 0.94rem;
  color: var(--text-body);
  line-height: 1.5;
}

.probe-budget-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  min-width: 210px;
  text-align: right;
  font-family: var(--font-mono);
}

.probe-budget-box.budget-depleted {
  border-color: var(--rose-border);
  background: var(--rose-bg);
}

.probe-budget-counter {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 0.45rem;
}

.probe-budget-box.budget-depleted .probe-budget-counter {
  color: var(--rose-600);
}

.probe-pips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
  max-width: 220px;
  margin-left: auto;
}

.probe-pip {
  width: 17px;
  height: 7px;
  border-radius: 3px;
  background: var(--emerald-500);
  transition: all 0.2s ease;
}

.probe-pip.spent {
  background: #CBD5E1;
}

/* ==========================================
   MEMORY WARNING BANNER
   ========================================== */
.memory-warning-banner {
  padding: 0.75rem 1rem;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber-500);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: #92400E;
  margin-bottom: 1rem;
}

/* ==========================================
   WORKBENCH GRID: INPUTS & SINGLE OUTPUT
   ========================================== */
.workbench-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.workbench-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.panel-header {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-main);
  padding: 0.75rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-ink);
}

.panel-status {
  font-family: var(--font-mono);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-armed {
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
}

.status-locked {
  color: var(--amber-600);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
}

.status-standby {
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-main);
}

.probe-form {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  justify-content: space-between;
}

.inputs-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.input-channel-row {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.input-channel-row:focus-within {
  border-color: var(--text-ink);
  background: #FFFFFF;
}

.channel-label-group {
  display: flex;
  flex-direction: column;
}

.channel-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-ink);
}

.channel-range {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-muted);
}

.channel-control-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.step-btn {
  width: 38px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-ink);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.step-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--text-ink);
}

.forensic-input {
  width: 92px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: 0 0.4rem;
}

.forensic-input:focus {
  outline: none;
  border-color: var(--text-ink);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
}

.console-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

/* Single-Output Display */
.terminal-screen {
  flex: 1;
  margin: 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 220px;
}

.terminal-screen.overwrite-flash {
  animation: flashPulse 0.35s ease-out;
}

@keyframes flashPulse {
  0% {
    background-color: var(--amber-bg);
    border-color: var(--amber-500);
  }
  100% {
    background-color: var(--bg-muted);
    border-color: var(--border-main);
  }
}

.terminal-empty-state {
  text-align: center;
  padding: 1rem;
}

.terminal-box-graphic {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  margin-bottom: 0.65rem;
}

.terminal-empty-text {
  font-size: 0.9rem;
  color: var(--text-body);
  margin-bottom: 0.25rem;
}

.terminal-empty-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.terminal-live-readout {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.terminal-live-readout[hidden] {
  display: none !important;
}

.terminal-overwrite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.terminal-probe-index {
  color: var(--text-ink);
  font-weight: 700;
}

.terminal-purge-notice {
  color: var(--amber-600);
  font-weight: 600;
}

.terminal-section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.terminal-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.terminal-input-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
}

.terminal-input-pill-name {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.terminal-input-pill-val {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-ink);
}

.terminal-output-box {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-output-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--emerald-600);
  line-height: 1;
}

/* ==========================================
   BOSS CHECK PANEL (HIDDEN UNTIL READY TO SOLVE)
   ========================================== */
.boss-check-panel[hidden] {
  display: none !important;
}

.boss-check-panel {
  background: var(--bg-card);
  border: 2px solid var(--text-ink);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  animation: fadeIn 0.25s ease-out;
}

.boss-check-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-main);
}

.boss-check-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-ink);
  margin-top: 0.3rem;
}

.boss-lock-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber-600);
}

.boss-check-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.boss-question-block {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
}

.question-step-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.boss-question-prompt {
  display: block;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-ink);
  margin-bottom: 0.85rem;
}

.prediction-lock-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.prediction-input-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  max-width: 100%;
}

.prediction-prefix {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-body);
}

.prediction-input {
  width: 155px;
  max-width: 100%;
}

.prediction-locked-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
}

.boss-question-block[hidden],
.prediction-locked-badge[hidden],
#btn-lock-prediction[hidden] {
  display: none !important;
}

.boss-options-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.boss-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-body);
}

.boss-option-card:hover {
  border-color: var(--text-ink);
  background: var(--bg-subtle);
}

.boss-option-card.selected {
  border-color: var(--emerald-600);
  background: var(--emerald-bg);
  color: var(--text-ink);
  box-shadow: 0 0 0 1px var(--emerald-600);
}

.boss-option-card input[type="radio"] {
  margin-top: 0.22rem;
  accent-color: var(--emerald-600);
}

.option-letter {
  font-weight: 700;
  color: var(--text-ink);
  margin-right: 0.25rem;
}

.form-error-msg {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--rose-600);
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
}

.boss-submit-row {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================
   INSTANT FEEDBACK MODAL
   ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.feedback-modal {
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.modal-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-verdict-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.modal-verdict-pill.pass {
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
}

.modal-verdict-pill.fail {
  color: var(--rose-600);
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
}

.modal-verdict-pill.neutral {
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 1rem;
}

.modal-checks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.modal-check-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.modal-check-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

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

.modal-check-status.ok {
  color: var(--emerald-600);
}

.modal-check-status.err {
  color: var(--rose-600);
}

.modal-check-question {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.modal-check-detail {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-ink);
  line-height: 1.45;
}

.modal-formula-box[hidden] {
  display: none !important;
}

.modal-formula-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono);
}

.formula-box-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.formula-box-code {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-ink);
}

.modal-diagnosis-box {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber-500);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.modal-diagnosis-box.good-discipline {
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
  border-left-color: var(--emerald-600);
}

.diagnosis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.diagnosis-tag {
  color: var(--text-ink);
}

.diagnosis-pill {
  color: var(--text-ink);
  background: rgba(255, 255, 255, 0.8);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
}

.diagnosis-text {
  font-size: 0.92rem;
  color: var(--text-ink);
  line-height: 1.55;
}

.diagnosis-secondary-note {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-body);
}

.modal-actions-row {
  display: flex;
  justify-content: flex-end;
}

.confirm-solve-modal {
  max-width: 520px;
}

.confirm-actions-row {
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 540px) {
  .confirm-actions-row {
    flex-direction: column-reverse;
  }

  .confirm-actions-row button {
    width: 100%;
  }
}

/* ==========================================
   FINAL RESULTS & SUBSTACK CTA
   ========================================== */
.results-banner-card,
.results-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.results-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

.results-hero-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: center;
}

.results-score-block {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  font-family: var(--font-mono);
}

.score-eyebrow {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.score-display-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.final-score-value {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text-ink);
  line-height: 1;
}

.final-top-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--amber-600);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}

.final-score-verdict {
  font-size: 0.78rem;
  color: var(--emerald-600);
  font-weight: 600;
}

.percentile-headline {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 0.25rem;
}

.highlight-emerald {
  color: var(--emerald-600);
  font-family: var(--font-mono);
}

.percentile-subtext {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.cohort-distribution {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.dist-pill {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.dist-pill.current-bucket {
  border-color: var(--emerald-600);
  background: var(--emerald-bg);
}

.dist-pill-top {
  display: flex;
  justify-content: space-between;
  color: var(--text-body);
  margin-bottom: 0.25rem;
}

.dist-pill.current-bucket .dist-pill-top {
  color: var(--emerald-600);
  font-weight: 700;
}

.dist-bar-track {
  height: 5px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  background: var(--amber-500);
}

.dist-pill.current-bucket .dist-bar-fill {
  background: var(--emerald-600);
}

.section-card-header {
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-ink);
}

.section-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.pillar-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pillar-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.pillar-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-ink);
}

.pillar-status-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.status-locked-in {
  color: var(--emerald-600);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
}

.status-blind-spot {
  color: var(--rose-600);
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
}

.status-pending {
  color: var(--amber-600);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
}

.pillar-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pillar-desc {
  font-size: 0.84rem;
  color: var(--text-body);
  line-height: 1.5;
}

.memory-prompt-question {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-ink);
  margin-bottom: 0.45rem;
}

.memory-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.btn-memory-choice {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
}

.btn-memory-choice.active {
  border-color: var(--emerald-600);
  background: var(--emerald-bg);
  color: var(--emerald-600);
}

.round-audit-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-main);
}

.audit-round-pill {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.results-rounds-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.round-breakdown-card {
  margin-bottom: 0;
}

.round-breakdown-card .modal-diagnosis-box {
  margin-bottom: 0;
}

.results-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.15rem;
  align-items: stretch;
}

.results-bottom-grid .results-section-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.share-card-preview {
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1rem;
}

.share-actions-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.substack-card-container {
  border-top: 3px solid var(--emerald-600);
}

.substack-headline {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-ink);
  margin: 0.6rem 0 0.45rem;
  line-height: 1.3;
}

.substack-body-copy {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

.substack-embed-wrapper {
  background: #FFFFFF;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.substack-iframe {
  display: block;
  width: 100%;
  height: 145px;
  border: 0;
}

.btn-substack-series {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-ink);
  border: 1px solid var(--border-strong);
  text-decoration: none;
}

.btn-substack-series:hover {
  background: var(--text-ink);
  color: #FFFFFF;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================== */
@media (max-width: 820px) {
  .workbench-grid,
  .results-hero-grid,
  .pillars-grid,
  .results-bottom-grid,
  .boss-options-list,
  .modal-checks-grid,
  .round-audit-strip {
    grid-template-columns: 1fr;
  }

  .probe-budget-box {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .probe-budget-counter {
    margin-bottom: 0;
  }
}

@media (max-width: 540px) {
  .lab-main {
    padding: 1rem 0.85rem 2.25rem;
  }

  .briefing-card {
    margin-top: 0.25rem;
    padding: 1.4rem;
  }

  .round-header-card,
  .results-banner-card,
  .results-section-card,
  .boss-check-panel,
  .feedback-modal {
    padding: 1.15rem;
  }

  .console-actions,
  .share-actions-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .share-actions-row button {
    width: 100%;
  }

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

  .prediction-input-wrapper {
    width: 100%;
    justify-content: space-between;
  }

  .prediction-input {
    flex: 1;
    width: auto;
  }

  .modal-actions-row .btn-primary {
    width: 100%;
  }

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

  .survey-optional-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   PARTICIPANT SURVEY SCREEN
   ========================================== */
.survey-card {
  max-width: 640px;
  margin: 1.5rem auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  animation: fadeIn 0.25s ease-out;
}

.survey-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-main);
}

.survey-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-ink);
  margin: 0.5rem 0 0.35rem;
  line-height: 1.25;
}

.survey-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.survey-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.survey-question-block {
  background: var(--bg-muted);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.survey-question-label {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 0.25rem;
}

.required-indicator {
  color: var(--crimson-500);
}

.survey-question-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.4;
}

.survey-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 681px) {
  .survey-options-grid .survey-option-card:last-child:nth-child(odd) {
    grid-column: span 2;
  }
}

.survey-option-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
  font-size: 0.86rem;
  color: var(--text-ink);
}

.survey-option-card:hover {
  border-color: var(--text-ink);
  background: var(--bg-subtle);
}

.survey-option-card:has(input:checked) {
  border-color: var(--emerald-600);
  background: var(--emerald-bg);
  box-shadow: 0 0 0 1px var(--emerald-600);
}

.survey-radio {
  accent-color: var(--emerald-600);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.survey-option-text {
  line-height: 1.3;
}

.survey-optional-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.survey-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.survey-field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-ink);
}

.optional-tag {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.survey-input,
.survey-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
}

.survey-actions-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

.survey-actions-row .btn-emerald {
  width: 100%;
}
