:root {
  --night: #111210;
  --night-raised: #171815;
  --night-soft: #1e1f1b;
  --ivory: #eee8dc;
  --ivory-soft: #c9c2b6;
  --muted: #99958d;
  --line: #4d4b45;
  --line-soft: #2d2e2a;
  --gold: #c79645;
  --gold-light: #e0b968;
  --green: #46bb79;
  --danger: #dc745f;
  --screen: #e7e4da;
  --screen-ink: #181a17;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --sans: "Avenir Next Rounded", "Nunito Sans", "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --data: "SF Pro Rounded", "Avenir Next Rounded", ui-rounded, "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--night); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="file"] { cursor: pointer; }
button { color: inherit; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 200; left: 18px; top: 14px; padding: 10px 14px; transform: translateY(-150%); border-radius: 4px; background: var(--ivory); color: var(--night); }
.skip-link:focus { transform: none; }
.wordmark { display: inline-flex; flex-direction: column; color: var(--ivory); text-decoration: none; }
.wordmark span { font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 700; line-height: .9; letter-spacing: -.04em; }
.wordmark small { margin-top: 12px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .23em; text-transform: uppercase; }

.auth-view { display: grid; grid-template-columns: minmax(360px,.8fr) minmax(520px,1.2fr); min-height: 100vh; overflow: hidden; }
.auth-copy { position: relative; z-index: 2; display: flex; align-items: flex-start; flex-direction: column; justify-content: center; padding: clamp(36px,7vw,110px); }
.auth-copy .wordmark { position: absolute; left: clamp(36px,7vw,110px); top: 48px; }
.auth-copy .kicker { margin: 0 0 18px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.auth-copy h1 { margin: 0; font-family: var(--serif); font-size: clamp(45px,5.7vw,77px); font-weight: 600; line-height: 1.2; letter-spacing: -.045em; }
.auth-copy > p:not(.kicker):not(.inline-message) { max-width: 470px; margin: 24px 0 35px; color: var(--muted); font-size: 16px; line-height: 1.75; }
.auth-copy .button { min-width: 236px; }
.auth-device { position: relative; min-width: 0; overflow: hidden; }
.auth-device img { position: absolute; width: 980px; max-width: none; right: -195px; top: 50%; transform: translateY(-48%); opacity: .84; }

.topbar { display: grid; grid-template-columns: 230px minmax(0,1fr) 230px; gap: 24px; align-items: center; min-height: 112px; padding: 26px clamp(28px,3.5vw,54px) 20px; }
.device-switcher { display: flex; align-items: center; justify-content: center; gap: 18px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.device-switcher::-webkit-scrollbar { display: none; }
.device-tab { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 10px; min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; }
.device-tab[aria-current="true"] { border-color: var(--gold); color: var(--ivory); background: rgba(255,255,255,.015); }
.device-tab i { font-size: 19px; }
.device-tab .gift-mark { color: var(--gold); }
.account-wrap { position: relative; justify-self: end; }
.account-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ivory-soft); font-size: 13px; }
.account-button i:first-child { font-size: 21px; }
.account-button i:last-child { font-size: 14px; }
.account-menu { position: absolute; z-index: 80; top: calc(100% + 10px); right: 0; width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--night-soft); box-shadow: 0 22px 50px rgba(0,0,0,.35); }
.account-menu p { margin: 0; padding: 10px 11px 12px; overflow: hidden; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu a, .account-menu button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 42px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ivory); font-size: 13px; text-decoration: none; }
.account-menu a:hover, .account-menu button:hover { background: rgba(255,255,255,.04); }

.living-intro { padding: 22px clamp(28px,4vw,62px) 8px; }
.living-intro h1 { max-width: none; margin: 0; font-family: var(--serif); font-size: clamp(38px,3vw,50px); font-weight: 600; line-height: 1.26; letter-spacing: -.045em; white-space: nowrap; }
.living-intro > p:last-child { margin: 18px 0 0; color: var(--muted); font-family: var(--serif); font-size: clamp(15px,1.45vw,21px); letter-spacing: .035em; }
.edition-line { display: none; margin: 0 0 10px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.loading-view { display: grid; min-height: 520px; place-items: center; color: var(--gold); font-size: 34px; }
.loading-view i { animation: spin .9s linear infinite; }
.error-view { min-height: 520px; padding: 70px 22px; text-align: center; }
.error-view > i { color: var(--gold); font-size: 60px; }
.error-view h2 { margin: 22px 0 9px; font-family: var(--serif); font-size: 34px; font-weight: 600; }
.error-view p { max-width: 440px; margin: 0 auto 25px; color: var(--muted); line-height: 1.65; }

.living-stage { display: grid; grid-template-columns: minmax(550px,1.35fr) minmax(390px,.85fr); gap: clamp(24px,3.5vw,56px); align-items: center; min-height: 710px; padding: 0 clamp(28px,3.5vw,54px) 50px; }
.device-column { min-width: 0; }
.device-shell { position: relative; width: min(100%,780px); aspect-ratio: 1.062; margin-left: -14px; }
.device-shell > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.live-screen { position: absolute; left: 10.1%; top: 11.85%; display: grid; width: 79.25%; height: 68.75%; overflow: hidden; place-items: center; background: #c9c6bd; }
.device-shell.standard { aspect-ratio: 1; }
.device-shell.standard .live-screen { left: 11.65%; top: 11.7%; width: 76.7%; height: 61.9%; }
.eink-canvas { display: block; width: 100%; height: auto; max-height: 100%; aspect-ratio: 4 / 3; background: #e8e5da; image-rendering: pixelated; image-rendering: crisp-edges; }
.frame-proof { min-height: 38px; margin: -12px auto 0; padding: 0 18px; color: var(--muted); font-size: 11px; line-height: 1.55; text-align: center; }
.frame-proof strong { color: var(--ivory-soft); font-weight: 700; }

.today-column { min-width: 0; padding-right: 1%; }
.today-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 33px; }
.today-heading h2 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 600; }
.preview-mode { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; font-weight: 700; }
.preview-mode.live { border-color: rgba(70,187,121,.45); color: var(--green); }
.preview-mode.stale, .preview-mode.partial { border-color: rgba(199,150,69,.55); color: var(--gold-light); }
.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 19px; }
.icon-button:hover { background: rgba(255,255,255,.05); color: var(--ivory); }
.screen-timeline { margin: 0; padding: 0; list-style: none; }
.timeline-item { position: relative; min-height: 128px; }
.timeline-item::after { content: ""; position: absolute; z-index: -1; left: 18px; top: 68%; bottom: -32%; width: 1px; border-left: 1px dashed rgba(199,150,69,.7); }
.timeline-item:last-child::after { display: none; }
.timeline-item.boot-only { margin-top: 12px; border-top: 1px solid var(--line-soft); }
.timeline-item.boot-only::after { display: none; }
.timeline-button { display: grid; grid-template-columns: 38px minmax(0,1fr) 116px; gap: 18px; align-items: center; width: 100%; min-height: 128px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; }
.timeline-button:hover { background: rgba(255,255,255,.025); }
.timeline-button:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.timeline-marker { display: grid; width: 38px; height: 38px; place-items: center; color: var(--muted); font-size: 38px; }
.timeline-item.current .timeline-marker, .timeline-button[aria-current="true"] .timeline-marker { color: var(--gold); filter: drop-shadow(0 0 7px rgba(199,150,69,.4)); }
.timeline-copy h3 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.timeline-copy p { margin: 8px 0 0; color: var(--muted); font-family: var(--serif); font-size: 14px; line-height: 1.55; }
.timeline-thumb { display: grid; width: 116px; height: 73px; place-items: center; overflow: hidden; border: 1px solid #69665e; border-radius: 8px; background: #d9d6cc; color: var(--screen-ink); }
.timeline-thumb canvas { display: block; width: 100%; height: auto; max-height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.timeline-thumb i { font-size: 31px; }
.timeline-thumb strong { font-size: 22px; }
.timeline-thumb .mini-tickers { width: 100%; padding: 7px 9px; font-family: var(--data); }
.mini-tickers span { display: flex; align-items: center; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #9f9d95; font-size: 7px; }
.sync-strip { display: flex; align-items: center; gap: 21px; margin-top: 18px; padding: 25px 0; border-top: 1px solid var(--line); }
.sync-strip div { display: flex; align-items: center; gap: 10px; color: var(--green); }
.sync-strip div i { font-size: 22px; }
.sync-strip div strong { font-size: 14px; }
.sync-strip > span { width: 1px; height: 21px; background: var(--line); }
.sync-strip p { margin: 0; color: var(--ivory-soft); font-size: 13px; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; min-height: 58px; padding: 0 24px; border-radius: 11px; font-size: 16px; font-weight: 700; }
.button i { font-size: 23px; }
.button-gold { border: 1px solid var(--gold); background: var(--gold); color: #fff9ed; box-shadow: 0 15px 34px rgba(199,150,69,.14); }
.button-gold:hover { background: var(--gold-light); }
.button-quiet { border: 1px solid var(--line); background: transparent; color: var(--ivory); }
.button-quiet:hover { border-color: var(--ivory-soft); background: rgba(255,255,255,.02); }
.button:disabled { cursor: wait; opacity: .5; }

.empty-view { min-height: 630px; padding: 120px 24px; text-align: center; }
.empty-view > i { color: var(--gold); font-size: 68px; }
.empty-view h2 { margin: 24px 0 9px; font-family: var(--serif); font-size: 34px; }
.empty-view p { margin: 0 0 30px; color: var(--muted); }
.empty-view .button { min-width: 210px; }

.editor { margin-top: 20px; padding: 78px clamp(28px,5vw,78px) 70px; border-top: 1px solid var(--line); background: #141512; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; max-width: 1260px; margin: 0 auto 50px; }
.section-heading > div > p { margin: 0 0 11px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: 45px; font-weight: 600; }
.section-heading > p { max-width: 300px; margin: 0; color: var(--muted); font-family: var(--serif); font-size: 14px; line-height: 1.7; text-align: right; }
#settingsForm { max-width: 1260px; margin: 0 auto; }
.edit-chapter { display: grid; grid-template-columns: minmax(220px,.36fr) minmax(0,.64fr); gap: clamp(34px,6vw,90px); padding: 42px 0; border-top: 1px solid var(--line-soft); }
.edit-chapter > header { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 12px; align-content: start; }
.edit-chapter > header > span { padding-top: 4px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.edit-chapter h3 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.edit-chapter header p { max-width: 310px; margin: 9px 0 0; color: var(--muted); font-family: var(--serif); font-size: 13px; line-height: 1.65; }
.watch-pages { display: grid; gap: 18px; }
.watch-page { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--night-raised); }
.watch-page h4 { margin: 0 0 12px; color: var(--muted); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.symbol-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.symbol-field { position: relative; min-width: 0; }
.symbol-control { display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; border: 1px solid var(--line-soft); border-radius: 8px; background: #20211d; }
.symbol-control:focus-within { border-color: var(--gold); }
.symbol-icon { display: grid; width: 38px; height: 42px; place-items: center; color: var(--gold); font-family: var(--data); font-size: 11px; font-weight: 900; }
.symbol-icon canvas { width: 24px; height: 24px; filter: invert(88%) sepia(19%) saturate(483%); image-rendering: pixelated; }
.symbol-field input { min-width: 0; width: 100%; min-height: 48px; padding: 0 12px 0 2px; border: 0; outline: 0; background: transparent; color: var(--ivory); font-family: var(--data); font-size: 16px; font-weight: 700; text-transform: uppercase; }
.suggestions { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); max-height: 240px; margin: 0; padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; background: #23241f; box-shadow: 0 18px 42px rgba(0,0,0,.42); list-style: none; }
.suggestion { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: #323329; }
.suggestion strong { display: block; font-size: 13px; }
.suggestion small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.suggestion > span:last-child { color: var(--gold); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.suggestion-empty { padding: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.chapter-body { display: grid; gap: 11px; min-width: 0; }
.switch-row { display: grid; grid-template-columns: minmax(0,1fr) 47px; gap: 20px; align-items: center; min-height: 72px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { font-size: 14px; }
.switch-row small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-row > i { position: relative; width: 46px; height: 26px; border: 1px solid var(--line); border-radius: 999px; background: #252620; }
.switch-row > i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.switch-row input:checked + i { border-color: var(--green); background: rgba(70,187,121,.15); }
.switch-row input:checked + i::after { background: var(--green); transform: translateX(20px); }
.switch-row input:focus-visible + i { outline: 2px solid var(--gold-light); outline-offset: 4px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; }
.field-grid[aria-disabled="true"] { opacity: .38; pointer-events: none; }
.field-grid label > span, .modal label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field-grid select, .field-grid input, .modal input { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #20211d; color: var(--ivory); font-size: 16px; }
.photo-body { min-width: 0; }
.photo-drop { position: relative; display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 15px; align-items: center; min-height: 86px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 9px; }
.photo-drop:hover { border-color: var(--gold); }
.photo-drop:focus-within { outline: 2px solid var(--gold-light); outline-offset: 4px; }
.photo-drop.is-full { border-style: solid; opacity: .62; cursor: default; }
.photo-drop[aria-busy="true"] { opacity: .62; cursor: progress; }
.photo-drop > i { color: var(--gold); font-size: 30px; }
.photo-drop strong, .photo-drop small { display: block; }
.photo-drop strong { font-size: 14px; }
.photo-drop small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.photo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-shelf-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; padding-top: 5px; border-bottom: 1px solid var(--line-soft); }
.photo-shelf-heading > div { min-width: 0; }
.photo-shelf-heading strong, .photo-shelf-heading span { display: inline; }
.photo-shelf-heading strong { margin-right: 10px; color: var(--ivory); font-family: var(--data); font-size: 13px; }
.photo-shelf-heading span { color: var(--muted); font-size: 11px; }
.photo-shelf-heading .text-button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.photo-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; width: 100%; min-width: 0; margin: 0; padding: 0; list-style: none; }
.photo-card { min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; background: #1b1c19; }
.photo-card[data-status="failed"], .photo-card[data-status="load-failed"], .photo-card[data-status="delete-failed"] { border-color: rgba(220,116,95,.72); }
.photo-card-visual { position: relative; aspect-ratio: 400 / 270; overflow: hidden; background: var(--screen); }
.photo-card-visual img { display: block; width: 100%; height: 100%; object-fit: contain; filter: grayscale(1) contrast(1.08); image-rendering: pixelated; }
.photo-card-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #6c6d67; font-size: 27px; }
.photo-card-index { position: absolute; left: 7px; top: 7px; display: grid; min-width: 25px; height: 25px; padding: 0 6px; place-items: center; border-radius: 999px; background: rgba(17,18,16,.88); color: var(--ivory); font-family: var(--data); font-size: 10px; font-weight: 800; }
.photo-card-state { position: absolute; right: 7px; bottom: 7px; max-width: calc(100% - 14px); overflow: hidden; padding: 5px 7px; border-radius: 4px; background: rgba(17,18,16,.88); color: var(--ivory-soft); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.photo-card-state.success { color: var(--green); }
.photo-card-state.error { color: #f2a796; }
.photo-card-meta { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; align-items: center; min-height: 43px; padding: 6px 7px 6px 10px; }
.photo-card-meta strong { overflow: hidden; color: var(--ivory-soft); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.photo-card-actions { display: flex; gap: 2px; }
.photo-card-action { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 15px; }
.photo-card-action:hover { background: var(--night-soft); color: var(--ivory); }
.photo-card-action.retry { color: var(--gold-light); }
.photo-empty { display: grid; min-height: 150px; padding: 25px; place-items: center; align-content: center; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--muted); text-align: center; }
.photo-empty i { color: var(--gold); font-size: 29px; }
.photo-empty strong { margin-top: 9px; color: var(--ivory-soft); font-size: 13px; }
.photo-empty span { margin-top: 5px; font-size: 11px; }
.photo-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.photo-message.error { color: var(--danger); }
.photo-message.success { color: var(--green); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; justify-self: start; min-height: 42px; padding: 0 14px; border: 1px solid var(--gold); border-radius: 8px; background: transparent; color: var(--gold-light); font-size: 13px; font-weight: 700; }
.save-bar { position: sticky; z-index: 30; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 22px; padding: 15px 0 max(15px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(20,21,18,.96); backdrop-filter: blur(14px); }
.save-bar p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.save-bar p.success { color: var(--green); }
.save-bar p.error { color: var(--danger); }
.save-bar .button { min-width: 180px; min-height: 50px; }

.modal { width: min(480px,calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--night-soft); color: var(--ivory); box-shadow: 0 30px 90px rgba(0,0,0,.62); }
.modal::backdrop { background: rgba(4,5,4,.76); backdrop-filter: blur(7px); }
.modal form { position: relative; padding: 36px; }
.modal-close { position: absolute; right: 15px; top: 15px; }
.modal-kicker { margin: 0 0 12px !important; color: var(--gold) !important; font-size: 10px !important; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.modal h2 { margin: 0; font-family: var(--serif); font-size: 32px; }
.modal form > p { margin: 12px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal input { margin-bottom: 13px; font-family: var(--data); font-size: 22px; font-weight: 800; letter-spacing: .14em; text-align: center; }
.modal .button { width: 100%; }
.inline-message { min-height: 20px; margin: 12px 0 0 !important; color: var(--muted); font-size: 12px !important; }
.inline-message.error { color: var(--danger); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: max(26px,env(safe-area-inset-bottom)); max-width: calc(100% - 28px); padding: 13px 20px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 999px; background: var(--ivory); color: var(--night); box-shadow: 0 18px 50px rgba(0,0,0,.4); font-size: 13px; font-weight: 700; text-align: center; }

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

@media (max-width: 980px) {
  .topbar { grid-template-columns: 190px minmax(0,1fr) auto; }
  .account-button span { display: none; }
  .living-stage { grid-template-columns: minmax(440px,1.15fr) minmax(330px,.85fr); gap: 18px; }
  .timeline-item { grid-template-columns: 34px minmax(0,1fr); }
  .timeline-button { grid-template-columns: 34px minmax(0,1fr); }
  .timeline-thumb { display: none; }
  .edit-chapter { grid-template-columns: 210px minmax(0,1fr); gap: 36px; }
}

@media (max-width: 760px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-copy { min-height: 100svh; padding: 120px 22px 52px; }
  .auth-copy .wordmark { left: 22px; top: 30px; }
  .auth-copy h1 { font-size: 48px; }
  .auth-device { display: none; }
  .topbar { grid-template-columns: minmax(0,1fr) auto; min-height: 92px; padding: 22px 18px 14px; }
  .topbar .wordmark span { font-size: 27px; }
  .topbar .wordmark small { margin-top: 8px; font-size: 8px; }
  .device-switcher { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; margin: 2px -18px 0; padding: 0 18px 6px; }
  .device-tab { min-height: 44px; padding: 0 15px; }
  .account-wrap { grid-column: 2; grid-row: 1; }
  .account-button { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .account-button i:last-child { display: none; }
  .living-intro { padding: 29px 20px 10px; }
  .living-intro h1 { font-size: 39px; line-height: 1.3; }
  .living-intro h1 { white-space: normal; }
  .living-intro > p:last-child { margin-top: 13px; font-size: 15px; line-height: 1.65; }
  .edition-line { display: block; }
  .living-stage { display: block; min-height: 0; padding: 4px 0 45px; }
  .device-shell { width: 100%; margin-left: 0; }
  .today-column { padding: 5px 20px 0; }
  .today-heading { margin-bottom: 13px; }
  .timeline-item { grid-template-columns: 34px minmax(0,1fr) 84px; gap: 12px; min-height: 105px; }
  .timeline-button { grid-template-columns: 34px minmax(0,1fr) 84px; gap: 12px; min-height: 105px; }
  .timeline-thumb { display: grid; width: 84px; height: 55px; }
  .timeline-copy h3 { font-size: 16px; }
  .timeline-copy p { margin-top: 5px; font-size: 12px; }
  .sync-strip { flex-wrap: wrap; gap: 12px; padding: 22px 0 18px; }
  .sync-strip > span { display: none; }
  .sync-strip p { flex-basis: 100%; }
  .hero-actions { gap: 10px; }
  .button { min-height: 54px; padding: 0 16px; font-size: 15px; }
  .editor { margin-top: 0; padding: 54px 17px 50px; }
  .section-heading { display: block; margin-bottom: 28px; }
  .section-heading h2 { font-size: 37px; }
  .section-heading > p { margin-top: 12px; text-align: left; }
  .edit-chapter { grid-template-columns: 1fr; gap: 24px; padding: 34px 0; }
  .edit-chapter > header { grid-template-columns: 27px minmax(0,1fr); }
  .symbol-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .photo-shelf-heading { align-items: flex-start; }
  .photo-shelf-heading strong, .photo-shelf-heading span { display: block; }
  .photo-shelf-heading strong { margin: 0 0 4px; }
  .save-bar { align-items: stretch; flex-direction: column; gap: 8px; margin: 0 -2px; padding: 10px 0 max(10px,env(safe-area-inset-bottom)); }
  .save-bar p { min-height: 17px; text-align: center; }
  .save-bar .button, .save-bar .text-button { width: 100%; }
  .modal form { padding: 31px 21px 24px; }
  .toast { bottom: max(82px,calc(env(safe-area-inset-bottom) + 70px)); border-radius: 10px; }
}

@media (max-width: 390px) {
  .living-intro h1 { font-size: 35px; }
  .timeline-item { grid-template-columns: 32px minmax(0,1fr); }
  .timeline-button { grid-template-columns: 32px minmax(0,1fr); }
  .timeline-thumb { display: none; }
  .hero-actions { grid-template-columns: 1fr; }
  .photo-card-meta { padding-left: 8px; }
}

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