/* Daily Care — big, calm, high-contrast UI for older eyes and shaky thumbs. */
:root {
  --bg: #f5f2ec;
  --card: #ffffff;
  --ink: #15191e;
  --muted: #3f4752;
  --line: #d8d2c4;
  --brand: #0f6e66;
  --brand-ink: #ffffff;
  --done: #1d7a3a;
  --done-bg: #e5f4e8;
  --due: #8a4b00;
  --due-bg: #fff1d6;
  --late: #a3221b;
  --late-bg: #fde6e3;
  --sick: #6d3fa6;
  --radius: 18px;
  --nav-h: 76px;
  color-scheme: light;
}
html { font-size: 20px; -webkit-text-size-adjust: 100%; }
html[data-size="m"] { font-size: 18px; }
html[data-size="l"] { font-size: 20px; }
html[data-size="xl"] { font-size: 24px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
body.no-nav { padding-bottom: 24px; }
main { max-width: 680px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px 0; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.15rem; margin: 26px 4px 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: .4em 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
.loading { text-align: center; margin-top: 30vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- header ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 4px 4px 0; }
.top .date { font-size: 1.45rem; font-weight: 800; }
.top .clock { font-size: 1.45rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.hello { margin: 2px 4px 0; color: var(--muted); }

/* ---------- cards & buttons ---------- */
.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 3px solid var(--brand);
  background: var(--card);
  color: var(--brand);
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.done { background: var(--done); border-color: var(--done); color: #fff; font-size: 1.25rem; min-height: 76px; }
.btn.sick { background: var(--sick); border-color: var(--sick); color: #fff; }
.btn.quiet { border-color: var(--line); color: var(--ink); font-weight: 700; }
.btn.danger { border-color: var(--late); color: var(--late); }
.btn[disabled] { opacity: .5; }
.btn-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }
.btn + .btn { margin-top: 10px; }
.linkbtn {
  background: none; border: none; padding: 14px 6px; margin: 4px auto 0; display: block;
  color: var(--muted); text-decoration: underline; font-size: 1rem; cursor: pointer;
}

/* ---------- "right now" cards ---------- */
.now { border-left-width: 10px; }
.now.due { border-color: var(--due); background: var(--due-bg); }
.now.late { border-color: var(--late); background: var(--late-bg); }
.now .when { font-weight: 800; font-size: 1rem; }
.now.due .when { color: var(--due); }
.now.late .when { color: var(--late); }
.item-head { display: flex; gap: 14px; align-items: flex-start; }
.icon { font-size: 2.2rem; line-height: 1; flex: none; width: 2.6rem; text-align: center; }
.title { font-size: 1.3rem; font-weight: 800; margin-top: 2px; }
.sub { color: var(--muted); font-size: 1rem; margin-top: 2px; }
.allgood { display: flex; gap: 14px; align-items: center; background: var(--done-bg); border-color: var(--done); }
.allgood .title { color: var(--done); }

/* ---------- counters ---------- */
.counter { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.counter .info { background: none; border: none; padding: 0; text-align: left; cursor: pointer; }
.counter .count { font-weight: 800; font-size: 1.05rem; }
.counter .count.goal-met { color: var(--done); }
.counter .btn { grid-column: 1 / -1; min-height: 60px; }
.dots { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand); display: block; }
.dots i.on { background: var(--brand); }
.dots i.extra { border-style: dashed; }

/* ---------- schedule list ---------- */
.sched { list-style: none; margin: 0; padding: 0; }
.sched li + li { border-top: 2px solid var(--line); }
.sched button {
  width: 100%; background: none; border: none; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 4.7rem 1.9rem 1fr; gap: 8px; align-items: center;
  padding: 14px 4px; min-height: 64px;
}
.sched .t { font-weight: 800; font-size: 1rem; }
.card.list { padding: 2px 12px; }
.missed { display: block; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--late); font-weight: 700; }
.sched .ic { font-size: 1.6rem; text-align: center; }
.sched .nm { font-weight: 700; }
.sched .st { display: block; font-size: .9rem; font-weight: 700; margin-top: 2px; }
.sched .is-done .nm { color: var(--muted); }
.st.done { color: var(--done); }
.st.skipped { color: var(--muted); }
.st.due { color: var(--due); }
.st.late { color: var(--late); }

/* ---------- sheet (full-screen detail) ---------- */
.sheet, .modal {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.sheet-inner { max-width: 680px; margin: 0 auto; }
.close {
  display: block; margin-left: auto; min-height: 56px; padding: 8px 20px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--card);
  font-size: 1.05rem; font-weight: 800; cursor: pointer;
}
.sheet .bigicon { font-size: 3.2rem; line-height: 1; }
.sheet h1 { font-size: 1.6rem; margin: 8px 0 4px; }
.sheet .timebig { font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 14px 0; }
.steps li {
  counter-increment: s; position: relative;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 14px 14px 64px; margin: 10px 0; font-size: 1.12rem; cursor: pointer; min-height: 60px;
}
.steps li::before {
  content: counter(s); position: absolute; left: 12px; top: 12px;
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.steps li.crossed { color: var(--muted); text-decoration: line-through; background: #efece5; }
.steps li.crossed::before { content: "✓"; background: var(--done); }
.steps.static li { cursor: default; }
.note { background: #e8f1f0; border: 2px solid #b9d6d3; border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.statusbox { border-radius: 14px; padding: 14px; margin: 14px 0; font-weight: 800; font-size: 1.1rem; }
.statusbox.done { background: var(--done-bg); color: var(--done); border: 2px solid var(--done); }
.statusbox.skipped { background: #eceae4; color: var(--muted); border: 2px solid var(--line); }
.loglist { list-style: none; padding: 0; margin: 8px 0; }
.loglist li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.loglist li.stack { flex-direction: column; align-items: flex-start; gap: 2px; }

/* ---------- confirm modal ---------- */
.modal { background: rgba(20, 25, 30, .55); display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 22px; padding: 22px 18px; width: min(560px, 100%); }
.modal-box h3 { font-size: 1.35rem; margin-bottom: 8px; }

/* ---------- feeling sick ---------- */
.prn .step-badge {
  display: inline-block; background: var(--sick); color: #fff; font-weight: 800;
  border-radius: 999px; padding: 4px 14px; font-size: .95rem; margin-bottom: 10px;
}
.prn.second .step-badge { background: #8b6bb8; }
.prn .real { color: var(--muted); font-size: 1rem; }
.lastgiven { border-radius: 12px; background: #f1ecf8; padding: 10px 12px; margin: 10px 0; font-weight: 700; }

/* ---------- more / settings ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { min-height: 60px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); font-weight: 800; cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--brand); background: #e1efed; color: var(--brand); }
.seg button:nth-child(1) { font-size: 18px; }
.seg button:nth-child(2) { font-size: 21px; }
.seg button:nth-child(3) { font-size: 25px; }
.toggle { display: flex; align-items: center; gap: 14px; padding: 12px 0; font-weight: 700; cursor: pointer; }
.toggle input { width: 30px; height: 30px; accent-color: var(--brand); flex: none; }
.ok-line { color: var(--done); font-weight: 800; }
.warn-line { color: var(--late); font-weight: 700; }

/* ---------- history ---------- */
.hist button { width: 100%; text-align: left; background: none; border: none; padding: 14px 4px; cursor: pointer; display: block; }
.hist li + li { border-top: 2px solid var(--line); }
.hist .d { font-weight: 800; font-size: 1.1rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: .9rem; margin: 4px 6px 0 0; background: #eceae4; }
.pill.good { background: var(--done-bg); color: var(--done); }
.pill.bad { background: var(--late-bg); color: var(--late); }

/* ---------- login ---------- */
.login { max-width: 460px; margin: 8vh auto 0; text-align: center; }
.login .logo { width: 96px; height: 96px; border-radius: 22px; }
.login h1 { font-size: 1.8rem; margin: 14px 0 6px; }
.login label { display: block; text-align: left; font-weight: 800; margin: 18px 4px 6px; }
.login input {
  width: 100%; font: inherit; font-size: 1.5rem; padding: 14px 16px; border-radius: 14px;
  border: 3px solid var(--line); background: #fff; color: var(--ink);
}
.login input.code { letter-spacing: .35em; text-align: center; font-weight: 800; }
.login input:focus { outline: none; border-color: var(--brand); }
.login .btn { margin-top: 22px; }
.err { color: var(--late); font-weight: 700; margin-top: 12px; min-height: 1.4em; }

/* ---------- install tip ---------- */
.tip { background: #fff8e6; border-color: #e9cf8a; }
.tip .title { font-size: 1.1rem; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border-top: 2px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav[hidden] { display: none; }
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); text-decoration: none; color: var(--muted); font-weight: 800; font-size: .9rem;
}
.nav a span { font-size: 1.6rem; line-height: 1; }
.nav a.active { color: var(--brand); background: #e8f1f0; }
.nav a.nav-sick.active { color: var(--sick); background: #f1ecf8; }

/* ---------- toast / offline ---------- */
.toast {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  max-width: 656px; margin: 0 auto;
  background: #1f2a2e; color: #fff; border-radius: 16px; padding: 12px 12px 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast[hidden] { display: none; }
.toast button {
  background: #fff; color: #1f2a2e; border: none; border-radius: 12px; padding: 12px 18px;
  font-weight: 800; min-height: 52px; cursor: pointer; flex: none;
}
.offline {
  position: sticky; top: 0; z-index: 15; background: #5a3d00; color: #fff; font-weight: 700;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; text-align: center; font-size: .9rem;
}
.offline[hidden] { display: none; }
