/*
 * UI v4 — FUTURE POST OFFICE
 * Bright editorial paper, postal objects, bold Chinese typography.
 * Loaded after the legacy stylesheet so this file deliberately owns the skin.
 */

:root {
  color-scheme: light;
  --paper: #f3efe5;
  --paper-soft: #fbf8f0;
  --paper-deep: #e9e2d3;
  --ink: #171713;
  --ink-soft: #4a4942;
  --ink-dim: #706e64;
  --line: #171713;
  --line-soft: rgba(23, 23, 19, 0.18);
  --blue: #3155f5;
  --blue-deep: #1735bc;
  --red: #ff5b45;
  --red-deep: #d93420;
  --yellow: #ffd84d;
  --lime: #d9ff58;
  --pink: #f2b6ef;
  --sky: #b9ddff;
  --mint: #bfead5;
  --white: #fffdf7;
  --radius-sm: 14px;
  --radius: 24px;
  --radius-lg: 36px;
  --sans: "Arial", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --shadow-hard: 8px 8px 0 var(--ink);
  --shadow-soft: 0 18px 46px rgba(23, 23, 19, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--paper);
  letter-spacing: -0.01em;
}

body {
  overflow-x: hidden;
  background-image: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 10% 12%, rgba(23, 23, 19, 0.22) 0 0.6px, transparent 0.8px),
    radial-gradient(circle at 77% 64%, rgba(23, 23, 19, 0.16) 0 0.5px, transparent 0.8px);
  background-size: 15px 17px, 19px 23px;
  mix-blend-mode: multiply;
  mask-image: none;
  -webkit-mask-image: none;
}

body::after {
  content: none;
  display: none;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

::selection {
  color: var(--white);
  background: var(--blue);
}

.hidden {
  display: none !important;
}

.grain {
  display: none;
}

.vignette {
  display: none;
}

main,
.topbar {
  position: relative;
  z-index: 1;
}

/* ---------- Navigation ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 12px 32px;
  gap: 22px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: rgba(243, 239, 229, 0.96);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-dot {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  box-shadow: none;
  transform: rotate(-8deg);
}

.brand-dot::before,
.brand-dot::after {
  content: "";
  position: absolute;
  border-radius: 0;
  background: transparent;
}

.brand-dot::before {
  width: 20px;
  height: 2px;
  left: 6px;
  top: 16px;
  background: var(--ink);
  box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink);
}

.brand-dot::after {
  width: 8px;
  height: 8px;
  right: 5px;
  top: 5px;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.brand-name {
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--ink);
}

.brand-sub {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: 0.08em;
}

.steps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  box-shadow: none;
}

.steps .step {
  position: relative;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-dim);
  background: transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.steps .step em {
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.steps .step:hover {
  color: var(--ink);
  background: var(--paper);
}

.steps .step.current {
  color: var(--white);
  background: var(--blue);
  box-shadow: none;
}

.steps .step.done {
  color: var(--ink);
}

.steps .step.done::after {
  content: "·";
  position: absolute;
  right: 4px;
  color: var(--red);
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.reset-btn,
.ghost-btn,
.regen-btn,
.chat-input button,
.primary-btn {
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -0.01em;
  cursor: pointer;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.reset-btn {
  min-height: 36px;
  padding: 0 14px;
  border-width: 1.5px;
  background: transparent;
}

.reset-btn:hover,
.ghost-btn:hover,
.regen-btn:hover,
.chat-input button:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.primary-btn {
  position: relative;
  min-height: 54px;
  padding: 0 22px;
  color: var(--white);
  border-color: var(--ink);
  background: var(--blue);
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
}

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

.primary-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: 7px 7px 0 var(--ink);
  transform: translate(-3px, -3px);
}

.primary-btn:active,
.ghost-btn:active,
.regen-btn:active,
.reset-btn:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.primary-btn > span {
  position: relative;
  z-index: 1;
}

.btn-arrow {
  margin-left: 22px;
  font-size: 20px;
  transition: transform 160ms ease;
}

.primary-btn:hover .btn-arrow {
  transform: translateX(5px);
}

.regen-btn {
  color: var(--ink);
  background: transparent;
}

.regen-btn::before {
  content: "↻";
  margin-right: 6px;
}

.regen-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ---------- Shared page typography ---------- */

.view {
  position: relative;
  min-height: calc(100vh - 76px);
  padding: 0;
  animation: pageIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.view-model {
  background: var(--yellow);
}

.view-map {
  background: var(--sky);
}

.view-detail {
  background: var(--paper);
}

.view-action {
  background: var(--mint);
}

.container {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
  padding: 74px 0;
}

.act-mark {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0 0 22px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-1deg);
}

.view-title {
  max-width: 980px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(44px, 6vw, 82px);
  font-weight: 950;
  line-height: 0.99;
  letter-spacing: -0.075em;
  text-wrap: balance;
  text-shadow: none;
}

.view-sub {
  max-width: 760px;
  margin: 24px 0 42px;
  color: var(--ink-soft);
  font-size: 17px;
  font-weight: 620;
  line-height: 1.8;
  text-shadow: none;
}

.view-sub em {
  color: var(--red-deep);
  font-style: normal;
  font-weight: 900;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 34px;
  padding-top: 28px;
  border-top: 2px solid var(--ink);
}

.action-row .hint {
  margin-right: auto;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

/* ---------- Hero / writing a letter ---------- */

.view-input {
  min-height: calc(100vh - 76px);
  padding: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(23, 23, 19, 0.08) calc(50% - 1px), rgba(23, 23, 19, 0.08) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--paper);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(400px, 0.86fr) minmax(600px, 1.14fr);
  grid-template-rows: auto auto 1fr auto;
  column-gap: clamp(52px, 7vw, 112px);
  align-items: start;
  width: min(1380px, calc(100% - 80px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 58px 0 44px;
}

.hero-eyebrow {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  margin: 0 0 36px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hero-eyebrow .rule {
  width: 26px;
  height: 2px;
  background: var(--red);
}

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

.hero-tag {
  grid-column: 1;
  grid-row: 2;
  max-width: 460px;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(17px, 1.4vw, 21px);
  font-weight: 700;
  line-height: 1.7;
  text-shadow: none;
}

.hero-title {
  position: relative;
  grid-column: 1;
  grid-row: 3;
  align-self: center;
  margin: 8px 0 42px;
  color: var(--ink);
  font-size: clamp(58px, 5vw, 78px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.095em;
  text-shadow: none;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}

.hero-title em {
  display: inline-block;
  position: relative;
  margin-top: 14px;
  color: var(--red);
  font-style: normal;
  font-weight: inherit;
  -webkit-text-fill-color: var(--red);
}

.hero-title em::after {
  content: "2036\A已收";
  white-space: pre;
  position: absolute;
  right: -48px;
  bottom: -55px;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 3px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(12deg);
}

.entry-switch {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  display: inline-flex;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
}

.entry-mode-btn {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-dim);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.entry-mode-btn:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.entry-mode-btn.active {
  color: var(--white);
  background: var(--ink);
}

.hero-shell {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-self: center;
  gap: 22px;
  width: 100%;
  margin: 0;
}

.hero-instrument {
  position: relative;
  order: 1;
  height: 240px;
  min-height: 240px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-hard);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: rotate(0.7deg);
}

.hero-instrument::before {
  content: "AIR MAIL / FOUR POSSIBLE FUTURES";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 18px 20px;
  color: var(--ink-dim);
  background-image:
    repeating-linear-gradient(135deg, var(--blue) 0 12px, transparent 12px 24px, var(--red) 24px 36px, transparent 36px 48px);
  background-position: 0 100%;
  background-size: 100% 8px;
  background-repeat: no-repeat;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 1;
}

.hero-instrument::after {
  content: "FUTURE\A POST";
  white-space: pre;
  position: absolute;
  right: 24px;
  top: 22px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(9deg);
}

.instrument-map {
  position: absolute;
  inset: 40px 30% 28px 24px;
  z-index: 1;
  width: auto;
  height: auto;
  transform: none;
}

.instrument-map::before {
  display: none;
}

.map-line {
  position: absolute;
  left: 20%;
  top: 52%;
  width: 66%;
  height: 3px;
  border-radius: 99px;
  transform-origin: left center;
  background: var(--ink);
  box-shadow: none;
}

.map-line-a { transform: rotate(-31deg); }
.map-line-b { transform: rotate(-10deg); }
.map-line-c { transform: rotate(12deg); }
.map-line-d { transform: rotate(33deg); }

.map-node {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
  box-shadow: none;
}

.map-node-core {
  left: 18%;
  top: calc(52% - 5px);
  width: 16px;
  height: 16px;
  background: var(--red);
  animation: none;
}

.map-node-a { left: 78%; top: 15%; background: var(--blue); }
.map-node-b { left: 84%; top: 38%; background: var(--yellow); }
.map-node-c { left: 84%; top: 61%; background: var(--lime); }
.map-node-d { left: 78%; top: 83%; background: var(--pink); }

.instrument-cards {
  position: absolute;
  top: auto;
  right: 108px;
  bottom: 36px;
  left: auto;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 84px);
  gap: 8px;
  width: auto;
}

.instrument-card {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  min-height: 48px;
  padding: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
}

.instrument-card::before {
  display: none;
}

.instrument-card:nth-child(1) { background: var(--sky); }
.instrument-card:nth-child(2) { background: var(--red); }
.instrument-card:nth-child(3) { background: var(--lime); }
.instrument-card:nth-child(4) { background: var(--pink); }

.instrument-card b,
.instrument-card strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  text-shadow: none;
}

.instrument-card i {
  display: none;
}

.instrument-metrics {
  display: none;
}

.input-wrap,
.choice-wrap {
  position: relative;
  order: 2;
  display: block;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--blue);
  box-shadow: var(--shadow-hard);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

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

.input-wrap:focus-within {
  border-color: var(--ink);
  outline: 4px solid var(--yellow);
  outline-offset: 4px;
  box-shadow: var(--shadow-hard);
}

.input-panel-head,
.choice-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 14px;
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.44);
  color: var(--white);
}

.input-panel-head span:first-child,
.choice-panel-head span:first-child {
  color: var(--white);
  font-size: 18px;
  font-weight: 900;
  text-shadow: none;
}

.input-panel-head span:last-child,
.choice-panel-head span:last-child {
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: none;
}

.decision-input {
  display: block;
  width: calc(100% - 32px);
  min-height: 164px;
  margin: 16px;
  padding: 22px;
  resize: vertical;
  border: 2px solid var(--ink);
  border-radius: 20px;
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, transparent 0 35px, rgba(23, 23, 19, 0.12) 35px 36px),
    var(--white);
  box-shadow: none;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 650;
  line-height: 36px;
}

.decision-input::placeholder {
  color: #817d72;
  opacity: 1;
}

.decision-input:focus {
  outline: 0;
}

.input-row {
  display: flex;
  justify-content: flex-end;
  min-height: 0;
  padding: 0 16px 16px;
  border: 0;
}

.input-row .primary-btn {
  color: var(--ink);
  background: var(--lime);
}

.input-row .primary-btn:hover {
  background: var(--yellow);
}

.hero-foot {
  grid-column: 2;
  grid-row: 4;
  margin: 22px 0 0;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

/* ---------- Script picker ---------- */

.choice-wrap {
  padding-bottom: 20px;
  background: var(--white);
}

.choice-wrap .choice-panel-head {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: var(--yellow);
  border-radius: 32px 32px 0 0;
}

.choice-wrap .choice-panel-head span:first-child,
.choice-wrap .choice-panel-head span:last-child {
  color: var(--ink);
}

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

.life-choice-card {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  grid-template-rows: auto auto auto;
  gap: 2px 14px;
  min-height: 128px;
  padding: 14px;
  overflow: hidden;
  text-align: left;
  border: 2px solid var(--ink);
  border-radius: 18px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
  cursor: pointer;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.life-choice-card:nth-child(1) { background: var(--sky); }
.life-choice-card:nth-child(2) { background: var(--red); }
.life-choice-card:nth-child(3) { background: var(--lime); }
.life-choice-card:nth-child(4) { background: var(--pink); }

.life-choice-card::before {
  display: none;
}

.life-choice-card:hover,
.life-choice-card.selected {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-3px, -3px) rotate(-0.4deg);
}

.life-choice-card.selected::after {
  content: "已选";
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  transform: rotate(9deg);
}

.life-choice-card.selected::before {
  display: none;
}

.life-choice-scene {
  grid-row: 1 / span 3;
  position: relative;
  width: 76px;
  height: 96px;
  margin: 0;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.scene-city .life-choice-scene,
.scene-town .life-choice-scene,
.scene-road .life-choice-scene,
.scene-market .life-choice-scene,
.life-choice-card.selected .life-choice-scene {
  border-color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.scene-mark {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  font-size: 9px;
  font-weight: 900;
}

.scene-line {
  position: absolute;
  right: 8px;
  height: 2px;
  background: var(--ink);
}

.scene-line.one { top: 15px; width: 25px; }
.scene-line.two { top: 22px; width: 18px; }

.scene-shape.main {
  position: absolute;
  left: 15px;
  bottom: -7px;
  width: 42px;
  height: 58px;
  border: 1.5px solid var(--ink);
  border-radius: 50% 50% 10px 10px;
  background: var(--blue);
  box-shadow: none;
}

.scene-shape.aux {
  position: absolute;
  right: 8px;
  bottom: 10px;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

.scene-road .scene-shape.main,
.scene-market .scene-shape.main {
  border-color: var(--ink);
  background: var(--blue);
  box-shadow: none;
}

.scene-road .scene-shape.aux,
.scene-market .scene-shape.aux {
  border-color: var(--ink);
  background: var(--red);
  box-shadow: none;
}

.life-choice-title {
  align-self: end;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  text-shadow: none;
}

.life-choice-caption {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  text-shadow: none;
}

.life-choice-action {
  align-self: end;
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 900;
  text-shadow: none;
}

.life-choice-card.selected .life-choice-title,
.life-choice-card.selected .life-choice-caption,
.life-choice-card.selected .life-choice-action {
  color: var(--ink);
  text-shadow: none;
}

.life-choice-card.selected .life-choice-action {
  color: var(--blue-deep);
}

.choice-followup {
  margin: 0 16px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: none;
}

.choice-followup-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.choice-followup-head span:first-child {
  color: var(--ink);
  font-weight: 900;
}

.choice-followup-head span:last-child,
.choice-followup-sub {
  color: var(--ink-dim);
  font-size: 11px;
  text-shadow: none;
}

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

.chip,
.chat-quick .chip,
.chat-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.chip:hover,
.chat-quick .chip:hover,
.chat-tab:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--yellow);
}

.choice-detail-input,
.chat-input input,
.drawer-panel input[type="text"],
.drawer-panel input[type="password"],
.score-input {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.choice-detail-input {
  min-height: 100px;
  margin-top: 12px;
  padding: 14px;
  resize: vertical;
}

.choice-detail-input:focus,
.chat-input input:focus,
.drawer-panel input:focus {
  border-color: var(--ink);
  outline: 4px solid var(--yellow);
  box-shadow: none;
}

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

/* ---------- Sorting / decision model ---------- */

.view-model .container {
  position: relative;
}

.view-model .container::after {
  content: "SORTED\A BY LIFE";
  white-space: pre;
  position: absolute;
  right: 1%;
  top: 80px;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border: 3px solid var(--red-deep);
  border-radius: 50%;
  color: var(--red-deep);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(12deg);
}

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

.radar-cell {
  position: relative;
  min-height: 180px;
  padding: 24px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.radar-cell:nth-child(1) { --cell-color: var(--sky); background: var(--sky); }
.radar-cell:nth-child(2) { --cell-color: var(--red); background: var(--red); }
.radar-cell:nth-child(3) { --cell-color: var(--lime); background: var(--lime); }
.radar-cell:nth-child(4) { --cell-color: var(--pink); background: var(--pink); }
.radar-cell:nth-child(5) { --cell-color: var(--white); background: var(--white); }
.radar-cell:nth-child(6) { --cell-color: var(--mint); background: var(--mint); }

.radar-cell::before {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

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

.radar-cell:hover {
  border-color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  transform: translate(-3px, -3px) rotate(-0.3deg);
}

.radar-label {
  margin: 0 0 36px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.radar-value {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 750;
  line-height: 1.55;
}

.brief-panel {
  position: relative;
  margin-top: 26px;
  padding: 30px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-hard);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brief-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: 12px;
  background: repeating-linear-gradient(180deg, var(--blue) 0 16px, var(--white) 16px 32px, var(--red) 32px 48px, var(--white) 48px 64px);
}

.brief-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 24px;
  border-bottom: 2px solid var(--ink);
}

.brief-kicker,
.compare-kicker {
  margin: 0 0 8px;
  color: var(--blue-deep);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brief-head h3,
.compare-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 36px);
  font-weight: 950;
  line-height: 1.2;
  letter-spacing: -0.05em;
  text-shadow: none;
}

.brief-situation {
  margin: 0;
  padding: 24px 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 650;
  line-height: 1.8;
  border-bottom: 2px solid var(--ink);
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.brief-block {
  min-width: 0;
  padding: 24px 20px 0;
  border: 0;
  border-right: 1.5px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.brief-block:first-child { padding-left: 0; }
.brief-block:last-child { border-right: 0; }

.brief-block h3,
.evidence-block h4 {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brief-block ul,
.evidence-block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.brief-block li,
.brief-block p,
.evidence-block li,
.evidence-block p {
  position: relative;
  margin: 0 0 10px;
  padding-left: 16px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.65;
}

.brief-block li::before,
.evidence-block li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  box-shadow: none;
}

/* ---------- Four future letters ---------- */

.view-map .container {
  display: flex;
  flex-direction: column;
}

.view-map .act-mark { order: 0; align-self: flex-start; }
.view-map .view-title { order: 1; }
.view-map .view-sub { order: 2; }
.view-map .branch-grid { order: 3; }
.view-map .branch-compare { order: 4; }
.view-map .action-row { order: 5; }

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

.branch-card {
  --branch-bg: var(--white);
  --branch-fg: var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 32px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 34px;
  color: var(--branch-fg);
  background: var(--branch-bg);
  box-shadow: 8px 8px 0 var(--ink);
  cursor: pointer;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 190ms ease, box-shadow 190ms ease;
}

.branch-card:nth-child(1) { --branch-bg: var(--blue); --branch-fg: var(--white); }
.branch-card:nth-child(2) { --branch-bg: var(--red); --branch-fg: var(--ink); }
.branch-card:nth-child(3) { --branch-bg: var(--lime); --branch-fg: var(--ink); }
.branch-card:nth-child(4) { --branch-bg: var(--pink); --branch-fg: var(--ink); }

.branch-card.branch-D {
  border-color: var(--ink);
  background: var(--pink);
}

.branch-A { --brand-color: var(--blue); }
.branch-B { --brand-color: var(--red); }
.branch-C { --brand-color: var(--lime); }
.branch-D { --brand-color: var(--pink); }

.branch-card:hover {
  border-color: var(--ink);
  background: var(--branch-bg);
  box-shadow: 13px 13px 0 var(--ink);
  transform: translate(-5px, -5px) rotate(-0.35deg);
}

.branch-card:focus-visible,
.history-item:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 4px;
  box-shadow: 10px 10px 0 var(--ink);
}

.branch-card::before {
  content: "OPEN ME";
  position: absolute;
  right: 28px;
  top: 26px;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: currentColor;
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  transform: rotate(11deg);
  opacity: 0.72;
}

.branch-card::after {
  content: "";
  position: absolute;
  right: -14px;
  bottom: -56px;
  width: 190px;
  height: 190px;
  border: 3px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0.08;
}

.branch-tag,
.branch-pill,
.compare-code {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 32px;
  padding: 0 11px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: currentColor;
  background: transparent;
  box-shadow: none;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.branch-name {
  position: relative;
  z-index: 1;
  max-width: 78%;
  margin: 38px 0 16px;
  color: currentColor;
  font-size: clamp(30px, 3.2vw, 50px);
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: -0.065em;
  text-shadow: none;
}

.branch-summary {
  position: relative;
  z-index: 1;
  max-width: 88%;
  margin: 0;
  color: currentColor;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.75;
  text-shadow: none;
  opacity: 0.88;
}

.branch-proof {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 18px 0 0;
  border: 0;
  color: currentColor;
  background: transparent;
  box-shadow: none;
}

.branch-proof span {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 9px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: currentColor;
  background: transparent;
  box-shadow: none;
  font-size: 9px;
  font-weight: 850;
}

.branch-proof em {
  overflow: hidden;
  color: currentColor;
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.76;
}

.branch-stats {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1.5px solid currentColor;
  color: currentColor;
  background: transparent;
  font-size: 10px;
  opacity: 0.9;
}

.branch-stats b {
  color: currentColor;
}

.branch-compare {
  margin-top: 54px;
  padding: 28px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-hard);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.compare-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 22px;
  border-bottom: 2px solid var(--ink);
}

.compare-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.compare-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
  font-size: 10px;
  font-weight: 750;
}

.compare-summary b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 5px;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
}

.compare-table {
  display: grid;
}

.compare-row {
  --brand-color: var(--blue);
  display: grid;
  grid-template-columns: minmax(170px, 1.35fr) 70px repeat(4, minmax(86px, 0.7fr)) minmax(160px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.compare-row:last-child {
  border-bottom: 0;
}

.compare-row:hover {
  color: var(--ink);
  background: var(--yellow);
}

.compare-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-code {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink);
  border-color: var(--ink);
  background: var(--brand-color);
}

.compare-identity strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-shadow: none;
}

.compare-identity em,
.compare-index em,
.compare-step {
  display: block;
  color: var(--ink-dim);
  font-size: 9px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.45;
  text-shadow: none;
}

.compare-index b {
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.compare-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
}

.compare-bar-label,
.compare-bar-num {
  color: var(--ink-dim);
  font-size: 8px;
  font-weight: 800;
}

.compare-bar-track,
.score-bar,
.risk-meter {
  overflow: hidden;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 99px;
  background: var(--paper-deep);
}

.compare-bar-track i,
.score-bar > span,
.risk-fill {
  display: block;
  height: 100%;
  background: var(--blue);
  box-shadow: none;
}

.compare-bar.pressure .compare-bar-track i {
  background: var(--red);
}

/* ---------- Open a future letter ---------- */

.view-detail > .container:first-child {
  padding-bottom: 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.76fr) minmax(0, 1.24fr);
  gap: 30px;
  align-items: start;
  padding-top: 28px;
}

.detail-side,
.detail-main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.branch-image {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 32px;
  background:
    linear-gradient(180deg, transparent 0 82%, var(--yellow) 82% 100%),
    var(--sky);
  box-shadow: var(--shadow-hard);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: rotate(-0.7deg);
}

.branch-image::before {
  content: "POSTCARD FROM THE FUTURE";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 18px;
  color: var(--ink);
  background-image:
    repeating-linear-gradient(135deg, var(--blue) 0 10px, transparent 10px 20px, var(--red) 20px 30px, transparent 30px 40px);
  background-position: 0 100%;
  background-size: 100% 8px;
  background-repeat: no-repeat;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.branch-image img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.branch-image-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  background: transparent;
}

.branch-image.error .branch-image-placeholder {
  color: var(--ink);
  background: var(--red);
}

.image-download-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  min-height: 38px;
  padding: 0 13px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.branch-pill {
  margin-top: 12px;
  color: var(--red-deep);
  border-color: var(--red-deep);
}

.detail-title {
  margin: -8px 0 0;
  color: var(--ink);
  font-size: clamp(42px, 4.4vw, 66px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.07em;
  text-shadow: none;
}

.detail-summary {
  margin: -6px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.75;
  text-shadow: none;
}

.life-judgement {
  position: relative;
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
}

.life-judgement-label {
  margin-bottom: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.life-judgement p {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.7;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.card::before {
  display: none;
}

.card.warn {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--red);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  font-size: 17px;
  font-weight: 950;
  text-shadow: none;
}

.card-title .kicker,
.card.warn .card-title .kicker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: none;
  font-family: var(--mono);
  font-size: 10px;
}

.card-sub {
  margin: -8px 0 18px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 650;
  text-shadow: none;
}

.score-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-list li {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 1.2fr) 30px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.score-list .score-label,
.score-num,
.slider-num {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.score-num,
.slider-num {
  color: var(--ink);
  font-family: var(--mono);
  text-align: right;
}

.verdict {
  margin: 20px 0 0;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--lime);
  box-shadow: none;
  font-family: var(--serif);
  font-weight: 750;
}

.sliders {
  display: grid;
  gap: 14px;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(100px, 1.4fr) 34px;
  align-items: center;
  gap: 10px;
}

.slider-row label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.slider-row input[type="range"] {
  width: 100%;
  height: 8px;
  appearance: none;
  border: 1px solid var(--ink);
  border-radius: 99px;
  background: var(--sky);
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  appearance: none;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 2px 2px 0 var(--ink);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 2px 2px 0 var(--ink);
}

.risk-meter {
  height: 12px;
  margin-top: 18px;
}

.risk-fill {
  background: var(--blue);
}

.risk-fill.warn { background: var(--yellow); }
.risk-fill.danger { background: var(--red); }

.risk-tip,
.risk-tip.warn,
.risk-tip.danger,
.risk-tip.ok {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-shadow: none;
}

.branch-evidence,
.action-evidence {
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.evidence-confidence,
.action-evidence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--sky);
}

.evidence-confidence span,
.action-evidence-head span,
.action-evidence-head b {
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.evidence-confidence b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
}

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

.action-evidence-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evidence-block {
  min-width: 0;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--ink);
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  min-height: 62px;
  padding: 7px 0 20px 42px;
  border: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: none;
}

.timeline li.warn::before { background: var(--red); border-color: var(--ink); }
.timeline li.danger::before { background: var(--ink); border-color: var(--ink); }

.timeline-day {
  color: var(--blue-deep);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
}

.timeline-event {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.65;
  text-shadow: none;
}

.chat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chat-tab.active {
  color: var(--white);
  border-color: var(--ink);
  background: var(--blue);
}

.chat-box {
  min-height: 250px;
  max-height: 440px;
  overflow: auto;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(23, 23, 19, 0.08) 31px 32px),
    var(--paper);
  box-shadow: none;
}

.bubble {
  max-width: 82%;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.bubble.future,
.bubble.future:hover {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.bubble.future .who {
  color: var(--ink-dim);
}

.bubble .who {
  margin-bottom: 5px;
  color: var(--ink-dim);
  font-size: 9px;
  font-weight: 800;
}

.bubble-text {
  display: inline-block;
  padding: 11px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.6;
}

.bubble.me {
  margin-left: auto;
  color: var(--white);
  background: transparent;
  box-shadow: none;
}

.bubble.me .bubble-text {
  color: var(--white);
  background: var(--blue);
}

.bubble.system {
  max-width: 100%;
  padding: 10px;
  border: 1px dashed var(--ink);
  border-radius: 12px;
  color: var(--ink-soft);
  background: var(--yellow);
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-input input {
  min-height: 46px;
  padding: 0 14px;
}

.chat-input button {
  color: var(--white);
  background: var(--blue);
}

.card.warn .card-title,
.card.warn .card-title .kicker,
.card.warn p {
  color: var(--ink);
}

.card.warn p {
  margin: 0;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.56);
}

/* ---------- Reply / action plan ---------- */

.action-evidence {
  margin: 0 0 26px;
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-hard);
}

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

.plan-grid .card:nth-child(1) { background: var(--yellow); }
.plan-grid .card:nth-child(2) { background: var(--sky); }
.plan-grid .card:nth-child(3) { background: var(--white); }
.plan-grid .card:nth-child(4) { background: var(--red); }
.plan-grid .card:nth-child(5) { background: var(--pink); }
.plan-grid .card:nth-child(6) { background: var(--lime); }

.plan-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-grid li {
  position: relative;
  padding: 13px 0 13px 30px;
  border-bottom: 1px solid rgba(23, 23, 19, 0.28);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
}

.plan-grid li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--white);
  box-shadow: none;
}

.plan-grid li.add-row {
  color: var(--blue-deep);
  font-weight: 850;
  cursor: pointer;
}

.plan-grid li.add-row::before {
  display: none;
}

.plan-grid li.add-row:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.35);
}

.plan-loading {
  opacity: 0.62;
}

/* ---------- Drawers, toast, loading ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(23, 23, 19, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, calc(100% - 24px));
  height: 100%;
  overflow: auto;
  padding: 34px;
  border: 0;
  border-left: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: -10px 0 0 rgba(23, 23, 19, 0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer-panel h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 34px;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.drawer-sub,
.history-empty {
  color: var(--ink-dim);
  font-size: 12px;
}

.history-list {
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.history-item {
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.history-item:hover {
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
}

.drawer-actions {
  display: flex;
  gap: 10px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  padding: 13px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--red);
  font-size: 12px;
  font-weight: 750;
  transform: translate(-50%, 120px);
  transition: transform 220ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

.toast-card {
  border: 0;
  color: var(--white);
  background: transparent;
  box-shadow: none;
}

.toast-copy strong { color: var(--white); }
.toast-copy span { color: rgba(255, 255, 255, 0.72); }

.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--ink);
  background: rgba(243, 239, 229, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.loader-ink {
  position: relative;
  width: 130px;
  height: 130px;
}

.ink-ring,
.ink-sweep,
.ink-bloom {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.ink-ring {
  border: 4px solid var(--red);
  border-style: dashed;
  animation: stampSpin 5s linear infinite;
}

.ink-sweep {
  inset: 14px;
  border: 2px solid var(--blue);
  border-left-color: transparent;
  animation: stampSpin 2s linear infinite reverse;
}

.ink-bloom {
  inset: 38px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  box-shadow: none;
  animation: stampPulse 1.4s ease-in-out infinite;
}

.loader-text {
  margin: 24px 0 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 850;
}

.loader-sub {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 650;
}

.loader-ellipsis i {
  color: var(--red);
}

.empty-state,
.api-banner {
  padding: 22px;
  border: 2px dashed var(--ink);
  border-radius: 18px;
  color: var(--ink-soft);
  background: var(--white);
  box-shadow: none;
}

.editable:hover {
  background: var(--yellow);
  box-shadow: inset 0 -2px 0 var(--ink);
}

.editable.editing,
.editable[contenteditable="true"]:focus {
  color: var(--ink);
  border-color: var(--ink);
  outline: 3px solid var(--yellow);
  background: var(--white);
  box-shadow: none;
}

.score-input {
  color: var(--ink);
  border-color: var(--ink);
}

.chat-box::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.drawer-panel::-webkit-scrollbar {
  width: 10px;
}

.chat-box::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.drawer-panel::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: var(--ink);
  background-clip: content-box;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stampSpin {
  to { transform: rotate(360deg); }
}

@keyframes stampPulse {
  50% { transform: scale(0.82); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .steps {
    order: 3;
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 2px;
  }

  .topbar {
    min-height: 110px;
  }

  .view {
    min-height: calc(100vh - 110px);
  }

  .hero {
    grid-template-columns: minmax(320px, 0.8fr) minmax(520px, 1.2fr);
    column-gap: 46px;
    width: min(1100px, calc(100% - 48px));
    min-height: calc(100vh - 110px);
  }

  .hero-title {
    font-size: clamp(54px, 5vw, 72px);
  }

  .instrument-cards {
    right: 94px;
  }

  .compare-row {
    grid-template-columns: minmax(170px, 1.35fr) 62px repeat(2, minmax(80px, 0.7fr)) minmax(150px, 1fr);
  }

  .compare-row > .compare-bar:nth-child(5),
  .compare-row > .compare-bar:nth-child(6) {
    display: none;
  }
}

@media (max-width: 940px) {
  .view-input {
    background: var(--paper);
  }

  .hero {
    display: block;
    width: min(760px, calc(100% - 40px));
    padding: 46px 0 56px;
  }

  .hero-eyebrow {
    margin-bottom: 24px;
  }

  .hero-title {
    max-width: 700px;
    margin-bottom: 64px;
    font-size: clamp(56px, 9vw, 78px);
  }

  .hero-title em::after {
    right: -22px;
  }

  .entry-switch {
    margin-bottom: 16px;
  }

  .hero-shell {
    display: grid;
  }

  .hero-foot {
    margin-top: 24px;
  }

  .container {
    width: min(840px, calc(100% - 40px));
    padding: 58px 0;
  }

  .view-model .container::after {
    display: none;
  }

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

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

  .brief-block:nth-child(2) { border-right: 0; }
  .brief-block:nth-child(3),
  .brief-block:nth-child(4) { border-top: 1.5px solid var(--ink); }

  .branch-grid {
    grid-template-columns: 1fr;
  }

  .branch-card {
    min-height: 330px;
  }

  .compare-row {
    grid-template-columns: minmax(180px, 1.4fr) 60px repeat(2, minmax(80px, 0.7fr));
  }

  .compare-step {
    display: none;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-side,
  .detail-main {
    max-width: 760px;
    margin: 0 auto;
  }

  .branch-image {
    min-height: min(66vw, 520px);
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 68px;
    padding: 10px 16px;
    grid-template-columns: 1fr auto;
    gap: 10px;
    background: rgba(243, 239, 229, 0.98);
  }

  .brand-dot {
    width: 32px;
    height: 32px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-right {
    gap: 5px;
  }

  .reset-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .steps {
    position: fixed;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 50;
    width: min(calc(100% - 24px), 430px);
    justify-content: space-between;
    margin: 0;
    padding: 4px;
    background: var(--white);
    box-shadow: 4px 4px 0 var(--ink);
    transform: translateX(-50%);
  }

  .steps .step {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    padding: 0 4px;
  }

  .steps .step em {
    font-size: 10px;
  }

  .view {
    min-height: calc(100vh - 68px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .hero {
    width: calc(100% - 28px);
    min-height: auto;
    padding: 34px 0 22px;
  }

  .hero-eyebrow {
    font-size: 8px;
  }

  .hero-tag {
    font-size: 16px;
  }

  .hero-title {
    margin: 10px 0 52px;
    font-size: clamp(42px, 12.5vw, 58px);
    line-height: 0.93;
    letter-spacing: -0.085em;
  }

  .hero-title em {
    margin-top: 8px;
  }

  .hero-title em::after {
    right: 0;
    bottom: -50px;
    width: 72px;
    height: 72px;
    font-size: 9px;
  }

  .entry-switch {
    width: 100%;
  }

  .entry-mode-btn {
    flex: 1;
  }

  .hero-instrument {
    height: 190px;
    min-height: 190px;
    border-radius: 26px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .hero-instrument::after {
    right: 14px;
    top: 16px;
    width: 54px;
    height: 54px;
    font-size: 7px;
  }

  .instrument-map {
    inset: 38px 34% 24px 14px;
  }

  .instrument-cards {
    right: 72px;
    bottom: 24px;
    grid-template-columns: repeat(2, 62px);
    gap: 6px;
  }

  .instrument-card {
    min-height: 38px;
    padding: 5px;
    grid-template-columns: 16px 1fr;
  }

  .instrument-card b,
  .instrument-card strong {
    font-size: 8px;
  }

  .input-wrap,
  .choice-wrap {
    border-radius: 26px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .input-panel-head,
  .choice-panel-head {
    display: block;
    padding: 18px 18px 12px;
  }

  .input-panel-head span,
  .choice-panel-head span {
    display: block;
  }

  .input-panel-head span:last-child,
  .choice-panel-head span:last-child {
    margin-top: 5px;
  }

  .decision-input {
    min-height: 184px;
    padding: 18px;
    font-size: 17px;
  }

  .input-row .primary-btn,
  .choice-start-row .primary-btn {
    width: 100%;
    justify-content: space-between;
  }

  .hero-foot {
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.5;
  }

  .life-choice-grid {
    grid-template-columns: 1fr;
  }

  .life-choice-card {
    min-height: 120px;
  }

  .container {
    width: calc(100% - 28px);
    padding: 44px 0;
  }

  .act-mark {
    margin-bottom: 18px;
  }

  .view-title {
    font-size: clamp(40px, 12vw, 58px);
  }

  .view-sub {
    margin: 18px 0 30px;
    font-size: 14px;
  }

  .radar-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .radar-cell {
    min-height: 140px;
    padding: 20px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .radar-label {
    margin-bottom: 24px;
  }

  .brief-panel {
    padding: 22px;
    border-radius: 26px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .brief-head,
  .compare-head {
    display: block;
  }

  .brief-fill-btn {
    margin-top: 14px;
  }

  .brief-grid {
    grid-template-columns: 1fr;
  }

  .brief-block,
  .brief-block:first-child {
    padding: 18px 0;
    border: 0;
    border-top: 1.5px solid var(--ink);
  }

  .branch-grid {
    gap: 16px;
  }

  .branch-card {
    min-height: 350px;
    padding: 24px;
    border-radius: 28px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .branch-card:hover {
    box-shadow: 8px 8px 0 var(--ink);
  }

  .branch-name {
    max-width: 82%;
    margin-top: 46px;
    font-size: 34px;
  }

  .branch-summary {
    max-width: 100%;
    font-size: 14px;
  }

  .branch-proof {
    align-items: flex-start;
  }

  .branch-proof em {
    white-space: normal;
  }

  .branch-stats {
    flex-wrap: wrap;
  }

  .branch-compare {
    margin-top: 34px;
    padding: 20px;
    border-radius: 26px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .compare-summary {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .compare-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 14px 4px;
  }

  .compare-row .compare-bar,
  .compare-step {
    display: none !important;
  }

  .action-row {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .action-row .hint {
    width: 100%;
    margin: 0 0 4px;
  }

  .action-row button {
    flex: 1 1 140px;
  }

  .detail-layout {
    gap: 24px;
  }

  .branch-image {
    min-height: 420px;
    border-radius: 26px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .detail-title {
    font-size: 46px;
  }

  .card,
  .life-judgement,
  .action-evidence {
    padding: 20px;
    border-radius: 20px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .score-list li {
    grid-template-columns: minmax(88px, 1fr) minmax(70px, 1fr) 26px;
  }

  .evidence-grid,
  .action-evidence-grid {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 70px 1fr;
    gap: 10px;
  }

  .chat-box {
    min-height: 300px;
  }

  .bubble {
    max-width: 92%;
  }

  .plan-grid {
    gap: 14px;
  }

  .drawer-panel {
    width: calc(100% - 12px);
    padding: 24px;
  }

  .toast {
    width: calc(100% - 32px);
    bottom: calc(78px + env(safe-area-inset-bottom));
    border-radius: 16px;
    text-align: center;
  }
}

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