/* Daily Routine — app shell.
   Mobile first, one-handed. Every tap target is at least 48px. */

:root {
  --bg:        #12141a;
  --surface:   #1c1f27;
  --surface-2: #262a35;
  --text:      #e8eaf0;
  --muted:     #9aa1b1;
  --accent:    #6ea8fe;
  --danger:    #ff6b6b;
  --warn:      #d8a12a;
  --good:      #5bbf7a;
  --tap:       48px;
  --radius:    14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f5f6f9;
    --surface:   #ffffff;
    --surface-2: #eceef3;
    --text:      #171a21;
    --muted:     #5e6577;
    --accent:    #2563eb;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  max-width: 26rem;
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100dvh;
  justify-content: center;
  gap: 0.5rem;
}

h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }

.muted { color: var(--muted); margin: 0 0 0.5rem; }
.small { font-size: 0.8125rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

/* --- PIN pips --- */

.pips { display: flex; gap: 0.85rem; margin: 1.25rem 0 0.5rem; }

.pip {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  transition: background-color 120ms, border-color 120ms, transform 120ms;
}

.pip.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }

.pips.shake { animation: shake 320ms; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .pip, .pips.shake { transition: none; animation: none; }
}

/* --- error --- */

.error {
  color: var(--danger);
  min-height: 2.75rem;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9375rem;
  max-width: 22rem;
}

/* --- keypad --- */

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(var(--tap), 5rem));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.key {
  min-width: var(--tap);
  min-height: 64px;
  font-size: 1.5rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}

.key:active { background: var(--surface-2); }
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.key-quiet { font-size: 1.25rem; color: var(--muted); }
.key-blank { visibility: hidden; }

.keypad[aria-busy="true"] .key { opacity: 0.45; pointer-events: none; }

/* --- buttons --- */

.btn {
  min-height: var(--tap);
  padding: 0 1.25rem;
  font: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn-quiet { color: var(--muted); margin-top: 1.5rem; }
.btn:active { background: var(--surface-2); }

/* --- facts list --- */

.facts {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.4rem 1.25rem;
  margin: 1.5rem 0 0.5rem;
  text-align: left;
  font-size: 0.9375rem;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* --- offline --- */

/* In the shell rather than a view, so it survives a re-render and is there
   before the first payload has been asked for. */
.offline {
  margin: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--bg);
  background: var(--warn);
}

@media (prefers-reduced-motion: no-preference) {
  .offline { animation: offline-in 160ms ease-out; }
}

@keyframes offline-in {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: none; }
}
