:root {
  color-scheme: light;
  --ground: #fbfaf8;
  --surface: #ffffff;
  --raised: #f1eeef;
  --active: #e9e1e7;
  --ink: #302a2f;
  --muted: #655d63;
  --faint: #756b72;
  --accent: #73566f;
  --accent-strong: #583e55;
  --line: #e5dfe2;
  --control: #94848e;
  --negative: #a03245;
  --negative-surface: #fbf0f2;
  --positive: #31664f;
  --positive-surface: #edf5ef;
  --warning: #76551f;
  --warning-surface: #faf3e6;
  --on-accent: #fff;
  --scrim: rgb(0 0 0 / .56);
  --backdrop: rgb(0 0 0 / .78);
  --motion-press: 120ms;
  --motion-feedback: 180ms;
  --motion-enter: 220ms;
  --motion-exit: 140ms;
  --ease-settle: cubic-bezier(.22, 1, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --radius: 8px;
  --gap: 16px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-bottom: 110px; }
body { margin: 0; line-height: 1.6; font-size: 16px; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { background: none; }
button:disabled, input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; color: var(--muted); background: var(--raised); }
input, textarea, select { max-width: 100%; min-width: 0; }
button, a { touch-action: manipulation; }
a:focus-visible, button:focus-visible, [data-preview]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
:where(input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
svg { width: 20px; height: 20px; flex: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
h1 { font: 600 30px/1.4 var(--serif); }
h2 { font-size: 20px; line-height: 1.5; font-weight: 500; }
h3 { font-size: 16px; line-height: 1.6; font-weight: 500; }
::selection { color: var(--ink); background: var(--active); }
.button, .icon-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; min-width: 48px; padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent; font-size: 14px; font-weight: 500; line-height: 1.5; flex: none; }
.button, .icon-button, .text-button, .nav-item, .tabs a, .article-card, .song, .account-link, .preview-close, .back-link { transition: background-color var(--motion-feedback) ease, color var(--motion-feedback) ease, border-color var(--motion-feedback) ease, transform var(--motion-press) var(--ease-settle); }
:where(input, textarea, select) { transition: border-color var(--motion-feedback) ease; }
:where(input, textarea, select):focus { border-color: var(--accent); }
.button[aria-busy=true] { color: var(--accent-strong); background: var(--raised); border-color: var(--control); }
.button[aria-busy=true]::before { content: ''; width: 16px; height: 16px; flex: none; border: 2px solid var(--control); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
.button[aria-busy=true] { justify-content: center; }
.primary { background: var(--accent); color: var(--on-accent); }
.secondary { background: var(--surface); border-color: var(--control); }
.icon-button { padding: 10px; border: 0; }
.button:active:not(:disabled), .icon-button:active:not(:disabled), .text-button:active:not(:disabled), .preview-close:active { transform: scale(.98); }
.nav-item:active, .tabs a:active, .account-link:active, .song:active:not(:disabled) { background: var(--active); }
.article-card:active { background: var(--raised); }
[data-preview]:active { opacity: .88; }
.read-label svg, .back-link svg { transition: transform var(--motion-feedback) var(--ease-settle); }
@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) { background: var(--accent-strong); }
  .secondary:hover:not(:disabled), .icon-button:hover:not(:disabled), .text-button:hover:not(:disabled), .preview-close:hover { background: var(--raised); }
  .nav-item:hover, .tabs a:hover, .song:hover:not(:disabled), .account-link:hover { background: var(--raised); }
  .article-card:hover h2, .back-link:hover { color: var(--accent-strong); }
  .article-card:hover .read-label svg { transform: translateX(3px); }
  .back-link:hover svg { transform: translateX(-3px); }
}
.text-button { color: var(--muted); padding-inline: 12px; }
form > label, .field-pair label { display: block; margin: 24px 0 8px; font-size: 14px; font-weight: 500; }
form > label:first-child { margin-top: 0; }
input:not([type=file]), textarea, select { width: 100%; padding: 13px 14px; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); font-size: 16px; min-height: 50px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
textarea { resize: vertical; line-height: 1.9; }
.form-error { color: var(--negative); font-size: 14px; margin: 16px 0; overflow-wrap: anywhere; }
.form-error:empty { display: none; }
.form-error:not(:empty) { padding: 12px 16px; border-left: 3px solid currentColor; border-radius: 4px; background: var(--negative-surface); }
.form-error[data-tone=warning] { color: var(--warning); background: var(--warning-surface); }
.form-error[data-tone=warning] .text-button { color: var(--warning); }
.form-error a { text-decoration: underline; text-underline-offset: 3px; }
.form-error .text-button { color: var(--negative); justify-content: flex-start; padding-left: 0; }
.field-hint { font-size: 13px; color: var(--muted); line-height: 1.8; }
/* A 1100px canvas = 12 × 77px columns + 11 × 16px gutters. */
.page { width: min(100%, 1148px); margin: 0 auto; padding: calc(52px + env(safe-area-inset-top)) 24px calc(136px + env(safe-area-inset-bottom)); min-height: 100svh; }
.page-reading, .page-stream { width: min(100%, 808px); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading > div { min-width: 0; }
.page-heading p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 0; margin-bottom: 24px; font-size: 14px; color: var(--muted); }
.bottom-nav { position: fixed; z-index: 20; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 1fr); width: 420px; max-width: calc(100% - 40px); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.nav-item { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; position: relative; color: var(--muted); font-size: 14px; }
.nav-item.active { color: var(--accent-strong); font-weight: 600; }
.nav-item.active::after { content: ''; position: absolute; bottom: 0; width: 20px; height: 2px; background: currentColor; }
/* One scroll surface, with a separate navigation row. Content never passes under it. */
.app-shell { height: 100svh; height: 100dvh; overflow: hidden; }
.app-shell #app { height: 100%; display: flex; flex-direction: column; }
.app-shell .page { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding-bottom: 40px; }
.app-shell .page-home { padding-bottom: 0; }
.app-shell .bottom-nav { position: static; transform: none; flex: none; width: 100%; max-width: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; grid-template-columns: repeat(3, minmax(80px, 140px)); justify-content: center; padding: 8px 20px calc(8px + env(safe-area-inset-bottom)); }
/* Login is an opening spread, not a second navigation shell. */
.login-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: 100svh; }
.login-story { padding: 60px clamp(32px, 6vw, 96px); display: flex; flex-direction: column; background: var(--raised); }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 500 26px/1.5 var(--serif); min-height: 44px; align-self: flex-start; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.brand small { font: 13px var(--font); color: var(--muted); }
.story-copy { margin: auto 0; padding: 56px 0; }
.story-title { font: 400 36px/1.6 var(--serif); }
.story-copy > p:last-child { font-size: 16px; line-height: 1.9; margin-top: 28px; color: var(--muted); }
.story-foot { font-size: 14px; color: var(--muted); }
.login-panel { display: grid; place-items: center; padding: 64px 40px; background: var(--surface); }
.login-card { width: min(100%, 380px); }
.login-subtitle { margin: 10px 0 36px; font-size: 16px; color: var(--muted); }
.input-wrap { display: flex; align-items: center; position: relative; }
.input-wrap input { padding-right: 56px; }
.input-wrap .icon-button { position: absolute; right: 2px; top: 1px; }
.login-submit { width: 100%; justify-content: space-between; margin-top: 28px; }
.login-hint { font-size: 13px; color: var(--muted); margin-top: 20px; }
/* The real background remains edge to edge. A neutral scrim protects the words. */
.page.page-home { max-width: none; width: 100%; padding: 0; }
.home-hero { min-height: 100svh; min-height: 100dvh; position: relative; overflow: hidden; background: var(--raised); display: flex; flex-direction: column; justify-content: center; padding: calc(56px + env(safe-area-inset-top)) max(40px, calc((100vw - 1100px) / 2)) calc(128px + env(safe-area-inset-bottom)); }
.app-shell .home-hero { min-height: 100%; padding-bottom: 40px; }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.with-image { background: #302a2f; color: #fff; }
.with-image::after { content: ''; position: absolute; inset: 0; background: var(--scrim); }
.hero-content, .home-letter { position: relative; z-index: 1; }
.hero-content { margin-block: auto; padding-block: 64px; }
.hero-content h1 { font: 500 20px/1.6 var(--font); }
.counter { display: flex; gap: 16px; align-items: baseline; margin-top: 16px; }
.counter strong { font: 400 clamp(72px, 8vw, 112px)/1.1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.counter > span { font-size: 18px; }
.clock-digits { font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 12px; letter-spacing: .08em; }
.since { margin-top: 28px; font-size: 13px; color: var(--muted); }
.home-letter { max-width: 620px; align-self: flex-end; width: 100%; padding-top: 32px; }
.confession { font: 400 24px/1.8 var(--serif); white-space: pre-line; overflow-wrap: anywhere; }
.home-note { font-size: 14px; margin-top: 16px; color: var(--muted); overflow-wrap: anywhere; }
.with-image .since, .with-image .home-note { color: #fff; }
/* Content uses its own shape: a photo, a date, or a line of writing. */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.tabs a { min-height: 48px; min-width: 44px; display: flex; align-items: center; position: relative; padding: 10px 4px 14px; color: var(--muted); font-size: 14px; }
.tabs .active { color: var(--ink); font-weight: 600; }
.tabs .active::after { position: absolute; content: ''; bottom: -1px; inset-inline: 0; height: 2px; background: var(--accent); }
.memory-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.memory-photos { grid-column: span 8; min-width: 0; }
.memory-dates { grid-column: span 4; padding-left: 24px; }
.memory-layout.without-photos .memory-dates { grid-column: 1 / -1; padding-left: 0; }
.memory-layout h2 { font: 500 20px/1.5 var(--serif); margin-bottom: 24px; }
.photo-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.photo-strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); cursor: zoom-in; background: var(--active); }
.photo-strip img:first-child, .single-photo img { grid-column: 1 / -1; }
.timeline-item { padding: 0 0 28px 20px; border-left: 1px solid var(--control); position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -3px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-date { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.article-list { border-top: 1px solid var(--line); }
.article-card { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 24px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--line); }
.article-card.has-cover { grid-template-columns: 136px minmax(0, 1fr) 180px; }
.article-date { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.article-date span { display: block; font-size: 13px; margin-top: 4px; }
.article-copy { min-width: 0; }
.article-copy h2 { font: 500 24px/1.6 var(--serif); margin-bottom: 16px; }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.read-label { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.read-label svg { width: 16px; height: 16px; }
.article-cover img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.note-card { padding: 28px 0 36px; border-bottom: 1px solid var(--line); }
.note-card:first-child { padding-top: 0; }
.note-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.note-card header strong { font-size: 14px; font-weight: 500; }
.note-card time { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.initials { background: var(--active); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; font: 400 24px var(--serif); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.9; margin-bottom: 20px; }
.note-images { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0,1fr)); }
.note-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); cursor: zoom-in; }
.note-images.count-1 { display: block; }
.note-images.count-1 img { width: auto; height: auto; max-height: 540px; aspect-ratio: auto; }
.note-images.count-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.note-card video { display: block; width: 100%; max-height: 540px; background: var(--ink); border-radius: var(--radius); }
.reading-heading { padding-bottom: 32px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.reading-heading h1 { margin-bottom: 20px; }
.reading-content { font: 400 18px/2 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.reading-end { margin-top: 36px; margin-bottom: 0; }
/* Personal home: 4 columns for the person, 8 for their music. */
.mine-layout { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 32px; align-items: start; }
.profile-summary { grid-column: span 4; padding: 28px; background: var(--raised); border-radius: var(--radius); }
.profile-summary .avatar { width: 64px; height: 64px; font-size: 32px; margin-bottom: 24px; }
.profile-summary h2 { font: 500 24px/1.5 var(--serif); }
.profile-summary p { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; margin: 12px 0 24px; }
.account-link { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--control); font-size: 14px; }
.account-link span { flex: 1; }
.music-section { grid-column: span 8; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { font: 500 20px/1.5 var(--serif); }
.section-heading > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.song { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 80px; text-align: left; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); }
.song-cover { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius); }
.song[aria-pressed=true] { color: var(--accent-strong); background: var(--raised); }
.song-state { display: inline-flex; align-items: center; }
.song-info { flex: 1; min-width: 0; }
.song-info strong { display: block; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.song-info small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.account-footer { margin-top: 36px; }
.settings-layout { display: grid; grid-template-columns: minmax(0,4fr) minmax(0,8fr); gap: 48px; align-items: start; }
.settings-intro { padding-top: 8px; }
.settings-intro h2 { margin-bottom: 16px; }
.settings-intro > p { color: var(--muted); margin-top: 16px; }
.editor-card { min-width: 0; }
.settings-layout .editor-card { padding: 28px; border-radius: var(--radius); background: var(--raised); }
.profile-avatar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.profile-avatar .avatar { width: 64px; height: 64px; font-size: 32px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-pair > div { min-width: 0; }
.composer textarea { min-height: 240px; }
.composer[data-type=article] textarea { min-height: 360px; }
.editor-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.upload-area { margin-top: 28px; padding-block: 24px; border-block: 1px solid var(--line); }
.upload-toolbar { display: flex; flex-wrap: wrap; gap: 12px; }
.upload-area .field-hint { margin-top: 12px; }
.editor-actions { display: flex; justify-content: flex-end; margin-top: 28px; }
.editor-actions .primary { min-width: 160px; }
.attachment-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.attachment-grid:not(:empty) { margin-top: 20px; }
.attachment-grid > div { position: relative; }
.attachment-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.attachment-grid button { position: absolute; top: 4px; right: 4px; min-width: 44px; min-height: 44px; background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius); font-size: 24px; }
.attachment-video { margin-top: 20px; }
.attachment-video video { width: 100%; max-height: 400px; display: block; margin-bottom: 12px; }
.footprint-day { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 32px; margin-bottom: 36px; }
.footprint-day > h2 { font-size: 16px; font-weight: 500; padding-top: 18px; font-variant-numeric: tabular-nums; }
.footprint-day article { display: flex; align-items: baseline; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.footprint-day article time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.footprint-day article > div { min-width: 0; }
.footprint-day article p { color: var(--muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.list-footer { text-align: center; margin-top: 36px; color: var(--muted); font-size: 13px; }
/* Honest loading, empty and recovery states share the same typography. */
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 260px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--control); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-loading p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.skeleton-row { padding: 28px 0; border-bottom: 1px solid var(--line); }
.skeleton-row span { display: block; height: 20px; width: 58%; background: var(--raised); border-radius: 4px; }
.skeleton-row span + span { width: 28%; height: 12px; margin-top: 16px; }
.empty-state { padding: 40px 24px; background: var(--raised); border-radius: var(--radius); }
.empty-state h3 { font: 500 20px/1.6 var(--serif); }
.empty-state p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.empty-state .button { margin-top: 24px; }
.status-layout { min-height: 100svh; display: flex; flex-direction: column; padding: calc(32px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); max-width: 1000px; margin: auto; }
.status-card { width: 100%; margin: auto; padding: 60px 0; }
.status-code { font: 400 96px/1.2 var(--serif); color: var(--accent); margin-bottom: 24px; }
.status-description { font-size: 16px; color: var(--muted); margin-top: 20px; line-height: 1.8; }
.status-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.status-hint, .status-footer { color: var(--muted); font-size: 13px; margin-top: 24px; }
.status-layout .status-card { text-align: center; }
.status-layout .status-actions { justify-content: center; }
.status-layout .status-brand { align-self: center; }
.status-layout .status-footer { text-align: center; }
.status-footer span { margin-left: 16px; }
.embedded-error { padding: 32px 24px; background: var(--raised); border-radius: var(--radius); }
.embedded-error h2 { font: 500 24px/1.5 var(--serif); }
.initial-loading { padding: 20vh 24px 24px; text-align: center; }
.startup-help { text-align: center; color: var(--muted); font-size: 14px; }
.startup-help a { text-decoration: underline; }
.image-failed { object-fit: contain !important; background: var(--raised); color: var(--muted); font: 14px var(--font); }
.hero-image.image-failed { opacity: 0; }
/* Overlays live above the bottom navigation without obscuring the final row. */
.player { position: fixed; z-index: 30; bottom: calc(100px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(760px, calc(100% - 40px)); display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--control); padding: 16px; border-radius: var(--radius); box-shadow: 0 8px 28px #0001; }
.player-label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.player-label strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-label small { display: block; font-size: 13px; color: var(--muted); }
.music-disc { font-size: 24px; }
audio { width: 280px; max-width: 100%; height: 44px; }
.app-shell.has-player .page { padding-bottom: calc(260px + env(safe-area-inset-bottom)); }
.app-shell.has-player .page-home { padding-bottom: 0; }
.app-shell.has-player .home-hero { padding-bottom: calc(260px + env(safe-area-inset-bottom)); }
.toast { display: flex; align-items: center; gap: 10px; position: fixed; bottom: calc(110px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; z-index: 80; background: var(--ink); color: var(--on-accent); font-size: 14px; padding: 14px 20px; border-radius: var(--radius); overflow-wrap: anywhere; }
.toast[data-tone=success] { background: var(--positive); }
.toast[data-tone=error] { background: var(--negative); }
.toast[data-tone=warning] { background: var(--warning); }
.toast > span { min-width: 0; }
.has-player .toast { bottom: calc(240px + env(safe-area-inset-bottom)); }
dialog { border: 0; border-radius: var(--radius); padding: 60px 16px 16px; max-width: 96vw; max-height: 94svh; background: var(--surface); }
dialog::backdrop { background: var(--backdrop); }
.preview-stage { display: grid; place-items: center; min-height: min(28svh, 240px); min-width: min(70vw, 600px); }
.preview-stage > * { grid-area: 1 / 1; }
.preview-stage > img { max-width: 90vw; max-height: 76svh; width: auto; object-fit: contain; margin: auto; }
.preview-stage[aria-busy=true] > img { visibility: hidden; }
.preview-status { padding: 24px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
dialog[data-closing=true]::backdrop { animation: backdrop-out var(--motion-exit) ease both; }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes skeleton-breathe { 50% { opacity: .45; } }
@media (prefers-reduced-motion: no-preference) {
  dialog[open]::backdrop { animation: backdrop-in var(--motion-enter) ease both; }
  dialog[open][data-closing=true]::backdrop { animation: backdrop-out var(--motion-exit) ease both; }
  .skeleton-row span { animation: skeleton-breathe 1.6s ease-in-out 4; }
}
.motion-paused *, .motion-paused *::before, .motion-paused *::after { animation-play-state: paused !important; }
.preview-close { position: absolute; top: 8px; right: 8px; min-width: 44px; min-height: 44px; border: 0; border-radius: var(--radius); font-size: 28px; }
@media (max-width: 1000px) {
  .page { padding-top: calc(36px + env(safe-area-inset-top)); }
  .home-hero { padding-inline: 32px; }
  .memory-photos { grid-column: span 7; }
  .memory-dates { grid-column: span 5; padding-left: 16px; }
  .mine-layout { gap: 24px; }
  .profile-summary { grid-column: span 5; padding: 24px; }
  .music-section { grid-column: span 7; }
  .settings-layout { grid-template-columns: minmax(0,3fr) minmax(0,7fr); gap: 24px; }
  .article-card.has-cover { grid-template-columns: 108px minmax(0,1fr) 140px; }
}
@media (max-width: 640px) {
  h1 { font-size: 28px; }
  .page { padding: calc(24px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-left)) calc(112px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-right)); }
  .page-heading { gap: 16px; margin-bottom: 24px; }
  .page-heading p { font-size: 14px; }
  .page-heading .button { padding-inline: 14px; }
  .page-heading .button svg { width: 16px; height: 16px; }
  .back-link { margin-bottom: 16px; }
  .bottom-nav { left: 0; bottom: 0; transform: none; width: 100%; max-width: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 6px max(16px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .nav-item { flex-direction: column; min-height: 56px; gap: 3px; font-size: 13px; }
  .nav-item.active::after { width: 16px; bottom: 1px; }
  .nav-item svg { width: 20px; height: 20px; }
  .app-shell .bottom-nav { grid-template-columns: repeat(3, 1fr); padding: 6px max(16px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .login-layout { display: block; background: var(--surface); }
  .login-story { padding: calc(24px + env(safe-area-inset-top)) 24px 28px; }
  .brand { font-size: 24px; }
  .story-copy { padding: 16px 0 0; margin: 0; }
  .story-title { font-size: 24px; line-height: 1.5; }
  .story-title br { display: none; }
  .story-copy > p:last-child, .story-foot { display: none; }
  .login-panel { padding: 36px 24px calc(40px + env(safe-area-inset-bottom)); }
  .login-subtitle { margin-bottom: 28px; }
  .home-hero { padding: calc(32px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-left)) calc(112px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-right)); }
  .hero-content { padding-block: 48px; }
  .hero-content h1 { font-size: 18px; }
  .counter strong { font-size: 80px; }
  .counter > span { font-size: 16px; }
  .since { margin-top: 24px; }
  .home-letter { max-width: none; padding-top: 32px; }
  .confession { font-size: 20px; line-height: 1.8; }
  .home-note { font-size: 13px; }
  .tabs { gap: 28px; margin-bottom: 28px; }
  .memory-layout { display: block; }
  .memory-layout h2 { font-size: 18px; margin-bottom: 16px; }
  .memory-dates { padding: 0; margin-top: 32px; }
  .without-photos .memory-dates { margin-top: 0; }
  .photo-strip { gap: 10px; }
  .article-card, .article-card.has-cover { grid-template-columns: minmax(0,1fr) auto; column-gap: 16px; row-gap: 10px; padding: 24px 0; }
  .article-date { grid-column: 1 / -1; padding: 0; font-size: 13px; display: flex; gap: 12px; }
  .article-date span { margin: 0; }
  .article-copy { grid-column: 1 / -1; }
  .has-cover .article-copy { grid-column: 1; }
  .article-copy h2 { font-size: 20px; margin-bottom: 12px; }
  .article-cover { grid-column: 2; grid-row: 2; width: 88px; }
  .article-cover img { aspect-ratio: 1; }
  .article-meta { gap: 8px 16px; }
  .has-cover .read-label { display: none; }
  .note-card { padding-bottom: 28px; }
  .note-text { font-size: 16px; }
  .reading-heading { margin-bottom: 28px; padding-bottom: 28px; }
  .reading-content { font-size: 18px; line-height: 1.95; }
  .mine-layout { display: block; }
  .profile-summary { padding: 24px; }
  .profile-summary .avatar { margin-bottom: 16px; }
  .music-section { margin-top: 32px; }
  .section-heading h2 { font-size: 18px; }
  .settings-layout { display: block; }
  .settings-intro { padding: 0; margin-bottom: 24px; }
  .settings-intro h2, .settings-intro > p:not(.field-hint) { display: none; }
  .settings-intro .field-hint { margin: 0; font-size: 14px; }
  .settings-layout .editor-card { padding: 24px 20px; }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
  .composer textarea { min-height: 240px; }
  .composer[data-type=article] textarea { min-height: 340px; }
  .editor-actions .primary { width: 100%; }
  .editor-meta { gap: 8px; }
  .editor-meta > :last-child { margin-left: auto; }
  .footprint-day { display: block; margin-bottom: 28px; }
  .footprint-day > h2 { font-size: 16px; padding-top: 0; margin-bottom: 8px; }
  .footprint-day article { gap: 20px; }
  .footprint-day article time { min-width: 44px; }
  .status-layout { padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
  .status-card { padding: 48px 0; }
  .status-code { font-size: 80px; }
  .status-card h1 { font-size: 26px; }
  .status-actions .button { padding-inline: 16px; }
  .embedded-error { padding: 28px 20px; }
  .empty-state { padding: 32px 24px; }
  .player { bottom: calc(84px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 12px; padding: 12px; width: calc(100% - 24px); }
  .player-label { grid-column: 1; }
  .player audio { grid-row: 2; grid-column: 1 / -1; width: 100%; }
  .player .icon-button { grid-column: 2; grid-row: 1; padding: 0; min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .button:active, .icon-button:active, .text-button:active, .preview-close:active, .read-label svg, .back-link svg { transform: none !important; }
}
