@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-italic.woff2) format('woff2'); }

:root {
  --serif: 'Instrument Serif', 'New York', ui-serif, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg: #fbf6ef; --paper: #fffdf9; --ink: #2b211c; --soft: #7d6c62; --faint: #b9aaa0;
  --line: rgba(60, 40, 30, 0.10); --accent: #d9603f; --accent-ink: #fff;
  --glass: rgba(255, 252, 247, 0.72);
  --shadow: 0 1px 2px rgba(60, 35, 20, .06), 0 10px 30px rgba(60, 35, 20, .08);
  color-scheme: light dark;
}
:root.light { color-scheme: light; }   /* homepage, sign-in, privacy: always the paper palette */
/* the app follows the sky (data-theme, set from the time of day); before that, the system */
:root[data-theme="dark"] {
  --bg: #16110e; --paper: #1f1915; --ink: #f3e9df; --soft: #c2b0a3; --faint: #7d6d62;
  --line: rgba(255, 230, 210, 0.12); --accent: #f08a5d; --accent-ink: #1a110c;
  --glass: rgba(30, 24, 20, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; --glass: rgba(255, 252, 247, 0.58); }
@media (prefers-color-scheme: dark) {
  :root:not(.light):not([data-theme]) {
    --bg: #16110e; --paper: #1f1915; --ink: #f3e9df; --soft: #b3a296; --faint: #6f6158;
    --line: rgba(255, 230, 210, 0.10); --accent: #f08a5d; --accent-ink: #1a110c;
    --glass: rgba(30, 24, 20, 0.66);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
html, body { margin: 0; color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.view { max-width: 680px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 20px 0; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; }
.bar nav { display: flex; gap: 2px; }
.bar-title { font-size: 26px; margin: 0; }
.ghost-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--soft); text-decoration: none; }
.ghost-btn:hover { background: var(--line); color: var(--ink); }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; font-size: 15px; }
.pill svg { width: 18px; height: 18px; }
.pill.dark { background: var(--ink); color: var(--bg); border-color: transparent; }
.pill:disabled { opacity: .5; }

/* ---------- today: the day's sky, a quiet page, one dock ---------- */
#today { display: flex; flex-direction: column; min-height: 100dvh; max-width: 760px; }
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); transition: background 2s ease; }
.sky .glow { position: absolute; width: 70vmax; height: 70vmax; margin: -35vmax 0 0 -35vmax; border-radius: 50%;
  background: radial-gradient(circle, var(--glow, #fff3d6) 0, transparent 60%); opacity: .4; transition: left 2s, top 2s; }
.sky .body { position: absolute; width: 9vmin; height: 9vmin; margin: -4.5vmin 0 0 -4.5vmin; border-radius: 50%; background: var(--glow, #fff3d6);
  box-shadow: 0 0 60px 20px color-mix(in srgb, var(--glow, #fff3d6) 45%, transparent); opacity: .75; }
.sky .drift { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .5; animation: drift 46s ease-in-out infinite alternate; }
.sky .drift.a { width: 60vmax; height: 26vmax; left: -10vmax; top: 18%; background: var(--cloud, rgba(255,255,255,.55)); }
.sky .drift.b { width: 50vmax; height: 22vmax; right: -14vmax; top: 46%; background: var(--cloud, rgba(255,255,255,.45)); animation-duration: 61s; animation-delay: -20s; }
.sky .stars { position: absolute; inset: 0; opacity: 0; transition: opacity 2s;
  background-image: radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent),
    radial-gradient(1.2px 1.2px at 44% 26%, #fff 50%, transparent), radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent),
    radial-gradient(1.6px 1.6px at 78% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 88% 9%, #fff 50%, transparent),
    radial-gradient(1.2px 1.2px at 6% 40%, #fff 50%, transparent), radial-gradient(1px 1px at 52% 6%, #fff 50%, transparent),
    radial-gradient(1.3px 1.3px at 35% 44%, #fff 50%, transparent), radial-gradient(1px 1px at 94% 48%, #fff 50%, transparent);
  animation: twinkle 7s ease-in-out infinite alternate; }
.sky.night .stars { opacity: .7; }
.sky .rain { position: absolute; inset: -10% 0 0; opacity: 0; background-image: repeating-linear-gradient(105deg, transparent 0 22px, rgba(255,255,255,.18) 22px 23px, transparent 23px 47px);
  background-size: 100% 120px; animation: rain .7s linear infinite; }
.sky.wet .rain { opacity: .5; }
@media (max-width: 700px) { .sky .body { display: none; } }
@keyframes drift { to { transform: translate(14vmax, -4vmax) scale(1.15); } }
@keyframes twinkle { to { opacity: .35; } }
@keyframes rain { to { background-position: -30px 120px; } }

.when { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.when > span { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); }
.here { border: 0; background: none; padding: 2px 0; text-align: left; color: var(--soft); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.here.muted { color: var(--faint); text-decoration: underline dotted; text-underline-offset: 3px; }
.page { flex: 1; display: flex; flex-direction: column; padding: 8px 0 24px; }
.hello { padding: 16vh 0 6vh; transition: padding .4s ease; }
.hello h1 { font-size: clamp(44px, 9vw, 84px); line-height: 1; margin: 0 0 12px; letter-spacing: -0.015em; }
.hello p { margin: 0; color: var(--soft); font-size: clamp(18px, 2.2vw, 22px); }
.hello.small { padding: 18px 0 10px; }
.hello.small h1 { font-size: clamp(30px, 4vw, 40px); margin: 0; }
.hello.small p { display: none; }

.words { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.words li { position: relative; }
.words li p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.words li.me p { font-family: var(--serif); font-size: clamp(23px, 2.6vw, 28px); line-height: 1.28; letter-spacing: -0.005em; }
.words li.them { padding-left: 16px; border-left: 2px solid var(--line); }
.words li.them p { color: var(--soft); font-size: clamp(15.5px, 1.5vw, 17px); line-height: 1.5; }
.words li.typing p::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; vertical-align: middle; }
.words .at { display: block; font-size: 12px; color: var(--faint); margin-top: 3px; }
.words .del { position: absolute; right: 0; top: -2px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--soft); font-size: 13px; display: none; }
.words li.me:hover .del, .words li.me.open .del { display: block; }
@keyframes blink { 50% { opacity: .2; } }

.painted { display: flex; align-items: center; gap: 14px; margin-top: 28px; padding: 10px; border-radius: 20px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow); }
.painted .thumb { width: 64px; height: 80px; border-radius: 14px; flex: none; }
.painted b { display: block; font-size: 23px; line-height: 1.1; }
.painted .txt span { color: var(--soft); font-size: 14px; }
.paint-now { align-self: flex-start; margin-top: 22px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--soft); font-size: 14.5px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint); }
.paint-now.busy { text-decoration: none; animation: blink 1.6s infinite; }
.paint-now:disabled { text-decoration: none; cursor: default; color: var(--soft); }

.plan-card { margin: 0 0 12px; padding: 20px; border-radius: 22px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.plan-card .serif { font-size: 28px; line-height: 1.1; margin: 0 0 8px; }
.plan-card p { margin: 0 0 14px; color: var(--soft); }
.plan-card .pill.dark { min-height: 50px; padding: 0 24px; font-size: 16px; }
.trial { font-size: 13px; color: var(--accent); text-decoration: none; margin-top: 2px; }
.plan-state { margin: 0; color: var(--ink); font-size: 16px; }
.nudge-card { margin: 0 0 12px; padding: 16px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
.nudge-card p { margin: 0 0 12px; }

.dock { position: sticky; bottom: 0; padding: 12px 0 max(16px, env(safe-area-inset-bottom)); }
.dock-row { display: flex; align-items: flex-end; gap: 12px; }
#form { flex: 1; display: flex; align-items: flex-end; min-height: 56px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line); border-radius: 28px; padding: 4px 4px 4px 18px; box-shadow: var(--shadow); }
#input { flex: 1; border: 0; background: none; resize: none; padding: 13px 0; max-height: 35vh; line-height: 1.4; outline: none; font-size: 17px; }
#input::placeholder { color: var(--soft); }
.send { flex: none; width: 46px; height: 46px; margin: 1px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.talk { flex: none; height: 56px; padding: 0 22px 0 18px; border-radius: 28px; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; gap: 10px;
  font-size: 16.5px; font-weight: 600; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .2s; }
.talk:active { transform: scale(.96); }
.talk .wave { display: flex; align-items: center; gap: 3px; height: 20px; }
.talk .wave i { width: 3px; border-radius: 2px; background: currentColor; animation: wave 1.2s ease-in-out infinite; }
.talk .wave i:nth-child(1) { height: 8px; } .talk .wave i:nth-child(2) { height: 16px; animation-delay: -.3s; }
.talk .wave i:nth-child(3) { height: 12px; animation-delay: -.6s; } .talk .wave i:nth-child(4) { height: 6px; animation-delay: -.9s; }
@keyframes wave { 50% { transform: scaleY(.45); } }
.orb { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .2s; }
.orb svg { width: 24px; height: 24px; }
.orb:active { transform: scale(.94); }
.orb.on { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); } 50% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--accent) 0%, transparent); } }

/* the wait while a day is painted: the page fades, the words turn to pigment */
.wait { position: fixed; inset: 0; z-index: 25; display: flex; align-items: flex-end; background: var(--bg); animation: fade 1.2s ease both; }
.wait canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wait-text { position: relative; width: 100%; padding: 140px max(24px, calc(50vw - 380px)) max(48px, calc(env(safe-area-inset-bottom) + 30px));
  background: linear-gradient(to top, var(--bg) 50%, color-mix(in srgb, var(--bg) 70%, transparent) 75%, transparent); }
.wait-text h1 { font-size: clamp(46px, 9vw, 88px); line-height: .98; margin: 8px 0 14px; letter-spacing: -0.02em; }
.wait-text h1::after { content: ''; display: inline-block; width: .5em; animation: dots 2.4s steps(4) infinite; overflow: hidden; vertical-align: bottom; white-space: nowrap; }
.wait-text p:not(.kicker) { color: var(--soft); font-size: clamp(17px, 2vw, 20px); line-height: 1.5; max-width: 32em; margin: 0 0 24px; }
.wait-text .pill { min-height: 52px; padding: 0 22px; }
.wait.done h1::after { display: none; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
body.waiting #today, body.waiting #day { opacity: 0; transition: opacity 1.2s ease; }

/* the live call: the day's sky shows through, the orb breathes with whoever is speaking */
.call { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; padding: max(18px, env(safe-area-inset-top)) 24px max(22px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 42%, transparent); backdrop-filter: blur(30px) saturate(1.3); -webkit-backdrop-filter: blur(30px) saturate(1.3); animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; } }
.call-top { width: 100%; max-width: 760px; display: flex; justify-content: space-between; color: var(--soft); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.call-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 0; }
.call-orb { --lv: 0; position: relative; width: min(46vw, 260px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; }
.call-orb::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, #fff) 0, var(--accent) 45%, color-mix(in srgb, var(--accent) 60%, #000) 100%);
  transform: scale(calc(.78 + var(--lv) * .5)); transition: transform .08s linear; box-shadow: 0 30px 90px color-mix(in srgb, var(--accent) 45%, transparent); }
.call-orb span { position: absolute; inset: -8%; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); animation: ring 3.2s ease-out infinite; }
.call-orb.me::before { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--ink) 30%, #fff) 0, var(--ink) 70%); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.call-orb.thinking::before { animation: think 1.4s ease-in-out infinite; }
@keyframes ring { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
@keyframes think { 50% { transform: scale(.72); } }
.call-state { margin: 0; color: var(--soft); font-size: 15px; min-height: 22px; }
.captions { width: 100%; max-width: 680px; min-height: 140px; text-align: center; }
.cap-agent { font-size: clamp(24px, 4vw, 34px); line-height: 1.25; margin: 0 0 10px; }
.cap-me { color: var(--soft); font-size: 17px; margin: 0; min-height: 26px; }
.call-actions { display: flex; gap: 16px; align-items: center; margin-top: 18px; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; }
.call-btn .slash { opacity: 0; }
.call-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.call-btn[aria-pressed="true"] .slash { opacity: 1; }
.call-end { min-height: 60px; padding: 0 34px; border-radius: 999px; border: 0; background: #d64533; color: #fff; font-size: 17px; }
.call-hint { color: var(--faint); font-size: 13.5px; margin: 14px 0 0; }

/* first visit: a few quiet steps before the page opens */
.onboard { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 6vh 0 14vh; }
.onboard h1 { font-size: clamp(48px, 10vw, 92px); line-height: .98; margin: 0 0 16px; letter-spacing: -0.02em; }
.onboard p { color: var(--soft); font-size: clamp(18px, 2.3vw, 22px); line-height: 1.5; margin: 0 0 30px; max-width: 34em; }
.onboard label { display: block; color: var(--soft); font-size: 15px; margin-bottom: 10px; }
.onboard input { flex: 1; min-width: 0; min-height: 56px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 18px; padding: 0 18px; font-size: 19px; color: var(--ink); }
.onboard .pill { min-height: 56px; padding: 0 24px; font-size: 16px; }
.onboard .row { gap: 12px; }
.onboard .steps { display: flex; gap: 6px; margin-top: 40px; }
.onboard .steps i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.onboard .steps i.on { background: var(--ink); }
.onboard .step { animation: rise .6s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
body.onboarding .dock, body.onboarding .page, body.onboarding .nudge-card, body.onboarding .bar nav { display: none !important; }

/* ---------- days ---------- */
#grid { padding-bottom: 48px; }
.month { font-size: 24px; margin: 22px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 190px), 1fr)); gap: 12px; }
.card { position: relative; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 4 / 5.4; padding: 14px; border-radius: 20px;
  color: #2b211c; text-decoration: none; overflow: hidden; box-shadow: var(--shadow); transition: transform .25s; }
.card:hover { transform: translateY(-3px); }
.card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(255,250,244,.92) 16%, rgba(255,250,244,0) 52%); pointer-events: none; }
.card.dark { color: #fbf1e7; }
.card.dark::before { background: linear-gradient(to top, rgba(22,14,10,.86) 16%, rgba(22,14,10,0) 52%); }
.card.plain { background: var(--paper); color: var(--ink); border: 1px dashed var(--faint); box-shadow: none; }
.card.plain::before { display: none; }
.card > * { position: relative; }
.card .num { position: absolute; top: 10px; left: 14px; font-family: var(--serif); font-size: 34px; line-height: 1; }
.card .wd { position: absolute; top: 46px; left: 15px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.card.plain .num, .card.plain .wd { color: var(--soft); }
.card b { font-family: var(--serif); font-weight: 400; font-size: 21px; line-height: 1.1; margin-bottom: 3px; }
.card .where { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .badge { position: absolute; top: 12px; right: 12px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.75); color: #2b211c; }
.empty { color: var(--soft); text-align: center; padding: 18vh 20px; font-size: 17px; }

/* ---------- one day ---------- */
#day { max-width: none; padding: 0; }
.stage { position: relative; height: 100svh; min-height: 520px; overflow: hidden; background: var(--bg); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage-top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.glass { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: var(--ink); }
.stage-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 80px max(22px, 6vw) max(46px, calc(env(safe-area-inset-bottom) + 34px)); pointer-events: none;
  background: linear-gradient(to top, rgba(255,250,244,.93) 30%, rgba(255,250,244,0)); color: #2b211c; }
.stage.dark .stage-text { background: linear-gradient(to top, rgba(22,14,10,.86) 30%, rgba(22,14,10,0)); color: #fbf1e7; }
.stage-text h1 { font-size: clamp(42px, 9vw, 80px); line-height: .98; margin: 6px 0 8px; }
.stage-text .tagline { font-style: italic; font-size: clamp(20px, 4vw, 28px); margin: 0 0 8px; opacity: .9; }
.stage-text .kicker, .stage-text .meta { color: inherit; opacity: .75; margin: 0; font-size: 14px; }
.stage-text .kicker { font-size: 12px; }
.scroll-cue { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; width: 20px; height: 20px; margin-left: -10px; border-right: 2px solid #2b211c;
  border-bottom: 2px solid #2b211c; transform: rotate(45deg) scale(.6); opacity: .35; animation: nudge 2s infinite; pointer-events: none; }
.stage.dark .scroll-cue { border-color: #fbf1e7; }
@keyframes nudge { 50% { translate: 0 5px; } }
.paper { max-width: 640px; margin: 0 auto; padding: 36px 22px 90px; }
.status { padding: 14px 16px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); margin-bottom: 20px; font-size: 15px; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { font-size: clamp(24px, 5vw, 31px); line-height: 1.25; padding: 16px 0; border-bottom: 1px solid var(--line); }
.summary { color: var(--soft); font-size: 17px; margin: 26px 0; }
.convo { border-top: 1px solid var(--line); padding-top: 6px; }
.convo summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; color: var(--soft); font-size: 15px; }
.convo .words { padding: 8px 0 20px; }

/* ---------- settings ---------- */
.prefs { padding-bottom: 110px; }
.prefs fieldset { border: 0; margin: 0; padding: 22px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.prefs legend { font-family: var(--serif); font-size: 24px; padding: 0; margin-bottom: 4px; }
.prefs label { display: flex; flex-direction: column; gap: 6px; color: var(--soft); font-size: 14px; }
.prefs input:not([type=checkbox]), .prefs textarea, .prefs select { color: var(--ink); font-size: 16px; min-height: 46px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; }
.prefs textarea { resize: vertical; line-height: 1.45; }
.prefs fieldset > textarea { width: 100%; }
.prefs .switch { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; color: var(--ink); font-size: 15.5px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; margin: 0; flex: none; transition: background .2s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.hint { margin: 0; color: var(--faint); font-size: 13.5px; }
.danger { align-self: flex-start; min-height: 44px; border: 0; background: none; color: #c0392b; padding: 0; font-size: 15px; }
.save-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px max(20px, calc(50vw - 320px)) max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.save-bar span { color: var(--soft); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: max(110px, calc(env(safe-area-inset-bottom) + 96px)); transform: translateX(-50%); max-width: min(92vw, 440px); padding: 12px 18px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-size: 14.5px; box-shadow: var(--shadow); z-index: 10; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
