:root {
  --bg: #f2f2f0;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #6a706c;
  --line: #e4e4e0;
  --field: #f8f8f6;
  --green: #2e6b5a;
  --green-soft: #e3eee8;
  --dark: #213b34;
  --dark-line: #4f6b62;
  --dark-muted: #b9d0c7;
  --chip: #ececea;
  --track: #ccd0cc;
  --red: #a8392b;
  --radius: 20px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.dark { background: var(--dark); color: #fff; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 40px) 22px calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  flex-direction: column;
}
.screen.loading { justify-content: center; align-items: center; color: var(--muted); }
.stack { display: flex; flex-direction: column; flex: 1; }
.spacer { flex: 1; min-height: 28px; }

/* brand */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand svg { width: 21px; height: 16px; color: var(--green); }
.dark .brand svg { color: var(--dark-muted); }
.brand.big { font-size: 28px; letter-spacing: -0.02em; gap: 10px; margin: 0 0 18px; }
.brand.big svg { width: 23px; height: 17px; }

/* type */
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-size: 12.5px; font-weight: 600; }
h1 { font-size: 33px; line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; margin: 8px 0 10px; }
h1.title { font-size: 30px; font-weight: 600; margin: 22px 0 18px; }
.sub { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.label { display: block; color: var(--muted); font-weight: 600; font-size: 13px; margin: 26px 0 8px; }
.section { text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-size: 12px; font-weight: 700; margin: 22px 4px 10px; }
.error { color: var(--red); font-size: 14px; min-height: 18px; margin: 10px 0 0; }
.note { color: var(--muted); text-align: center; font-size: 13px; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 12px 4px 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 16px; text-decoration: none; align-self: flex-start; padding: 4px 0; background: none; border: 0; }
.dark .back { color: var(--dark-muted); }

/* inputs */
.field {
  width: 100%; height: 50px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card);
  font-size: 16px; padding: 0 16px; outline: none; -webkit-appearance: none; appearance: none;
}
.field.soft { background: var(--field); height: 42px; border-radius: 10px; font-size: 15px; padding: 0 12px; }
.field:focus { border-color: var(--green); }
input[type='password'].field { letter-spacing: 0.15em; }
input[type='password'].field::placeholder { letter-spacing: normal; }

.chips { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.chip {
  height: 42px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 15px; font-weight: 500; padding: 0 2px; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.chip.small { font-size: 13px; }
.chip[aria-pressed='true'] { background: var(--green-soft); border-color: var(--green); }
.custom { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.custom .field { height: 44px; }
.custom span { color: var(--muted); white-space: nowrap; font-size: 15px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip); border-radius: 16px; padding: 4px; }
.segmented button { height: 38px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 15px; }
.segmented button[aria-pressed='true'] { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.switch { position: relative; width: 51px; height: 31px; flex: none; border: 0; border-radius: 99px; background: var(--track); transition: background 0.2s; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch[aria-checked='true'] { background: var(--green); }
.switch[aria-checked='true']::after { transform: translateX(20px); }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border: 0; border-radius: 16px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.99); }
.btn.dark { background: var(--dark); }
.btn.small { height: 44px; border-radius: 12px; font-size: 15px; width: auto; padding: 0 18px; }
.btn:disabled { opacity: 0.55; }
.btn-text { background: none; border: 0; font-size: 16px; font-weight: 500; padding: 16px; width: 100%; }
.btn-text.danger { color: var(--red); font-weight: 600; }
.btn-outline { border: 1.5px solid var(--green); color: var(--green); background: var(--card); border-radius: 10px; height: 34px; padding: 0 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.badge { background: var(--chip); color: var(--ink); border-radius: 99px; padding: 5px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge.on { background: var(--green-soft); color: var(--green); }

/* cards and rows */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 10px; }
.card.pad { padding: 16px; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); min-height: 51px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; text-decoration: none; color: inherit; }
.row:first-child { border-top: 0; }
.row.tall { min-height: 70px; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 16px; font-weight: 600; }
.row .name.plain { font-weight: 500; }
.row .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.row .meta.on { color: var(--green); font-weight: 600; }
.row .value { color: var(--muted); font-size: 14px; white-space: nowrap; }
.row .chev { color: var(--muted); font-size: 18px; line-height: 1; }
.row.add { color: var(--green); font-weight: 600; font-size: 16px; }

.hero { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-radius: var(--radius); background: var(--dark); color: #fff; text-decoration: none; }
.hero .grow { flex: 1; }
.hero .name { font-size: 16px; font-weight: 700; }
.hero .meta { color: var(--dark-muted); font-size: 13px; margin-top: 4px; }
.hero .chev { font-size: 20px; color: var(--dark-muted); }

.pause-edit { padding: 0 16px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pause-edit .field { flex: 1; min-width: 170px; height: 44px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.stat { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px 16px 16px; }
.stat .num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.stat .num.green { color: var(--green); }
.stat .what { color: var(--muted); font-size: 13px; margin-top: 10px; }

.form-card { margin-top: 18px; }
.form-card .label:first-child { margin-top: 0; }
.form-card .label { margin-top: 14px; }

/* gate: unlocked / not now */
.center { text-align: center; align-items: center; }
.circle { width: 62px; height: 62px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 18px; }
.circle svg { width: 26px; height: 26px; }
.clock { font-size: 56px; font-weight: 700; line-height: 1; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }

/* bricked */
.bricked .mark { width: 66px; height: 50px; margin: 0 auto 22px; }
.bricked h1 { margin: 0 0 8px; }
.bricked .sub { color: var(--dark-muted); }
.bricked .countdown { font-size: 54px; font-weight: 600; line-height: 1; margin: 34px 0 10px; font-variant-numeric: tabular-nums; }
.bricked .locked { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.bricked .pill { border: 1.5px solid var(--dark-line); border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.bricked .sos { background: none; border: 0; color: var(--dark-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; margin-top: 22px; padding: 8px; opacity: 0.8; }
.bricked .sos-form { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 22px; }
.bricked .sos-form .sub { font-size: 14px; }
.bricked .field { background: rgba(255, 255, 255, 0.08); border-color: var(--dark-line); color: #fff; }
.bricked .field::placeholder { color: var(--dark-muted); }
.bricked .field:focus { border-color: var(--dark-muted); }
.bricked .btn-text { color: var(--dark-muted); padding: 10px; }
.bricked .error { color: #ffb4a8; margin: 0; min-height: 0; }
.bricked .error:empty { display: none; }
.btn.danger { background: var(--red); }

.steps { margin: 0; padding: 0 0 0 20px; line-height: 1.55; font-size: 15px; }
.steps li { margin: 0 0 10px; }
.steps li:last-child { margin-bottom: 0; }
code { background: var(--chip); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 340px) {
  h1 { font-size: 29px; }
  .chip { font-size: 14px; }
}
