:root {
  --ink: #111512;
  --ink-soft: #1b211c;
  --ink-muted: #667068;
  --paper: #f3efe5;
  --paper-deep: #e8e1d2;
  --paper-muted: #cfc9ba;
  --line: rgba(17, 21, 18, 0.14);
  --line-light: rgba(243, 239, 229, 0.16);
  --copper: #bb6747;
  --copper-deep: #8f422e;
  --sage: #c2cbb2;
  --blue: #a8c2c0;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--ink); }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr);
  background: var(--paper);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: var(--ink);
  border-bottom: 1px solid var(--line-light);
}

.wordmark, .icon-button, .avatar, .room-nav-button, .room-link, .button, .text-button {
  border: 0;
  background: transparent;
  color: inherit;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 8px 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .01em;
}

.wordmark-mark {
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: end;
  gap: 3px;
  padding: 3px 4px;
  border: 1px solid rgba(243, 239, 229, .68);
  border-radius: 50%;
}

.wordmark-mark span { display: block; width: 3px; background: var(--copper); border-radius: 2px; }
.wordmark-mark span:nth-child(1) { height: 8px; }
.wordmark-mark span:nth-child(2) { height: 13px; background: var(--sage); }
.wordmark-mark span:nth-child(3) { height: 10px; background: var(--blue); }

.topbar-right { display: flex; align-items: center; gap: 18px; }
.save-state { display: inline-flex; align-items: center; gap: 8px; color: var(--paper-muted); font-size: 12px; letter-spacing: .02em; }
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 4px rgba(194, 203, 178, .11); }
.icon-button { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--line-light); color: var(--paper); font-size: 19px; transition: background .2s ease, border-color .2s ease; }
.icon-button:hover, .avatar:hover { background: rgba(243, 239, 229, .1); border-color: rgba(243, 239, 229, .35); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-light); border-radius: 50%; color: var(--sage); font-family: var(--serif); font-size: 15px; transition: background .2s ease; }

.journey-sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  padding: 34px 24px 22px;
  background: var(--ink-soft);
  color: var(--paper);
  border-right: 1px solid var(--line-light);
}

.eyebrow { margin: 0; color: var(--copper); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-tagline { margin: 10px 0 0; color: var(--paper); font-family: var(--serif); font-size: 25px; line-height: 1.16; }
.progress-block { margin: 43px 0 20px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; color: var(--paper-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.progress-copy strong { color: var(--sage); font-weight: 600; }
.progress-track { height: 2px; margin-top: 13px; background: rgba(243,239,229,.13); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--copper); transition: width .45s ease; }

.journey-list { display: flex; flex-direction: column; gap: 3px; }
.room-link { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) 12px; align-items: center; gap: 8px; padding: 10px 8px; color: var(--paper-muted); text-align: left; transition: color .2s ease, background .2s ease; }
.room-link:hover { color: var(--paper); background: rgba(243,239,229,.05); }
.room-link.active { color: var(--paper); background: rgba(243,239,229,.09); }
.room-link.complete { color: var(--sage); }
.room-index { color: var(--copper); font-size: 11px; font-variant-numeric: tabular-nums; }
.room-link.complete .room-index { color: var(--sage); }
.room-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.room-glyph { color: var(--paper-muted); font-size: 12px; opacity: .6; }
.room-link.complete .room-glyph { color: var(--sage); opacity: 1; }
.sidebar-foot { display: flex; gap: 9px; align-items: flex-start; margin-top: auto; padding-top: 24px; color: rgba(243,239,229,.53); font-size: 11px; line-height: 1.45; }
.status-mark { color: var(--copper); font-size: 12px; }

.main-stage { min-width: 0; min-height: calc(100vh - 76px); background: var(--paper); color: var(--ink); overflow: hidden; }
.stage-inner { width: min(1110px, 100%); margin: 0 auto; padding: 56px clamp(28px, 6vw, 90px) 82px; }

.welcome-stage { min-height: calc(100vh - 76px); position: relative; display: flex; align-items: center; overflow: hidden; background: var(--paper); }
.welcome-stage::before { content: ""; position: absolute; width: 42vw; height: 42vw; min-width: 390px; min-height: 390px; right: -13vw; top: -11vw; border: 1px solid rgba(17,21,18,.11); border-radius: 50%; }
.welcome-stage::after { content: ""; position: absolute; width: 25vw; height: 25vw; min-width: 220px; min-height: 220px; right: 7vw; top: 8vw; border: 1px solid rgba(187,103,71,.23); border-radius: 50%; }
.welcome-inner { position: relative; z-index: 1; width: min(1040px, 100%); margin: 0 auto; padding: 72px clamp(28px, 7vw, 100px); }
.welcome-kicker { display: flex; align-items: center; gap: 12px; color: var(--copper-deep); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.welcome-kicker::before { content: ""; display: block; width: 34px; height: 1px; background: var(--copper); }
.welcome-title { max-width: 760px; margin: 24px 0 24px; font-family: var(--serif); font-size: clamp(48px, 7vw, 94px); font-weight: 400; letter-spacing: 0; line-height: .98; }
.welcome-title em { color: var(--copper-deep); font-style: italic; }
.welcome-dek { max-width: 550px; margin: 0; color: #4a544d; font-size: 18px; line-height: 1.55; }
.welcome-actions { display: flex; align-items: flex-end; gap: 18px; margin-top: 38px; }
.welcome-entry { display: flex; flex-direction: column; gap: 8px; width: 210px; }
.entry-label { color: var(--ink-muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.entry-input { height: 40px; background: rgba(255,255,255,.35); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 19px; font-size: 13px; font-weight: 700; letter-spacing: .02em; transition: transform .2s ease, background .2s ease, color .2s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--ink); color: var(--paper); }
.button-primary:hover { background: var(--copper-deep); }
.button-secondary { padding-left: 0; color: var(--ink); border-bottom: 1px solid var(--ink); }
.button-secondary:hover { color: var(--copper-deep); border-color: var(--copper-deep); }
.welcome-note { max-width: 440px; margin-top: 62px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; }
.welcome-note strong { color: var(--ink); font-weight: 700; }

.home-stage { background: var(--paper); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); gap: 72px; align-items: start; }
.home-title { max-width: 740px; margin: 17px 0 20px; font-family: var(--serif); font-size: clamp(42px, 5.3vw, 74px); font-weight: 400; line-height: 1.02; }
.home-title em { color: var(--copper-deep); font-style: italic; }
.home-dek { max-width: 570px; margin: 0; color: #4d574f; font-size: 17px; }
.current-room { margin-top: 54px; padding-top: 21px; border-top: 1px solid var(--line); }
.current-room-label { display: flex; justify-content: space-between; align-items: center; gap: 18px; color: var(--ink-muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.current-room-label strong { color: var(--ink); font-weight: 700; }
.current-room-title { margin: 11px 0 8px; font-family: var(--serif); font-size: 29px; font-weight: 400; }
.current-room-copy { max-width: 550px; margin: 0; color: #536058; }
.room-link-button { display: inline-flex; align-items: center; gap: 9px; margin-top: 22px; padding: 0 0 4px; border-bottom: 1px solid var(--ink); color: var(--ink); font-weight: 700; }
.room-link-button:hover { color: var(--copper-deep); border-color: var(--copper-deep); }
.ritual-card { padding: 28px; background: var(--ink); color: var(--paper); }
.ritual-card .eyebrow { color: var(--sage); }
.ritual-card h2 { margin: 15px 0 12px; font-family: var(--serif); font-size: 29px; font-weight: 400; line-height: 1.1; }
.ritual-card p { margin: 0; color: var(--paper-muted); font-size: 14px; line-height: 1.55; }
.ritual-line { display: flex; align-items: center; gap: 10px; margin-top: 30px; color: var(--paper); font-size: 12px; }
.ritual-line::before { content: ""; display: block; width: 28px; height: 1px; background: var(--copper); }
.home-quiet { margin-top: 65px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; }
.home-quiet strong { color: var(--ink); }

.room-stage { min-height: calc(100vh - 76px); background: var(--paper); }
.room-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.room-number { color: var(--copper-deep); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.room-title { max-width: 720px; margin: 13px 0 12px; font-family: var(--serif); font-size: clamp(42px, 5.3vw, 70px); font-weight: 400; line-height: 1; }
.room-subtitle { max-width: 620px; margin: 0; color: #536058; font-size: 16px; line-height: 1.5; }
.room-switcher { display: flex; gap: 7px; padding-top: 3px; }
.room-nav-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink); font-size: 18px; }
.room-nav-button:hover:not(:disabled) { border-color: var(--copper); color: var(--copper-deep); }
.room-nav-button:disabled { color: #a9a59a; cursor: not-allowed; }
.room-content { display: grid; grid-template-columns: minmax(0, .83fr) minmax(350px, 1.17fr); gap: clamp(40px, 7vw, 110px); padding-top: 42px; }
.room-landing { position: sticky; top: 28px; align-self: start; }
.arrival-label { display: flex; align-items: center; gap: 10px; color: var(--copper-deep); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.arrival-label::before { content: ""; width: 23px; height: 1px; background: var(--copper); }
.arrival-copy { margin: 16px 0 0; font-family: var(--serif); font-size: 25px; line-height: 1.25; }
.breath-control { display: flex; align-items: center; gap: 13px; margin-top: 29px; color: var(--ink-muted); font-size: 12px; }
.breath-button { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--copper); border-radius: 50%; background: transparent; color: var(--copper-deep); font-size: 18px; transition: background .25s ease, color .25s ease, transform .25s ease; }
.breath-button:hover { background: var(--copper); color: var(--paper); transform: scale(1.05); }
.breath-button.marked { background: var(--copper); color: var(--paper); }
.room-essay { margin-top: 54px; padding-top: 19px; border-top: 1px solid var(--line); color: #69736b; font-size: 12px; line-height: 1.6; }
.room-essay strong { color: var(--ink); font-weight: 700; }
.room-form { min-width: 0; }
.carry-block { margin-bottom: 31px; padding: 18px 0 22px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.carry-block .field-label { color: var(--copper-deep); }
.field-label { display: block; margin-bottom: 9px; color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.field-note { margin: -2px 0 12px; color: var(--ink-muted); font-size: 12px; }
.text-input, .text-area, .select-input { width: 100%; border: 1px solid rgba(17,21,18,.26); border-radius: 0; background: rgba(255,255,255,.26); color: var(--ink); outline: none; transition: border-color .2s ease, background .2s ease; }
.text-input { height: 44px; padding: 0 12px; }
.text-area { min-height: 132px; padding: 12px; resize: vertical; line-height: 1.55; }
.text-area.large { min-height: 186px; }
.text-input:focus, .text-area:focus, .select-input:focus { border-color: var(--copper); background: rgba(255,255,255,.56); }
.text-input::placeholder, .text-area::placeholder { color: #92968d; }
.question-block { margin-bottom: 31px; }
.question-index { margin-bottom: 7px; color: var(--ink-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.question-prompt { margin: 0 0 13px; font-family: var(--serif); font-size: 23px; line-height: 1.25; }
.question-help { margin: -4px 0 12px; color: var(--ink-muted); font-size: 12px; }
.schedule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.schedule-grid .text-input { background: rgba(255,255,255,.26); }
.check-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; color: #536058; font-size: 12px; }
.check-row input { margin: 3px 0 0; accent-color: var(--copper-deep); }
.form-bottom { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 12px; padding-top: 21px; border-top: 1px solid var(--line); }
.form-status { color: var(--ink-muted); font-size: 12px; }
.form-actions { display: flex; align-items: center; gap: 9px; }
.button-dark { background: var(--ink); color: var(--paper); }
.button-dark:hover { background: var(--copper-deep); }
.button-light { border: 1px solid var(--line); color: var(--ink); }
.button-light:hover { border-color: var(--copper); color: var(--copper-deep); }

.locked-stage { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 50px; }
.locked-panel { width: min(500px, 100%); text-align: center; }
.locked-symbol { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 23px; border: 1px solid var(--copper); border-radius: 50%; color: var(--copper-deep); font-size: 23px; }
.locked-panel h1 { margin: 0 0 15px; font-family: var(--serif); font-size: 42px; font-weight: 400; }
.locked-panel p { margin: 0 auto; color: #536058; }

.handoff-stage { background: var(--paper); }
.handoff-intro { max-width: 760px; padding-bottom: 35px; border-bottom: 1px solid var(--line); }
.handoff-title { margin: 15px 0 17px; font-family: var(--serif); font-size: clamp(43px, 5vw, 70px); font-weight: 400; line-height: .99; }
.handoff-title em { color: var(--copper-deep); font-style: italic; }
.handoff-intro p { max-width: 640px; margin: 0; color: #536058; font-size: 16px; }
.handoff-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 55px; padding-top: 38px; }
.output-wrap { min-width: 0; }
.finishing-checkpoint { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-bottom: 31px; padding: 22px 0 24px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.finishing-checkpoint h2 { margin: 10px 0 9px; font-family: var(--serif); font-size: 28px; font-weight: 400; line-height: 1.1; }
.finishing-checkpoint p:not(.eyebrow) { max-width: 610px; margin: 0; color: #536058; font-size: 13px; line-height: 1.55; }
.checkpoint-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 270px; }
.output-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.output-label { color: var(--ink-muted); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.output-actions { display: flex; gap: 8px; }
.mini-button { min-height: 33px; padding: 0 11px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 11px; font-weight: 700; }
.mini-button:hover { border-color: var(--copper); color: var(--copper-deep); }
.output-box { min-height: 520px; max-height: 680px; overflow: auto; padding: 24px; border: 1px solid rgba(17,21,18,.22); background: #faf8f2; color: #293129; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.handoff-aside { align-self: start; padding-top: 3px; }
.aside-block { padding: 17px 0 22px; border-top: 2px solid var(--ink); }
.aside-block + .aside-block { margin-top: 22px; }
.aside-block h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 22px; font-weight: 400; }
.aside-block p { margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 1.55; }
.aside-list { margin: 0; padding: 0; list-style: none; color: #536058; font-size: 12px; }
.aside-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.aside-list li:last-child { border-bottom: 0; }
.output-footnote { margin-top: 15px; color: var(--ink-muted); font-size: 11px; }

.settings-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain; padding: 20px; background: rgba(17,21,18,.72); }
.settings-panel { width: min(500px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; padding: 30px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.settings-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settings-panel h2 { margin: 0; font-family: var(--serif); font-size: 31px; font-weight: 400; }
.close-button { width: 31px; height: 31px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 17px; }
.settings-panel .field-group { margin-top: 28px; }
.settings-copy { margin: 10px 0 0; color: var(--ink-muted); font-size: 12px; }
.settings-backup { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-backup .field-label { margin-bottom: 0; }
.compact-field { margin-top: 16px; }
.settings-warning { margin: 12px 0 0; color: var(--copper-deep); font-size: 12px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.settings-actions { display: flex; justify-content: space-between; gap: 15px; margin-top: 28px; }
.danger-button { color: var(--copper-deep); border-bottom: 1px solid var(--copper); }

.toast { position: fixed; right: 25px; bottom: 25px; z-index: 20; max-width: 300px; padding: 11px 14px; background: var(--ink); color: var(--paper); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .journey-sidebar { padding-left: 18px; padding-right: 16px; }
  .stage-inner { padding-left: 38px; padding-right: 38px; }
  .room-content { gap: 38px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .topbar { height: 64px; padding: 0 18px; }
  .save-state { display: none; }
  .journey-sidebar { position: sticky; top: 0; z-index: 5; display: block; padding: 12px 18px 11px; border-right: 0; border-bottom: 1px solid var(--line-light); }
  .sidebar-intro, .progress-block, .sidebar-foot { display: none; }
  .journey-list { flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .journey-list::-webkit-scrollbar { display: none; }
  .room-link { width: auto; min-width: 48px; grid-template-columns: 1fr; justify-items: center; gap: 2px; padding: 7px 9px; }
  .room-name { display: none; }
  .room-glyph { display: none; }
  .room-index { font-size: 11px; }
  .main-stage { min-height: calc(100vh - 117px); }
  .welcome-stage, .room-stage, .locked-stage { min-height: calc(100vh - 117px); }
  .welcome-inner, .stage-inner { padding: 51px 22px 67px; }
  .welcome-title { max-width: 680px; font-size: clamp(46px, 13vw, 64px); }
  .welcome-dek { font-size: 16px; }
  .welcome-stage::before { width: 90vw; height: 90vw; right: -43vw; top: -20vw; }
  .welcome-stage::after { width: 52vw; height: 52vw; right: -7vw; top: 19vw; }
  .home-grid, .room-content, .handoff-layout { grid-template-columns: 1fr; gap: 39px; }
  .home-title { font-size: clamp(45px, 13vw, 68px); }
  .current-room { margin-top: 42px; }
  .ritual-card { max-width: 460px; }
  .room-top { padding-bottom: 27px; }
  .room-title { font-size: clamp(43px, 13vw, 67px); }
  .room-switcher { padding-top: 0; }
  .room-landing { position: static; }
  .room-essay { margin-top: 32px; }
  .room-form { padding-top: 0; }
  .handoff-title { font-size: clamp(45px, 13vw, 69px); }
  .finishing-checkpoint { grid-template-columns: 1fr; align-items: start; }
  .checkpoint-actions { justify-content: flex-start; min-width: 0; }
  .output-box { max-height: none; min-height: 480px; }
  .handoff-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .aside-block + .aside-block { margin-top: 0; }
}

@media (max-width: 600px) {
  .welcome-inner { width: 100%; max-width: 390px; margin-left: 0; margin-right: auto; }
  .welcome-title { max-width: 330px; font-size: 44px; line-height: 1.06; }
  .welcome-dek { max-width: 330px; }
  .welcome-actions { align-items: stretch; flex-direction: column; gap: 16px; }
  .welcome-entry { width: 100%; }
  .button-primary { width: 100%; }
}

@media (max-width: 480px) {
  .topbar-right { gap: 9px; }
  .wordmark { font-size: 17px; }
  .welcome-title { max-width: 320px; font-size: 42px; line-height: 1.06; }
  .form-bottom { align-items: flex-start; flex-direction: column; }
  .form-actions { width: 100%; flex-direction: column; }
  .form-bottom .button, .form-actions .button { width: 100%; }
  .checkpoint-actions { width: 100%; flex-direction: column; }
  .checkpoint-actions .button { width: 100%; }
  .schedule-grid, .handoff-aside { grid-template-columns: 1fr; }
}
