/*
 * UI v8 — LIFE, IN PREVIEW
 * Quiet hierarchy, generous space, precise motion.
 */

:root {
  color-scheme: light;
  --surface-canvas: #f5f5f7;
  --surface-raised: #ffffff;
  --surface-soft: #ececf0;
  --surface-dark: #08090b;
  --label-primary: #1d1d1f;
  --label-secondary: #6e6e73;
  --label-tertiary: #74747b;
  --separator: rgba(60, 60, 67, 0.14);
  --separator-strong: rgba(60, 60, 67, 0.24);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --success: #248a3d;
  --warning: #c93400;
  --danger: #d70015;
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --shadow-float: 0 30px 80px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 12px 36px rgba(0, 0, 0, 0.07);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;

  --bg-0: var(--surface-canvas);
  --bg-1: var(--surface-raised);
  --bg-2: var(--surface-soft);
  --bg-3: #e1e1e5;
  --ink: var(--label-primary);
  --ink-soft: #3a3a3c;
  --ink-dim: var(--label-secondary);
  --ink-faint: var(--label-tertiary);
  --line: var(--separator);
  --line-soft: rgba(60, 60, 67, 0.08);
  --line-strong: var(--separator-strong);
  --blue: var(--accent);
  --blue-deep: #0058b0;
  --lilac: var(--accent);
  --lilac-deep: #0058b0;
  --lilac-bg: var(--accent-soft);
  --lilac-line: rgba(0, 113, 227, 0.24);
  --lilac-faint: rgba(0, 113, 227, 0.06);
  --green: var(--success);
  --red: var(--danger);
  --amber: #ff9f0a;
  --violet: #8944ab;
  --ok: var(--success);
  --warm: #ff9f0a;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--surface-canvas);
}

body {
  min-width: 320px;
  color: var(--label-primary);
  background: var(--surface-canvas);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after,
body .grain,
body .vignette {
  display: none;
}

::selection {
  color: var(--label-primary);
  background: rgba(0, 113, 227, 0.2);
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #0071e3;
  outline-offset: 3px;
}

/* View changes move focus to headings for screen readers; don't paint a giant
   browser-default rectangle around these programmatic focus targets. */
body :is(.hero-title, .view-title, .detail-title):focus {
  outline: none;
}

/* Floating navigation: glass is deliberately reserved for controls. */
body .topbar {
  position: sticky;
  top: 12px;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(156px, 1fr) auto minmax(156px, 1fr);
  align-items: center;
  gap: 20px;
  width: min(calc(100% - 28px), 1180px);
  min-height: 60px;
  margin: 12px auto 0;
  padding: 8px 10px 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 20px;
  background: rgba(250, 250, 252, 0.76);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.025);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
}

body .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
}

body .brand-dot {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: var(--label-primary);
  box-shadow: none;
}

body .brand-dot::before,
body .brand-dot::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 7px;
  top: auto;
  right: auto;
  width: 2px;
  height: 17px;
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  transform-origin: bottom center;
}

body .brand-dot::before { transform: rotate(-38deg); }
body .brand-dot::after { transform: rotate(38deg); }

body .brand-name {
  color: var(--label-primary);
  font-size: 17px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.02em;
}

body .brand-sub {
  display: none;
}

body .steps {
  counter-reset: nav-step;
  grid-column: auto;
  order: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 14px;
  background: rgba(118, 118, 128, 0.08);
  box-shadow: none;
  justify-self: center;
  overflow: visible;
}

body .steps .step {
  counter-increment: nav-step;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: var(--label-secondary);
  background: transparent;
  box-shadow: none;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

body .steps .step::before {
  content: counter(nav-step);
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  color: inherit;
  background: rgba(118, 118, 128, 0.12);
  font-size: 10px;
  font-weight: 650;
}

body .steps .step::after { display: none; }

body .steps .step em {
  font-size: 12px;
  font-style: normal;
  font-weight: 560;
}

body .steps .step:hover {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.7);
}

body .steps .step.done {
  color: var(--label-secondary);
}

body .steps .step.done::before {
  content: "✓";
  color: var(--success);
  background: rgba(36, 138, 61, 0.1);
}

body .steps .step.current {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.09);
}

body .steps .step.current::before {
  color: #fff;
  background: var(--accent);
}

body .steps .step[aria-disabled="true"]:not(.current) {
  color: var(--label-tertiary);
  cursor: not-allowed;
  opacity: 0.58;
}

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

body :is(.reset-btn, .ghost-btn, .regen-btn) {
  min-width: 44px;
  min-height: 42px;
  padding: 8px 11px;
  border: 0;
  border-radius: 12px;
  color: var(--label-secondary);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 560;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

body :is(.reset-btn, .ghost-btn, .regen-btn):hover {
  border: 0;
  color: var(--label-primary);
  background: rgba(118, 118, 128, 0.1);
  box-shadow: none;
  transform: none;
}

body .regen-btn::before,
body .regen-btn::after {
  display: none;
  content: none;
}

body .mailbox-button {
  color: var(--label-primary);
  background: rgba(118, 118, 128, 0.1);
}

body .mailbox-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

body .mailbox-button.has-unread {
  color: var(--accent);
  background: var(--accent-soft);
}

/* One clear invitation, then one clear action. */
body .view.view-input {
  position: relative;
  min-height: calc(100svh - 84px);
  padding: clamp(70px, 10vh, 118px) 24px 64px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 4%, rgba(0, 113, 227, 0.11), transparent 31%),
    var(--surface-canvas);
}

body .view.view-input::before {
  content: "";
  position: absolute;
  top: 16%;
  left: 50%;
  width: min(72vw, 900px);
  height: min(72vw, 900px);
  border: 1px solid rgba(0, 113, 227, 0.08);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

body .hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 1040px);
  margin: 0 auto;
  text-align: center;
}

body .hero-eyebrow {
  order: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 7px 12px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  color: var(--label-secondary);
  background: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body .hero-eyebrow .rule {
  display: block;
  width: 5px;
  height: 5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

body .hero-eyebrow .rule:last-child { display: none; }

body .hero-title {
  order: 2;
  max-width: 940px;
  margin: 0;
  color: var(--label-primary);
  font-size: clamp(54px, 7.7vw, 104px);
  font-weight: 720;
  line-height: 0.98;
  letter-spacing: -0.065em;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  text-shadow: none;
}

body .hero-title em {
  display: inline;
  color: var(--accent);
  background: linear-gradient(100deg, #0071e3 8%, #6946d7 86%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: normal;
  font-weight: inherit;
}

body .hero-title em::after { display: none; }

body .hero-tag {
  order: 3;
  max-width: 690px;
  margin: 28px auto 0;
  color: var(--label-secondary);
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.018em;
}

body .entry-switch {
  order: 4;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: clamp(42px, 6vh, 64px) auto 12px;
  padding: 4px;
  border: 0;
  border-radius: 15px;
  background: rgba(118, 118, 128, 0.1);
}

body .entry-mode-btn {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  color: var(--label-secondary);
  background: transparent;
  font-size: 13px;
  font-weight: 560;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

body .entry-mode-btn:hover { color: var(--label-primary); }

body .entry-mode-btn.active {
  color: var(--label-primary);
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

body .hero-shell {
  order: 5;
  position: relative;
  display: block;
  width: min(100%, 780px);
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body .hero-shell::before { display: none; }

body .hero-instrument { display: none; }

body .input-wrap::before,
body .input-wrap::after,
body .choice-wrap::before,
body .choice-wrap::after {
  display: none;
}

body .input-wrap,
body .choice-wrap {
  position: relative;
  width: 100%;
  min-height: 0;
  padding: clamp(20px, 3vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-float);
  text-align: left;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  transition: box-shadow 220ms ease, transform 220ms ease;
}

body .input-wrap:focus-within {
  border-color: rgba(0, 113, 227, 0.3);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.14), 0 0 0 4px rgba(0, 113, 227, 0.08);
  transform: translateY(-2px);
}

body .input-panel-head,
body .choice-panel-head,
body .choice-followup-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 16px;
  border: 0;
}

body .input-panel-head label,
body .choice-panel-head > span:first-child,
body .choice-followup-head > span:first-child {
  color: var(--label-primary);
  font-size: 15px;
  font-weight: 650;
}

body .input-panel-head > span,
body .choice-panel-head > span:last-child,
body .choice-followup-head > span:last-child {
  color: var(--label-tertiary);
  font-size: 12px;
  font-weight: 500;
}

body .decision-input,
body .choice-detail-input {
  display: block;
  width: 100%;
  min-height: 150px;
  padding: 18px;
  resize: vertical;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  color: var(--label-primary);
  background: var(--surface-canvas);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025);
  font-size: clamp(17px, 1.65vw, 20px);
  font-weight: 400;
  line-height: 1.58;
  letter-spacing: -0.018em;
  transition: border-color 180ms ease, background 180ms ease;
}

body .decision-input::placeholder,
body .choice-detail-input::placeholder {
  color: var(--label-secondary);
  opacity: 1;
}

body :is(.chat-input input, .drawer-panel input, .drawer-panel textarea)::placeholder {
  color: var(--label-secondary);
  opacity: 1;
}

body .decision-input:focus,
body .choice-detail-input:focus {
  border-color: rgba(0, 113, 227, 0.3);
  background: #fff;
}

body .choice-detail-input {
  min-height: 92px;
  padding: 14px 15px;
  font-size: 15px;
}

body .input-hint {
  margin: 10px 2px 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.45;
}

body .decision-input[aria-invalid="true"] {
  border-color: rgba(215, 0, 21, 0.52);
  background: rgba(215, 0, 21, 0.035);
  box-shadow: 0 0 0 4px rgba(215, 0, 21, 0.08);
}

body .input-row {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin-top: 16px;
  padding: 0;
  border: 0;
}

body .input-row .primary-btn { width: auto; }

body .primary-btn,
body .chat-input button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

body .primary-btn::after { display: none; }

body .primary-btn:hover,
body .chat-input button:hover {
  color: #fff;
  background: var(--accent-hover);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.22);
  transform: translateY(-1px);
}

body .primary-btn:active,
body .chat-input button:active {
  box-shadow: none;
  transform: scale(0.98);
}

body #startBtn:not(.is-ready) {
  color: #fff;
  background: #6e6e73;
  box-shadow: none;
  transform: none;
}

body .btn-arrow {
  display: inline-grid;
  place-items: center;
  width: auto;
  height: auto;
  border: 0;
  font-size: 17px;
}

body .hero-foot {
  order: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 0;
  color: var(--label-tertiary);
  font-size: 12px;
  font-weight: 500;
}

body .hero-foot span {
  color: var(--success);
  font-size: 8px;
}

@media (max-width: 900px) {
  body .topbar {
    grid-template-columns: 1fr auto;
    overflow: visible;
    background: rgba(250, 250, 252, 0.96);
    transform: none;
    filter: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body .steps {
    position: fixed;
    right: 16px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 16px;
    z-index: 90;
    display: flex;
    justify-content: space-between;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(246, 246, 248, 0.86);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    overflow: visible;
  }

  body .steps .step {
    min-width: 44px;
    padding: 0 9px;
  }

  body .steps .step::before { margin-right: 0; }
  body .steps .step em { display: none; }
  body .steps .step.current { flex: 1; }
  body .steps .step.current::before { margin-right: 6px; }
  body .steps .step.current em { display: inline; }
}

@media (max-width: 640px) {
  body .topbar {
    top: 8px;
    width: calc(100% - 16px);
    min-height: 56px;
    margin-top: 8px;
    padding-left: 13px;
    border-radius: 18px;
  }

  body .brand-dot {
    width: 28px;
    height: 28px;
  }

  body .topbar-right .reset-btn {
    display: inline-flex;
    width: auto;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding-right: 10px;
    padding-left: 10px;
    overflow: visible;
    color: var(--label-secondary);
    font-size: 12px;
    text-indent: 0;
  }

  body .topbar-right .reset-btn::before,
  body .topbar-right .reset-btn::after {
    display: none;
    content: none;
  }

  body .topbar-right #resetBtn { display: inline-flex; }

  body .view.view-input {
    min-height: calc(100svh - 72px);
    padding: clamp(52px, 8vh, 76px) 16px 100px;
  }

  body .hero-title {
    font-size: clamp(46px, 14vw, 68px);
    line-height: 1;
  }

  body .hero-tag {
    max-width: 510px;
    margin-top: 21px;
    font-size: 16px;
  }

  body .entry-switch {
    margin-top: 38px;
  }

  body .entry-mode-btn {
    min-height: 38px;
    padding: 0 16px;
  }

  body .input-wrap,
  body .choice-wrap {
    padding: 18px;
    border-radius: 24px;
  }

  body .input-panel-head {
    display: block;
  }

  body .input-panel-head > span {
    display: block;
    margin-top: 3px;
  }

  body .decision-input {
    min-height: 142px;
    padding: 15px;
    border-radius: 17px;
    font-size: 17px;
  }

  body .input-row .primary-btn {
    width: 100%;
  }

  body .hero-foot {
    max-width: 320px;
    justify-content: center;
    line-height: 1.45;
  }
}

@media (max-width: 390px) and (max-height: 700px) {
  body .view.view-input { padding-top: 34px; }
  body .hero-eyebrow { margin-bottom: 14px; }
  body .hero-title { font-size: 43px; }
  body .hero-tag { margin-top: 14px; font-size: 14px; }
  body .entry-switch { margin-top: 24px; }
  body .input-wrap { padding: 14px; }
  body .input-panel-head { padding-bottom: 10px; }
  body .decision-input { min-height: 100px; font-size: 16px; }
  body .hero-foot { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Quick-start stories
   -------------------------------------------------------------------------- */

body .life-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body .life-choice-card {
  --scene-color: var(--accent);
  position: relative;
  min-height: 152px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: 18px;
  color: var(--label-primary);
  background: var(--surface-canvas);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

body .life-choice-card:nth-child(2) { --scene-color: #6946d7; }
body .life-choice-card:nth-child(3) { --scene-color: #248a3d; }
body .life-choice-card:nth-child(4) { --scene-color: #c93400; }

body .life-choice-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.07), transparent 52%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--scene-color) 7%, transparent), transparent 52%);
  opacity: 0;
  transition: opacity 180ms ease;
}

body .life-choice-card:hover {
  border-color: rgba(0, 113, 227, 0.32);
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

body .life-choice-card.selected {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 12px 32px rgba(0, 0, 0, 0.08);
  transform: none;
}

body .life-choice-card:hover::before,
body .life-choice-card.selected::before { opacity: 1; }

body :is(
  .life-choice-scene,
  .scene-city .life-choice-scene,
  .scene-town .life-choice-scene,
  .scene-road .life-choice-scene,
  .scene-market .life-choice-scene
) {
  position: relative;
  height: 54px;
  margin: 0 0 13px;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  background: #f2f2f5;
  background: color-mix(in srgb, var(--scene-color) 7%, #fff);
  box-shadow: none;
}

body .scene-mark {
  color: #fff;
  border: 0;
  background: var(--scene-color);
  box-shadow: none;
  font-size: 10px;
  font-weight: 700;
}

body .scene-line,
body .scene-shape,
body .scene-shape.main,
body .scene-shape.aux {
  color: var(--scene-color);
  background: rgba(0, 113, 227, 0.22);
  background: color-mix(in srgb, var(--scene-color) 36%, transparent);
  box-shadow: none;
}

body .scene-shape.main {
  background: #7ab5ef;
  background: color-mix(in srgb, var(--scene-color) 74%, #fff);
}

body .life-choice-title {
  position: relative;
  display: block;
  color: var(--label-primary);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  text-shadow: none;
}

body .life-choice-caption {
  position: relative;
  display: block;
  margin-top: 4px;
  color: var(--label-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  text-shadow: none;
}

body .life-choice-action {
  position: relative;
  display: block;
  margin-top: 10px;
  padding: 0;
  color: var(--accent);
  border: 0;
  font-size: 11px;
  font-weight: 600;
  text-shadow: none;
}

body .choice-followup {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: 18px;
  color: var(--label-primary);
  background: rgba(0, 113, 227, 0.045);
  box-shadow: none;
}

body .choice-followup-sub {
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 400;
  text-shadow: none;
}

body .choice-detail-chips,
body .chat-quick,
body .chat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

body :is(.chip, .chat-tab) {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  color: var(--label-secondary);
  background: #fff;
  box-shadow: none;
  font-size: 12px;
  font-weight: 560;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

body :is(.chip, .chat-tab):hover {
  color: var(--accent);
  border-color: rgba(0, 113, 227, 0.28);
  background: var(--accent-soft);
  box-shadow: none;
  transform: none;
}

body .choice-start-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   Shared product pages
   -------------------------------------------------------------------------- */

body .view:not(.view-input) {
  position: relative;
  min-height: calc(100svh - 84px);
  padding: clamp(76px, 8vw, 112px) 24px 130px;
  color: var(--label-primary);
  background: var(--surface-canvas);
}

body .container {
  width: min(1080px, 100%);
  margin-right: auto;
  margin-left: auto;
}

body .act-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

body .act-mark::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

body .view-title {
  max-width: 820px;
  margin: 0 0 20px;
  color: var(--label-primary);
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.055em;
  text-wrap: balance;
  text-align: left;
  text-shadow: none;
}

body .view-title em,
body .view-sub em {
  color: var(--accent);
  font-style: normal;
}

body .view-sub {
  max-width: 680px;
  margin: 0 0 48px;
  color: var(--label-secondary);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.012em;
  text-align: left;
  text-shadow: none;
}

body .action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid var(--separator);
}

body .action-row .hint {
  color: var(--label-tertiary);
  font-size: 12px;
  font-weight: 500;
}

body .action-row :is(.primary-btn, .ghost-btn, .regen-btn) {
  min-height: 44px;
  padding-right: 16px;
  padding-left: 16px;
}

body .action-row .primary-btn { margin-left: auto; }

body :is(.ghost-btn, .regen-btn) {
  border: 0;
  color: var(--label-secondary);
  background: rgba(118, 118, 128, 0.08);
}

body :is(.ghost-btn, .regen-btn):hover {
  color: var(--label-primary);
  background: rgba(118, 118, 128, 0.14);
}

body :is(
  .radar-cell,
  .branch-card,
  .card,
  .brief-panel,
  .branch-compare,
  .action-evidence,
  .empty-state,
  .history-item,
  .brief-block,
  .evidence-block,
  .evidence-confidence,
  .branch-proof,
  .verdict,
  .life-judgement
) {
  color: var(--label-primary);
  border-color: var(--separator);
  background: var(--surface-raised);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body :is(.card, .brief-panel, .action-evidence, .radar-cell)::before,
body :is(.card, .brief-panel, .action-evidence, .radar-cell)::after {
  display: none;
}

body :is(
  .choice-detail-input,
  .chat-input input,
  .drawer-panel input[type="text"],
  .drawer-panel input[type="password"],
  .score-input
) {
  color: var(--label-primary);
  border: 1px solid var(--separator);
  border-radius: 13px;
  background: var(--surface-canvas);
  box-shadow: none;
  caret-color: var(--accent);
}

body :is(.choice-detail-input, .chat-input input, .drawer-panel input, .score-input):focus {
  border-color: rgba(0, 113, 227, 0.38);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

body .empty-state {
  padding: 38px 24px;
  border-style: dashed;
  border-radius: 20px;
  color: var(--label-secondary);
  text-align: center;
}

body .editable:hover {
  background: var(--accent-soft);
  box-shadow: inset 0 -1px 0 rgba(0, 113, 227, 0.4);
}

body .editable.editing,
body .editable[contenteditable="true"]:focus {
  outline: 2px solid rgba(0, 113, 227, 0.5);
  outline-offset: 2px;
  background: #fff;
  box-shadow: 0 0 0 5px var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Step 02 — understand the decision
   -------------------------------------------------------------------------- */

body .radar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

body .radar-cell {
  position: relative;
  min-height: 148px;
  padding: 24px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

body .radar-cell:hover {
  border: 0;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.075);
  transform: translateY(-2px);
}

body .radar-cell::before {
  content: "";
  position: absolute;
  top: 20px;
  right: 20px;
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cell-color, var(--accent));
}

body .radar-cell::after { display: none; }

body .radar-cell:nth-child(1) { --cell-color: #0071e3; }
body .radar-cell:nth-child(2) { --cell-color: #5e5ce6; }
body .radar-cell:nth-child(3) { --cell-color: #248a3d; }
body .radar-cell:nth-child(4) { --cell-color: #0a84ff; }
body .radar-cell:nth-child(5) { --cell-color: #bf5af2; }
body .radar-cell:nth-child(6) { --cell-color: #c93400; }

body .radar-label,
body .life-judgement-label,
body .action-evidence-head b,
body .brief-block h3 {
  color: var(--label-tertiary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
}

body .radar-value {
  max-width: 92%;
  color: var(--label-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.58;
}

body .brief-panel,
body .action-evidence {
  margin-top: 14px;
  padding: clamp(24px, 3.2vw, 38px);
  border: 0;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
}

body .brief-kicker,
body .compare-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body .brief-head h3,
body .compare-head h3 {
  color: var(--label-primary);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.025em;
  text-shadow: none;
}

body .brief-situation {
  color: var(--label-primary);
  font-size: 18px;
  line-height: 1.72;
}

body .brief-grid,
body .evidence-grid,
body .action-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body :is(.brief-block, .evidence-block) {
  padding: 20px;
  border: 0;
  border-radius: 17px;
  background: var(--surface-canvas);
}

body :is(.brief-block li, .evidence-block li, .brief-block p, .evidence-block p) {
  color: var(--label-secondary);
}

body :is(.brief-block li, .evidence-block li)::before {
  background: var(--accent);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Step 03 — four future branches
   -------------------------------------------------------------------------- */

body .branch-compare {
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
}

body .compare-head {
  padding: 24px 26px;
  border-bottom: 1px solid var(--separator);
}

body .compare-summary span,
body .branch-tag,
body .branch-pill,
body .compare-code,
body .branch-proof span {
  color: var(--label-secondary);
  border: 0;
  border-radius: 999px;
  background: var(--surface-canvas);
  box-shadow: none;
}

body .compare-summary b {
  color: #fff;
  border-radius: 999px;
  background: var(--accent);
}

body .compare-table { background: #fff; }

body .compare-row {
  color: var(--label-primary);
  border-color: var(--separator);
  background: #fff;
}

body .compare-row:hover {
  color: var(--label-primary);
  background: rgba(0, 113, 227, 0.045);
}

body .compare-identity strong,
body .compare-index b,
body .branch-name {
  color: var(--label-primary);
  text-shadow: none;
}

body :is(.compare-identity em, .compare-index em, .compare-bar-label, .compare-bar-num, .compare-step) {
  color: var(--label-secondary);
  text-shadow: none;
}

body .compare-bar-track,
body .score-bar,
body .risk-meter {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.14);
}

body .compare-bar-track i,
body .score-bar > span,
body .risk-fill {
  border-radius: 999px;
  background: var(--accent);
  box-shadow: none;
}

body .compare-bar.pressure .compare-bar-track i { background: #c93400; }

body .branch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

body .branch-grid::before,
body .branch-grid::after { display: none; }

body .branch-A { --brand-color: #0071e3; }
body .branch-B { --brand-color: #6946d7; }
body .branch-C { --brand-color: #248a3d; }
body .branch-D { --brand-color: #c93400; }

body .branch-card,
body .branch-card.branch-D {
  position: relative;
  min-height: 320px;
  padding: 28px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--label-primary);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

body .branch-card:hover {
  border: 0;
  color: var(--label-primary);
  background: #fff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

body .branch-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: block;
  width: auto;
  height: 5px;
  border-radius: 0;
  background: var(--brand-color);
}

body .branch-card::after { display: none; }

body .branch-tag {
  width: max-content;
  color: var(--brand-color);
  background: var(--accent-soft);
  background: color-mix(in srgb, var(--brand-color) 9%, #fff);
  font-size: 11px;
  font-weight: 650;
}

body .branch-name {
  max-width: 92%;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.04em;
}

body .branch-summary {
  color: var(--label-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.68;
  text-shadow: none;
}

body .branch-proof {
  border: 0;
  border-radius: 16px;
  background: var(--surface-canvas);
}

body .branch-stats {
  color: var(--label-tertiary);
  border-color: var(--separator);
  font-size: 11px;
}

body .branch-stats b { color: var(--label-primary); }

/* --------------------------------------------------------------------------
   Step 04 — deep dive
   -------------------------------------------------------------------------- */

body .detail-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.76fr) minmax(0, 1.24fr);
  gap: clamp(20px, 3vw, 38px);
  align-items: start;
}

body .detail-side {
  position: sticky;
  top: 98px;
}

body .branch-image {
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #e9e9ed, #f8f8fa);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.1);
}

body .branch-image::before,
body .branch-image::after { display: none; }

body .branch-image-placeholder {
  color: var(--label-secondary);
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0;
}

body .branch-image.error .branch-image-placeholder {
  color: var(--danger);
  background: rgba(215, 0, 21, 0.06);
}

body .image-download-btn {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.72);
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

body .branch-pill {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

body .detail-title {
  color: var(--label-primary);
  font-size: clamp(38px, 4.6vw, 58px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.055em;
  text-shadow: none;
}

body .detail-summary {
  margin: 18px 0 0;
  padding: 0 0 0 16px;
  border: 0;
  color: var(--label-secondary);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
  text-shadow: none;
}

body .life-judgement {
  border: 0;
  border-radius: var(--radius-md);
  background: #111114;
  box-shadow: none;
}

body .life-judgement-label { color: rgba(255, 255, 255, 0.54); }

body .life-judgement p {
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.6;
}

body .card {
  border: 0;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
}

body .card-title {
  color: var(--label-primary);
  border-bottom-color: var(--separator);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-shadow: none;
}

body .card-title .kicker,
body .card.warn .card-title .kicker {
  color: var(--accent);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}

body .card-sub,
body .risk-tip,
body .timeline-meta {
  color: var(--label-secondary);
  font-weight: 400;
  text-shadow: none;
}

body .score-label,
body .score-num,
body .slider-row label,
body .slider-num {
  color: var(--label-primary);
}

body .verdict {
  color: var(--label-primary);
  border: 0;
  border-radius: 15px;
  background: var(--surface-canvas);
}

body .slider-row input[type="range"] {
  background: linear-gradient(90deg, #248a3d, #ff9f0a, #d70015);
}

body .slider-row input[type="range"]::-webkit-slider-thumb {
  border-color: rgba(60, 60, 67, 0.18);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body .slider-row input[type="range"]::-moz-range-thumb {
  border-color: rgba(60, 60, 67, 0.18);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body .risk-fill.warn { background: #ff9f0a; }
body .risk-fill.danger { background: var(--danger); }
body .risk-tip.warn { color: #9a6700; }
body .risk-tip.danger { color: var(--danger); }
body .risk-tip.ok { color: var(--success); }

/* Undo the legacy generic .loading fullscreen rule on inline loading copy. */
body .risk-tip.loading,
body #counterfactual.loading {
  position: static;
  inset: auto;
  z-index: auto;
  display: block;
  min-height: 0;
  padding: 0;
  color: var(--label-secondary);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: pulseCopy 1.2s ease-in-out infinite;
}

@keyframes pulseCopy { 50% { opacity: 0.5; } }

body .evidence-confidence {
  color: var(--label-primary);
  border: 0;
  border-radius: 15px;
  background: rgba(0, 113, 227, 0.07);
}

body .evidence-confidence b { color: var(--accent); }

body .timeline::before {
  background: var(--separator-strong);
}

body .timeline li::before {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 5px #fff;
}

body .timeline li.warn::before { border-color: #ff9f0a; }
body .timeline li.danger::before { border-color: var(--danger); }

body .timeline-day,
body .bubble.future .who {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

body .timeline-event {
  color: var(--label-primary);
  font-weight: 400;
  text-shadow: none;
}

body .chat-tab.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

body .chat-box {
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-canvas);
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.04);
}

body .bubble.future,
body .bubble.system {
  color: var(--label-primary);
  border: 1px solid var(--separator);
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  box-shadow: none;
}

body .bubble.me {
  color: #fff;
  border-radius: 16px 16px 5px 16px;
  background: var(--accent);
  box-shadow: none;
}

body .bubble.me .who { color: rgba(255, 255, 255, 0.7); }

body .chat-input input {
  min-height: 48px;
  padding: 0 16px;
}

body .card.warn {
  border: 1px solid rgba(201, 52, 0, 0.15);
  background: #fff8f5;
}

body .card.warn .card-title,
body .card.warn .card-title .kicker { color: #c93400; }

body .card.warn p {
  color: var(--label-primary);
  border-color: rgba(201, 52, 0, 0.16);
  background: transparent;
}

/* --------------------------------------------------------------------------
   Step 05 — turn insight into action
   -------------------------------------------------------------------------- */

body .action-evidence-head b {
  color: var(--accent);
  border: 0;
  background: var(--accent-soft);
}

body .plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body .plan-grid > .card,
body .plan-grid > .card:nth-child(n) {
  min-height: 230px;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.045);
}

body .plan-grid > .card:nth-child(1) {
  color: #fff;
  background: #111114;
}

body .plan-grid > .card:nth-child(1) .card-title,
body .plan-grid > .card:nth-child(1) li {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

body .plan-grid > .card:nth-child(1) .card-title .kicker { color: #6eb5ff; }

body .plan-grid > .card:nth-child(1) li::before {
  border-color: rgba(255, 255, 255, 0.76);
  background: transparent;
}

body .plan-grid > .card:nth-child(2) {
  box-shadow: inset 0 4px 0 var(--accent), 0 2px 14px rgba(0, 0, 0, 0.045);
}

body .plan-grid > .card:nth-child(4) {
  border: 1px solid rgba(201, 52, 0, 0.15);
  background: #fff8f5;
}

body .plan-grid li {
  color: var(--label-primary);
  border-bottom-color: var(--separator);
  font-weight: 400;
  text-shadow: none;
}

body .plan-grid li::before {
  border-color: var(--separator-strong);
  background: #fff;
  box-shadow: none;
}

body .plan-grid li.add-row,
body .plan-grid li.add-row::before {
  color: var(--accent);
}

body .future-postman {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 34px;
  margin: 24px 0 30px;
  padding: 30px;
  border: 0;
  border-radius: var(--radius-lg);
  color: #fff;
  background: #111114;
  box-shadow: none;
}

body .future-postman::before { display: none; }

body .future-postman-kicker {
  margin: 0 0 9px;
  color: #6eb5ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body .future-postman h3 {
  max-width: 720px;
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(23px, 3vw, 34px);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.035em;
  text-shadow: none;
}

body .future-postman > div > p:last-child,
body .future-postman-action small {
  color: rgba(255, 255, 255, 0.58);
  font-weight: 400;
  text-shadow: none;
}

body .future-postman-action {
  display: grid;
  justify-items: center;
  gap: 9px;
}

body .future-postman .primary-btn {
  color: var(--label-primary);
  background: #fff;
}

body .future-postman .primary-btn:hover {
  color: var(--label-primary);
  background: #f0f0f2;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   History, time-travel mailbox, feedback
   -------------------------------------------------------------------------- */

body.mailbox-open { overflow: hidden; }

body .drawer-mask {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body .drawer-panel {
  width: min(480px, calc(100% - 20px));
  max-width: none;
  padding: 32px;
  border: 0;
  border-radius: 28px 0 0 28px;
  color: var(--label-primary);
  background: rgba(250, 250, 252, 0.98);
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

body .drawer-panel h3 {
  padding-right: 56px;
  color: var(--label-primary);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-shadow: none;
}

body .drawer-sub,
body .history-input,
body .history-empty {
  color: var(--label-secondary);
  font-weight: 400;
  text-shadow: none;
}

body .history-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

body .history-item,
body .mailbox-item {
  border: 1px solid var(--separator);
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
}

body .history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  padding: 0;
  overflow: hidden;
  cursor: default;
}

body .history-restore {
  display: block;
  min-width: 0;
  padding: 16px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

body .history-meta,
body .history-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body .history-item:hover,
body .mailbox-item:hover {
  border-color: rgba(0, 113, 227, 0.24);
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
  transform: none;
}

body .history-topic { color: var(--label-primary); }
body .history-when,
body .history-branches { color: var(--label-tertiary); }

body .history-delete {
  align-self: stretch;
  width: 48px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 0;
  border-left: 1px solid var(--separator);
}

body .history-delete:hover {
  color: var(--danger);
  background: rgba(215, 0, 21, 0.08);
}

body #mailboxDrawer .mailbox-panel {
  width: min(680px, calc(100% - 20px));
  padding: 38px 40px 46px;
}

body .mailbox-close,
body .drawer-close {
  position: sticky;
  top: 0;
  right: auto;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 0 -44px auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--label-secondary);
  background: rgba(118, 118, 128, 0.1);
  font-size: 22px;
  cursor: pointer;
}

body .mailbox-close:hover,
body .drawer-close:hover,
body .mailbox-back:hover {
  color: var(--label-primary);
  background: rgba(118, 118, 128, 0.16);
}

body .mailbox-view { min-height: 100%; }

body .mailbox-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body .mailbox-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 26px 0 18px;
  padding: 16px;
  border: 1px solid var(--separator);
  border-radius: 18px;
  background: #fff;
}

body .mailbox-toolbar > span {
  color: var(--label-secondary);
  font-size: 12px;
  line-height: 1.55;
  text-align: right;
}

body .mailbox-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  border: 0;
  border-radius: 15px;
  background: rgba(118, 118, 128, 0.1);
}

body .mailbox-tab {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: var(--label-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
}

body .mailbox-tab:hover {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.5);
}

body .mailbox-tab--active {
  color: var(--label-primary);
  border: 0;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

body .mailbox-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

body .mailbox-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

body .mailbox-item--unread {
  border-color: rgba(0, 113, 227, 0.3);
  box-shadow: inset 4px 0 0 var(--accent);
}

body .mailbox-item--scheduled { opacity: 1; }

body .mailbox-item-open {
  min-width: 0;
  padding: 18px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

body .mailbox-item-top,
body .mailbox-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body .mailbox-item-top span,
body .mailbox-item-bottom span,
body .mailbox-letter-date {
  color: var(--label-tertiary);
  font-size: 10px;
  font-weight: 600;
}

body .mailbox-item-top b {
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
}

body .mailbox-item h4 {
  margin: 9px 0 6px;
  color: var(--label-primary);
  font-size: 19px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

body .mailbox-item p {
  display: -webkit-box;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--label-secondary);
  font-size: 12px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body .mailbox-item-delete {
  align-self: stretch;
  width: 48px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--separator);
  color: var(--label-tertiary);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

body .mailbox-item-delete:hover {
  color: var(--danger);
  background: rgba(215, 0, 21, 0.06);
}

body .mailbox-empty {
  display: grid;
  min-height: 250px;
  margin-top: 14px;
  padding: 34px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--separator-strong);
  border-radius: 20px;
  color: var(--label-tertiary);
  text-align: center;
}

body .mailbox-empty > span { color: var(--accent); font-size: 36px; opacity: 0.72; }
body .mailbox-empty p { max-width: 340px; margin: 12px 0 0; font-size: 13px; }

body .mailbox-back {
  min-height: 44px;
  margin: 0 0 22px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  color: var(--label-secondary);
  background: rgba(118, 118, 128, 0.1);
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
}

body .mailbox-letter-sheet {
  position: relative;
  padding: 38px 40px 42px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--label-primary);
  background: #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
}

body .mailbox-letter-sheet::before { display: none; }

body .mailbox-letter-route {
  position: relative;
  display: inline-flex;
  margin-bottom: 18px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 650;
}

body #mailboxReadTitle {
  margin: 10px 0 24px;
  color: var(--label-primary);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.045em;
}

body .mailbox-letter-body {
  color: var(--label-primary);
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

body .mailbox-letter-context {
  display: grid;
  gap: 9px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--separator);
}

body .mailbox-letter-context p { margin: 0; color: var(--label-secondary); font-size: 11px; }
body .mailbox-letter-context b { color: var(--label-primary); }

body .mailbox-letter-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 13px 0 0;
}

body .mailbox-reply {
  margin-top: 22px;
  padding: 24px;
  border: 0;
  border-radius: 20px;
  background: #fff;
}

body .mailbox-reply h4 {
  margin: 0 0 6px;
  color: var(--label-primary);
  font-size: 20px;
  font-weight: 650;
}

body .mailbox-reply > p:not(.mailbox-form-error) {
  margin: 0 0 17px;
  color: var(--label-secondary);
  font-size: 12px;
}

body .mailbox-outcomes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

body .mailbox-outcomes button,
body .mailbox-kind {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--separator);
  border-radius: 13px;
  color: var(--label-secondary);
  background: var(--surface-canvas);
  box-shadow: none;
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
}

body .mailbox-outcomes button:hover,
body .mailbox-kind:hover {
  color: var(--label-primary);
  border-color: rgba(0, 113, 227, 0.24);
  background: #fff;
}

body .mailbox-outcomes button.mailbox-outcome--active,
body .mailbox-kind--active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

body .mailbox-reply label,
body .mailbox-compose label,
body .mailbox-compose legend {
  display: block;
  margin: 18px 0 8px;
  color: var(--label-primary);
  font-size: 12px;
  font-weight: 600;
}

body .mailbox-compose label span { color: var(--label-tertiary); font-weight: 400; }

body .mailbox-reply textarea,
body .mailbox-compose input,
body .mailbox-compose select,
body .mailbox-compose textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--separator);
  border-radius: 13px;
  color: var(--label-primary);
  background: #fff;
  box-shadow: none;
  font-size: 14px;
}

body .mailbox-compose input,
body .mailbox-compose select {
  min-height: 48px;
  padding: 0 14px;
}

body .mailbox-reply textarea,
body .mailbox-compose textarea {
  padding: 13px 14px;
  line-height: 1.65;
  resize: vertical;
}

body .mailbox-reply textarea:focus,
body .mailbox-compose input:focus,
body .mailbox-compose select:focus,
body .mailbox-compose textarea:focus {
  border-color: rgba(0, 113, 227, 0.4);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

body .mailbox-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

body .mailbox-compose fieldset {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body .mailbox-kind-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

body .mailbox-kind {
  min-height: 112px;
  padding: 16px;
  text-align: left;
}

body .mailbox-kind strong,
body .mailbox-kind span { display: block; }

body .mailbox-kind strong {
  margin-bottom: 8px;
  color: var(--label-primary);
  font-size: 17px;
  font-weight: 650;
}

body .mailbox-kind span {
  color: var(--label-secondary);
  font-size: 11px;
  line-height: 1.5;
}

body .mailbox-privacy-note {
  margin: 16px 0;
  padding: 12px 13px;
  border-left: 2px solid var(--accent);
  color: var(--label-secondary);
  background: var(--accent-soft);
  font-size: 11px;
  line-height: 1.55;
}

body .mailbox-form-error {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(215, 0, 21, 0.22);
  border-radius: 12px;
  color: var(--danger);
  background: rgba(215, 0, 21, 0.06);
  font-size: 11px;
}

body .mailbox-submit { width: 100%; }
body .mailbox-submit[disabled] { cursor: wait; opacity: 0.58; }

body .letter-arrival {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: flex;
  width: min(520px, calc(100% - 48px));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  color: #fff;
  background: rgba(29, 29, 31, 0.88);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

body .letter-arrival > div:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

body .letter-arrival-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 18px;
}

body .letter-arrival p,
body .letter-arrival strong,
body .letter-arrival p span { display: block; min-width: 0; }
body .letter-arrival p { margin: 0; }
body .letter-arrival strong { margin-bottom: 3px; font-size: 13px; }
body .letter-arrival p span { color: rgba(255, 255, 255, 0.58); font-size: 11px; }

body .letter-arrival-actions { display: flex; flex: 0 0 auto; gap: 6px; }

body .letter-arrival-actions button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

body .letter-arrival-actions button:first-child {
  color: var(--label-primary);
  background: #fff;
}

body .toast,
body .toast-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: #fff;
  background: rgba(29, 29, 31, 0.9);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body .toast-icon,
body .toast-error .toast-icon {
  color: #fff;
  background: var(--accent);
}

body .toast-error .toast-icon { background: var(--danger); }
body .toast-copy strong { color: #fff; }
body .toast-copy span { color: rgba(255, 255, 255, 0.66); }

/* Scope the fullscreen experience to the real overlay only. */
body #loading {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  background: rgba(8, 9, 11, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body #loading .ink-ring {
  border-color: rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-right-color: var(--accent);
}

body #loading .ink-sweep {
  border-color: rgba(0, 113, 227, 0.16);
  border-bottom-color: var(--accent);
}

body #loading .ink-bloom {
  border-radius: 50%;
  background: var(--accent);
  box-shadow: none;
}

body #loading .loader-text {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

body #loading .loader-sub { color: rgba(255, 255, 255, 0.54); }
body #loading .loader-ellipsis i { color: #6eb5ff; }

/* --------------------------------------------------------------------------
   Complete responsive pass
   -------------------------------------------------------------------------- */

@media (max-width: 940px) {
  body .detail-layout { grid-template-columns: 1fr; }
  body .detail-side { position: static; }
}

@media (max-width: 720px) {
  body .view:not(.view-input) {
    min-height: calc(100svh - 72px);
    padding: 54px 16px 112px;
  }

  body .view-title {
    font-size: clamp(42px, 12vw, 56px);
    letter-spacing: -0.05em;
  }

  body .view-sub {
    margin-bottom: 34px;
    font-size: 15px;
  }

  body .radar-grid,
  body .branch-grid,
  body .plan-grid,
  body .brief-grid,
  body .evidence-grid,
  body .action-evidence-grid {
    grid-template-columns: 1fr;
  }

  body .life-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body .life-choice-card {
    min-height: 128px;
    padding: 12px;
  }

  body .life-choice-caption {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  body .life-choice-action { margin-top: 7px; }

  body .radar-cell,
  body .branch-card,
  body .branch-card.branch-D,
  body .card,
  body .brief-panel,
  body .branch-compare,
  body .action-evidence {
    border-radius: 22px;
  }

  body .branch-card,
  body .branch-card.branch-D {
    min-height: 290px;
    padding: 24px;
  }

  body .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  body .action-row .hint { text-align: center; }
  body .action-row .primary-btn { margin-left: 0; }
  body .action-row :is(.primary-btn, .ghost-btn, .regen-btn) { justify-content: center; }

  body .view-detail > .action-row {
    position: static;
    bottom: auto;
    z-index: auto;
    margin: 38px auto 0;
    padding: 20px 0 0;
    border: 0;
    border-top: 1px solid var(--separator);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body .future-postman {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px;
  }

  body .future-postman-action { justify-items: stretch; }

  body .drawer-panel {
    width: calc(100% - 8px);
    padding: 28px 20px calc(32px + env(safe-area-inset-bottom));
    border-radius: 24px 0 0 24px;
  }

  body #mailboxDrawer .mailbox-panel {
    width: calc(100% - 8px);
    padding: 28px 20px calc(32px + env(safe-area-inset-bottom));
  }

  body .mailbox-close,
  body .drawer-close { top: 0; right: auto; }

  body .mailbox-toolbar,
  body .future-postman {
    grid-template-columns: 1fr;
  }

  body .mailbox-toolbar { align-items: stretch; }
  body .mailbox-toolbar > span { text-align: left; }

  body .mailbox-kind-grid,
  body .mailbox-outcomes { grid-template-columns: 1fr; }

  body .mailbox-kind { min-height: 92px; }
  body .mailbox-letter-sheet { padding: 30px 24px 34px; }

  body .letter-arrival {
    right: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  body .letter-arrival-actions button:first-child { flex: 1 1 auto; }
  body .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  body .view:not(.view-input) { padding-right: 13px; padding-left: 13px; }
  body .life-choice-card { min-height: 118px; }
  body .mailbox-tab { padding-right: 5px; padding-left: 5px; font-size: 10px; }
  body .mailbox-form-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 720px) {
  body button {
    min-height: 44px !important;
  }

  body input:not([type="range"]),
  body select {
    min-height: 44px;
  }

  body input:not([type="range"]),
  body textarea,
  body select {
    font-size: 16px !important;
  }

  body .slider-row input[type="range"] {
    min-height: 44px;
    height: 44px;
    background: linear-gradient(90deg, #248a3d, #ff9f0a, #d70015) center / 100% 5px no-repeat;
  }
}

body :is(button, input, textarea, select, [role="button"]):focus-visible {
  outline: 3px solid #0071e3 !important;
  outline-offset: 3px;
}

body :is(.hero-title, .view-title, .detail-title):focus {
  outline: none !important;
}
