/* Next Me: design tokens and shell. Same look as docs/design/prototype.html. */
:root {
  --bg: #eef1f6; --card: #ffffff; --ink: #111a2e; --mute: #5b6679; --line: #dde2ec;
  --brand: #2447d6; --on-brand: #ffffff; --soft: #e4e9f8;
  --sun: #d97a00; --sun-soft: #fff0d9; --good: #12836f; --good-soft: #dcf3ee; --bad: #c9372c; --bad-soft: #fde6e3;
  --f-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --card: #131c31; --ink: #eef2fb; --mute: #97a3ba; --line: #243049;
    --brand: #8aa3ff; --on-brand: #0b1120; --soft: #1a2547;
    --sun: #ffb347; --sun-soft: #3a2a10; --good: #3ccaa8; --good-soft: #12302b; --bad: #ff7a6e; --bad-soft: #3b1b19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --card: #131c31; --ink: #eef2fb; --mute: #97a3ba; --line: #243049;
  --brand: #8aa3ff; --on-brand: #0b1120; --soft: #1a2547;
  --sun: #ffb347; --sun-soft: #3a2a10; --good: #3ccaa8; --good-soft: #12302b; --bad: #ff7a6e; --bad-soft: #3b1b19;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  overscroll-behavior: none; touch-action: manipulation;
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
[hidden] { display: none !important; } /* without this, a rule like .scrim { display: flex } would show hidden elements */
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* The phone-sized app. Full screen on a phone, framed on a wide screen. */
.app { height: 100vh; height: 100dvh; max-width: 430px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); }
@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; }
  .app { height: min(100dvh, 860px); width: 430px; border: 1px solid var(--line); border-radius: 36px; overflow: hidden; box-shadow: 0 20px 60px rgba(10, 20, 50, .18); }
}
#view {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 52px; color: var(--mute); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tab[aria-current="page"] { color: var(--brand); }

h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.1; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.mute { color: var(--mute); }
.note { font-size: 12px; color: var(--mute); }
.num { font-variant-numeric: tabular-nums; }
.big { font-family: var(--f-display); font-size: 34px; font-weight: 800; line-height: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sep { border-top: 1px solid var(--line); }

.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 500; background: var(--card); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--brand); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.sun { background: var(--sun-soft); color: var(--sun); }
.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--mute); font-size: 14px; }
.plain li::marker { color: var(--brand); }

/* 97-day map */
.map { display: grid; grid-template-columns: repeat(25, 1fr); gap: 3px; }
.map i { aspect-ratio: 1; border-radius: 3px; background: var(--soft); }
.map i.past { background: color-mix(in srgb, var(--good) 45%, var(--soft)); }
.map i.now { background: var(--sun); outline: 2px solid var(--sun); outline-offset: 1px; }
.map i.end { background: var(--brand); }

.map i.l1 { background: color-mix(in srgb, var(--good) 35%, var(--soft)); }
.map i.l2 { background: color-mix(in srgb, var(--good) 65%, var(--soft)); }
.map i.l3 { background: var(--good); }

.app { position: relative; }
.hero { display: flex; gap: 14px; align-items: center; }
.ringwrap { position: relative; width: 84px; height: 84px; flex: none; }
.ringwrap b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-size: 22px; }

/* buttons, inputs, links */
.btn { min-height: 46px; padding: 0 18px; border-radius: 14px; background: var(--brand); color: var(--on-brand); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: var(--soft); color: var(--brand); }
.btn.block { width: 100%; }
.field { width: 100%; min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 14px; font: inherit; }
.field:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.link { color: var(--brand); font-weight: 600; font-size: 13px; min-height: 32px; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.bar.good > i { background: var(--good); }
a.card { color: inherit; }

/* tick circles and rows */
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: transparent; }
.check .ic { width: 16px; height: 16px; stroke-width: 3; }
.check.big { width: 34px; height: 34px; }
.check.off { border-style: dashed; opacity: .5; }
.done .check, .check.on { background: var(--good); border-color: var(--good); color: #fff; }
.task { min-height: 48px; width: 100%; text-align: left; }
.done .tx { color: var(--mute); text-decoration: line-through; }
.habit { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; }
.habit.rest .tx { color: var(--mute); }
.del { color: var(--bad); min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: 12px; }
.del.ask { background: var(--bad-soft); }
.week { display: flex; gap: 4px; }
.week i { width: 12px; height: 12px; border-radius: 4px; background: var(--soft); }
.week i.y { background: var(--good); }
.week i.n { background: var(--bad-soft); box-shadow: inset 0 0 0 1.5px var(--bad); }
.week i.p { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.flame { display: inline-flex; align-items: center; gap: 3px; color: var(--sun); font-weight: 700; font-size: 14px; }
.flame .ic { width: 16px; height: 16px; }

.mood { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood button { min-height: 48px; border-radius: 14px; border: 1px solid var(--line); font-size: 22px; background: var(--bg); }
.mood button.on { border-color: var(--brand); background: var(--soft); }

/* bottom sheet and toast */
.scrim { position: absolute; inset: 0; background: rgba(5, 10, 25, .5); display: flex; align-items: flex-end; z-index: 20; }
.sheet { width: 100%; background: var(--card); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; max-height: 88%; overflow: auto; animation: up .22s ease-out; }
.sheetform { display: flex; flex-direction: column; gap: 12px; }
.grab { width: 40px; height: 4px; border-radius: 9px; background: var(--line); align-self: center; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.toast { position: absolute; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 18px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; z-index: 30; max-width: 88%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
