/* Mobile-first, theme-aware. Colours live in variables — don't hard-code a
   value a variable already covers. */

:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --text: #14141a;
  --muted: #6b6b78;
  --line: #e3e3e8;
  --primary: #c96442;
  --ok: #2e9e6b;
  --warn: #d08b23;
  --err: #cf4b3f;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --card: #1a1a1f;
    --text: #ececf1;
    --muted: #8e8e9c;
    --line: #2a2a32;
    --primary: #d97757;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }

.head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600;
     text-transform: uppercase; letter-spacing: 0.06em; }

.pill {
  font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  white-space: nowrap;
}
.pill--open    { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill--closed  { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); }
.pill--unknown { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card--hero { text-align: center; padding: 24px 16px 18px; }
.hero-label { font-size: 13px; color: var(--muted); text-transform: uppercase;
              letter-spacing: 0.06em; }
.countdown {
  font-size: clamp(38px, 13vw, 56px);
  font-weight: 700; line-height: 1.1; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.hero-sub { font-size: 14px; color: var(--muted); min-height: 21px; }

.bar { height: 6px; background: var(--line); border-radius: 999px;
       overflow: hidden; margin-top: 16px; }
.bar-fill { height: 100%; width: 0; background: var(--primary);
            border-radius: 999px; transition: width .6s ease; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
        margin-bottom: 12px; }
.grid .card { margin: 0; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase;
              letter-spacing: 0.05em; }
.stat-value { font-size: 22px; font-weight: 650; margin-top: 4px;
              font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.lvl-error { color: var(--err); }
.lvl-warn  { color: var(--warn); }

.actions { display: flex; gap: 10px; margin-top: 4px; }
button {
  flex: 1; font-size: 16px; font-weight: 600; padding: 13px 16px;
  border-radius: var(--radius); border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer;
}
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button:active { transform: scale(.985); }
button[disabled] { opacity: .55; cursor: default; }

.toast { min-height: 20px; margin: 12px 0 0; font-size: 14px; color: var(--muted);
         text-align: center; }
.foot { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; }
code { font-size: .92em; }

/* ------------------------------ settings ------------------------------ */

.pill--quiet { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.bar--slim { height: 4px; margin-top: 10px; }

.row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.row:last-of-type { border-bottom: 0; }
.row strong { display: block; font-size: 15px; font-weight: 600; }
.row small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }

/* Native checkbox, scaled up so it's a comfortable tap target on a phone. */
.row--toggle input[type="checkbox"] {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px;
  accent-color: var(--primary); cursor: pointer;
}

.row--times { gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field > span { font-size: 13px; color: var(--muted); }
.field--stacked { align-items: stretch; }

/* 16px minimum — anything smaller makes iOS Safari zoom on focus. */
input[type="time"], input[type="text"] {
  font: inherit; font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  width: 100%;
}
input[type="time"]:focus, input[type="text"]:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 1px; border-color: transparent;
}

.actions--tight { margin-top: 16px; }

.form-msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; text-align: center; }
.form-msg--ok { color: var(--ok); }
.form-msg--error { color: var(--err); }
