/* SafeBARS StressLens — refined companion experience
   Design language: friendly-professional. Rounded type, layered depth
   (soft shadows + selective hard "sticker" shadows), a characterful
   companion mascot, and a calm but rich motion layer. */

:root {
  /* core palette (extends the Transition Companion tokens) */
  --navy: #050a4b;
  --navy-2: #111c63;
  --navy-3: #1b2a86;
  --hero-blue: #0b73f6;
  --hero-blue-dark: #075dd9;
  --hero-blue-soft: #e8f1ff;
  --school-blue: #1c4a88;
  --yellow: #ffdc00;
  --yellow-light: #ffe85b;
  --yellow-deep: #e5c200;
  --orange: #f58542;
  --ink: #111c48;
  --muted: #53617c;
  --mist: #f4f7fc;
  --mist-2: #eef3fb;
  --line: #d8e1ef;
  --line-strong: #b8c9de;
  --soft-blue: #edf5ff;
  --white: #ffffff;
  --danger: #a84d2c;
  --danger-soft: #fff0ed;
  --teal: #0f9f9b;
  --teal-soft: #eaf8f6;
  --coral: #ff7c67;
  --coral-soft: #fff0ec;
  --green: #1f9d6b;
  --green-soft: #e7f6ee;
  --purple: #6b5bd2;
  --purple-soft: #efeefe;

  /* structure */
  --control-border: #9db6d4;
  --control-height: 46px;
  --control-height-compact: 40px;
  --control-radius: 12px;
  --panel-radius: 18px;
  --card-radius: 16px;
  --page-max: 1180px;
  --gutter: clamp(16px, 4vw, 56px);
  --page-top: 30px;
  --section-gap: 22px;
  --panel-padding: 28px;

  /* depth */
  --shadow-soft: 0 1px 2px rgba(5, 10, 75, 0.04), 0 10px 30px rgba(5, 10, 75, 0.08);
  --shadow-card: 0 6px 18px rgba(5, 10, 75, 0.10);
  --shadow-lift: 0 18px 40px rgba(5, 10, 75, 0.16);
  --shadow-sticker: 6px 6px 0 var(--navy);
  --shadow-sticker-sm: 4px 4px 0 var(--navy);
  --shadow-sticker-yellow: 0 4px 0 var(--yellow-deep);
  --shadow-sticker-blue: 0 4px 0 var(--navy-3);
  --focus-ring: 0 0 0 4px rgba(11, 115, 246, 0.28);
  --focus-ring-yellow: 0 0 0 4px rgba(255, 220, 0, 0.5);

  /* type */
  --font-rounded: "Nunito", ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
    "Quicksand", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --transition-fast: 150ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition: 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition-spring: 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--mist);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .wordmark, .entry-kicker, .frame-card h3, .fix-card h3, .role-card h3 {
  font-family: var(--font-rounded);
  letter-spacing: -0.01em;
}

button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(11, 115, 246, 0.10), transparent 60%),
    radial-gradient(1000px 520px at 100% 0%, rgba(255, 220, 0, 0.10), transparent 55%),
    var(--mist);
}

/* ============ HEADER ============ */
.brand-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 0 var(--gutter);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: var(--white);
  box-shadow: 0 2px 0 var(--yellow), 0 10px 30px rgba(5, 10, 75, 0.28);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
}
.wordmark .brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--yellow);
  color: var(--navy);
  box-shadow: var(--shadow-sticker-sm);
}
.wordmark span { color: var(--yellow); }

.brand-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.back-button:not([hidden]):hover,
.back-button:not([hidden]):focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateX(-2px);
}
.back-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.back-button svg { width: 20px; height: 20px; }

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.header-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 70px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  border-bottom: 4px solid transparent;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, 0.07);
}
.header-nav a.active {
  color: var(--white);
  border-bottom-color: var(--yellow);
}

/* Language toggle (中 / EN) */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  margin: auto 0 auto 14px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.lang-toggle button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  width: 34px;
  height: 28px;
  border-radius: 999px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.lang-toggle button:hover { color: var(--white); }
.lang-toggle button.active {
  background: var(--yellow);
  color: #050a4b;
}
@media (max-width: 720px) {
  .lang-toggle { margin: 4px 0 4px auto; height: 36px; }
  .lang-toggle button { width: 38px; height: 30px; }
}

/* ============ DASHBOARD (top overview) ============ */
.dashboard {
  margin: 16px auto 6px;
  padding: 26px clamp(18px, 4vw, 34px);
  border-radius: var(--panel-radius);
  background: linear-gradient(180deg, #ffffff 0%, var(--mist) 100%);
  border: 2px solid var(--line-strong);
  box-shadow: 0 14px 34px rgba(5, 10, 75, 0.10);
}
.dash-head { max-width: 720px; }
.dash-head h2 {
  font-size: clamp(22px, 3.4vw, 30px);
  margin: 6px 0 8px;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.dash-head p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 22px 0 18px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: var(--white);
  border: 2px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--navy);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 7px 7px 0 var(--navy); }
.stat-num {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 900;
  line-height: 1;
  color: var(--hero-blue-dark);
}
.stat-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card.stat-live {
  background: linear-gradient(180deg, var(--hero-blue), var(--hero-blue-dark));
  border-color: var(--navy-3);
  box-shadow: 4px 4px 0 var(--navy-3);
}
.stat-card.stat-live .stat-num { color: var(--white); }
.stat-card.stat-live .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card.stat-live:hover { box-shadow: 7px 7px 0 var(--navy-3); }

.dash-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ VIEW STAGE ============ */
.view-stage {
  flex: 1;
  padding: var(--page-top) var(--gutter) calc(var(--page-top) * 2.2);
  max-width: var(--page-max);
  margin: 0 auto;
  width: 100%;
}

.view { display: none; }
.view.active { display: block; animation: viewIn 380ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px) scale(0.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* staggered reveal for elements flagged by JS */
.fx-reveal { opacity: 0; transform: translateY(16px); }
.view.active .fx-reveal {
  animation: cardReveal 520ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fx-pop { animation: popIn 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

/* ============ BUTTONS ============ */
.yellow-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--control-height);
  padding: 0 24px;
  border: 2px solid var(--yellow-deep);
  border-radius: var(--control-radius);
  background: linear-gradient(180deg, var(--yellow-light), var(--yellow));
  color: var(--navy);
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: var(--shadow-sticker-yellow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.yellow-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #fff0a0, var(--yellow-light));
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 0 var(--yellow-deep), 0 12px 24px rgba(255, 220, 0, 0.30);
}
.yellow-button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 var(--yellow-deep);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--control-height);
  padding: 0 24px;
  border: 2px solid var(--navy-3);
  border-radius: var(--control-radius);
  background: linear-gradient(180deg, var(--hero-blue), var(--hero-blue-dark));
  color: var(--white);
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: var(--shadow-sticker-blue);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #2a87ff, var(--hero-blue));
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 0 var(--navy-3), 0 12px 24px rgba(11, 115, 246, 0.34);
}
.primary-button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 var(--navy-3);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--hero-blue-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(11, 115, 246, 0.35);
  border-radius: 8px;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.text-button:hover,
.text-button:focus-visible {
  color: var(--navy-2);
  background: var(--soft-blue);
}

/* ============ ENTRY ============ */
.entry-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  padding-top: 18px;
}

.entry-copy {
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  padding: clamp(24px, 3vw, 40px);
  box-shadow: var(--shadow-sticker);
  position: relative;
}
.entry-copy::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px dashed rgba(11, 115, 246, 0.22);
  border-radius: calc(var(--panel-radius) - 8px);
  pointer-events: none;
}

.entry-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--hero-blue-dark);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 20px;
}
.entry-kicker svg { color: var(--hero-blue); }

.entry-copy h1 {
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--ink);
}
.entry-copy > p {
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 26px;
  max-width: 60ch;
}

.issue-form { display: flex; flex-direction: column; gap: 14px; }
.issue-form label {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.issue-form textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px 18px;
  border: 2px solid var(--line-strong);
  border-radius: var(--card-radius);
  background: var(--mist);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.issue-form textarea::placeholder { color: #93a2ba; }
.issue-form textarea:hover { border-color: var(--control-border); }
.issue-form textarea:focus {
  border-color: var(--hero-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(11, 115, 246, 0.14);
}

.issue-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.issue-chips button {
  padding: 9px 15px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy-2);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--mist-2);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.issue-chips button:hover,
.issue-chips button:focus-visible {
  border-color: var(--hero-blue);
  background: var(--soft-blue);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--cartoon-shadow, #d5e6f8);
}
.issue-chips button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--mist-2); }

/* ============ ENTRY MASCOT + COMPANION ============ */
.entry-mascot {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  position: relative;
}

.how-it-works {
  background: var(--white);
  border: 2px solid var(--line);
  border-left: 6px solid var(--teal);
  border-radius: var(--panel-radius);
  padding: var(--panel-padding);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.how-it-works h3 {
  margin: 0 0 18px;
  font-size: 19px;
  color: var(--ink);
}
.how-it-works ol { list-style: none; padding: 0; margin: 0; counter-reset: steps; }
.how-it-works li {
  position: relative;
  padding-left: 46px;
  margin-bottom: 20px;
}
.how-it-works li:last-child { margin-bottom: 0; }
.how-it-works li::before {
  counter-increment: steps;
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-family: var(--font-rounded);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--teal-soft);
}
.how-it-works li strong { display: block; font-size: 15px; margin-bottom: 3px; }
.how-it-works li span { font-size: 14px; color: var(--muted); }

.companion {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: linear-gradient(180deg, var(--soft-blue), #ffffff);
  border: 2px solid var(--line);
  border-radius: var(--panel-radius);
  padding: var(--panel-padding);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.companion-bird {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  animation: floatY 4.5s ease-in-out infinite;
}
.companion-speech {
  font-size: 15px;
  color: var(--navy-2);
  line-height: 1.55;
  transition: opacity 200ms ease;
}
.companion-speech.large { font-size: 18px; margin-bottom: 18px; }

/* mascot speech bubble (used in entry image views) */
.companion-bubble {
  position: relative;
  transition: opacity 200ms ease;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: 16px;
  padding: 16px 18px;
  font-family: var(--font-rounded);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  box-shadow: 6px 6px 0 rgba(5, 10, 75, 0.16);
}
.companion-bubble::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -13px;
  width: 20px;
  height: 20px;
  border-right: 3px solid var(--navy);
  border-bottom: 3px solid var(--navy);
  background: var(--white);
  transform: rotate(45deg);
}

/* ============ IMAGE VIEW ============ */
.card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  gap: var(--gutter);
  align-items: start;
  position: relative;
}
.image-card {
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sticker);
}
.image-card .img-wrap {
  position: relative;
  background: var(--mist);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}
.image-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--mist);
}
.image-card .theme-ribbon {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 3px 3px 0 rgba(5, 10, 75, 0.2);
}
.image-caption { padding: var(--panel-padding); }
.image-caption .eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--hero-blue-dark);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}
.image-caption p {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.55;
}

.companion-panel {
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--panel-radius);
  padding: var(--panel-padding);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 96px;
}
.companion-panel .panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.companion-panel .panel-head .avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  animation: floatY 4.5s ease-in-out infinite;
}
.companion-panel .panel-head .who { display: grid; gap: 2px; }
.companion-panel .panel-head .who strong { font-family: var(--font-rounded); font-size: 15px; }
.companion-panel .panel-head .who small { color: var(--muted); font-size: 12px; }
.companion-panel .actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.companion-panel .actions .primary-button,
.companion-panel .actions .text-button { width: 100%; justify-content: center; }

/* Issue gallery picker (replaces "Describe a different issue") */
/* AI-driven concern panel (replaces the old hardcoded gallery) */
.ai-badge {
  display: inline-block;
  font-family: var(--font-rounded);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--yellow);
  border: 2px solid var(--navy);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 8px;
  vertical-align: middle;
  box-shadow: 2px 2px 0 var(--navy);
}
.ai-related { margin-top: 14px; }
.related-hint {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.gallery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.gallery-chips button {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.gallery-chips button:hover,
.gallery-chips button:focus-visible {
  border-color: var(--hero-blue);
  background: var(--soft-blue);
  color: var(--hero-blue-dark);
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--hero-blue);
}
.gallery-chips button:active {
  transform: translateY(0);
  box-shadow: none;
}
.re-analyze { margin-top: 16px; }
.re-analyze label {
  display: block;
  font-family: var(--font-rounded);
  font-weight: 800;
  font-size: 13px;
  color: var(--navy-2);
  margin-bottom: 6px;
}
.re-analyze-row { display: flex; gap: 8px; }
.re-analyze-row input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 12px;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}
.re-analyze-row input:focus-visible {
  outline: none;
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px var(--soft-blue);
}

/* ============ INTRO SCREENS ============ */
.condition-intro {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  padding: 20px 0 8px;
}
.condition-intro h2 {
  font-size: clamp(26px, 3vw, 34px);
  margin: 0 0 14px;
  line-height: 1.15;
}
.condition-intro p {
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 24px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-rounded);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(5, 10, 75, 0.16);
  margin-bottom: 18px;
}

/* study panel card used by intros */
.study-panel {
  max-width: 680px;
  margin: 0 auto;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  padding: clamp(24px, 3vw, 38px);
  box-shadow: var(--shadow-sticker);
  text-align: left;
}
.study-panel h2 { font-size: clamp(24px, 3vw, 32px); margin: 6px 0 16px; text-align: left; }
.study-panel p { font-size: 16px; color: var(--muted); margin: 0 0 16px; line-height: 1.6; }
.study-panel p:last-of-type { margin-bottom: 0; }
.study-panel .cta-row { display: flex; justify-content: center; margin-top: 24px; }

/* ============ FRAME / ROLE / FIX CARDS ============ */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--section-gap);
}
.frame-card,
.fix-card,
.role-card {
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--card-radius);
  padding: var(--panel-padding);
  box-shadow: var(--shadow-sticker-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.frame-card:hover,
.role-card:hover { transform: translateY(-3px); box-shadow: 8px 8px 0 var(--navy); }

.frame-card img,
.fix-card img,
.role-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--mist);
}
.frame-card h3,
.role-card h3,
.fix-card h3 {
  margin: 0;
  font-size: 19px;
}
.frame-card p,
.role-card p,
.fix-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.55;
}
.frame-card label { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.frame-card textarea,
.role-card textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border: 2px solid var(--line-strong);
  border-radius: var(--control-radius);
  font-size: 14px;
  resize: vertical;
  background: var(--mist);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.frame-card textarea:focus,
.role-card textarea:focus {
  border-color: var(--hero-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(11, 115, 246, 0.14);
}

.frame-card .week-kicker,
.role-card .role-kicker {
  align-self: flex-start;
  padding: 6px 13px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 3px 3px 0 rgba(5, 10, 75, 0.16);
}

/* single frame presentation */
.frame-stage { max-width: 760px; margin: 0 auto; }
.frame-stage .frame-card { box-shadow: var(--shadow-sticker); }

/* ============ FIXES ============ */
.fix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--section-gap);
}
.fix-card {
  cursor: pointer;
  border: 3px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--mist-2);
  position: relative;
  user-select: none;
}
.fix-card:hover { transform: translateY(-3px); box-shadow: 7px 7px 0 var(--line-strong); border-color: var(--hero-blue); }
.fix-card.selected {
  border-color: var(--hero-blue);
  background: var(--soft-blue);
  box-shadow: 6px 6px 0 var(--hero-blue);
}
.fix-card .rank-badge {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 3px solid var(--navy);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-rounded);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 3px 3px 0 rgba(5, 10, 75, 0.2);
}
.fix-card .effort {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}
.fix-card .effort .meter { display: grid; gap: 4px; }
.fix-card .effort .meter .track {
  height: 8px;
  border-radius: 999px;
  background: var(--mist-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.fix-card .effort .meter .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hero-blue), var(--teal));
  width: 0;
  transition: width 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.fix-card .effort .label-row { display: flex; justify-content: space-between; }
.fix-card .effort strong { color: var(--ink); }

.fix-limit-notice {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin: 6px 0 18px;
}
.fix-limit-notice b { color: var(--hero-blue-dark); }

/* ============ DEMOGRAPHICS ============ */
.demographics {
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  padding: var(--panel-padding);
  box-shadow: var(--shadow-sticker);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.demographics h2 { margin: 0 0 4px; font-size: 24px; }
.demographics label { font-size: 14px; font-weight: 800; }
.demographics input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0 var(--range-pct, 50%), var(--mist-2) var(--range-pct, 50%) 100%);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.demographics input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--hero-blue);
  box-shadow: 0 2px 6px rgba(5, 10, 75, 0.25);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.demographics input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.demographics input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--hero-blue);
  cursor: pointer;
}
.demographics .range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.demographics textarea {
  width: 100%;
  min-height: 100px;
  padding: 13px 15px;
  border: 2px solid var(--line-strong);
  border-radius: var(--control-radius);
  font-size: 14.5px;
  background: var(--mist);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.demographics textarea:focus {
  border-color: var(--hero-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(11, 115, 246, 0.14);
}

/* ============ THANK YOU ============ */
.thank-you {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: var(--shadow-sticker);
  position: relative;
  overflow: hidden;
}
.thank-you .celebrate {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  animation: floatY 4s ease-in-out infinite;
}
.thank-you h2 { margin: 0 0 12px; font-size: 30px; }
.thank-you p { color: var(--muted); margin: 0 0 22px; font-size: 16px; }
.thank-you .recap {
  text-align: left;
  background: var(--mist);
  border: 2px solid var(--line);
  border-radius: var(--card-radius);
  padding: 16px 18px;
  margin-bottom: 22px;
  font-size: 14px;
  color: var(--ink);
}
.thank-you .recap li { margin-bottom: 8px; }
.thank-you .recap li:last-child { margin-bottom: 0; }
.thank-you .recap b { color: var(--hero-blue-dark); }

/* ============ NAV FOOTER + PROGRESS ============ */
.nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
}
.nav-footer.center { justify-content: center; border-top: 0; }

.progress-dots { display: flex; gap: 9px; align-items: center; }
.progress-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line);
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.progress-dots span.active { background: var(--hero-blue); transform: scale(1.25); }
.progress-dots span.completed { background: var(--teal); }

/* top progress bar for study views */
.study-progress {
  position: sticky;
  top: 70px;
  z-index: 20;
  height: 6px;
  background: var(--mist-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.study-progress .fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--hero-blue), var(--teal), var(--yellow));
  transition: width 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ============ COMPANION TYPING ============ */
.typing-dots { display: inline-flex; gap: 5px; align-items: center; }
.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hero-blue);
  animation: typingBounce 1.1s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ============ SPARKLE BURST ============ */
.spark-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 5; }
.spark {
  position: absolute;
  color: var(--yellow);
  animation: sparkPop 700ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes sparkPop {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  60% { opacity: 1; transform: scale(1.1) rotate(20deg); }
  100% { opacity: 0; transform: scale(0.9) rotate(40deg); }
}

/* ============ NOTICE ============ */
.notice {
  max-width: 760px;
  margin: 0 auto 26px;
  padding: 14px 18px;
  border-radius: var(--control-radius);
  border-left: 5px solid var(--teal);
  background: var(--teal-soft);
  color: var(--navy-2);
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice svg { color: var(--teal); margin-top: 1px; }

/* ============ LOADING ============ */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 247, 252, 0.82);
  backdrop-filter: blur(3px);
  z-index: 100;
}
.loading-overlay[hidden] { display: none; }
.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 30px 38px;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-sticker);
}
.loading-card .loader-orbit {
  position: relative;
  width: 56px;
  height: 56px;
}
.loading-card .orbit-dot {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 1px 1px 0 rgba(5, 10, 75, 0.25);
}
.loading-card .orbit-dot.d1 { background: var(--yellow); animation: orbit 1.4s linear infinite; }
.loading-card .orbit-dot.d2 { background: var(--hero-blue); animation: orbit 1.4s linear infinite; animation-delay: -.47s; }
.loading-card .orbit-dot.d3 { background: var(--teal); animation: orbit 1.4s linear infinite; animation-delay: -.94s; }
.loading-card .orbit-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 1px 1px 0 rgba(5, 10, 75, 0.25);
  animation: orbitPulse 1.2s ease-in-out infinite;
}
@keyframes orbit {
  from { transform: rotate(0deg) translateX(22px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(22px) rotate(-360deg); }
}
@keyframes orbitPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.28); } }
.loading-card .label { font-family: var(--font-rounded); font-weight: 800; color: var(--navy-2); font-size: 14px; }

/* ============ MASCOT ANIMATIONS ============ */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}
.mascot-eye { transform-origin: center; animation: blink 5.5s infinite; }
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(16deg); }
  50% { transform: rotate(-6deg); }
  75% { transform: rotate(10deg); }
}
.mascot-wave { transform-origin: 80% 80%; animation: wave 2.4s ease-in-out infinite; }

/* ============ REFINEMENT PASS (exceed sticker prototype) ============ */

/* floating sticker doodles around the entry hero */
.doodle-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.entry-doodle {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 2px solid var(--navy);
  border-radius: 10px;
  font-family: var(--font-rounded);
  font-weight: 800;
  font-size: 12.5px;
  white-space: nowrap;
  box-shadow: var(--shadow-sticker-sm);
  animation: doodleFloat 5s ease-in-out infinite;
}
.entry-doodle svg { width: 15px; height: 15px; }
.entry-doodle.d1 { top: -14px; left: 5%; background: var(--yellow); color: var(--navy); --rot: -5deg; transform: rotate(-5deg); }
.entry-doodle.d2 { top: 41%; right: -10px; background: var(--white); color: var(--coral); --rot: 4deg; transform: rotate(4deg); }
.entry-doodle.d3 { bottom: -12px; left: 1%; background: #57c7ad; color: var(--navy); --rot: 3deg; transform: rotate(3deg); }
.entry-doodle.d2 { animation-delay: .8s; }
.entry-doodle.d3 { animation-delay: 1.6s; }
@keyframes doodleFloat {
  0%, 100% { transform: rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-9px) rotate(var(--rot, 0deg)); }
}

/* wavy underlines on key headings (signature neobrutalist / academic flair) */
.study-panel h2,
.condition-intro h2,
.entry-copy h1 {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--hero-blue);
  text-decoration-thickness: 3px;
  text-underline-offset: 9px;
}

/* companion "speaks" wiggle */
.speaking { animation: speechWiggle 460ms cubic-bezier(.36, .07, .19, .97) both; }
@keyframes speechWiggle {
  0% { transform: rotate(0); }
  18% { transform: rotate(-1.4deg); }
  42% { transform: rotate(1.4deg); }
  66% { transform: rotate(-0.8deg); }
  100% { transform: rotate(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 920px) {
  .entry-layout,
  .card-layout { grid-template-columns: 1fr; }
  .entry-mascot { order: -1; }
  .companion-panel { position: static; }
  .companion { flex-direction: row; align-items: center; text-align: left; }
  .doodle-layer { display: none; }
}
@media (max-width: 560px) {
  .brand-header { flex-wrap: wrap; gap: 8px; padding: 12px var(--gutter); min-height: auto; }
  .header-nav { width: 100%; justify-content: flex-start; }
  .header-nav a { height: 44px; padding: 0 11px; }
  .view-stage { padding-left: 16px; padding-right: 16px; }
  .entry-copy,
  .how-it-works,
  .companion-panel,
  .frame-card,
  .fix-card,
  .role-card,
  .tradeoff-form,
  .demographics,
  .thank-you,
  .study-panel { padding: 20px; }
  .nav-footer { flex-wrap: wrap; }
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .view.active .fx-reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ===========================================================
   THREE-STAGE REFLECTION FLOW (chat -> issues -> timeline)
   =========================================================== */

/* ---------- shared stage scaffolding ---------- */
.chat-stage,
.issues-stage,
.timeline-stage {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 2px 40px;
}
.chat-header,
.timeline-head {
  margin-bottom: 18px;
}
.chat-sub {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 0.98rem;
}

/* ---------- Stage 1: chat ---------- */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 4px;
  min-height: 120px;
}
.bubble {
  max-width: 82%;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: bubbleIn 260ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.bubble-user {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--hero-blue), var(--hero-blue-dark));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: var(--shadow-card);
}
.bubble-assistant {
  align-self: flex-start;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-soft);
}
.bubble-assistant::before {
  content: "Mirror";
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hero-blue);
  margin-bottom: 4px;
}

.chat-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.chat-typing .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--hero-blue);
  animation: typingBounce 1s infinite ease-in-out;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-ready-box {
  margin: 6px 0 18px;
  padding: 18px 20px;
  border-radius: var(--card-radius);
  background: var(--yellow-light);
  border: 2px solid var(--yellow-deep);
  box-shadow: var(--shadow-sticker-yellow);
}
.chat-ready-box p { margin: 0 0 12px; font-weight: 600; color: var(--navy); }

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px;
  background: var(--white);
  border: 1.5px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  position: sticky;
  bottom: 12px;
}
.chat-input-row #chat-input {
  flex: 1;
  border: none;
  resize: none;
  outline: none;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  max-height: 160px;
  padding: 8px 6px;
  background: transparent;
  color: var(--ink);
}
.chat-input-row #btn-chat-send {
  flex: 0 0 auto;
  padding: 10px 22px;
}
.chat-input-row #chat-input:disabled,
.chat-input-row #btn-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Stage 2: five issues ---------- */
.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.issue-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  font: inherit;
  color: var(--ink);
}
.issue-card:hover {
  transform: translateY(-3px);
  border-color: var(--hero-blue);
  box-shadow: var(--shadow-card);
}
.issue-card.is-loading { opacity: 0.65; pointer-events: none; }
.issue-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.issue-card-media {
  height: 110px;
  overflow: hidden;
  border-radius: 12px;
  margin: 2px 0 2px;
  border: 1px solid var(--line);
  background: #f6f8fb;
}
.issue-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.issue-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.issue-title { margin: 0; font-size: 1.06rem; line-height: 1.3; color: var(--navy); }
.issue-one-line { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.issue-meta { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.issue-meta b { color: var(--ink); }
.issue-cta {
  margin-top: 2px;
  font-weight: 700;
  color: var(--hero-blue);
  font-size: 0.9rem;
}

/* severity + effort badges (shared across issues & timeline) */
.sev-badge, .eff-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sev-high { background: var(--coral-soft); color: var(--danger); }
.sev-medium { background: var(--yellow-light); color: #8a6a00; }
.sev-low { background: var(--green-soft); color: var(--green); }
.eff-high { background: var(--coral-soft); color: var(--danger); }
.eff-medium { background: var(--yellow-light); color: #8a6a00; }
.eff-low { background: var(--teal-soft); color: var(--teal); }

/* ---------- Stage 3: timeline ---------- */
.timeline-lens {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.lens-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
}
.lens-nothing { background: var(--danger-soft); border-color: #e7c4b8; }
.lens-act { background: var(--green-soft); border-color: #bfe7d2; }
.lens-tag {
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.lens-nothing .lens-tag { color: var(--danger); }
.lens-act .lens-tag { color: var(--green); }
.lens-row > span:last-child { line-height: 1.5; }

.timeline-stepper {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timeline-stepper::before {
  content: "";
  position: absolute;
  left: 92px;
  top: 14px; bottom: 14px;
  width: 3px;
  background: var(--line-strong);
  border-radius: 3px;
}
.tl-node {
  display: grid;
  grid-template-columns: 92px 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 0;
}
.tl-time {
  font-weight: 800;
  color: var(--navy);
  font-size: 0.86rem;
  text-align: right;
  padding-top: 10px;
  line-height: 1.2;
}
.tl-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  margin: 12px auto 0;
  background: var(--hero-blue);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--hero-blue);
  z-index: 1;
  justify-self: center;
}
.tl-dot.sev-high { background: var(--coral); box-shadow: 0 0 0 2px var(--coral); }
.tl-dot.sev-medium { background: var(--yellow-deep); box-shadow: 0 0 0 2px var(--yellow-deep); }
.tl-dot.sev-low { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.tl-body {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}
.tl-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.tl-head-row h4 { margin: 0; font-size: 1.02rem; color: var(--navy); }
.tl-body p { margin: 0 0 8px; line-height: 1.5; }
.tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.85rem;
  color: var(--muted);
}
.tl-meta b { color: var(--ink); }
.tl-signal { color: var(--school-blue); }

.leverage-card {
  margin-top: 26px;
  padding: 22px 24px;
  border-radius: var(--panel-radius);
  background: linear-gradient(180deg, var(--hero-blue-soft), var(--white));
  border: 1.5px solid var(--hero-blue);
  box-shadow: var(--shadow-card);
}
.leverage-card h3 { margin: 0 0 6px; color: var(--navy); }
.lp-action { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin: 0 0 14px; }
.lp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.lp-grid > div {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.lp-k { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 700; }
.lp-v { display: block; font-weight: 600; color: var(--ink); margin-top: 2px; }
.lp-step, .lp-measure { margin: 8px 0 0; line-height: 1.5; }
.lp-step b, .lp-measure b { color: var(--hero-blue-dark); }

@media (max-width: 620px) {
  .lens-row { grid-template-columns: 1fr; gap: 4px; }
  .timeline-stepper::before { left: 7px; }
  .tl-node { grid-template-columns: 22px 1fr; }
  .tl-time { text-align: left; padding-top: 0; grid-column: 1 / -1; padding-left: 30px; }
  .tl-dot { grid-row: 2; margin-left: 0; }
  .tl-body { grid-column: 2; }
  .lp-grid { grid-template-columns: 1fr; }
}

/* ---------- Timeline future-simulation narrative ---------- */
.timeline-narrative {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--teal-soft);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.55;
}
.tl-builds {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--teal);
  line-height: 1.45;
}
.tl-builds b { color: var(--teal); font-weight: 700; }

/* ---------- Entry: upload study material ---------- */
.entry-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 18px;
  color: var(--navy-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.entry-divider::before,
.entry-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--line-strong);
  border-radius: 2px;
}
.entry-upload { display: flex; flex-direction: column; gap: 12px; }
.entry-upload h3 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
}
.entry-upload > p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--navy-2);
}
.upload-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  border: 2px dashed var(--teal);
  border-radius: var(--card-radius);
  background: var(--teal-soft);
  color: var(--navy-2);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.upload-drop:hover {
  background: #e0f4f1;
  border-color: var(--navy-3);
  transform: translateY(-1px);
}
.upload-drop .upload-icon { width: 30px; height: 30px; color: var(--teal); flex: 0 0 auto; }
.upload-drop .upload-text { font-weight: 700; font-size: 14px; }
#study-paste {
  width: 100%;
  min-height: 90px;
  padding: 14px 16px;
  border: 2px solid var(--line-strong);
  border-radius: var(--card-radius);
  background: var(--mist);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}
#study-paste:focus {
  border-color: var(--hero-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(11, 115, 246, 0.14);
}
.entry-upload-note {
  margin: 2px 0 0;
  font-size: 12px;
  color: #7a89a6;
  line-height: 1.5;
}

/* ---------- Issues: interpretation banner (upload path) ---------- */
.issues-problem {
  margin: 4px 0 14px;
  padding: 14px 16px;
  background: var(--teal-soft);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  color: var(--ink);
}
.issues-problem .ip-tag {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--teal);
}
.issues-problem p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}
