:root {
  --bg: #f6f6f4; --surface: #fff; --text: #1c1d1b; --muted: #6a6d68; --border: #e2e3df;
  --field: #f3f3f1; --accent: #2a2a2a; --accent-ink: #fff; --link: #2a2a2a;
  --danger: #b3261e; --ok: #1f7a3f;
  color-scheme: light;
}
:root[data-app="time-farm"] { --bg: #faf7ee; --border: #e6e0cd; --field: #f6f2e6; --accent: #29613c; --link: #29613c; }
:root[data-app="habit-streaks"] { --bg: #fffdfb; --border: #ece8e2; --field: #f5f3f0; --accent: #f6c227; --accent-ink: #241c05; --link: #9a5a00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111211; --surface: #1c1d1b; --text: #ecedea; --muted: #a2a59f; --border: #2e302c;
    --field: #252724; --accent: #f1f1ef; --accent-ink: #111; --link: #f1f1ef;
    --danger: #ff8a80; --ok: #7fd49a; color-scheme: dark;
  }
  :root[data-app="time-farm"]:not([data-theme="light"]) { --bg: #131711; --surface: #1d221b; --border: #2f362c; --field: #262c24; --accent: #8fcf9c; --accent-ink: #0f2414; --link: #8fcf9c; }
  :root[data-app="habit-streaks"]:not([data-theme="light"]) { --bg: #000; --surface: #1c1c1e; --border: #2c2c2e; --field: #2c2c2e; --accent: #e8b93e; --accent-ink: #241c05; --link: #e8b93e; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
main { max-width: 560px; margin: 0 auto; padding: 48px 16px 40px; }
[hidden] { display: none !important; }
:root:not([data-app="time-farm"]) [data-time-farm-only] { display: none !important; }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand img { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
:root:not([data-app]) .brand img { display: none; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 40px 0 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { margin-top: 20px; }
.field:first-child { margin-top: 0; }
.label { display: block; font-weight: 600; margin-bottom: 8px; }
.optional { color: var(--muted); font-weight: 400; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--field); border-radius: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 8px 6px; border-radius: 9px; font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer; user-select: none; transition: background .15s, color .15s; }
.seg input:checked + label { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.seg input:focus-visible + label { outline: 2px solid var(--link); outline-offset: 1px; }

textarea, input[type="email"] { display: block; width: 100%; font: inherit; color: var(--text); background: var(--field); border: 1px solid transparent; border-radius: 12px; padding: 12px 14px; }
textarea { min-height: 150px; resize: vertical; }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: .8; }
textarea:focus, input[type="email"]:focus { outline: none; border-color: var(--link); background: var(--surface); }

.submit { display: block; width: 100%; margin-top: 20px; padding: 13px; font: inherit; font-weight: 600; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 12px; cursor: pointer; }
.submit:disabled { opacity: .5; cursor: default; }
.submit:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.note { margin: 12px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.status { margin: 12px 0 0; font-size: 14px; text-align: center; }
.status:empty { display: none; }
.status.error { color: var(--danger); }

.done { text-align: center; padding: 24px 0 8px; }
.done .check { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 26px; }
.done h2 { margin: 14px 0 4px; }
.done p { margin: 0 0 18px; color: var(--muted); }
.link-button { font: inherit; color: var(--link); background: none; border: 0; padding: 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

details { border-top: 1px solid var(--border); }
details:last-of-type { border-bottom: 1px solid var(--border); }
summary { padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 14px; color: var(--muted); }

footer { margin-top: 40px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; }
footer a { color: inherit; }

.prose h1 { margin: 16px 0 20px; }
.prose p { color: var(--text); }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 420px) { main { padding-top: 32px; } .card { padding: 16px; border-radius: 18px; } h1 { font-size: 23px; } }
