/* Original IBS decision-line drawing: a split route, never a borrowed illustration. */
body:has(.avatar-main) .avatar-heading {
  position: relative;
  isolation: isolate;
  min-height: 370px;
  margin-bottom: 34px;
}
body:has(.avatar-main) .avatar-heading h1,
body:has(.avatar-main) .avatar-heading > p,
body:has(.avatar-main) .avatar-heading-actions {
  position: relative;
  z-index: 2;
  max-width: 68%;
}
body:has(.avatar-main) .avatar-heading h1 {
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 1.08;
}
body:has(.avatar-main) .avatar-heading > p:last-of-type { max-width: 48%; }
.linework-hero {
  position: absolute;
  z-index: 1;
  right: 0;
  top: -34px;
  width: 51%;
  height: 410px;
  overflow: hidden;
  pointer-events: none;
}
.linework-hero svg { display: block; width: 100%; height: 100%; }
.linework-field { fill: #174463; }
.linework-sweep,
.linework-branch,
.linework-cut,
.route-sweep,
.route-left,
.route-right,
.route-lower-right {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.linework-sweep { stroke: #03111e; stroke-width: 34; }
.linework-sweep-secondary { stroke: #266080; stroke-width: 13; }
.linework-branch { stroke: #89cbd0; stroke-width: 6; transition: stroke .24s ease, stroke-width .24s ease; }
.linework-cut { stroke: #f4eddd; stroke-width: 4; }
.linework-core { fill: #071b2b; stroke: #ffd04a; stroke-width: 5; vector-effect: non-scaling-stroke; }
.linework-point { fill: #071b2b; stroke: #89cbd0; stroke-width: 4; vector-effect: non-scaling-stroke; }
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: #ffd04a; stroke-width: 10; }
body[data-creation-mode="fiction"] .linework-point:first-of-type,
body[data-creation-mode="photo"] .linework-point:first-of-type,
body[data-creation-mode="camera"] .linework-point:first-of-type { stroke: #ffd04a; }

/* Behind the existing generic 3D figure, the same route becomes an asymmetric frame. */
body:has(.avatar-main) .preview-stage { position: relative; isolation: isolate; }
body:has(.avatar-main) .route-graphic { z-index: 0; }
.route-field { fill: #164d78; opacity: .7; }
.route-sweep { stroke: #041321; stroke-width: 41; }
.route-sweep-secondary { stroke: #286789; stroke-width: 14; }
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: #89cbd0;
  stroke-width: 6;
  opacity: .9;
  transition: stroke .24s ease, stroke-width .24s ease;
}
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: #ffd04a;
  stroke-width: 12;
  opacity: 1;
}
.route-core { fill: #071b2b; stroke: #ffd04a; stroke-width: 5; vector-effect: non-scaling-stroke; }
.route-point { fill: #071b2b; stroke: #f4eddd; stroke-width: 4; vector-effect: non-scaling-stroke; }
body:has(.avatar-main) .avatar-3d-stage { z-index: 1; }
.ibs-current {
  fill: none;
  stroke: #f4eddd;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20 80;
  stroke-dashoffset: -10;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  animation: ibs-route-current 1.65s linear infinite;
  animation-play-state: paused;
}
body[data-creation-mode="fiction"] .ibs-current-fiction,
body[data-creation-mode="photo"] .ibs-current-photo,
body[data-creation-mode="camera"] .ibs-current-camera { opacity: .9; }
[data-flow-visible="true"] .ibs-current { animation-play-state: running; }
@keyframes ibs-route-current { to { stroke-dashoffset: -110; } }
body:has(.avatar-main) .creation-preview { border-width: 3px; }
body:has(.avatar-main) .creation-card { border-left: 3px solid var(--ibs-line); }
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] { border-left: 8px solid #071b2b; }
body:has(.avatar-main) .world-preview { border-top-width: 5px; }

@media (max-width: 850px) {
  body:has(.avatar-main) .avatar-heading { min-height: 0; }
  body:has(.avatar-main) .avatar-heading h1,
  body:has(.avatar-main) .avatar-heading > p,
  body:has(.avatar-main) .avatar-heading-actions { max-width: none; }
  body:has(.avatar-main) .avatar-heading > p:last-of-type { max-width: none; }
  .linework-hero { position: relative; right: auto; top: auto; width: 100%; height: 175px; margin-top: 20px; }
  .linework-hero svg { object-fit: cover; }
}
@media (max-width: 650px) {
  .linework-hero { height: 126px; margin-top: 15px; }
  body:has(.avatar-main) .avatar-heading { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .linework-branch, .route-left, .route-right, .route-lower-right { transition: none; }
  .ibs-current { animation: none; opacity: 0 !important; }
}

/* The first decision is a stage, not another card. The routes remain the content. */
body:has(.avatar-main) .avatar-heading {
  min-height: 570px;
  padding: clamp(38px, 5vw, 72px);
  border-top: 8px solid var(--ibs-gold);
  background: var(--ibs-field);
  overflow: hidden;
}
body:has(.avatar-main) .avatar-heading h1,
body:has(.avatar-main) .avatar-heading > p,
body:has(.avatar-main) .avatar-heading-actions { max-width: 50%; }
body:has(.avatar-main) .avatar-heading h1 { font-size: clamp(3.15rem, 5.1vw, 5.9rem); }
body:has(.avatar-main) .avatar-heading > p:last-of-type { max-width: 45%; }
.linework-hero {
  top: 0;
  right: -3%;
  width: 64%;
  height: 100%;
}
.linework-sweep { stroke-width: 44; }
.linework-sweep-secondary { stroke-width: 17; }
.linework-branch { stroke-width: 8; }
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-width: 13; }
.linework-core { stroke-width: 7; }

@media (max-width: 850px) {
  body:has(.avatar-main) .avatar-heading {
    min-height: 0;
    padding: 38px 32px 0;
  }
  body:has(.avatar-main) .avatar-heading h1,
  body:has(.avatar-main) .avatar-heading > p,
  body:has(.avatar-main) .avatar-heading-actions,
  body:has(.avatar-main) .avatar-heading > p:last-of-type { max-width: none; }
  .linework-hero {
    right: auto;
    width: calc(100% + 64px);
    height: 220px;
    margin: 30px -32px 0;
  }
}
@media (max-width: 650px) {
  body:has(.avatar-main) .avatar-heading { padding: 28px 20px 0; }
  body:has(.avatar-main) .avatar-heading h1 { font-size: clamp(2.2rem, 9vw, 3.1rem); }
  .linework-hero {
    width: calc(100% + 40px);
    height: 190px;
    margin: 26px -20px 0;
  }
}

/* Segmented creation choice, adapted to IBS's flat decision-line language. */
body:has(.avatar-main) .avatar-heading { min-height: 530px; }
body:has(.avatar-main) .hero-mode-picker {
  z-index: 2;
  width: min(54%, 650px);
  margin: 26px 0 0;
}
body:has(.avatar-main) .mode-picker {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 5px;
  overflow: hidden;
  background: var(--ibs-ink);
}
body:has(.avatar-main) .mode-picker::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 5px auto 5px 5px;
  width: calc((100% - 10px) / 3);
  background: var(--ibs-gold);
  pointer-events: none;
  transform: translateX(0);
  transition: transform .42s cubic-bezier(.2, .8, .2, 1);
}
body[data-creation-mode="photo"] .mode-picker::before { transform: translateX(100%); }
body[data-creation-mode="camera"] .mode-picker::before { transform: translateX(200%); }
body:has(.avatar-main) .mode-picker button,
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 76px;
  padding: 12px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ibs-paper);
  text-align: center;
  transition: color .22s ease;
}
body:has(.avatar-main) .mode-picker button:hover:not([aria-pressed="true"]) {
  background: transparent;
  color: var(--ibs-gold);
}
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] { color: var(--ibs-ink); }
body:has(.avatar-main) .mode-picker button[aria-pressed="true"] small { color: var(--ibs-ink); }
body:has(.avatar-main) .mode-picker small { font-size: .8125rem; }
body:has(.avatar-main) .mode-picker button:focus-visible {
  outline: 3px solid var(--ibs-paper);
  outline-offset: -5px;
}
@media (max-width: 850px) {
  body:has(.avatar-main) .avatar-heading { min-height: 0; }
  body:has(.avatar-main) .hero-mode-picker { width: 100%; }
}
@media (max-width: 650px) {
  body:has(.avatar-main) .mode-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body:has(.avatar-main) .mode-picker button,
  body:has(.avatar-main) .mode-picker button[aria-pressed="true"] {
    min-height: 56px;
    padding: 10px 5px;
    border: 0;
  }
  body:has(.avatar-main) .mode-picker strong { font-size: .875rem; }
  body:has(.avatar-main) .mode-picker small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body:has(.avatar-main) .mode-picker::before,
  body:has(.avatar-main) .mode-picker button { transition: 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; }
}
