:root {
  --paper: #f4efe3;
  --paper-light: #fffaf0;
  --paper-panel: #fbf6ea;
  --paper-muted: #eee5d4;
  --ink: #1f1d19;
  --ink-soft: #5f584c;
  --ink-muted: #8a8070;
  --line: #d8cbb6;
  --line-strong: #b9aa92;
  --seal: #9d2f28;
  --seal-soft: #f4e1dc;
  --shadow: 0 18px 48px rgba(54, 45, 31, 0.18);
  color: var(--ink);
  background: var(--paper);
  font-family:
    "Noto Serif SC", "Source Han Serif SC", ui-serif, Georgia, "Times New Roman",
    "Noto Sans SC", system-ui, sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(115, 92, 57, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(115, 92, 57, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(157, 47, 40, 0.08), transparent 24%),
    #e7ddcc;
  background-size: 28px 28px, 28px 28px, auto;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(157, 47, 40, 0.38);
  outline-offset: 3px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(280px, 380px);
  gap: 22px;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  padding: 24px;
}

.phone {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  width: min(100%, 430px);
  height: min(860px, calc(100vh - 48px));
  min-height: min(860px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.status-bar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-panel);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.22;
  color: var(--ink);
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.icon-text-button,
.icon-button,
.choice-button,
.anchor-button,
.restart-button {
  border: 1px solid var(--line-strong);
  background: var(--paper-light);
  color: var(--ink);
  cursor: pointer;
}

.icon-text-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
}

.task-strip {
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr 0.68fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.task-strip div {
  min-width: 0;
  padding: 12px 14px;
  background: var(--paper-light);
}

.task-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.task-strip strong {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.3;
}

.story-area {
  grid-row: 4;
  overflow: auto;
  min-height: 0;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 120px),
    var(--paper-light);
}

.background-block {
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.82;
}

.state-echoes {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.state-echoes h2 {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.state-echo {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--seal);
  border-radius: 6px;
  background: var(--paper-panel);
}

.state-echo h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.92rem;
}

.state-echo p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.58;
}

.guidance-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--seal);
  border-radius: 6px;
  background: var(--paper-panel);
}

.guidance-panel h2 {
  margin-bottom: 6px;
  color: var(--seal);
  font-size: 0.9rem;
}

.guidance-panel p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.recovery-notice {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--seal);
  border-radius: 6px;
  background: var(--seal-soft);
}

.recovery-notice h2 {
  margin-bottom: 6px;
  color: var(--seal);
  font-size: 0.9rem;
}

.recovery-notice p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.experimental-notice,
.surface-fallback {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--seal);
  border-left: 4px solid var(--seal);
  border-radius: 6px;
  background: var(--seal-soft);
}

.experimental-notice h2 {
  margin-bottom: 8px;
  color: var(--seal);
  font-size: 1rem;
}

.experimental-notice p,
.surface-fallback-body {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.surface-fallback-label {
  margin-bottom: 6px;
  color: var(--seal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.fallback-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.fragment-surface {
  margin-bottom: 10px;
  line-height: 1.72;
}

.anchor-button {
  display: inline;
  min-height: 28px;
  margin: 0 2px;
  padding: 1px 4px;
  border: 0;
  border-bottom: 1px solid var(--seal);
  border-radius: 3px;
  background: rgba(157, 47, 40, 0.08);
  color: var(--ink);
  font-weight: 700;
  line-height: inherit;
}

.anchor-button.opened {
  border-bottom-color: var(--line-strong);
  background: rgba(31, 29, 25, 0.06);
  color: var(--ink-soft);
}

.anchor-button.active {
  border-bottom-color: var(--seal);
  background: var(--seal-soft);
  color: var(--seal);
}

.evidence-card {
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--seal);
  border-radius: 6px;
  background: var(--paper-panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.evidence-card.depth-2 {
  border-left-color: var(--ink-soft);
  background: #f7efe0;
}

.evidence-card.depth-3 {
  border-left-color: var(--line-strong);
  background: #f2eadc;
}

.evidence-card h3 {
  margin-bottom: 8px;
  font-size: 0.96rem;
}

.evidence-body {
  margin-bottom: 10px;
  line-height: 1.72;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--paper-muted);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.outcome-panel {
  grid-row: 3;
  margin: 14px 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-panel);
  color: var(--ink-soft);
  line-height: 1.5;
}

.choice-area {
  grid-row: 5;
  display: grid;
  gap: 8px;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: visible;
  max-height: none;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper-panel);
}

.choice-button {
  display: grid;
  gap: 4px;
  min-height: 48px;
  padding: 9px 11px;
  border-radius: 6px;
  text-align: left;
  overflow-wrap: anywhere;
}

.choice-button:hover,
.anchor-button:hover,
.icon-text-button:hover,
.restart-button:hover {
  border-color: var(--seal);
  background: #fff6ef;
}

.choice-button.locked {
  cursor: not-allowed;
  opacity: 0.48;
}

.choice-button.newly-unlocked {
  border-color: var(--seal);
  background: var(--seal-soft);
  box-shadow: inset 3px 0 0 var(--seal);
}

.choice-title {
  font-weight: 800;
  line-height: 1.25;
}

.choice-description {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.choice-area.compact .choice-button {
  min-height: 42px;
  padding: 8px 10px;
}

.choice-area.compact .choice-description {
  font-size: 0.78rem;
  line-height: 1.28;
}

.choice-area.cozy .choice-button {
  min-height: 52px;
}

.choice-requirement {
  color: var(--seal);
  font-size: 0.75rem;
  font-weight: 700;
}

.choice-empty {
  min-height: 46px;
  padding: 13px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.path-panel {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(251, 246, 234, 0.94);
  box-shadow: 0 20px 50px rgba(54, 45, 31, 0.12);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.path-map-content {
  overflow: auto;
  max-height: calc(100vh - 128px);
  padding: 14px 18px 18px;
}

.path-scene {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.path-scene.visited h3::after {
  content: " 已到达";
  color: var(--seal);
  font-size: 0.72rem;
  font-weight: 800;
}

.path-scene h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.path-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.path-pill {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--paper-muted);
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.path-pill.active {
  background: var(--seal-soft);
  color: var(--seal);
  font-weight: 800;
}

.path-pill.chosen {
  background: #efe1c9;
  color: var(--ink);
  font-weight: 800;
}

.ending-screen {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100%;
}

.review-screen {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100%;
}

.ending-screen h2 {
  font-size: 1.4rem;
}

.review-screen h2 {
  margin-bottom: 0;
  font-size: 1.22rem;
}

.ending-body {
  line-height: 1.75;
}

.review-body {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.72;
}

.chapter-flow {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.chapter-flow h3 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.chapter-flow-nodes {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-flow-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 10px;
  position: relative;
  min-height: 86px;
}

.flow-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-light);
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.chapter-flow-node.visited .flow-marker {
  border-color: var(--seal);
  background: var(--seal-soft);
  color: var(--seal);
}

.chapter-flow-node.current .flow-marker {
  border-color: var(--ink);
  background: var(--paper-muted);
  color: var(--ink);
}

.flow-body {
  min-width: 0;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-light);
}

.chapter-flow-node.current .flow-body {
  border-color: var(--line-strong);
  background: var(--paper-panel);
}

.flow-body h4 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 0.92rem;
}

.flow-meta {
  margin-bottom: 8px;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.flow-branches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-branches li {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--paper-muted);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.flow-branches li.chosen {
  background: var(--seal-soft);
  color: var(--seal);
}

.flow-branches li.available {
  background: var(--paper-muted);
  color: var(--ink-muted);
}

.flow-branches li.unlocked {
  background: #efe1c9;
  color: var(--ink);
}

.flow-branches li.pending {
  border: 1px dashed var(--line-strong);
  background: var(--paper-panel);
  color: var(--ink-soft);
}

.flow-branches li.locked {
  border: 1px dashed #c9aba7;
  background: #f2e5e1;
  color: var(--seal);
}

.flow-connector {
  grid-column: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  margin-top: -12px;
  color: var(--ink-muted);
  font-weight: 900;
}

.profile-section {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.profile-section h3 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.profile-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-list li {
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--paper-muted);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
}

.continue-button {
  border-color: var(--seal);
  background: var(--seal-soft);
}

.restart-button {
  min-height: 46px;
  border-radius: 6px;
  font-weight: 800;
}

.loading-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-light);
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .phone {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .path-panel {
    position: fixed;
    inset: 12px;
    display: none;
    z-index: 10;
  }

  .path-panel.open {
    display: block;
  }

  .review-screen {
    gap: 8px;
  }

  .review-screen h2 {
    font-size: 1.12rem;
  }

  .review-body {
    line-height: 1.55;
  }

  .chapter-flow {
    gap: 7px;
    padding: 8px 0;
  }

  .chapter-flow h3 {
    font-size: 0.86rem;
  }

  .chapter-flow-node {
    min-height: auto;
    column-gap: 8px;
  }

  .flow-body {
    margin-bottom: 6px;
    padding: 7px;
  }

  .flow-body h4 {
    margin-bottom: 3px;
    font-size: 0.88rem;
  }

  .flow-meta {
    margin-bottom: 5px;
    font-size: 0.72rem;
  }

  .flow-branches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding-bottom: 0;
  }

  .flow-branches li {
    min-width: 0;
    max-width: 100%;
    padding: 3px 5px;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.66rem;
    line-height: 1.22;
  }

  .flow-connector {
    height: 16px;
    margin-top: -8px;
  }

  .profile-section {
    padding: 10px 0;
  }
}
