:root {
  color-scheme: light;
  --canvas: #e8e3da;
  --paper: #fbf8f1;
  --paper-deep: #f1eadf;
  --ink: #252824;
  --muted: #716f67;
  --line: #d8d0c4;
  --accent: #b8583d;
  --accent-soft: #f1d8cb;
  --sage: #647565;
  --sage-soft: #dce5da;
  --night: #273033;
  --white: #ffffff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow: 0 24px 70px rgb(38 35 29 / 16%);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [contenteditable="true"]:focus-visible { outline: 3px solid #1872b7; outline-offset: 2px; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .75rem 1rem; background: var(--ink); color: white; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.prototype-lab { min-height: 100vh; display: grid; grid-template-columns: minmax(270px, 360px) 1fr; }
.review-panel { padding: clamp(2rem, 5vw, 5rem); padding-right: 2rem; display: flex; flex-direction: column; align-items: flex-start; }
.eyebrow, .microcopy { margin: 0; color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.review-panel h1 { margin: .35rem 0 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: clamp(3.5rem, 7vw, 6.5rem); font-weight: 500; line-height: .95; letter-spacing: -.08em; }
.review-lede { max-width: 17rem; margin: 1rem 0 2.25rem; color: #4e504c; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.08rem; line-height: 1.75; }
.screen-picker { width: 100%; display: grid; border-top: 1px solid #c8c0b4; }
.screen-picker__item { display: grid; grid-template-columns: 2.2rem 1fr; gap: .5rem; width: 100%; padding: .85rem .25rem; border: 0; border-bottom: 1px solid #c8c0b4; background: transparent; text-align: left; font-weight: 680; }
.screen-picker__item span { color: #8c877e; font-size: .72rem; }
.screen-picker__item.is-active { color: var(--accent); padding-left: .75rem; }
.review-note { margin-top: 2.25rem; padding: 1rem 1.1rem; border-left: 3px solid var(--sage); background: rgb(255 255 255 / 38%); }
.review-note h2 { margin: 0 0 .5rem; font-size: .82rem; }
.review-note ol { margin: 0; padding-left: 1.2rem; color: #555750; font-size: .78rem; line-height: 1.7; }
.fiction-notice { margin-top: auto; padding-top: 2rem; color: #77736b; font-size: .72rem; }

.device-stage { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--paper-deep); border-left: 1px solid #d3cbc0; }
.phone { position: relative; width: min(390px, calc(100vw - 2rem)); height: min(844px, calc(100vh - 3rem)); min-height: 680px; overflow: hidden; border: 8px solid #151817; border-radius: 44px; background: var(--paper); box-shadow: var(--shadow); }
.phone__speaker { position: absolute; z-index: 10; top: 8px; left: 50%; width: 82px; height: 23px; border-radius: 0 0 15px 15px; background: #151817; transform: translateX(-50%); }
.status-bar { height: 35px; padding: 9px 18px 0; display: flex; justify-content: space-between; font-size: .66rem; font-weight: 700; }
.screens { height: calc(100% - 95px); }
.screen { height: 100%; display: flex; flex-direction: column; background: var(--paper); }
.screen[hidden] { display: none; }
.screen-scroll { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.screen-scroll::-webkit-scrollbar { display: none; }
.app-header { min-height: 65px; padding: .6rem .85rem .7rem; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; border-bottom: 1px solid var(--line); background: rgb(251 248 241 / 96%); }
.app-header--roomy { grid-template-columns: 1fr auto; min-height: 82px; padding: .75rem 1rem 1rem; }
.app-header h2 { margin: .15rem 0 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.15rem; line-height: 1.25; }
.app-header--roomy h2 { font-size: 1.55rem; }
.app-header__center { text-align: center; }
.icon-button, .plain-button { border: 0; background: transparent; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; font-size: 1.35rem; }
.icon-button:hover { background: var(--paper-deep); }
.plain-button { padding: .45rem .2rem; color: var(--accent); font-size: .78rem; font-weight: 700; }
.header-spacer { width: 38px; }
.avatar-pair { display: flex; border: 0; background: transparent; }
.avatar-pair span, .mini-avatar { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 2px solid var(--paper); border-radius: 50%; background: var(--accent-soft); color: #7c3322; font-size: .68rem; font-weight: 800; }
.avatar-pair span + span { margin-left: -7px; background: var(--sage-soft); color: #405345; }
.mini-avatar--ink { background: var(--sage-soft); color: #405345; }

.timeline-content { padding: 0 1rem 2rem; }
.today-prompt { margin: .9rem 0 1.1rem; padding: .85rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; border: 1px solid #dac5b8; border-radius: var(--radius-md); background: #f8eae0; }
.today-prompt p { margin: .1rem 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: .94rem; }
.today-prompt .today-prompt__date { color: var(--muted); font-family: inherit; font-size: .68rem; }
.round-action { flex: 0 0 auto; padding: .6rem .75rem; border: 0; border-radius: 999px; background: var(--accent); color: white; font-size: .74rem; font-weight: 750; }
.month-divider { display: flex; align-items: center; gap: .7rem; margin: 1.2rem 0 .7rem; color: var(--muted); font-size: .68rem; letter-spacing: .08em; }
.month-divider::before, .month-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.memory-card { overflow: hidden; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fffdf8; }
.memory-card--text { border-left: 4px solid var(--sage); }
.photo-art { position: relative; height: 180px; overflow: hidden; background: #d98862; }
.photo-art::before { content: ""; position: absolute; inset: 55% 0 0; background: #567579; }
.photo-art .sun { position: absolute; width: 58px; height: 58px; right: 48px; top: 34px; border-radius: 50%; background: #f4d2a1; }
.photo-art .shore { position: absolute; left: -10%; right: -10%; bottom: -35px; height: 90px; border-radius: 50% 50% 0 0; background: #263d40; transform: rotate(-4deg); }
.figure { position: absolute; bottom: 20px; width: 13px; height: 45px; border-radius: 10px 10px 2px 2px; background: #1f292a; }
.figure::before { content: ""; position: absolute; left: 1px; top: -9px; width: 11px; height: 11px; border-radius: 50%; background: inherit; }
.figure--one { left: 43%; transform: rotate(-3deg); }
.figure--two { left: 51%; height: 50px; transform: rotate(3deg); }
.memory-card__body { padding: .9rem .95rem .65rem; }
.memory-card__meta { margin: 0 0 .4rem; color: var(--accent); font-size: .68rem; font-weight: 750; }
.memory-card h3, .voice-entry h3 { margin: 0 0 .45rem; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.16rem; }
.memory-card p, .voice-entry p { line-height: 1.65; }
.memory-card__body > p:not(.memory-card__meta) { margin: 0; color: #4f504c; font-family: "Iowan Old Style", "Songti SC", serif; font-size: .84rem; }
.author-line { display: flex; align-items: center; gap: .35rem; margin-top: .7rem; color: var(--muted); font-size: .65rem; }
.author-line .mini-avatar { width: 23px; height: 23px; }
.dot { color: #aaa398; }
.text-link { width: 100%; padding: .72rem .95rem; display: flex; justify-content: space-between; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--accent); font-size: .72rem; font-weight: 750; }

.chat-content, .confirm-content, .perspective-content, .memoir-content { padding: 1rem; }
.day-label { margin: 0 0 1rem; color: var(--muted); text-align: center; font-size: .65rem; }
.message { max-width: 86%; margin-bottom: .85rem; padding: .8rem .9rem; border-radius: var(--radius-md); font-family: "Iowan Old Style", "Songti SC", serif; font-size: .86rem; line-height: 1.6; }
.message p { margin: 0; }
.message--guide { display: flex; gap: .55rem; background: var(--sage-soft); border-bottom-left-radius: 4px; }
.message--me { margin-left: auto; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.guide-mark { color: var(--sage); font-family: sans-serif; }
.journal-input { display: grid; gap: .45rem; margin-top: 1.25rem; color: var(--muted); font-size: .7rem; }
textarea, input[type="text"], input[type="date"] { width: 100%; border: 1px solid var(--line); background: #fffdf9; color: var(--ink); }
textarea { resize: vertical; padding: .75rem; border-radius: var(--radius-md); line-height: 1.55; }
.composer-tools { display: flex; justify-content: space-between; margin-top: .6rem; }
.composer-tools button { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: .7rem; }
.sticky-action { padding: .65rem .9rem .75rem; border-top: 1px solid var(--line); background: #fffdf8; }
.sticky-action p { margin: .4rem 0 0; color: var(--muted); text-align: center; font-size: .62rem; }
.sticky-action--split { display: grid; grid-template-columns: 1fr 1.25fr; gap: .6rem; }
.primary-button, .secondary-button { width: 100%; min-height: 43px; border-radius: 999px; font-size: .78rem; font-weight: 750; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: white; }
.primary-button--ink { border-color: var(--night); background: var(--night); }
.secondary-button { border: 1px solid var(--line); background: white; }

.draft-status { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .75rem; color: var(--sage); font-size: .67rem; font-weight: 750; }
.draft-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.field-row { padding: .75rem; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fffdf9; font-size: .74rem; }
.field-row input { width: auto; padding: .25rem; border: 0; color: var(--accent); font-weight: 700; }
.paper-card { margin-top: .8rem; padding: 1.2rem 1rem; border: 1px solid #d9cec0; background: #fffdf8; box-shadow: 0 10px 22px rgb(70 58 44 / 7%); }
.paper-card__date { margin: 0 0 .85rem; color: var(--muted); font-size: .66rem; letter-spacing: .08em; }
.paper-card h3 { margin: 0 0 .7rem; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.3rem; }
.paper-card > p:not(.paper-card__date) { margin: .55rem 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: .83rem; line-height: 1.75; }
.edit-hint { margin-top: .6rem; padding: .3rem 0; border: 0; background: transparent; color: var(--accent); font-size: .65rem; }
.visibility-card { margin-top: .8rem; padding: .85rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-radius: var(--radius-md); background: var(--sage-soft); }
.visibility-card h3 { margin: 0 0 .2rem; font-size: .78rem; }
.visibility-card p { margin: 0; color: #536156; font-size: .66rem; line-height: 1.5; }
.lock-badge { padding: .35rem .5rem; border: 1px solid #92a393; border-radius: 999px; color: #405345; font-size: .62rem; font-weight: 750; }

.photo-art--wide { height: 155px; margin: -1rem -1rem 1rem; }
.voice-entry { margin-bottom: .8rem; padding: 1rem; border-radius: var(--radius-md); }
.voice-entry--warm { background: #f5e4d8; }
.voice-entry--cool { background: var(--sage-soft); }
.voice-entry__author { display: flex; align-items: center; gap: .45rem; margin-bottom: .65rem; font-size: .68rem; }
.voice-entry__author span:last-child { margin-left: auto; color: var(--muted); }
.voice-entry p { margin: 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: .82rem; }
.comments { margin-top: 1.15rem; }
.comments > h3 { font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.05rem; }
.comment { display: flex; gap: .55rem; align-items: flex-start; }
.comment p { margin: .25rem 0; font-size: .76rem; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-top: .75rem; }
.comment-form input { min-width: 0; padding: .65rem .75rem; border-radius: 999px; }
.comment-form button { padding: .55rem .8rem; border: 0; border-radius: 999px; background: var(--night); color: white; font-size: .7rem; }

.chapter-marker { display: flex; align-items: center; gap: .6rem; color: var(--accent); font-size: .67rem; letter-spacing: .08em; }
.chapter-marker i { height: 1px; flex: 1; background: var(--line); }
.memoir-title-field, .memoir-editor { display: grid; gap: .4rem; margin-top: 1rem; color: var(--muted); font-size: .68rem; }
.memoir-title-field input { padding: .65rem 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 1.2rem; }
.selected-materials { margin-top: 1.15rem; padding: .9rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fffdf8; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: .75rem; }
.section-heading h3 { margin: .2rem 0 0; font-family: "Iowan Old Style", "Songti SC", serif; }
.section-heading button { border: 0; background: transparent; color: var(--accent); font-size: .7rem; font-weight: 750; }
.material-row { display: grid; grid-template-columns: 45px 1fr auto; gap: .65rem; align-items: center; padding: .6rem 0; border-top: 1px solid #e5ddd2; }
.material-thumb { width: 45px; height: 45px; border-radius: var(--radius-sm); background: #d98862; border-bottom: 15px solid #567579; }
.material-thumb--paper { display: grid; place-items: center; border: 1px solid #d8cdbc; background: var(--paper-deep); color: var(--accent); font-family: serif; }
.material-row strong, .material-row span { display: block; }
.material-row strong { font-family: "Iowan Old Style", "Songti SC", serif; font-size: .78rem; }
.material-row span { margin-top: .18rem; color: var(--muted); font-size: .62rem; }
.material-row .drag-handle { padding: .5rem; color: #aaa398; font-size: 1rem; }
.memoir-editor textarea { font-family: "Iowan Old Style", "Songti SC", serif; font-size: .82rem; }
.source-note { margin: .75rem 0 0; color: var(--muted); font-size: .64rem; line-height: 1.55; }

.bottom-nav { height: 60px; padding: .35rem .6rem .5rem; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: #fffdf8; }
.bottom-nav button { display: grid; place-items: center; gap: .05rem; border: 0; background: transparent; color: #88837a; font-size: .58rem; }
.bottom-nav button span { font-size: 1.05rem; line-height: 1; }
.bottom-nav button.is-active { color: var(--accent); font-weight: 750; }
.home-indicator { position: absolute; z-index: 8; left: 50%; bottom: 3px; width: 120px; height: 4px; border-radius: 999px; background: #171918; transform: translateX(-50%); }
.toast { position: absolute; z-index: 15; left: 50%; bottom: 78px; width: max-content; max-width: calc(100% - 2rem); padding: .65rem .9rem; border-radius: 999px; background: var(--night); color: white; font-size: .72rem; box-shadow: 0 8px 22px rgb(0 0 0 / 20%); pointer-events: none; transform: translateX(-50%); }

@media (max-width: 800px) {
  .prototype-lab { display: block; }
  .review-panel { display: none; }
  .device-stage { min-height: 100dvh; padding: 0; border: 0; background: var(--paper); }
  .phone { width: 100%; height: 100dvh; min-height: 620px; border: 0; border-radius: 0; box-shadow: none; }
  .phone__speaker { display: none; }
}

@media (max-width: 340px) {
  .today-prompt { align-items: flex-start; }
  .today-prompt p { font-size: .82rem; }
  .round-action { padding: .55rem .62rem; }
  .app-header h2 { font-size: 1.02rem; }
  .sticky-action--split { grid-template-columns: 1fr 1fr; }
}

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