:root {
  --bg: #f4f1e9;
  --surface: #ffffff;
  --surface-2: #fbfaf4;
  --ink: #14161e;
  --ink-soft: #5a5d6b;
  --ink-mute: #8a8d99;
  --line: #e6e1d2;
  --soft-line: #efeadb;
  --codex-blue: #3d6dff;
  --codex-blue-deep: #2748b8;
  --codex-blue-tint: #eaf0ff;
  --coral: #ff6a4c;
  --coral-tint: #ffece5;
  --green: #2e9d5c;
  --green-tint: #e6f3ec;
  --yellow: #f4c451;
  --yellow-tint: #fff4d6;
  --ethan: #2f7a74;
  --ethan-tint: #e3efee;
  --zac: #bd5a43;
  --zac-tint: #fbe9e3;
  --shadow-sm: 0 1px 0 rgba(20,22,30,0.04), 0 1px 2px rgba(20,22,30,0.04);
  --shadow-md: 0 1px 0 rgba(20,22,30,0.04), 0 8px 20px -10px rgba(20,22,30,0.18);
  --shadow-lg: 0 1px 0 rgba(20,22,30,0.04), 0 20px 40px -20px rgba(20,22,30,0.22);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #efece4;
}

body {
  min-width: 320px;
  color: var(--ink);
  font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

button { font-family: inherit; }

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

::selection { background: var(--codex-blue); color: #fff; }

h1, h2, h3, h4, p { margin-top: 0; }

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

/* ─── App Shell ─── */
.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Top Bar ─── */
.topbar, #topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(244,241,233,0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Wordmark ─── */
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.wordmark-icon {
  width: 32px;
  height: 32px;
  background: var(--ink);
  border-radius: 9px;
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.wordmark-icon-screen {
  width: 16px;
  height: 10px;
  background: #fff;
  border-radius: 3px;
  position: relative;
}

.wordmark-icon-screen::before,
.wordmark-icon-screen::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 3px;
  height: 4px;
  background: var(--codex-blue);
  border-radius: 1px;
}

.wordmark-icon-screen::before { left: 3px; }
.wordmark-icon-screen::after  { right: 3px; }

.wordmark-icon-antenna {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 4px;
  background: var(--codex-blue);
}

.wordmark-text-primary {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.wordmark-text-sub {
  display: block;
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Kid selector pill (topbar) ─── */
.kid-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.kid-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease;
}

.kid-selector-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11.5px;
}

/* ─── Tags / Pills ─── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.tag-neutral { background: var(--surface-2); color: var(--ink-soft); border-color: var(--soft-line); }
.tag-blue    { background: var(--codex-blue-tint); color: var(--codex-blue-deep); border-color: rgba(61,109,255,0.2); }
.tag-green   { background: var(--green-tint); color: var(--green); border-color: rgba(46,157,92,0.25); }
.tag-yellow  { background: var(--yellow-tint); color: #7a5400; border-color: rgba(244,196,81,0.3); }
.tag-coral   { background: var(--coral-tint); color: #a83a23; border-color: rgba(255,106,76,0.25); }
.tag-ink     { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ─── Eyebrow ─── */
.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 6px;
}

/* ─── Home icon button ─── */
.home-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
}

/* ─── Main content wrapper ─── */
#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 26px 60px;
}

/* ─── HERO DARK PANEL ─── */
.hero-dark {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  padding: 28px 30px;
  background: linear-gradient(135deg, #14161e 0%, #1f2434 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}

.hero-grid-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.08;
  pointer-events: none;
}

.hero-left {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin: 0 0 6px;
}

.hero-h1 {
  margin: 4px 0 8px;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.hero-h1 .highlight-yellow { color: var(--yellow); }

.hero-tagline {
  margin: 0 0 18px;
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  max-width: 460px;
}

.hero-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}

.hero-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
}

.hero-right {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
  z-index: 1;
}

.bot-bubble {
  position: relative;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 300px;
  min-width: 220px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.45);
  margin-bottom: -8px;
  margin-right: 30px;
  z-index: 2;
}

.bot-bubble-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--codex-blue);
  margin-bottom: 4px;
  font-weight: 700;
}

.bot-bubble-tail {
  position: absolute;
  bottom: -7px;
  right: 28px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 4px 4px 8px -4px rgba(0,0,0,0.2);
}

.hero-bot-img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,0.35));
}

/* ─── Section headings ─── */
.section-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 14px;
}

.section-row h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-row-hint {
  color: var(--ink-mute);
  font-size: 13px;
}

/* ─── Agent Cards Grid ─── */
.agent-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr;
  gap: 14px;
  margin-bottom: 22px;
}

.agent-card {
  position: relative;
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 160ms ease, border-color 200ms ease;
  border: 1px solid var(--line);
}

.agent-card.selected {
  transform: translateY(-1px);
}

.agent-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
}

.agent-card.selected .agent-card-accent {
  height: 8px;
}

.agent-viewing-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 8px 3px 6px;
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-viewing-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
}

.agent-card-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 6px;
}

/* ─── Agent Avatar ─── */
.agent-avatar {
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-name {
  font-size: 19px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

.level-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  color: #fff;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.agent-note {
  color: var(--ink-mute);
  font-size: 12px;
  margin-top: 2px;
}

/* ─── XP Bar ─── */
.xp-bar-wrap {
  margin-top: 14px;
}

.xp-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

.xp-bar-labels span:first-child {
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

.xp-bar-labels strong { color: var(--ink); }

.xp-bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--soft-line);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar-fill {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  transition: width 360ms cubic-bezier(.2,.7,.2,1);
}

/* ─── Agent card footer ─── */
.agent-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--soft-line);
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ink-mute);
}

.status-dot.active { background: var(--green); }

.agent-status-text {
  font-size: 13px;
  color: var(--ink-soft);
}

.agent-card-cta {
  font-size: 13px;
  font-weight: 600;
}

/* ─── Parent Guide Card ─── */
.parent-guide-card {
  position: relative;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  text-align: left;
}

.parent-guide-card h3 {
  margin: 12px 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.parent-guide-card p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.45;
}

.parent-guide-card-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

/* ─── Mission Path Panel ─── */
.mission-path-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.mission-path-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 14px;
  flex-wrap: wrap;
}

.mission-path-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mission-path-title-text h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mission-path-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mission-path-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}

.switch-kid-btn {
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

/* ─── Mission Path Track ─── */
.mission-path-track {
  position: relative;
  padding-top: 24px;
  padding-bottom: 14px;
}

.mission-path-line-bg {
  position: absolute;
  left: 8.33%;
  right: 8.33%;
  top: 42px;
  height: 3px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--line) 0, var(--line) 6px, transparent 6px, transparent 12px);
  z-index: 0;
}

.mission-path-line-fill {
  position: absolute;
  left: 8.33%;
  top: 42px;
  height: 3px;
  border-radius: 3px;
  z-index: 1;
  transition: width 320ms cubic-bezier(.2,.7,.2,1);
}

.mission-path-other-marker {
  position: absolute;
  top: 28px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  transition: left 320ms cubic-bezier(.2,.7,.2,1);
}

.mission-path-other-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.mission-path-nodes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
}

.mission-node-btn {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mission-node-dot-wrap {
  position: relative;
}

.mission-node-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  border: 2px solid;
  animation: pulse-ring 1.8s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.4); }
}

.mission-node-dot {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid;
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.mission-node-labels {
  text-align: center;
}

.mission-node-num {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.mission-node-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.3;
  max-width: 130px;
  margin-left: auto;
  margin-right: auto;
}

.mission-node-next {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 8px;
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Badge Trophy Case ─── */
.badge-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px 26px;
  box-shadow: var(--shadow-sm);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.badge-cell {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px 8px 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
}

.badge-cell.earned {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.badge-cell:not(.earned) { background: var(--surface-2); }

.badge-label {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.badge-state {
  font-size: 10.5px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-state-earned {
  color: var(--green, #3a7a4a);
}

.badge-description {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-top: 2px;
  margin-bottom: 3px;
}

/* ─── MISSION DETAIL ─── */
.mission-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: start;
}

/* Side rail */
.mission-rail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 76px;
}

.mission-rail-heading {
  padding: 10px 12px 6px;
}

.rail-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.rail-item.active { background: var(--codex-blue-tint); }

.rail-item-num {
  font-size: 10.5px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.rail-item-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-item.locked .rail-item-title { color: var(--ink-mute); }

.mission-rail-progress {
  padding: 10px 12px 6px;
  margin-top: 4px;
  border-top: 1px solid var(--soft-line);
}

.rail-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

/* Mission status dot (in rail) */
.mission-status-dot {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid;
  flex-shrink: 0;
}

.mission-status-dot.done {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.mission-status-dot.active {
  background: var(--ink);
  color: var(--yellow);
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(20,22,30,0.08);
}

.mission-status-dot.locked {
  background: var(--surface);
  color: var(--ink-mute);
  border-color: var(--line);
}

/* Mission main content */
.mission-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 14px;
}

.breadcrumb-sep { opacity: 0.5; }

.breadcrumb-current {
  color: var(--ink);
  font-weight: 600;
}

/* Mission header card */
.mission-header-card {
  position: relative;
  padding: 24px 26px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.mission-number-bg {
  position: absolute;
  top: -30px;
  right: -20px;
  font-size: 200px;
  font-weight: 700;
  color: var(--codex-blue-tint);
  letter-spacing: -0.04em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  font-family: "Space Grotesk", sans-serif;
}

.mission-tags { margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }

.mission-h1 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.mission-summary {
  margin: 0 0 16px;
  max-width: 620px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.45;
}

/* Bot speech bubble */
.bot-speech {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.bot-speech-avatar {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

.bot-speech-bubble {
  position: relative;
  border-radius: 18px;
  padding: 12px 16px;
  max-width: 360px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.bot-speech-bubble.tone-blue {
  background: var(--codex-blue-tint);
  border: 1px solid rgba(61,109,255,0.18);
}

.bot-speech-bubble.tone-soft {
  background: var(--surface-2);
  border: 1px solid var(--soft-line);
}

.bot-speech-tail {
  position: absolute;
  left: -7px;
  bottom: 14px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
}

.tone-blue .bot-speech-tail {
  background: var(--codex-blue-tint);
  border-left: 1px solid rgba(61,109,255,0.18);
  border-bottom: 1px solid rgba(61,109,255,0.18);
}

.tone-soft .bot-speech-tail {
  background: var(--surface-2);
  border-left: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}

/* Three mission task cards */
.mission-task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
}

/* Activity card – warm lined paper */
.task-card-activity {
  position: relative;
  background: linear-gradient(180deg, var(--yellow-tint), #fffaee);
  border: 1px solid rgba(244,196,81,0.4);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
}

.lined-paper-bg {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 22px,
    rgba(122,84,0,0.08) 22px,
    rgba(122,84,0,0.08) 23px
  );
  pointer-events: none;
}

/* Project card – blueprint grid */
.task-card-project {
  position: relative;
  background: linear-gradient(180deg, var(--codex-blue-tint), #f4f7ff);
  border: 1px solid rgba(61,109,255,0.25);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
}

.blueprint-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(61,109,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61,109,255,0.08) 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
}

/* Terminal card – dark */
.task-card-terminal {
  position: relative;
  background: #0f1116;
  border: 1px solid #232735;
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  color: #e6e8ef;
}

.terminal-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #232735;
  background: #15171f;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.terminal-title {
  font-size: 11px;
  color: #7e8398;
  margin-left: 6px;
}

.terminal-copy-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  background: #232735;
  color: #e6e8ef;
  border: 1px solid #2e3344;
  border-radius: 6px;
  cursor: pointer;
}

.terminal-body {
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #cdd2e0;
}

.terminal-comment { color: #7e8398; }
.terminal-highlight-yellow { color: #f4c451; }
.terminal-highlight-green  { color: #2e9d5c; }
.terminal-highlight-coral  { color: #ff6a4c; }

.task-card-inner { position: relative; }

.task-card-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.task-card-h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.task-card-p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

/* Checklist + Level Up row */
.mission-lower-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.checklist-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.checklist-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-count {
  font-size: 13px;
  color: var(--ink-mute);
}

.checklist-xp-wrap { width: 70px; }

.checklist-list { display: grid; gap: 8px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 160ms ease;
  border: 1px solid;
}

.checklist-item.checked {
  background: var(--green-tint);
  border-color: rgba(46,157,92,0.25);
}

.checklist-item:not(.checked) {
  background: var(--surface-2);
  border-color: var(--soft-line);
}

.checklist-box {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid;
}

.checklist-box.checked {
  background: var(--green);
  border-color: var(--green);
}

.checklist-box:not(.checked) {
  background: #fff;
  border-color: var(--line);
}

.checklist-item-label {
  font-size: 14.5px;
  font-weight: 500;
}

.checklist-item.checked .checklist-item-label {
  color: var(--green);
  text-decoration: line-through;
}

/* Level Up card */
.level-up-card {
  position: relative;
  background: linear-gradient(180deg, var(--coral-tint), #fff6f2);
  border: 1px solid rgba(255,106,76,0.3);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow: hidden;
}

.level-up-glow {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,106,76,0.18), transparent 70%);
}

/* Reflection field */
.reflection-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.reflection-layout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.reflection-h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.reflection-hint {
  margin: 0 0 10px;
  color: var(--ink-mute);
  font-size: 13px;
}

.reflection-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 23px,
    rgba(20,22,30,0.06) 23px,
    rgba(20,22,30,0.06) 24px
  );
}

/* Summary action area */
.summary-action-slot { margin-top: 4px; }

.summary-status {
  min-height: 18px;
  font-size: 13px;
  color: var(--ink-mute);
  margin: 4px 0 0;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Mission complete CTA */
.mission-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #14161e 0%, #1f2434 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.mission-cta-label {
  font-size: 12.5px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.mission-cta-text {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.mission-cta-badge { color: var(--yellow); }

.mission-cta-btn {
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--yellow);
  color: #1a1a1a;
  border: 0;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
  white-space: nowrap;
}

/* Completion note */
.completion-note {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 10px 14px;
  border: 1px solid rgba(46,157,92,0.22);
  border-radius: var(--radius);
  background: var(--green-tint);
  color: var(--green);
  font-weight: 600;
  font-size: 14px;
}

.completion-note-sub {
  color: var(--ink-soft);
  font-weight: 400;
}

/* Summary prompt */
.summary-prompt {
  display: grid;
  gap: 10px;
  width: fit-content;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.summary-prompt-btns {
  display: flex;
  gap: 8px;
}

.summary-prompt-btns button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}

/* Mission nav */
.mission-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.mission-nav-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mission-nav-btn.next { margin-left: auto; }

/* Copy prompt feedback */
.copy-feedback {
  min-height: 18px;
  margin-bottom: 8px;
  color: var(--ink-mute);
  font-size: 0.82rem;
}

/* Learning summary */
.learning-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.learning-summary-grid {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.learning-summary dt {
  color: var(--ink-mute);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 10px;
}

.learning-summary dd {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink);
}

/* Media card */
.media-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  border-left: 3px solid var(--codex-blue);
}

.media-card a { color: var(--ink); }

.media-action {
  display: inline-flex;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* ─── PROFILE / LEARNER DASHBOARD ─── */
.profile-identity-hero {
  position: relative;
  padding: 24px 28px;
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: center;
}

.profile-dot-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  pointer-events: none;
}

.profile-hero-left {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar-lg {
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 22px -8px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.profile-identity-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.profile-name {
  margin: 4px 0 6px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-level-chip {
  padding: 3px 8px;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.profile-meta-text {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.profile-hero-right { position: relative; }

.profile-xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  margin-bottom: 6px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.profile-xp-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}

.profile-xp-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 999px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}

.profile-badges-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Profile continue + summary */
.profile-continue-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.profile-continue-card {
  position: relative;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-continue-number {
  position: absolute;
  right: -20px;
  top: -20px;
  font-size: 200px;
  font-weight: 700;
  color: var(--codex-blue-tint);
  letter-spacing: -0.04em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.profile-continue-inner { position: relative; }

.profile-summary-card {
  padding: 18px 20px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

/* Project Shelf */
.project-shelf { margin-top: 20px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.project-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.project-tile-preview {
  position: relative;
  height: 110px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--soft-line);
}

.project-tile-type {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255,255,255,0.85);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-tile-emoji { font-size: 42px; }

.project-tile-body { padding: 14px 16px; }

.project-tile-body h4 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.project-tile-body p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.project-tile-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-tile-mission {
  font-size: 11px;
  color: var(--ink-mute);
}

.project-form-wrapper {
  margin-top: 16px;
}

/* Add project tile */
.project-add-tile {
  display: grid;
  place-items: center;
  gap: 8px;
  background: transparent;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--ink-mute);
  cursor: pointer;
  min-height: 200px;
  font-family: inherit;
  width: 100%;
  transition: border-color 140ms ease;
}

.project-add-tile:hover { border-color: var(--ink-mute); }

.project-add-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--ink);
}

.project-add-label { font-weight: 600; color: var(--ink); }
.project-add-sub { font-size: 12.5px; }

/* Learner summaries */
.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.summary-card h4 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.summary-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }

/* Shelf chips */
.shelf-chip-row { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

.shelf-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Project form */
.project-form {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

textarea,
input[type="text"],
input:not([type]),
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.project-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
}

/* Buttons */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}

.primary-button:hover { opacity: 0.92; }

.ghost-button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.project-form button[type="submit"] {
  justify-self: start;
  padding: 11px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.edit-button {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

/* ─── Parent Guide ─── */
.parent-guide {
  display: grid;
  gap: 16px;
}

.parent-guide h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.parent-guide article {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.parent-guide article h3 { font-size: 18px; font-weight: 700; }

.watch-for {
  margin-bottom: 0;
  color: var(--ink-mute);
  font-size: 13.5px;
  font-style: italic;
}

/* ─── All complete ─── */
.all-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--green-tint);
  border: 1px solid rgba(46,157,92,0.25);
  border-radius: 999px;
  color: var(--green);
  font-weight: 600;
  font-size: 14px;
}

/* ─── Completion helper ─── */
.completion-helper {
  margin-bottom: 0;
  color: var(--ink-mute);
  font-size: 13px;
}

/* ─── Responsive ─── */
@media (max-width: 980px) {
  .mission-shell {
    grid-template-columns: 1fr;
  }
  .mission-rail {
    position: static;
  }
  .mission-task-grid {
    grid-template-columns: 1fr;
  }
  .mission-lower-grid {
    grid-template-columns: 1fr;
  }
  .agent-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
  .profile-identity-hero {
    grid-template-columns: 1fr;
  }
  .profile-continue-grid {
    grid-template-columns: 1fr;
  }
  .hero-dark {
    grid-template-columns: 1fr;
  }
  .hero-right { display: none; }
  .badge-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  #app { padding: 16px 16px 40px; }
  .topbar, #topbar { padding: 14px 16px; }
  .agent-cards-grid { grid-template-columns: 1fr; }
  .mission-path-nodes { grid-template-columns: repeat(3, 1fr); }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: 1fr; }
  .hero-dark { padding: 20px; }
  .hero-h1 { font-size: 26px; }
}
