@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/fonts/inter-700.woff2") format("woff2"); }

/* Two moods: night blue while the child sleeps, warm and light while it is awake. */
:root {
  --bg-a: #1a2142; --bg-b: #34305f; --fg: #eef0ff; --dim: #b4b7dc;
  --orb: #f4e6c1; --btn: #f4e6c1; --btn-fg: #1a2142;
  --field: rgba(255, 255, 255, 0.1); --hair: rgba(255, 255, 255, 0.22);
  --sheet: #232a50; --danger: #ffb4a8;
  color-scheme: dark;
}
body.day {
  --bg-a: #fdf1dc; --bg-b: #f7d8c0; --fg: #3b2b2a; --dim: #7a5f58;
  --orb: #f0a352; --btn: #1a2142; --btn-fg: #eef0ff;
  --field: rgba(59, 43, 42, 0.08); --hair: rgba(59, 43, 42, 0.25);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 16px/1.5 "Inter", "Segoe UI", system-ui, sans-serif; color: var(--fg);
  background: linear-gradient(170deg, var(--bg-a), var(--bg-b)) fixed;
  transition: color 0.4s;
}
#view {
  min-height: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
    calc(22px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0; text-align: center; text-wrap: balance; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
p { margin: 0; }
.dim, .small { color: var(--dim); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; }

.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.topbar .name { font-weight: 600; }
.kids { display: flex; flex-wrap: wrap; gap: 8px; }
h1, h2, .topbar .name, .chip, .since, .devices li { overflow-wrap: anywhere; }
.topbar .name, .chip { min-width: 0; }
.chip { font: inherit; font-size: 14px; padding: 7px 16px; min-height: 44px; border-radius: 999px; border: 0; background: transparent;
  color: var(--fg); box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; }
.chip.on { background: var(--fg); color: var(--bg-a); box-shadow: none; cursor: default; font-weight: 600; }
.chip:disabled { opacity: 0.5; }
.iconbtn { background: none; border: 0; color: var(--fg); font: inherit; padding: 10px 0 10px 16px; cursor: pointer; }

.orb { width: 120px; height: 120px; border-radius: 50%; align-self: center; margin: 28px 0 12px; background: var(--orb);
  box-shadow: inset -26px -10px 0 0 var(--bg-a), 0 0 60px 4px rgba(244, 230, 193, 0.22); transition: background 0.4s, box-shadow 0.4s; }
body.day .orb { margin-bottom: 44px; box-shadow: 0 0 0 16px rgba(240, 163, 82, 0.2), 0 0 0 36px rgba(240, 163, 82, 0.1); }
body.empty .orb { background: transparent; box-shadow: inset 0 0 0 2px var(--hair); }
.since { text-align: center; color: var(--dim); font-variant-numeric: tabular-nums; }
.since strong { display: block; color: var(--fg); font-size: 20px; font-weight: 600; }

.timeline { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.track { position: relative; height: 12px; border-radius: 6px; background: var(--field); overflow: hidden; }
.track i { position: absolute; top: 0; bottom: 0; background: #f4e6c1; border-radius: 3px; min-width: 2px; }
body.day .track i { background: #34305f; }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); }

button, input, select { font: inherit; }
select { color: inherit; }
select option { color: #14242e; }
.btn { width: 100%; padding: 15px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600;
  background: var(--btn); color: var(--btn-fg); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--hair); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.slim { width: auto; padding: 8px 14px; font-size: 14px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.pair { display: flex; gap: 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
.grid .btn { padding: 15px 8px; }
.btn.on:disabled { opacity: 1; }
.mark { width: 120px; height: 120px; align-self: center; margin: 20px 0 4px; color: var(--orb); transition: color 0.4s; }
body.empty .mark { opacity: 0.35; }
.last { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.last li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hair); }
.last li span:first-child { color: var(--dim); }
.last li span:last-child { text-align: right; overflow-wrap: anywhere; }

form, .stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--dim); }
input[type="text"], input[type="password"], select { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--hair);
  background: var(--field); color: var(--fg); font-size: 16px; }
label.check { flex-direction: row; gap: 10px; align-items: flex-start; color: var(--fg); font-size: 14px; line-height: 1.45; }
label.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.err { color: var(--danger); font-size: 14px; min-height: 21px; }
.note { border: 1px solid var(--hair); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.banner { text-align: center; font-size: 13px; padding: 6px 10px; border-radius: 999px; background: var(--field); }

dialog { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 440px; max-height: 88%; color: #eef0ff;
  background: var(--sheet); border-radius: 22px 22px 0 0; --fg: #eef0ff; --dim: #b4b7dc; --btn: #f4e6c1; --btn-fg: #1a2142;
  --field: rgba(255, 255, 255, 0.1); --hair: rgba(255, 255, 255, 0.22); }
dialog::backdrop { background: rgba(10, 12, 30, 0.6); }
.sheet { padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 22px; }
.sheet section { display: flex; flex-direction: column; gap: 10px; }
.sheet .head { display: flex; justify-content: space-between; align-items: center; }
.devices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.devices li > span { min-width: 0; overflow-wrap: anywhere; }
.linkbox { font-size: 13px; word-break: break-all; user-select: all; }
a { color: inherit; }
a.btn { display: block; text-align: center; text-decoration: none; }
footer.brand { text-align: center; font-size: 12px; color: var(--dim); }
.legal { max-width: 640px; gap: 12px; }
.legal h1 { text-align: left; font-size: 24px; margin-top: 18px; }
.legal h2 { margin-top: 10px; }
.legal ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { body, .orb { transition: none; } }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
