/* ============================================================
   Context Hitch — Main Stylesheet
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */

:root {
  /* Background layers */
  --bg-base:     #0a0f1a;   /* deepest — page background */
  --bg-surface:  #111827;   /* slightly elevated — form fields */
  --bg-raised:   #1a2336;   /* notably elevated — cards */

  /* Borders */
  --border:        #1e2d42;
  --border-subtle: #263346;

  /* Text */
  --text-primary:   #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted:     #4b6080;

  /* Accent — teal/cyan */
  --accent:          #22d3ee;
  --accent-dim:      rgba(34, 211, 238, 0.08);
  --accent-glow:     rgba(34, 211, 238, 0.20);
  --accent-border:   rgba(34, 211, 238, 0.30);
  --accent-text-on:  #0a0f1a;  /* dark text on teal button background */

  /* Semantic */
  --error:     #f87171;
  --error-dim: rgba(248, 113, 113, 0.10);
  --success:   #34d399;
  --success-dim: rgba(52, 211, 153, 0.10);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Layout */
  --content-width: 640px;
  --radius:        6px;
  --radius-lg:     10px;

  /* Transitions */
  --fast:   120ms ease;
  --base:   200ms ease;
  --slow:   400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-base);
  /*
    Very subtle radial tint — barely visible, adds the impression of depth
    without being a visual element.
  */
  background-image:
    radial-gradient(
      ellipse 80% 60% at 25% 35%,
      rgba(34, 211, 238, 0.035) 0%,
      transparent 70%
    );
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Base links ────────────────────────────────────────────── */
/*
  Bare anchor color — warm white so unstyled links are legible on
  the dark background without the browser default royal blue.
  Component-specific rules (.prose a, .nav-link, etc.) override these.
*/

a         { color: #89B4CC; }
a:visited { color: #6A9AB8; }
a:hover   { color: #AAD0E8; text-decoration: underline; }

/* ── Page layout ───────────────────────────────────────────── */

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);

  /* Subtle page entrance */
  animation: page-entry 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes page-entry {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ────────────────────────────────────────────────── */

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

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  letter-spacing: -0.01em;
}

.logo-mark {
  font-size: 15px;
  color: var(--accent);
  line-height: 1;
  user-select: none;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-link {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--fast);
}

.nav-link:hover { color: var(--text-secondary); }

/* ── Main ──────────────────────────────────────────────────── */

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-20) 0 var(--space-16);
}

/* ── Views (hero / passphrase / request) ───────────────────── */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in var(--slow) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
  /* No extra wrapper needed — the view class handles it */
}

/* ── Marvin block ──────────────────────────────────────────── */

.marvin-block {
  margin-bottom: var(--space-12);
}

.marvin-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.65;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.marvin-label::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}

.marvin-message {
  font-size: 19px;
  line-height: 1.72;
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 0.005em;
  max-width: 580px;
}

#marvin-message { white-space: pre-wrap; }

/* Ford-voice callout — amber, distinct from Marvin's teal */
.ford-callout {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(251, 191, 36, 0.04);
  border-left: 2px solid rgba(251, 191, 36, 0.38);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.ford-callout-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(251, 191, 36, 0.65);
  margin-bottom: var(--space-2);
}

.ford-callout p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 400;
  margin: 0;
}

.ford-callout p + p {
  margin-top: var(--space-2);
}

/* Marvin-voice callout — teal, mirrors Ford's amber callout */
.marvin-callout {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(34, 211, 238, 0.04);
  border-left: 2px solid rgba(34, 211, 238, 0.30);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.marvin-callout-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.65;
  margin-bottom: var(--space-2);
}

.marvin-callout p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 400;
  margin: 0;
}

.marvin-callout p + p {
  margin-top: var(--space-2);
}

/* Blinking typewriter cursor */
.marvin-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: cursor-blink 1.1s step-end infinite;
}

.marvin-cursor.done {
  /* Cursor stays after typing completes */
}

.marvin-cursor.hidden {
  display: none;
}

@keyframes cursor-blink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ── CTA group ─────────────────────────────────────────────── */

.cta-group {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background var(--base), border-color var(--base),
              color var(--base), transform var(--fast),
              box-shadow var(--base), opacity var(--fast);
  -webkit-appearance: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — solid teal */
.btn-primary {
  background: var(--accent);
  color: var(--accent-text-on);
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #38e8ff;
  border-color: #38e8ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(34, 211, 238, 0.28);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

/* Secondary — outlined */
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

/* Ghost — text only */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
  font-size: 13px;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-secondary);
}

/* Marvin link — teal underline hyperlink appearance, used in confident-liar game */
.btn-marvin-link {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
  font-size: 14px;
  color: #00B4B4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-marvin-link:hover:not(:disabled) {
  color: #33CCCC;
  cursor: pointer;
}

/* ── Form panels ───────────────────────────────────────────── */

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: var(--space-10);
}

.form-panel-header {
  margin-bottom: var(--space-10);
}

.form-panel-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-panel-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Form groups ───────────────────────────────────────────── */

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.form-label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  opacity: 0.7;
  margin-left: var(--space-1);
}

/* ── Inputs ────────────────────────────────────────────────── */

.form-input {
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--base), box-shadow var(--base);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.55;
}

.form-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-dim);
}

textarea.form-input {
  resize: vertical;
  min-height: 84px;
  line-height: 1.55;
}

/*
  Passphrase input — intentionally distinct.
  It's a key, not a login form field.
  Monospace font, larger size, slightly deeper background.
*/
.passphrase-input {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.06em;
  padding: 16px 20px;
  background: var(--bg-raised);
  border-color: var(--border-subtle);
}

.passphrase-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 28px rgba(34, 211, 238, 0.05);
}

.passphrase-hint {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Form feedback ─────────────────────────────────────────── */

.form-error-msg,
.form-success-msg {
  display: none;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
}

.form-error-msg {
  color: var(--error);
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.22);
}

.form-success-msg {
  color: var(--success);
  background: var(--success-dim);
  border: 1px solid rgba(52, 211, 153, 0.22);
}

.form-error-msg.visible,
.form-success-msg.visible {
  display: block;
  animation: fade-in 250ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Input error shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18%      { transform: translateX(-7px); }
  36%      { transform: translateX(7px); }
  54%      { transform: translateX(-5px); }
  72%      { transform: translateX(5px); }
  90%      { transform: translateX(-2px); }
}

.form-input.shake {
  animation: shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── Form actions ──────────────────────────────────────────── */

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding-top: var(--space-2);
}

/* ── Footer ────────────────────────────────────────────────── */

.site-footer {
  padding: var(--space-6) 0 var(--space-8);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--fast);
}

.footer-links a:hover { color: var(--text-secondary); }

/* ── App page (post-auth) ──────────────────────────────────── */

.app-welcome {
  margin-bottom: var(--space-12);
}

.app-welcome-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.app-welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--base), background var(--base);
  position: relative;
  overflow: hidden;
}

.feature-card:hover:not(.feature-card--disabled) {
  border-color: var(--border-subtle);
  background: var(--bg-raised);
}

.feature-card--disabled {
  cursor: default;
  opacity: 0.55;
}

.feature-card-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
  margin-bottom: var(--space-3);
}

.feature-card-badge--soon {
  color: var(--text-muted);
}

.feature-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.feature-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Nav item for app page */
.nav-link--app {
  font-size: 13px;
  font-weight: 500;
}

.btn-logout {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 0;
  transition: color var(--fast);
}

.btn-logout:hover { color: var(--text-secondary); }

/* ── Utility ───────────────────────────────────────────────── */

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

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 600px) {
  :root {
    --space-10: 32px;
    --space-12: 40px;
    --space-16: 52px;
    --space-20: 64px;
  }

  .site-header {
    padding-top: var(--space-6);
  }

  .marvin-message {
    font-size: 17px;
  }

  .cta-group {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-group .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 22px;
    font-size: 15px;
  }

  .passphrase-input {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  .form-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .form-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

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

@media (max-width: 380px) {
  .page-wrapper {
    padding: 0 var(--space-4);
  }
}

/* ============================================================
   Prose pages (terms, about)
   ============================================================ */

.site-main--prose {
  justify-content: flex-start;
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
}

.prose-page-header {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
}

.prose-page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.2;
}

.prose-page-meta {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Callout boxes */
.callout {
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: var(--space-8);
}

.callout--warning {
  background: rgba(248, 113, 113, 0.05);
  border-color: rgba(248, 113, 113, 0.28);
}

.callout-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.callout--warning .callout-heading {
  color: var(--error);
}

.callout-body {
  font-size: 14px;
  line-height: 1.65;
}

.callout--warning .callout-body {
  color: var(--text-secondary);
}

.callout-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Long-form prose */
.prose section {
  padding-top: var(--space-8);
  margin-bottom: var(--space-4);
  border-top: 1px solid var(--border);
}

.prose section:first-child {
  padding-top: 0;
  border-top: none;
}

.prose h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.prose h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  margin-top: var(--space-6);
}

.prose h3:first-child { margin-top: 0; }

.prose p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.78;
  margin-bottom: var(--space-4);
}

.prose p:last-child { margin-bottom: 0; }

.prose strong {
  font-weight: 600;
  color: var(--text-primary);
}

.prose em {
  font-style: italic;
}

.prose ol {
  margin: 0 0 var(--space-4) var(--space-6);
  list-style-type: decimal;
}

.prose ul {
  margin: 0 0 var(--space-4) var(--space-5);
  list-style-type: disc;
}

.prose li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-2);
  padding-left: var(--space-1);
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-border);
  transition: color var(--fast), border-color var(--fast);
}

.prose a:hover {
  color: #38e8ff;
  border-bottom-color: #38e8ff;
}

.prose .section-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  display: block;
  margin-bottom: var(--space-2);
}

/* About page thesis blocks */
.thesis-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.thesis-number {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: var(--space-2);
}

.thesis-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.thesis-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================================
   Wider page wrapper variants
   ============================================================ */

.page-wrapper--medium {
  max-width: 760px;
}

.page-wrapper--wide {
  max-width: 940px;
}

/* ============================================================
   Context Window Visualizer
   ============================================================ */

.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Window size controls */
.window-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.window-controls-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.window-size-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 11px;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}

.window-size-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.window-size-btn.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* Fill bar */
.fill-bar-container {
  margin-bottom: var(--space-6);
}

.fill-bar-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.fill-bar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fill-bar-stats {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.fill-bar-track {
  height: 8px;
  background: var(--bg-raised);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.fill-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 280ms cubic-bezier(0.16, 1, 0.3, 1),
              background 400ms ease;
  min-width: 0;
}

.fill-bar-fill--danger {
  background: var(--error);
}

/* Messages area */
.messages-area {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 240px;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
}

.messages-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: var(--space-10) 0;
  opacity: 0.6;
  pointer-events: none;
}

.message-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: message-in 180ms ease both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.message-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.message-token-count {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.message-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  word-break: break-word;
}

/* Dropped message state */
.message-item--dropped {
  opacity: 0.28;
}

.message-item--dropped .message-content {
  text-decoration: line-through;
  text-decoration-color: var(--error);
  text-decoration-thickness: 1px;
}

.dropped-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--error);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Marvin in-conversation commentary — visually distinct from chat bubbles */
.msg-marvin-commentary {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: rgba(34, 211, 238, 0.05);
  border-left: 2px solid rgba(34, 211, 238, 0.30);
  border-radius: 0 var(--radius) var(--radius) 0;
  animation: message-in 180ms ease both;
}

.msg-marvin-commentary-mark {
  color: var(--accent);
  font-size: 11px;
  opacity: 0.55;
  flex-shrink: 0;
  line-height: 1.55;
}

.msg-marvin-commentary-text {
  font-size: 13px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.55;
  word-break: break-word;
}

.msg-marvin-commentary.message-item--dropped {
  opacity: 0.28;
}

/* Demo + reset row */
.viz-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

/* Two-column layout: conversation + dropped panel */
.viz-columns {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-5);
  align-items: start;
  margin-bottom: var(--space-4);
}

.viz-col-conversation {
  min-width: 0; /* prevent grid blowout */
}

/* Dropped panel — always visible, starts empty */
.dropped-panel {
  background: rgba(248, 113, 113, 0.03);
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: var(--space-4);
}

.dropped-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(248, 113, 113, 0.12);
  background: rgba(248, 113, 113, 0.05);
}

.dropped-panel-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--error);
  opacity: 0.65;
}

.dropped-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--error);
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.22);
  border-radius: 20px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: center;
  transition: background var(--base), color var(--base);
}

.dropped-count--active {
  background: rgba(248, 113, 113, 0.18);
}

.dropped-panel-body {
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 120px;
  max-height: 440px;
  overflow-y: auto;
}

.dropped-empty {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.45;
  font-style: italic;
  padding: var(--space-8) var(--space-2);
  text-align: center;
  line-height: 1.5;
}

/* Individual dropped entry */
.dropped-item {
  padding: var(--space-2) var(--space-3);
  background: rgba(248, 113, 113, 0.05);
  border: 1px solid rgba(248, 113, 113, 0.12);
  border-radius: var(--radius);
  animation: dropped-item-in 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes dropped-item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropped-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.dropped-item-role {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--error);
  opacity: 0.55;
}

.dropped-item-seq {
  font-size: 9px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
}

.dropped-item-content {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 700px) {
  .viz-columns {
    grid-template-columns: 1fr;
  }

  .dropped-panel {
    position: static;
  }

  /* ── Change 1: Sticky Marvin commentary (visualizer only) ── */
  /* .marvin-block:has(#marvin-commentary) targets exactly the  */
  /* visualizer's block — #marvin-commentary is unique to that  */
  /* page. Scopes away from app.html, comparison.html, etc.    */
  /* Sticky is on .marvin-block (not #marvin-commentary) so the */
  /* containing block is site-main, not the block itself.      */
  .marvin-block:has(#marvin-commentary) {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
    margin-left: calc(-1 * var(--space-6));
    margin-right: calc(-1 * var(--space-6));
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  /* ── Change 2: Minimap-style messages area ──────────────── */
  .messages-area {
    min-height: 60px;
    max-height: 120px;
    padding: var(--space-2);
    gap: var(--space-1);
  }

  .message-content {
    font-size: 7px;
    line-height: 1.3;
    color: var(--text-muted);
    opacity: 0.35;
    overflow: hidden;
    max-height: 26px;
    word-break: break-word;
  }

  .message-meta {
    display: none;
  }

  .dropped-panel-body {
    max-height: 80px;
  }

  .dropped-item-content {
    display: none;
  }
}

/* First-drop modal */
.first-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  padding: var(--space-4);
  animation: fade-in 200ms ease both;
}

.first-drop-modal {
  background: var(--bg-raised);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-8) var(--space-6);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.first-drop-modal .marvin-message {
  margin-bottom: var(--space-6);
}

/* ============================================================
   Model Comparison
   ============================================================ */

.prompt-section {
  margin-bottom: var(--space-6);
}

.prompt-textarea {
  resize: vertical;
  min-height: 96px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Results area */
.comparison-results {
  display: none;
  margin-top: var(--space-8);
}

.comparison-results.visible {
  display: block;
  animation: view-in var(--slow) both;
}

.results-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  align-items: start;
}

/* Model columns */
.model-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--base);
}

.model-col--done {
  border-color: var(--border-subtle);
}

.model-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}

.model-col-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-col-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.model-col-provider {
  font-size: 11px;
  color: var(--text-muted);
}

.model-col-model-id {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.55;
  letter-spacing: 0.01em;
  margin-top: 1px;
}

.model-col-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.model-col-badge--loading {
  color: var(--accent);
  background: var(--accent-dim);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.model-col-badge--done {
  color: var(--success);
  background: var(--success-dim);
}

.model-col-badge--error {
  color: var(--error);
  background: var(--error-dim);
}

.model-col-badge--unavailable {
  color: var(--text-muted);
  background: var(--bg-raised);
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

.model-col-body {
  padding: var(--space-5);
  flex: 1;
  min-height: 180px;
}

/* Loading skeleton */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-line {
  height: 13px;
  background: var(--bg-raised);
  border-radius: 3px;
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.skeleton-line:nth-child(1) { width: 100%; }
.skeleton-line:nth-child(2) { width: 88%; animation-delay: 0.15s; }
.skeleton-line:nth-child(3) { width: 95%; animation-delay: 0.05s; }
.skeleton-line:nth-child(4) { width: 75%; animation-delay: 0.25s; }
.skeleton-line:nth-child(5) { width: 91%; animation-delay: 0.10s; }
.skeleton-line:nth-child(6) { width: 83%; animation-delay: 0.20s; }

/* Response text */
.model-response-text {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.model-error-text {
  font-size: 13px;
  color: var(--error);
  opacity: 0.8;
  line-height: 1.5;
}

.model-unavailable-text {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* Stats strip */
.model-col-stats {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.stat-value--empty {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

/* Post-run Marvin block */
.marvin-post {
  display: none;
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.marvin-post.visible {
  display: block;
  animation: fade-in 400ms ease both;
}

/* ── Comparison responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .model-col-stats {
    gap: var(--space-4);
  }

  .page-wrapper--wide {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .page-wrapper--medium {
    max-width: 100%;
  }
}

/* GATE DISABLED — Session 6 */
/* Hide Sign out button when site is in open-access mode. */
html.gate-open .btn-logout { display: none; }

/* ============================================================
   Side-by-Side Comparison — dynamic rebuild
   ============================================================ */

/* Wider layout for the comparison page */
.page-wrapper--wide {
  max-width: 1100px;
}

/* ── Model selector section ─────────────────────────────────── */

.model-selectors-section {
  margin-bottom: var(--space-6);
}

.model-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.model-slot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.model-slot-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.optional-label {
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.65;
}

/* ── Model description card ─────────────────────────────────── */

.model-card {
  display: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  animation: fade-in 200ms ease both;
}

.model-card.visible {
  display: block;
}

.model-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.model-card-provider {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.model-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  opacity: 0.8;
}

.model-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.model-card-meta-item {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
}

.preview-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 20px;
  padding: 2px 7px;
}

/* ── Column header right side (badge + chevron) ─────────────── */

.model-col-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.accordion-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--base);
  flex-shrink: 0;
}

.accordion-open .accordion-chevron {
  transform: rotate(180deg);
}

/* ── Accordion body wrapper ─────────────────────────────────── */

.accordion-body-wrap {
  /* On desktop, always visible — no height restriction */
}

/* ── Synthesis panel ────────────────────────────────────────── */

.synthesis-panel {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
  animation: fade-in 300ms ease both;
}

.synthesis-panel.visible {
  display: block;
}

.synthesis-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.synthesis-body {
  padding: var(--space-5);
}

.synthesis-text {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.synthesis-text--muted {
  color: var(--text-muted);
  font-style: italic;
}

.synthesis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.synthesis-meta-item {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.synthesis-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.synthesis-badge--loading {
  color: var(--accent);
  background: var(--accent-dim);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.synthesis-badge--done {
  color: var(--success);
  background: var(--success-dim);
}

.synthesis-badge--error {
  color: var(--error);
  background: var(--error-dim);
}

/* ── True Cost ────────────────────────────────────────────────── */

/* Divider between standard stats and True Cost stats */
.true-cost-divider {
  border-top: 1px solid rgba(0, 180, 180, 0.3);
  margin-top: 8px;
  padding-top: 8px;
}

.true-cost-divider .stat {
  font-size: 13px;
}

/* Section label */
.true-cost-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Asterisk marker — links to transparency footer */
.estimate-marker {
  color: var(--accent, #00B4B4);
  cursor: pointer;
  font-size: 10px;
  margin-left: 2px;
}

/* Info tooltip */
.true-cost-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #6b7280;
  font-size: 10px;
  cursor: help;
}

.true-cost-tooltip .tooltip-content {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid var(--accent, #00B4B4);
  border-radius: 6px;
  padding: 10px 12px;
  max-width: 280px;
  font-size: 12px;
  line-height: 1.5;
  color: #aabbcc;
  text-transform: none;
  letter-spacing: normal;
  z-index: 10;
  white-space: normal;
}

.true-cost-tooltip:hover .tooltip-content,
.true-cost-tooltip:focus .tooltip-content {
  display: block;
}

/* Pricing verification date on model cards */
.model-card-verified-date {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

.model-card-verified-date--stale {
  color: #B8860B;
}

/* Model description disclaimer */
.model-desc-disclaimer {
  font-size: 12px;
  line-height: 1.5;
  color: #6b7280;
  margin-top: var(--space-4);
  max-width: 640px;
}

.model-desc-disclaimer a {
  color: #89B4CC;
}

.model-desc-disclaimer a:hover {
  color: var(--accent, #00B4B4);
}

/* Ford/Marvin context callouts — hidden until comparison completes */
#comparison-context {
  display: none;
  margin-top: var(--space-6);
}

#comparison-context.visible {
  display: block;
}

/* Transparency / methodology footer — hidden until comparison completes */
.transparency-footer {
  display: none;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  line-height: 1.6;
  color: #8899aa;
}

.transparency-footer.visible {
  display: block;
}

.transparency-footer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: var(--space-4);
}

.transparency-footer strong {
  color: #aabbcc;
  display: block;
  margin-top: var(--space-3);
  margin-bottom: 2px;
}

.transparency-footer a {
  color: #89B4CC;
}

.transparency-footer a:hover {
  color: var(--accent, #00B4B4);
}

/* ── Comparison responsive (dynamic rebuild) ────────────────── */

@media (max-width: 640px) {
  .model-selector-grid {
    grid-template-columns: 1fr;
  }

  .comparison-results {
    display: flex;
    flex-direction: column;
  }

  /* Synthesis floats above raw responses on mobile */
  .synthesis-panel {
    order: -1;
  }

  /* results-label sits between synthesis and grid */
  .results-label {
    order: 0;
  }

  /* comparison-grid after the label */
  .comparison-grid {
    order: 1;
    grid-template-columns: 1fr !important;  /* always single column on mobile */
  }

  /* Columns start collapsed on mobile — user taps to expand */
  .model-col:not(.accordion-open) .accordion-body-wrap {
    display: none;
  }

  /* Header is tappable — hint cursor */
  .model-col-header {
    cursor: pointer;
    user-select: none;
  }
}

/* ── Easter egg — PLAY sequence ────────────────────────────────────────────── */
/*
  Each letter in the P→L→A→Y sequence applies a progressively more dramatic
  animation to <body>. Classes are removed on animationend so they can retrigger.
  The inset box-shadow trick paints a teal flash over the whole viewport without
  requiring a separate overlay element.
*/

/* P — barely perceptible: single opacity dip */
@keyframes easter-flash-p {
  0%, 100% { opacity: 1; }
  45%       { opacity: 0.94; }
}
body.easter-p { animation: easter-flash-p 500ms ease both; }

/* L — gentle 2px shake */
@keyframes easter-shake-l {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-2px); }
  75%      { transform: translateX(2px); }
}
body.easter-l { animation: easter-shake-l 380ms ease both; }

/* A — stronger 4px shake + teal border pulse via inset shadow */
@keyframes easter-shake-a {
  0%   { transform: translateX(0);   box-shadow: inset 0 0 0 2px rgba(34,211,238,0);   }
  20%  { transform: translateX(-4px); box-shadow: inset 0 0 0 2px rgba(34,211,238,0.55); }
  45%  { transform: translateX(4px);  box-shadow: inset 0 0 0 2px rgba(34,211,238,0.3);  }
  70%  { transform: translateX(-2px); box-shadow: inset 0 0 0 2px rgba(34,211,238,0.15); }
  100% { transform: translateX(0);   box-shadow: inset 0 0 0 2px rgba(34,211,238,0);   }
}
body.easter-a { animation: easter-shake-a 430ms ease both; }

/* Y — full flash: screen-wide teal flood + strong shake */
@keyframes easter-blast-y {
  0%   { transform: translateX(0);    box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0);    }
  12%  { transform: translateX(-6px); box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0.18); }
  28%  { transform: translateX(6px);  box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0.11); }
  46%  { transform: translateX(-4px); box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0.07); }
  65%  { transform: translateX(2px);  box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0.03); }
  100% { transform: translateX(0);    box-shadow: inset 0 0 0 100vmax rgba(34,211,238,0);    }
}
body.easter-y { animation: easter-blast-y 600ms ease both; }

/* ============================================================
   Prompt Laboratory
   ============================================================ */

/* ── Prompt input area ────────────────────────────────────── */

.lab-prompt-area {
  position: relative;
}

.lab-char-count {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--fast);
}

.lab-char-count.over-limit {
  color: var(--error);
}

/* ── Results container ────────────────────────────────────── */

.lab-results {
  display: none;
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.lab-results.visible {
  display: block;
}

.lab-section {
  margin-bottom: var(--space-8);
}

.lab-section-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

/* ── Split-pane workbench ─────────────────────────────────── */

.lab-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

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

.lab-pane {
  min-width: 0; /* prevent grid blowout from long content */
}

.lab-pane-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.lab-pane--original.readonly textarea.form-input {
  opacity: 0.6;
  pointer-events: none;
  resize: none;
}

.lab-pane--original.readonly .btn-primary {
  display: none;
}

.lab-pane--revision {
  display: none;
}

.lab-pane--revision.visible {
  display: block;
  animation: lab-fade-in 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Revision pane loading/error */
.lab-revision-loading {
  display: none;
  margin-top: var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.lab-revision-loading.visible {
  display: block;
}

.lab-revision-error {
  display: none;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 14px;
}

.lab-revision-error.visible {
  display: block;
}

.lab-revision-results {
  display: none;
  margin-top: var(--space-6);
}

.lab-revision-results.visible {
  display: block;
}

/* Changed-row highlight on revised framing card */
.lab-framing-row.changed {
  background: rgba(34, 211, 238, 0.06);
  border-radius: var(--radius);
  padding-left: var(--space-3);
  border-left: 2px solid rgba(34, 211, 238, 0.45);
}

@media (max-width: 768px) {
  .lab-workbench.split {
    grid-template-columns: 1fr;
  }
}

/* ── Starter prompt chips ─────────────────────────────────── */

.lab-starters {
  margin-bottom: var(--space-4);
}

.lab-starters-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  display: block;
}

.lab-starters-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.lab-starter-chip {
  display: inline-block;
  padding: 5px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
  white-space: nowrap;
}

.lab-starter-chip:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.lab-starter-chip.selected {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Starter hint — Ford callout after submission */
.lab-starter-hint {
  margin-bottom: var(--space-6);
  animation: lab-fade-in 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Prompt Scaffold — guiding questions in revision pane ── */

.lab-scaffold {
  margin-bottom: var(--space-5);
  border-left: 2px solid rgba(251, 191, 36, 0.25);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

.lab-scaffold-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(251, 191, 36, 0.03);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: rgba(251, 191, 36, 0.75);
  text-align: left;
  transition: background var(--fast);
}

.lab-scaffold-toggle:hover {
  background: rgba(251, 191, 36, 0.06);
}

.lab-scaffold-arrow {
  transition: transform var(--fast);
  font-size: 10px;
}

.lab-scaffold.open .lab-scaffold-arrow {
  transform: rotate(90deg);
}

.lab-scaffold-body {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
}

.lab-scaffold.open .lab-scaffold-body {
  display: block;
}

.lab-scaffold-questions {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.lab-scaffold-q {
  padding-left: var(--space-3);
}

.lab-scaffold-q-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.lab-scaffold-q-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ── Response text — prose rendering ─────────────────────── */

.lab-response-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  word-break: break-word;
}

.lab-response-text h1,
.lab-response-text h2,
.lab-response-text h3 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: var(--space-5) 0 var(--space-2);
}

.lab-response-text h1 { font-size: 18px; }
.lab-response-text h2 { font-size: 16px; }
.lab-response-text h3 { font-size: 15px; }

.lab-response-text h1:first-child,
.lab-response-text h2:first-child,
.lab-response-text h3:first-child {
  margin-top: 0;
}

.lab-response-text p {
  margin: var(--space-3) 0;
}

.lab-response-text p:first-child { margin-top: 0; }
.lab-response-text p:last-child  { margin-bottom: 0; }

.lab-response-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.lab-response-text em {
  font-style: italic;
}

.lab-response-text ul,
.lab-response-text ol {
  margin: var(--space-3) 0;
  padding-left: var(--space-6);
}

.lab-response-text li {
  margin-bottom: var(--space-1);
  line-height: 1.6;
}

.lab-response-text li::marker {
  color: var(--text-muted);
}

.lab-response-text code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.lab-response-text pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.lab-response-text pre code {
  background: none;
  border: none;
  padding: 0;
}

.lab-response-text hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-5) 0;
}

.lab-response-text blockquote {
  border-left: 2px solid var(--border);
  padding-left: var(--space-4);
  margin: var(--space-3) 0;
  color: var(--text-secondary);
}

.lab-response-text table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: 14px;
}

.lab-response-text th,
.lab-response-text td {
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-3);
  text-align: left;
}

.lab-response-text th {
  background: var(--bg-surface);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Baseline Marvin line — fade-in after first submission ── */

.lab-baseline-marvin {
  margin-bottom: var(--space-6);
}

.lab-baseline-marvin.visible {
  display: block;
  animation: lab-fade-in 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lab-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Thinking Window — collapsible, marvin-callout pattern ─ */

.lab-thinking {
  border-left: 2px solid rgba(34, 211, 238, 0.30);
  background: rgba(34, 211, 238, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

.lab-thinking-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-align: left;
  transition: background var(--fast);
}

.lab-thinking-toggle:hover {
  background: rgba(34, 211, 238, 0.06);
}

.lab-thinking-arrow {
  transition: transform var(--fast);
  font-size: 10px;
}

.lab-thinking.open .lab-thinking-arrow {
  transform: rotate(90deg);
}

.lab-thinking-body {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
}

.lab-thinking.open .lab-thinking-body {
  display: block;
}

.lab-thinking-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  opacity: 0.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.lab-thinking-redacted {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-3);
}

/* Ford disclosure inside the thinking panel */
.lab-thinking-disclosure {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(251, 191, 36, 0.04);
  border-left: 2px solid rgba(251, 191, 36, 0.30);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ── Framing Card — marvin-callout style panel ────────────── */

.lab-framing-card {
  border-left: 2px solid rgba(34, 211, 238, 0.30);
  background: rgba(34, 211, 238, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--space-4) var(--space-5);
}

.lab-framing-card-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.65;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lab-framing-card-title::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}

.lab-framing-row {
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(34, 211, 238, 0.08);
}

.lab-framing-row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.lab-framing-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.lab-framing-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.lab-framing-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.5;
}

/* Topic prominence bars */
.lab-framing-topic {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.lab-framing-topic + .lab-framing-topic {
  margin-top: var(--space-2);
}

.lab-framing-topic-label {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 0;
  flex-shrink: 1;
}

.lab-framing-topic-bar {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.lab-framing-topic-pip {
  width: 14px;
  height: 6px;
  border-radius: 2px;
  background: var(--border);
}

.lab-framing-topic-pip.filled {
  background: var(--accent);
}

/* Loaded assumption items */
.lab-framing-assumption {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.lab-framing-assumption.inadvertent {
  border-left-color: rgba(251, 191, 36, 0.50);
  background: rgba(251, 191, 36, 0.03);
}

.lab-framing-inadvertent-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-left: var(--space-2);
  vertical-align: middle;
}

/* Position indicator — track + dot for score 1-5 */
.lab-framing-position {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.lab-framing-position-end {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 52px;
}

.lab-framing-position-end:last-child {
  text-align: right;
}

.lab-framing-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
  max-width: 180px;
}

.lab-framing-dot {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left var(--base);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.35);
}

/* Disclosure line at bottom of framing card */
.lab-framing-disclosure {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(34, 211, 238, 0.08);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.lab-framing-error {
  font-size: 14px;
  color: var(--text-secondary);
  padding: var(--space-4) var(--space-5);
  border-left: 2px solid rgba(34, 211, 238, 0.15);
  background: rgba(34, 211, 238, 0.02);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Marvin trigger callout ───────────────────────────────── */

.lab-marvin-trigger {
  display: none;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(34, 211, 238, 0.04);
  border-left: 2px solid rgba(34, 211, 238, 0.30);
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  transition: opacity var(--base);
}

.lab-marvin-trigger.visible {
  display: block;
}

.lab-marvin-trigger.minimized {
  opacity: 0.4;
}

.lab-marvin-trigger.minimized .lab-marvin-trigger-text {
  display: none;
}

.lab-marvin-trigger-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.65;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lab-marvin-trigger-label::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}

.lab-marvin-trigger-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 400;
}

/* ── Debrief panel ────────────────────────────────────────── */

.lab-debrief {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
  animation: lab-fade-in 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lab-debrief.visible {
  display: block;
}

.lab-debrief-disclosure {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-5);
}

.lab-debrief-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.lab-debrief-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--fast);
}

.lab-debrief-link:hover {
  color: var(--accent);
}

/* Contextual documentation link in debrief */
.lab-debrief-doc {
  margin-bottom: var(--space-4);
  font-size: 13px;
}

.lab-debrief-doc a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--fast);
}

.lab-debrief-doc a:hover {
  color: var(--accent);
}

/* ── Source Shelf ─────────────────────────────────────────── */

.lab-source-shelf {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.lab-shelf-panel {
  border-left: 2px solid rgba(34, 211, 238, 0.20);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

.lab-shelf-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(34, 211, 238, 0.03);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-align: left;
  transition: background var(--fast);
}

.lab-shelf-toggle:hover {
  background: rgba(34, 211, 238, 0.06);
}

.lab-shelf-arrow {
  transition: transform var(--fast);
  font-size: 10px;
}

.lab-shelf-panel.open .lab-shelf-arrow {
  transform: rotate(90deg);
}

.lab-shelf-body {
  display: none;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.lab-shelf-panel.open .lab-shelf-body {
  display: block;
}

.lab-shelf-group {
  margin-bottom: var(--space-6);
}

.lab-shelf-group:last-child {
  margin-bottom: 0;
}

.lab-shelf-provider {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  letter-spacing: 0.01em;
}

.lab-shelf-entry {
  margin-bottom: var(--space-3);
}

.lab-shelf-entry:last-child {
  margin-bottom: 0;
}

.lab-shelf-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--fast);
}

.lab-shelf-link:hover {
  color: #38e8ff;
}

.lab-shelf-annotation {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 2px;
}

/* ── Cost footer ──────────────────────────────────────────── */

.lab-cost {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ── Loading / Error states ───────────────────────────────── */

.lab-loading {
  display: none;
  margin-top: var(--space-6);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.lab-loading.visible {
  display: block;
}

.lab-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lab-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: var(--space-2);
}

@keyframes lab-spin {
  to { transform: rotate(360deg); }
}

.lab-error {
  display: none;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--error-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 14px;
}

.lab-error.visible {
  display: block;
}

/* ── Lab mobile adjustments ───────────────────────────────── */

@media (max-width: 600px) {
  .lab-framing-position {
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .lab-framing-track {
    max-width: none;
    order: -1;
    width: 100%;
  }

  .lab-framing-position-end {
    font-size: 10px;
    min-width: auto;
  }

  .lab-framing-topic {
    flex-wrap: wrap;
  }

  .lab-response-text table {
    font-size: 13px;
  }

  .lab-response-text th,
  .lab-response-text td {
    padding: var(--space-1) var(--space-2);
  }

  .lab-response-text pre {
    font-size: 13px;
  }
}
