:root {
  --bg: #071b2b;
  --panel: #0d2a42;
  --panel2: #164d78;
  --line: #89cbd0;
  --line-strong: #ffd04a;
  --text: #f4eddd;
  --muted: #c9d6d6;
  --faint: #a8bec4;
  --purple: #ffd04a;
  --purple-light: #ffd04a;
  --purple-dark: #0d2a42;
  --danger: #ff9c87;
  --shadow: none;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
body { background: var(--bg); }
::selection { background: #ffd04a; color: #071b2b; }
.sidebar { border-bottom: 2px solid var(--line); background: var(--bg); backdrop-filter: none; }
.brand { font-weight: 900; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 2px solid #ffd04a; border-radius: 0; background: #ffd04a; color: #071b2b; box-shadow: none; font-size: 1.2rem; font-weight: 900; }
.version { color: var(--muted); margin-left: 47px; font-size: .72rem; letter-spacing: 0; }
.nav-item { border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); }
.nav-item:hover, .nav-item.active { border-color: #ffd04a; background: transparent; color: var(--text); }
.nav-icon { color: #ffd04a; }
.privacy-card { max-width: 250px; border: 2px solid var(--line); border-radius: 0; background: var(--panel); }
.privacy-title { color: var(--text); }
.privacy-card p { color: var(--muted); font-size: .78rem; }
.status-dot { background: #ffd04a; box-shadow: none; }
.privacy-card a { color: #ffd04a; }
main { padding-top: 48px; }
.eyebrow { display: none; }
.topbar { margin-bottom: 32px; }
.topbar h1 { font-size: clamp(2.4rem, 4vw, 4rem); letter-spacing: -.035em; }
.top-description { color: var(--muted); font-size: 1rem; }
.button, .button.ghost, .button.primary { border-radius: 0; box-shadow: none; }
.button.ghost { border: 2px solid var(--line); background: var(--panel); color: var(--text); }
.button.ghost:hover { background: var(--panel2); border-color: #ffd04a; }
.button.primary { border: 2px solid #ffd04a; background: #ffd04a; color: #071b2b; }
.button.primary:hover { background: var(--text); transform: translateY(-2px); }
.workspace { gap: 22px; }
.panel { border: 2px solid var(--line); border-radius: 0; background: var(--panel); box-shadow: none; }
.input-panel { border-top: 6px solid #ffd04a; }
.step { border-radius: 0; background: #ffd04a; color: #071b2b; font-family: inherit; }
.source-badge { border: 2px solid var(--line); border-radius: 0; color: var(--muted); font-family: inherit; }
.field-label { color: var(--text); }
.text-input, textarea, select { border: 2px solid var(--line); border-radius: 0; background: var(--bg); color: var(--text); }
::placeholder { color: #a8bec4; }
.textarea-meta strong, .range-head output { color: #ffd04a; }
input[type=range] { accent-color: #ffd04a; }
.decision-input { border-top: 2px solid var(--line); }
.option-input { border: 2px solid var(--line); border-radius: 0; background: var(--bg); }
.option-input legend { color: #ffd04a; }
.score-inputs label { color: var(--muted); }
.icon-button { border: 2px solid var(--line); border-radius: 0; background: var(--bg); color: var(--text); }
.icon-button:not(:disabled):hover { background: var(--panel2); }
.empty-state { min-height: 430px; }
.empty-route { display: block; width: 190px; height: 128px; margin: 0 0 24px; overflow: visible; }
.empty-route path { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.empty-route path:nth-child(2) { stroke: #ffd04a; stroke-width: 9; }
.empty-route circle { fill: var(--bg); stroke: #ffd04a; stroke-width: 4; }
.empty-state li { border: 2px solid var(--line); border-radius: 0; color: var(--muted); }
.empty-state li span { color: #ffd04a; }
.decision-output { border: 2px solid #ffd04a; border-radius: 0; background: var(--panel2); }
.decision-kicker, .decision-output dt { color: #ffd04a; }
.decision-output h3, .decision-output > p:not(.decision-recommendation), .decision-output small { color: var(--muted); }
.decision-output dl div { border-color: var(--line); }
.metric, .claim-card, .rule-card { border: 2px solid var(--line); border-radius: 0; background: var(--bg); }
.metric span, .confidence-label, .claim-number, .rule-card small { color: var(--muted); }
.claim-text, .rule-card p { color: var(--text); }
.stance, .rule-status { border-radius: 0; }
.stance.supporting, .rule-status.recorded { color: #ffd04a; background: var(--panel2); }
.confidence-track { background: var(--panel2); }
.confidence-track i { background: #ffd04a; }
.principles > div { border: 2px solid var(--line); border-radius: 0; background: var(--panel); }
.principles span { color: #ffd04a; font-family: inherit; }
.principles strong { color: var(--text); }
@media (max-width: 850px) { .sidebar nav { border-color: var(--line); border-top-width: 2px; } }
@media (max-width: 560px) {
  .sidebar nav { overflow: visible; justify-content: flex-start; white-space: normal; flex-wrap: wrap; }
  .nav-item { flex: none; }
  .topbar { flex-direction: column; align-items: stretch; }
  .top-actions { flex-direction: row; }
  .topbar h1 { font-size: 2.1rem; }
  .empty-state { min-height: 250px; }
}
@media (prefers-reduced-motion: reduce) { .button.primary:hover { transform: none; } }

/* IBS Flow — shared visual layer for the four public legacy surfaces.
   Load this after each page's existing styles. It changes appearance only. */
:root {
  color-scheme: light;
  --flow-canvas: #f7f8fc;
  --flow-white: #ffffff;
  --flow-ink: #171b28;
  --flow-muted: #596274;
  --flow-quiet: #737d91;
  --flow-line: #e1e5f0;
  --flow-purple: #5144f5;
  --flow-purple-dark: #392dcf;
  --flow-lilac: #edeaff;
  --flow-cyan: #58d1de;
  --flow-cyan-pale: #e8f9fb;
  --flow-shadow: 0 18px 48px rgba(48, 56, 116, .09);
  --bg: var(--flow-canvas);
  --panel: var(--flow-white);
  --panel2: var(--flow-lilac);
  --line: var(--flow-line);
  --line-strong: #b9b2ff;
  --text: var(--flow-ink);
  --muted: var(--flow-muted);
  --faint: var(--flow-quiet);
  --purple: var(--flow-purple);
  --purple-light: var(--flow-lilac);
  --purple-dark: var(--flow-purple-dark);
  --violet: var(--flow-purple);
  --ibs-ink: var(--flow-canvas);
  --ibs-field: var(--flow-white);
  --ibs-field-deep: var(--flow-cyan-pale);
  --ibs-blue: var(--flow-lilac);
  --ibs-paper: var(--flow-ink);
  --ibs-muted: var(--flow-muted);
  --ibs-gold: var(--flow-purple);
  --ibs-line: var(--flow-line);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
html { scroll-behavior: smooth; }
body, body:has(.avatar-main), body[data-ui="sandbox"], body:has(.app-shell) {
  background: var(--flow-canvas);
  color: var(--flow-ink);
}
body { overflow-x: hidden; }
::selection { color: #fff; background: var(--flow-purple); }
button, input, textarea, select { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
body:has(.avatar-main) a:focus-visible, body:has(.avatar-main) button:focus-visible,
body:has(.avatar-main) input:focus-visible, body[data-ui="sandbox"] a:focus-visible,
body[data-ui="sandbox"] button:focus-visible, body[data-ui="sandbox"] input:focus-visible {
  outline: 3px solid var(--flow-purple);
  outline-offset: 3px;
}
input::placeholder, textarea::placeholder,
body:has(.app-shell) ::placeholder,
body:has(.avatar-main) .character-input::placeholder {
  color: #788294;
  opacity: 1;
}

/* A single bright navigation grammar replaces the four older mastheads. */
body:has(.site-header) .site-header,
body:has(.avatar-main) .header,
body[data-ui="sandbox"] .header,
body:has(.app-shell) .sidebar {
  background: #fff;
  color: var(--flow-ink);
  border: 0;
  border-bottom: 1px solid var(--flow-line);
  box-shadow: 0 7px 22px rgba(41, 49, 96, .04);
  backdrop-filter: none;
}
body:has(.site-header) .logo,
body:has(.avatar-main) .logo,
body[data-ui="sandbox"] .logo,
body:has(.app-shell) .brand { color: var(--flow-ink); letter-spacing: -.035em; }
body:has(.site-header) .logo-mark,
body:has(.avatar-main) .logo span,
body[data-ui="sandbox"] .logo span,
body:has(.app-shell) .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: var(--flow-purple);
  color: #fff;
  box-shadow: 0 7px 16px rgba(81, 68, 245, .2);
  font-size: 1.17rem;
  font-weight: 900;
}
body:has(.site-header) .logo-accent { color: var(--flow-purple); }
body:has(.site-header) .site-header nav a,
body:has(.avatar-main) .header nav a,
body[data-ui="sandbox"] .header nav a,
body:has(.app-shell) .nav-item {
  color: var(--flow-muted);
  border: 0;
  border-radius: 11px;
  font-weight: 650;
}
body:has(.site-header) .site-header nav a:hover,
body:has(.site-header) .site-header nav .current,
body:has(.avatar-main) .header nav a:hover,
body:has(.avatar-main) .header nav a[aria-current],
body[data-ui="sandbox"] .header nav a:hover,
body[data-ui="sandbox"] .header nav a[aria-current],
body:has(.app-shell) .nav-item:hover,
body:has(.app-shell) .nav-item.active {
  color: var(--flow-purple);
  border: 0;
  background: var(--flow-lilac);
}
body:has(.avatar-main) .header small,
body[data-ui="sandbox"] .header small,
body:has(.app-shell) .version { color: var(--flow-quiet); }
body:has(.app-shell) .nav-icon { color: var(--flow-purple); }

/* Buttons, fields and quiet text use the same treatment everywhere. */
body:has(.site-header) .header-cta,
body:has(.site-header) .button.primary,
body:has(.avatar-main) .hero-start,
body:has(.avatar-main) .enter-sandbox,
body[data-ui="sandbox"] .primary,
body[data-ui="sandbox"] .data-path-actions a,
body:has(.app-shell) .button.primary {
  border: 1px solid var(--flow-purple);
  border-radius: 14px;
  background: var(--flow-purple);
  color: #fff;
  box-shadow: 0 11px 22px rgba(81, 68, 245, .16);
  font-weight: 800;
  transition: transform .24s cubic-bezier(.2,.8,.2,1), background .24s ease, box-shadow .24s ease;
}
body:has(.site-header) .header-cta:hover,
body:has(.site-header) .button.primary:hover,
body:has(.avatar-main) .hero-start:hover,
body:has(.avatar-main) .enter-sandbox:hover,
body[data-ui="sandbox"] .primary:hover,
body:has(.app-shell) .button.primary:hover {
  background: var(--flow-purple-dark);
  color: #fff;
  box-shadow: 0 16px 27px rgba(81, 68, 245, .2);
  transform: translateY(-2px);
}
body:has(.site-header) .button.secondary,
body:has(.app-shell) .button.ghost {
  border: 1px solid #c8c5ee;
  border-radius: 14px;
  background: #fff;
  color: var(--flow-purple);
  box-shadow: none;
}
body:has(.site-header) .button.secondary:hover,
body:has(.app-shell) .button.ghost:hover {
  background: var(--flow-lilac);
  border-color: var(--flow-purple);
  color: var(--flow-purple-dark);
}

/* Landing: the decision preview sits in a flowing, open field. */
body:has(.site-header) .hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 58% 88% at 89% 19%, #d7f7fb 0, transparent 70%),
              radial-gradient(ellipse 69% 110% at 14% 90%, #ddd8ff 0, transparent 74%),
              #f6f5ff;
}
body:has(.site-header) .hero::before,
body:has(.site-header) .hero::after { display: none; }
body:has(.site-header) .hero-grid { position: relative; z-index: 1; min-height: 640px; }
body:has(.site-header) .hero-river { opacity: .45; }
body:has(.site-header) .hero-river path { stroke: #b7acfa; stroke-linecap: round; }
body:has(.site-header) .hero-river path:first-child { stroke: #e2ddff; }
body:has(.site-header) .hero-river path:nth-child(2) { stroke: #b8eff4; }
body:has(.site-header) .hero-river path:nth-child(3) { stroke: #766cf5; }
body:has(.site-header) .hero-river circle { fill: #fff; stroke: var(--flow-purple); }
body:has(.site-header) .hero h1,
body:has(.site-header) .audience-grid h2,
body:has(.site-header) .section-head h2,
body:has(.site-header) .status-grid h2,
body:has(.site-header) .join-heading h2 { color: var(--flow-ink); letter-spacing: -.045em; }
body:has(.site-header) .hero h1 span { color: var(--flow-purple); }
body:has(.site-header) .hero-lead { color: var(--flow-muted); }
body:has(.site-header) .hero-footnote { color: var(--flow-quiet); }
body:has(.site-header) .hero-footnote a { color: var(--flow-purple); }
body:has(.site-header) .decision-preview {
  border: 1px solid #dedcf1;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(48, 56, 116, .12);
  color: var(--flow-ink);
}
body:has(.site-header) .preview-top { color: var(--flow-muted); border-bottom: 1px solid var(--flow-line); }
body:has(.site-header) .preview-badge { border: 0; border-radius: 999px; background: var(--flow-lilac); color: var(--flow-purple); }
body:has(.site-header) .preview-question,
body:has(.site-header) .preview-row span,
body:has(.site-header) .preview-bottom { color: var(--flow-muted); }
body:has(.site-header) .preview-answer {
  border: 0;
  border-radius: 17px;
  background: #f0efff;
  color: var(--flow-ink);
}
body:has(.site-header) .preview-answer small { color: var(--flow-purple); }
body:has(.site-header) .preview-answer strong { color: var(--flow-ink); }
body:has(.site-header) .preview-answer p,
body:has(.site-header) .preview-row p { color: var(--flow-muted); }
body:has(.site-header) .preview-row {
  border-bottom: 1px solid var(--flow-line);
  border-radius: 0;
  background: transparent;
}
body:has(.site-header) .audience-section,
body:has(.site-header) .path-section,
body:has(.site-header) .status-section,
body:has(.site-header) .join-section { color: var(--flow-ink); background: #fff; }
body:has(.site-header) .audience-section,
body:has(.site-header) .status-section { background: var(--flow-canvas); }
body:has(.site-header) .audience-grid p,
body:has(.site-header) .path-grid p,
body:has(.site-header) .status-intro,
body:has(.site-header) .status-list p,
body:has(.site-header) .join-heading > p:last-child,
body:has(.site-header) .join-card p,
body:has(.site-header) .join-card small { color: var(--flow-muted); }
body:has(.site-header) .audience-grid > a,
body:has(.site-header) .path-grid article,
body:has(.site-header) .status-list > div,
body:has(.site-header) .join-card {
  border: 1px solid var(--flow-line);
  border-radius: 22px;
  background: #fff;
  color: var(--flow-ink);
  box-shadow: 0 12px 34px rgba(48, 56, 116, .05);
}
body:has(.site-header) .audience-grid > a:last-child,
body:has(.site-header) .join-card + .join-card { background: #f8f8ff; }
body:has(.site-header) .audience-grid > a:hover { background: var(--flow-lilac); }
body:has(.site-header) .audience-grid a span { color: var(--flow-muted); }
body:has(.site-header) .audience-grid b,
body:has(.site-header) .join-label,
body:has(.site-header) .path-no { color: var(--flow-purple); }
body:has(.site-header) .path-no { border-bottom-color: var(--flow-cyan); }
body:has(.site-header) .status-list { gap: 10px; }
body:has(.site-header) .status-list > div { padding: 20px 22px; }
body:has(.site-header) .status-pill.available { border: 0; border-radius: 999px; background: var(--flow-lilac); color: var(--flow-purple); }
body:has(.site-header) .status-pill.upcoming { border: 0; border-radius: 999px; background: #edf4f5; color: #286b75; }
body:has(.site-header) .join-card .button.secondary { border-color: #c8c5ee; background: #fff; color: var(--flow-purple); }
body:has(.site-header) .final-cta {
  background: radial-gradient(ellipse at 90% 10%, #8178ff 0, transparent 55%), #4134cb;
}
body:has(.site-header) .final-panel {
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 28px;
  background: rgba(255,255,255,.13);
  color: #fff;
}
body:has(.site-header) .final-panel h2,
body:has(.site-header) .final-panel .section-kicker { color: #fff; }
body:has(.site-header) .final-panel p:not(.section-kicker) { color: #eeeaff; }
body:has(.site-header) .site-footer { border-color: var(--flow-line); background: #fff; color: var(--flow-ink); }
body:has(.site-header) .footer-inner small,
body:has(.site-header) .footer-inner nav { color: var(--flow-muted); }

/* Character creation: a soft field with a visible first choice. */
body:has(.avatar-main) .header { background: #fff; }
body:has(.avatar-main) .avatar-main { padding-top: clamp(20px, 3vw, 42px); }
body:has(.avatar-main) .avatar-heading {
  min-height: 550px;
  margin-bottom: 28px;
  border: 1px solid #e5e0fa;
  border-radius: 34px;
  background: radial-gradient(ellipse 72% 105% at 95% 6%, #d9f8fb 0, transparent 67%),
              radial-gradient(ellipse 68% 100% at 56% 110%, #d9d4ff 0, transparent 66%),
              #f5f4ff;
  box-shadow: 0 22px 54px rgba(48, 56, 116, .08);
}
body:has(.avatar-main) .avatar-heading h1 { color: var(--flow-ink); }
body:has(.avatar-main) .avatar-heading h1 span { color: var(--flow-purple); }
body:has(.avatar-main) .avatar-heading > p:last-of-type { color: var(--flow-muted); }
body:has(.avatar-main) .linework-hero { opacity: .38; }
body:has(.avatar-main) .linework-field { fill: #e7e4ff; }
body:has(.avatar-main) .linework-sweep { stroke: #e0dcff; }
body:has(.avatar-main) .linework-sweep-secondary { stroke: #a9e9f0; }
body:has(.avatar-main) .linework-branch { stroke: #8f87e8; }
body[data-creation-mode="fiction"] .linework-branch-fiction,
body[data-creation-mode="photo"] .linework-branch-photo,
body[data-creation-mode="camera"] .linework-branch-camera { stroke: var(--flow-purple); }
body:has(.avatar-main) .linework-cut { stroke: #fff; }
body:has(.avatar-main) .linework-core,
body:has(.avatar-main) .linework-point { fill: #fff; stroke: var(--flow-purple); }
body:has(.avatar-main) .avatar-heading-actions a { color: var(--flow-purple); border-bottom-color: #b8b1fa; }
body:has(.avatar-main) .avatar-heading-actions a:hover { border-bottom-color: var(--flow-purple); }
body:has(.avatar-main) .mode-picker {
  border: 1px solid #dedcf2;
  border-radius: 17px;
  background: #e9e9f6;
  box-shadow: 0 6px 18px rgba(48, 56, 116, .05);
}
body:has(.avatar-main) .mode-picker::before {
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 15px rgba(57, 52, 118, .12);
}
body:has(.avatar-main) .mode-picker button,
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] {
  color: var(--flow-muted);
  border: 0;
  background: transparent;
}
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] { color: var(--flow-purple); }
body:has(.avatar-main) .mode-picker button small,
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] small { color: var(--flow-muted); }
body:has(.avatar-main) .mode-picker button:hover:not([aria-pressed="true"]) { color: var(--flow-purple); background: transparent; }
body:has(.avatar-main) .creation-card,
body:has(.avatar-main) .creation-preview {
  border: 1px solid var(--flow-line);
  border-radius: 25px;
  background: #fff;
  box-shadow: var(--flow-shadow);
}
body:has(.avatar-main) .creation-card { border-top: 1px solid var(--flow-line); }
body:has(.avatar-main) .creation-card h2,
body:has(.avatar-main) .creation-preview h2,
body:has(.avatar-main) .world-preview h2 { color: var(--flow-ink); }
body:has(.avatar-main) .creation-card > p,
body:has(.avatar-main) .mode-panel > p,
body:has(.avatar-main) .upload-state,
body:has(.avatar-main) .consent-note,
body:has(.avatar-main) .avatar-3d-hint,
body:has(.avatar-main) .creation-preview > p,
body:has(.avatar-main) .world-steps small { color: var(--flow-muted); }
body:has(.avatar-main) .character-label,
body:has(.avatar-main) .mode-panel > label:not(.upload-zone),
body:has(.avatar-main) .identity-choice { color: var(--flow-ink); }
body:has(.avatar-main) .character-input,
body:has(.avatar-main) .mode-panel select {
  border: 1px solid #cfd5e5;
  border-radius: 13px;
  background: #fff;
  color: var(--flow-ink);
}
body:has(.avatar-main) input[type="radio"],
body:has(.avatar-main) input[type="checkbox"] { accent-color: var(--flow-purple); }
body:has(.avatar-main) .upload-zone,
body:has(.avatar-main) .camera-box {
  border: 1px dashed #aab0e8;
  border-radius: 17px;
  background: #f8f8ff;
  color: var(--flow-ink);
}
body:has(.avatar-main) .upload-zone:hover { border-color: var(--flow-purple); background: #f2f0ff; }
body:has(.avatar-main) .upload-icon { border-radius: 12px; background: var(--flow-lilac); color: var(--flow-purple); }
body:has(.avatar-main) .camera-actions button,
body:has(.avatar-main) .remove-photo {
  border: 1px solid #cbd0e8;
  border-radius: 11px;
  background: #fff;
  color: var(--flow-purple);
}
body:has(.avatar-main) .privacy-box,
body:has(.avatar-main) .carry-photo { border-top: 1px solid var(--flow-line); background: transparent; color: var(--flow-muted); }
body:has(.avatar-main) .privacy-box summary { color: var(--flow-ink); }
body:has(.avatar-main) .privacy-box ul { color: var(--flow-muted); }
body:has(.avatar-main) .creation-preview { border-color: var(--flow-line); }
body:has(.avatar-main) .preview-top { color: var(--flow-ink); }
body:has(.avatar-main) .preview-badge { border: 0; border-radius: 999px; background: var(--flow-lilac); color: var(--flow-purple); }
body:has(.avatar-main) .preview-stage {
  border-block: 1px solid var(--flow-line);
  background: radial-gradient(ellipse 65% 65% at 45% 30%, #e3faff 0, transparent 80%), #efedff;
}
body:has(.avatar-main) .route-field { fill: #ddd9ff; opacity: .65; }
body:has(.avatar-main) .route-sweep { stroke: #d7d2ff; }
body:has(.avatar-main) .route-sweep-secondary { stroke: #aee9ee; }
body:has(.avatar-main) .route-graphic .route-left,
body:has(.avatar-main) .route-graphic .route-right,
body:has(.avatar-main) .route-graphic .route-lower-right { stroke: #a6a0ee; }
body[data-creation-mode="fiction"] .route-graphic .route-left,
body[data-creation-mode="photo"] .route-graphic .route-right,
body[data-creation-mode="camera"] .route-graphic .route-lower-right { stroke: var(--flow-purple); }
body:has(.avatar-main) .route-core,
body:has(.avatar-main) .route-point { fill: #fff; stroke: var(--flow-purple); }
body:has(.avatar-main) .avatar-3d-fallback { color: var(--flow-muted); }
body:has(.avatar-main) .growth { border-top: 1px solid var(--flow-line); }
body:has(.avatar-main) .growth div { border-color: var(--flow-line); }
body:has(.avatar-main) .growth span { color: var(--flow-quiet); }
body:has(.avatar-main) .growth strong { color: var(--flow-ink); }
body:has(.avatar-main) .world-preview { border-top: 1px solid var(--flow-line); }
body:has(.avatar-main) .world-steps div { border-bottom: 1px solid var(--flow-line); }
body:has(.avatar-main) .world-steps span { color: var(--flow-purple); }
body:has(.avatar-main) footer { border-color: var(--flow-line); color: var(--flow-muted); }

/* Sandbox: clear form states, relaxed space, and a calm character stage. */
body[data-ui="sandbox"] .intro {
  margin-top: 30px;
  padding: clamp(30px, 5vw, 58px);
  border: 1px solid #e5e0fa;
  border-radius: 30px;
  background: radial-gradient(ellipse 55% 110% at 90% 10%, #d4f6fa 0, transparent 78%),
              radial-gradient(ellipse 70% 100% at 12% 100%, #e4e0ff 0, transparent 72%), #f5f4ff;
}
body[data-ui="sandbox"] .intro h1,
body[data-ui="sandbox"] .board-title h2,
body[data-ui="sandbox"] .step h3,
body[data-ui="sandbox"] .result h3,
body[data-ui="sandbox"] .avatar h2,
body[data-ui="sandbox"] .more h2 { color: var(--flow-ink); }
body[data-ui="sandbox"] .intro h1 span { color: var(--flow-purple); }
body[data-ui="sandbox"] .intro p:not(.eyebrow),
body[data-ui="sandbox"] .step p,
body[data-ui="sandbox"] .result > p { color: var(--flow-muted); }
body[data-ui="sandbox"] .intro aside {
  border: 0;
  border-radius: 19px;
  padding: 16px 22px;
  background: rgba(255,255,255,.77);
  box-shadow: 0 12px 29px rgba(48, 56, 116, .07);
}
body[data-ui="sandbox"] .intro-step { color: var(--flow-ink); }
body[data-ui="sandbox"] .intro-step + .intro-step { border-top: 1px solid var(--flow-line); }
body[data-ui="sandbox"] .character-banner,
body[data-ui="sandbox"] .data-paths {
  border: 1px solid var(--flow-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 9px 30px rgba(48, 56, 116, .05);
  color: var(--flow-ink);
}
body[data-ui="sandbox"] .character-banner strong { color: var(--flow-ink); }
body[data-ui="sandbox"] .character-banner a { color: var(--flow-purple); }
body[data-ui="sandbox"] .board-title > span { border: 0; border-radius: 999px; background: var(--flow-lilac); color: var(--flow-purple); }
body[data-ui="sandbox"] .game,
body[data-ui="sandbox"] .avatar {
  border: 1px solid var(--flow-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--flow-shadow);
}
body[data-ui="sandbox"] .game,
body[data-ui="sandbox"] .avatar { min-width: 0; }
body[data-ui="sandbox"] .progress { background: #eae9f5; }
body[data-ui="sandbox"] .progress span { background: var(--flow-purple); }
body[data-ui="sandbox"] .card-icon { border: 0; border-radius: 14px; background: var(--flow-lilac); color: var(--flow-purple); }
body[data-ui="sandbox"] .step textarea,
body[data-ui="sandbox"] .step input:not([type=radio]),
body[data-ui="sandbox"] .step select {
  border: 1px solid #cfd5e5;
  border-radius: 13px;
  background: #fff;
  color: var(--flow-ink);
}
body[data-ui="sandbox"] .examples button,
body[data-ui="sandbox"] .feedback button,
body[data-ui="sandbox"] .save button,
body[data-ui="sandbox"] .replay,
body[data-ui="sandbox"] .back,
body[data-ui="sandbox"] .avatar-foot button {
  border: 1px solid #cdd1e6;
  border-radius: 11px;
  background: #fff;
  color: var(--flow-purple);
}
body[data-ui="sandbox"] .examples button:hover,
body[data-ui="sandbox"] .feedback button:hover,
body[data-ui="sandbox"] .avatar-foot button:hover { background: var(--flow-lilac); }
body[data-ui="sandbox"] .priorities label span,
body[data-ui="sandbox"] .branches article,
body[data-ui="sandbox"] .metrics div {
  border: 1px solid var(--flow-line);
  border-radius: 16px;
  background: #f8f8fe;
  color: var(--flow-ink);
}
body[data-ui="sandbox"] .priorities input:checked + span,
body[data-ui="sandbox"] .feedback button.selected {
  border-color: #8f86f8;
  background: var(--flow-lilac);
  color: var(--flow-purple-dark);
  box-shadow: inset 0 0 0 1px #aaa3fa;
}
body[data-ui="sandbox"] .priorities small,
body[data-ui="sandbox"] .branches p,
body[data-ui="sandbox"] .feedback small,
body[data-ui="sandbox"] .save small,
body[data-ui="sandbox"] .save label,
body[data-ui="sandbox"] .avatar > p,
body[data-ui="sandbox"] .metrics small,
body[data-ui="sandbox"] .avatar-foot p { color: var(--flow-muted); }
body[data-ui="sandbox"] .tag,
body[data-ui="sandbox"] .branches article > span,
body[data-ui="sandbox"] .next > span,
body[data-ui="sandbox"] .avatar-top,
body[data-ui="sandbox"] .metrics strong { color: var(--flow-purple); }
body[data-ui="sandbox"] .next {
  border: 0;
  border-radius: 17px;
  background: var(--flow-lilac);
  color: var(--flow-ink);
}
body[data-ui="sandbox"] .next small { color: var(--flow-muted); }
body[data-ui="sandbox"] .review-signal {
  border: 0;
  border-radius: 16px;
  background: var(--flow-cyan-pale);
}
body[data-ui="sandbox"] .review-signal strong { color: #1d6a76; }
body[data-ui="sandbox"] .review-signal p { color: var(--flow-muted); }
body[data-ui="sandbox"] .avatar { background: #fff; }
body[data-ui="sandbox"] .avatar-art {
  border-radius: 19px;
  background: radial-gradient(ellipse at 50% 27%, #e0faff 0, transparent 75%), #efedff;
}
body[data-ui="sandbox"] .avatar-art::before { border-color: #a6a0f6; }
body[data-ui="sandbox"] .avatar-top span:last-child { border: 0; border-radius: 999px; background: var(--flow-lilac); color: var(--flow-purple); }
body[data-ui="sandbox"] .data-paths .eyebrow { color: var(--flow-purple); }
body[data-ui="sandbox"] .more { border-color: var(--flow-line); }
body[data-ui="sandbox"] .more p,
body[data-ui="sandbox"] .principles small { color: var(--flow-muted); }
body[data-ui="sandbox"] .more a { color: var(--flow-purple); }
body[data-ui="sandbox"] .principles div { border-color: var(--flow-line); }
body[data-ui="sandbox"] .principles span { color: var(--flow-purple); }
body[data-ui="sandbox"] .decision-history { border-top-color: var(--flow-line); }
body[data-ui="sandbox"] .decision-history h3,
body[data-ui="sandbox"] .decision-history strong { color: var(--flow-ink); }
body[data-ui="sandbox"] .decision-history > p,
body[data-ui="sandbox"] .decision-history li p { color: var(--flow-muted); }
body[data-ui="sandbox"] footer { border-color: var(--flow-line); color: var(--flow-muted); }

/* Judgment workspace: same language, denser information. */
body:has(.app-shell) .sidebar { padding-block: 17px; }
body:has(.app-shell) .privacy-card {
  border: 1px solid var(--flow-line);
  border-radius: 13px;
  background: #f8f8ff;
  color: var(--flow-muted);
}
body:has(.app-shell) .privacy-title { color: var(--flow-ink); }
body:has(.app-shell) .privacy-card p { color: var(--flow-muted); }
body:has(.app-shell) .privacy-card a { color: var(--flow-purple); }
body:has(.app-shell) .status-dot { background: var(--flow-cyan); }
body:has(.app-shell) main { padding-top: clamp(27px, 4vw, 56px); }
body:has(.app-shell) .topbar {
  padding: clamp(27px, 4vw, 49px);
  border: 1px solid #e5e0fa;
  border-radius: 27px;
  background: radial-gradient(ellipse 70% 130% at 91% 5%, #d7f7fa 0, transparent 72%), #f0eeff;
}
body:has(.app-shell) .topbar h1 { color: var(--flow-ink); }
body:has(.app-shell) .top-description { color: var(--flow-muted); }
body:has(.app-shell) .panel {
  border: 1px solid var(--flow-line);
  border-radius: 23px;
  background: #fff;
  box-shadow: var(--flow-shadow);
}
body:has(.app-shell) .input-panel { border-top: 1px solid var(--flow-line); }
body:has(.app-shell) .panel-heading h2,
body:has(.app-shell) .field-label,
body:has(.app-shell) .decision-input h3,
body:has(.app-shell) .empty-state h3,
body:has(.app-shell) .result-section-head h3,
body:has(.app-shell) .claim-text,
body:has(.app-shell) .rule-card p { color: var(--flow-ink); }
body:has(.app-shell) .step {
  border: 0;
  border-radius: 10px;
  background: var(--flow-lilac);
  color: var(--flow-purple);
}
body:has(.app-shell) .source-badge {
  border: 0;
  border-radius: 999px;
  background: #f1f2f8;
  color: var(--flow-muted);
}
body:has(.app-shell) .field-label span,
body:has(.app-shell) .decision-input > p,
body:has(.app-shell) .score-inputs label,
body:has(.app-shell) .textarea-meta,
body:has(.app-shell) .metric span,
body:has(.app-shell) .confidence-label,
body:has(.app-shell) .claim-number,
body:has(.app-shell) .rule-card small,
body:has(.app-shell) .layer2-note,
body:has(.app-shell) .result-section-head span { color: var(--flow-muted); }
body:has(.app-shell) .text-input,
body:has(.app-shell) textarea,
body:has(.app-shell) select,
body:has(.app-shell) .option-input {
  border: 1px solid #cfd5e5;
  border-radius: 13px;
  background-color: #fff;
  color: var(--flow-ink);
}
body:has(.app-shell) .option-input legend,
body:has(.app-shell) .textarea-meta strong,
body:has(.app-shell) .range-head output,
body:has(.app-shell) .decision-kicker,
body:has(.app-shell) .decision-output dt,
body:has(.app-shell) .empty-state li span { color: var(--flow-purple); }
body:has(.app-shell) input[type=range] { accent-color: var(--flow-purple); }
body:has(.app-shell) .decision-input { border-top-color: var(--flow-line); }
body:has(.app-shell) .icon-button {
  border: 1px solid var(--flow-line);
  border-radius: 10px;
  background: #fff;
  color: var(--flow-purple);
}
body:has(.app-shell) .icon-button:not(:disabled):hover { background: var(--flow-lilac); }
body:has(.app-shell) .empty-route path { stroke: #aaa3fa; }
body:has(.app-shell) .empty-route path:nth-child(2) { stroke: var(--flow-cyan); }
body:has(.app-shell) .empty-route circle { fill: #fff; stroke: var(--flow-purple); }
body:has(.app-shell) .empty-state li {
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: #fafaff;
  color: var(--flow-muted);
}
body:has(.app-shell) .decision-output {
  border: 1px solid #c8c2ff;
  border-radius: 18px;
  background: var(--flow-lilac);
  color: var(--flow-ink);
}
body:has(.app-shell) .decision-output h3,
body:has(.app-shell) .decision-output > p:not(.decision-recommendation),
body:has(.app-shell) .decision-output small { color: var(--flow-muted); }
body:has(.app-shell) .decision-recommendation { color: var(--flow-ink); }
body:has(.app-shell) .decision-output dl div { border-color: #d2cef8; }
body:has(.app-shell) .metric,
body:has(.app-shell) .claim-card,
body:has(.app-shell) .rule-card {
  border: 1px solid var(--flow-line);
  border-radius: 14px;
  background: #f9f9fe;
}
body:has(.app-shell) .stance.supporting,
body:has(.app-shell) .rule-status.recorded { background: var(--flow-lilac); color: var(--flow-purple-dark); }
body:has(.app-shell) .confidence-track { background: #e9e8f4; }
body:has(.app-shell) .confidence-track i { background: var(--flow-purple); }
body:has(.app-shell) .jev-panel,
body:has(.app-shell) .jev-result {
  border: 1px solid var(--flow-line);
  border-radius: 16px;
  background: #f8f8ff;
  color: var(--flow-ink);
}
body:has(.app-shell) .jev-consent,
body:has(.app-shell) .jev-result strong,
body:has(.app-shell) .jev-result dd { color: var(--flow-ink); }
body:has(.app-shell) .jev-status,
body:has(.app-shell) .jev-result p,
body:has(.app-shell) .jev-result dt,
body:has(.app-shell) .jev-result small { color: var(--flow-muted) !important; }
body:has(.app-shell) .jev-button { border-radius: 12px; background: var(--flow-lilac); color: var(--flow-purple); }
body:has(.app-shell) .principles > div {
  border: 1px solid var(--flow-line);
  border-radius: 15px;
  background: #fff;
}
body:has(.app-shell) .principles span { color: var(--flow-purple); }
body:has(.app-shell) .principles strong { color: var(--flow-ink); }
body:has(.app-shell) .principles p { color: var(--flow-muted); }

/* Continuous color fields replace the previous route diagrams. */
body:has(.site-header) .hero-river,
body:has(.avatar-main) .linework-hero,
body:has(.avatar-main) .route-graphic,
body:has(.app-shell) .empty-route { display: none; }
body:has(.site-header) .hero::after,
body:has(.avatar-main) .avatar-heading::after,
body[data-ui="sandbox"] .intro::after,
body:has(.app-shell) .topbar::after {
  content: "";
  display: block;
  position: absolute;
  z-index: 0;
  width: min(65vw, 880px);
  height: min(55vw, 660px);
  border-radius: 44% 56% 59% 41% / 53% 37% 63% 47%;
  background: radial-gradient(ellipse 53% 55% at 24% 70%, rgba(88,209,222,.58), transparent 78%),
              radial-gradient(ellipse 58% 66% at 68% 26%, rgba(121,107,252,.51), transparent 82%);
  filter: blur(23px);
  opacity: .68;
  pointer-events: none;
  transform-origin: 55% 48%;
  animation: flow-tide 16s ease-in-out infinite alternate;
}
body:has(.site-header) .hero::after { top: -16%; right: -18%; }
body:has(.avatar-main) .avatar-heading,
body[data-ui="sandbox"] .intro,
body:has(.app-shell) .topbar { position: relative; isolation: isolate; overflow: hidden; }
body:has(.avatar-main) .avatar-heading::after { top: -22%; right: -18%; }
body[data-ui="sandbox"] .intro::after { top: -62%; right: -20%; }
body:has(.app-shell) .topbar::after { top: -85%; right: -10%; }
body:has(.avatar-main) .avatar-heading > *,
body[data-ui="sandbox"] .intro > *,
body:has(.app-shell) .topbar > * { position: relative; z-index: 1; }
body:has(.avatar-main) .preview-stage::before {
  content: "";
  display: block;
  position: absolute;
  z-index: 0;
  inset: 12% 8% 8%;
  border-radius: 54% 46% 60% 40% / 42% 62% 38% 58%;
  background: radial-gradient(ellipse at 40% 37%, #c8f7fa, #c7c2ff 68%, transparent 83%);
  opacity: .82;
  animation: flow-tide 13s ease-in-out infinite alternate-reverse;
}
body:has(.avatar-main) .avatar-3d-stage,
body[data-ui="sandbox"] #avatar3dStage { position: relative; z-index: 1; }
body[data-ui="sandbox"] .avatar-art::before {
  border: 0;
  border-radius: 55% 45% 60% 40% / 40% 61% 39% 60%;
  background: radial-gradient(ellipse at 42% 40%, #c5f6fa, #c8c3ff 74%, transparent);
  opacity: .72;
}
@keyframes flow-tide {
  from { transform: translate3d(-3%, 1%, 0) rotate(-7deg) scale(.97); }
  to { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.06); }
}

@media (max-width: 850px) {
  body:has(.avatar-main) .avatar-heading { min-height: 0; }
  body:has(.avatar-main) .creation-preview { position: relative; top: auto; }
  body:has(.site-header) .hero-grid { min-height: 0; }
  body[data-ui="sandbox"] .intro { margin-top: 18px; }
  body:has(.app-shell) .sidebar nav { border-color: var(--flow-line); }
}
@media (max-width: 650px) {
  body:has(.site-header) .hero-grid { padding-block: 55px; }
  body:has(.site-header) .hero-river { opacity: .22; }
  body:has(.site-header) .decision-preview { border-radius: 21px; }
  body:has(.avatar-main) .avatar-heading { padding: 30px 20px 0; border-radius: 24px; }
  body:has(.avatar-main) .hero-mode-picker { width: 100%; }
  body:has(.avatar-main) .mode-picker button strong { font-size: .85rem; }
  body:has(.avatar-main) .mode-picker button small { display: none; }
  body:has(.avatar-main) .creation-card,
  body:has(.avatar-main) .creation-preview { border-radius: 20px; }
  body[data-ui="sandbox"] .intro { padding: 27px 20px; border-radius: 23px; }
  body[data-ui="sandbox"] .game,
  body[data-ui="sandbox"] .avatar { border-radius: 19px; }
  body[data-ui="sandbox"] .branches { grid-template-columns: 1fr; }
  body:has(.app-shell) .topbar { padding: 25px 20px; border-radius: 20px; }
  body:has(.app-shell) .panel { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
