:root {
  --bg: #f7f4ee; --card: #fffdf9; --ink: #1f1d1a; --muted: #7a736a; --line: #e6dfd3;
  --accent: #b24a2a; --accent-ink: #fff; --accent-soft: #f5e4dc; --ok: #2f6b52;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root { --bg: #161412; --card: #201d19; --ink: #ece7dc; --muted: #9b948a; --line: #2f2a24; --accent: #e0765a; --accent-ink: #1a0e09; --accent-soft: #3a2620; --ok: #7fb89a; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 2rem; margin: 0 0 .5em; } h2 { font-size: 1.4rem; margin: 0 0 .5em; } h3 { font-size: 1.1rem; margin: 0 0 .4em; }
p { margin: 0 0 1em; } a { color: var(--accent); } .muted { color: var(--muted); } .small { font-size: .92rem; } .center { text-align: center; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-weight: 600; margin: 16px 0 6px; } label .hint { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 12px 18px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 17px; cursor: pointer; text-decoration: none; transition: transform .06s; }
.btn:active { transform: scale(.98); } .btn[disabled] { opacity: .55; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); min-height: 44px; }
.btn.danger { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); color: #fff; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 0 0 16px; }
.err { color: var(--accent); font-size: .95rem; margin: 10px 0 0; min-height: 1.2em; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); } .switch:first-of-type { border-top: 0; }
.switch .t { font-weight: 600; } .switch .d { color: var(--muted); font-size: .9rem; }
.toggle { flex: none; width: 52px; height: 32px; border-radius: 16px; background: var(--line); border: 0; position: relative; cursor: pointer; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle.on { background: var(--accent); } .toggle.on::after { left: 23px; }
.page { max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 18px) 18px calc(var(--sab) + 96px); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; min-height: 40px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--accent); text-decoration: none; }
.brand small { display: block; font-family: var(--sans); font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 8px 8px calc(var(--sab) + 8px); z-index: 20; }
.tabs a { flex: 1; max-width: 140px; text-align: center; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 0; }
.tabs a .ic { display: block; font-size: 22px; line-height: 1.1; } .tabs a.on { color: var(--accent); }
/* the one thing */
.focus { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 20px 0; }
.thing { font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 7vw, 2.6rem); line-height: 1.15; letter-spacing: -0.015em; overflow-wrap: anywhere; margin: 0 0 12px; }
.why { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); font-style: italic; margin: 0 0 18px; white-space: pre-wrap; }
.since { color: var(--muted); font-size: .95rem; margin-bottom: 26px; }
.ring { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--accent); display: inline-block; vertical-align: -1px; margin-right: 8px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.empty h1 { font-size: 2.2rem; }
.empty textarea.big { font-family: var(--serif); font-size: 1.6rem; line-height: 1.25; min-height: 120px; padding: 16px; border-radius: 16px; resize: none; }
.hint-list { padding: 0; margin: 0; list-style: none; color: var(--muted); font-size: .95rem; } .hint-list li { padding: 4px 0; } .hint-list li::before { content: "— "; color: var(--accent); }
.done-splash { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; animation: pop .35s ease-out; }
.done-splash .big { font-family: var(--serif); font-size: 4.2rem; line-height: 1; margin: 0 0 6px; color: var(--ok); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* history */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; }
.stats b { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; } .stats span { color: var(--muted); font-size: .78rem; }
.day { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 18px 0 6px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; margin-top: 2px; }
.item.done .mark { background: var(--ok); color: #fff; } .item.dropped .mark { border: 2px solid var(--line); color: var(--muted); }
.item .t { font-weight: 600; overflow-wrap: anywhere; } .item.dropped .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.item .s { color: var(--muted); font-size: .85rem; } .item .n { font-size: .92rem; color: var(--muted); font-style: italic; white-space: pre-wrap; }
.item .x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 4px; cursor: pointer; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 20px 20px 0 0; padding: 14px 16px calc(var(--sab) + 16px); }
.sheet .h { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; } .sheet .btn { margin-top: 8px; }
.tip { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: .92rem; margin-bottom: 16px; }
.tip button { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
.code-in { text-align: center; font-size: 30px; letter-spacing: .35em; padding-left: calc(14px + .35em); }
#toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 90px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .95rem; z-index: 60; max-width: 90vw; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { margin-top: auto; padding-top: 30px; color: var(--muted); font-size: .85rem; }
