/* Pulse — random check-ins to catch how you're actually feeling.
   Deep slate-blue, bone text, a five-step warm-to-cool mood spectrum. */

:root {
  --bg: #10151a;
  --surface: #171e25;
  --surface-2: #202a33;
  --line: #263039;
  --ink: #e7ecef;
  --muted: #7e8d98;
  --faint: #4d5a64;
  --accent: #6fa9c4;
  --accent-dim: #3f6a7c;
  --sage: #87a07a;
  --clay: #c4694b;
  --radius: 14px;
  --nav-h: 64px;

  /* mood spectrum, 1..5 */
  --m1: #c4694b;
  --m2: #c98a5b;
  --m3: #c4a24c;
  --m4: #93a86b;
  --m5: #6fa082;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Karla', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(111, 169, 196, 0.08), transparent 60%),
    var(--bg);
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- Auth ---------- */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-inner { width: 100%; max-width: 340px; text-align: center; }

.auth-mark {
  width: 56px; height: 56px;
  margin: 0 auto 28px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 50% 42%, rgba(111, 169, 196, 0.85), rgba(111, 169, 196, 0.12) 62%, transparent 72%);
  box-shadow: 0 0 34px rgba(111, 169, 196, 0.35);
}
.auth-mark::after {
  content: '';
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #cfe6f0, var(--accent) 70%);
}

.auth-label {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.auth-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1.25;
  margin-bottom: 36px;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-form input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
}
.auth-form input:focus { outline: none; border-color: var(--accent-dim); }

.auth-form button {
  margin-top: 8px;
  background: var(--accent);
  color: #0c1418;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 1rem;
}
.auth-form button:disabled { opacity: 0.6; }

.auth-error { color: var(--clay); font-size: 0.88rem; }

/* ---------- Shell ---------- */

.app { min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  background: linear-gradient(rgba(16, 21, 26, 0.96), rgba(16, 21, 26, 0.82));
  backdrop-filter: blur(8px);
}

.topbar__title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

.topbar__actions { display: flex; align-items: center; gap: 12px; }

.topbar__logout {
  font-size: 0.78rem;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view-container {
  padding: 8px 20px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 520px;
  margin: 0 auto;
}

.loading { text-align: center; color: var(--faint); padding: 48px 0; font-size: 1.4rem; }
.offline-note { color: var(--accent); font-size: 0.82rem; margin-top: 6px; }
.muted-note { color: var(--muted); font-size: 0.88rem; line-height: 1.6; }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(18, 24, 29, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}
.bottom-nav__item svg { width: 21px; height: 21px; }
.bottom-nav__item.active { color: var(--accent); }

/* ---------- View heads ---------- */

.view-head { padding: 14px 0 4px; }
.view-head__title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.2;
}
.view-head__sub { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

.zone { margin-top: 22px; animation: rise 0.45s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Check-in ---------- */

.checkin {
  padding: 14vh 0 24px;
  text-align: center;
}

.checkin__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.checkin__prompt {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.3;
  margin-bottom: 40px;
}

.mood-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.mood-btn {
  flex: 1;
  max-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.mood-btn:active:not(:disabled) { transform: scale(0.94); }
.mood-btn:disabled { opacity: 0.4; }

.mood-btn__num {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
}
.mood-btn__label {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.mood-btn:nth-child(1) .mood-btn__num { color: var(--m1); }
.mood-btn:nth-child(2) .mood-btn__num { color: var(--m2); }
.mood-btn:nth-child(3) .mood-btn__num { color: var(--m3); }
.mood-btn:nth-child(4) .mood-btn__num { color: var(--m4); }
.mood-btn:nth-child(5) .mood-btn__num { color: var(--m5); }

.mood-btn--picked {
  border-color: var(--accent);
  background: var(--surface-2);
}

.checkin__hint, .checkin__done {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.88rem;
}
.checkin__done { color: var(--sage); }

/* ---------- History ---------- */

.today-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pulse-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0c1418;
  flex-shrink: 0;
}

.day-list { display: flex; flex-direction: column; gap: 6px; }

.day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.day-row__label {
  width: 78px;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.day-row__dots {
  display: flex;
  gap: 5px;
  flex: 1;
  overflow-x: auto;
}
.day-row__dots .pulse-dot { width: 24px; height: 24px; font-size: 0.68rem; }
.day-row__avg {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  color: var(--ink);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ---------- Settings ---------- */

.setting {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.setting__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.setting__label { font-size: 0.98rem; }
.setting__label small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 3px; line-height: 1.4; }

.setting__sub {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

.ghost-btn {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 13px;
  font-size: 0.92rem;
  margin-top: 10px;
  transition: transform 0.15s, border-color 0.15s;
}
.ghost-btn:active { transform: scale(0.98); }
.ghost-btn:disabled { opacity: 0.45; }

.push-status {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}
.push-status--on { color: var(--sage); }
.push-status--off { color: var(--clay); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
