:root {
  color-scheme: dark;
  --bg: #0b100d;
  --surface: #131b17;
  --surface-2: #18231d;
  --line: #29372f;
  --text: #f4f7f5;
  --muted: #9aa9a1;
  --mint: #8ce1b2;
  --mint-dark: #163d29;
  --gold: #f5c873;
  --blue: #91bdf8;
  --danger: #ff9b9b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -5%, rgba(64, 124, 91, .22), transparent 34rem),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.shell {
  width: min(100%, 44rem);
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom));
}
header, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
header { margin: .5rem .25rem 1.25rem; align-items: flex-start; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .25rem; font-size: clamp(1.75rem, 8vw, 2.5rem); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 1.2rem; letter-spacing: -.02em; }
.eyebrow {
  margin-bottom: .35rem;
  color: var(--mint);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.card, .auth-card {
  background: linear-gradient(150deg, rgba(24,35,29,.98), rgba(16,24,20,.98));
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: 0 1.2rem 3rem rgba(0,0,0,.18);
}
.card { padding: 1.15rem; margin-bottom: 1rem; }
.auth-card { margin-top: min(18vh, 8rem); padding: 1.4rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.5rem;
  border-radius: 1rem;
  background: var(--mint);
  color: #0b2115;
  font-weight: 900;
}
.auth-card form { display: grid; gap: 1rem; margin-top: 1.5rem; }
label { display: grid; gap: .45rem; color: #cad3ce; font-size: .85rem; font-weight: 650; }
input {
  width: 100%;
  min-height: 3rem;
  padding: .8rem .9rem;
  border: 1px solid #34453b;
  border-radius: .8rem;
  outline: none;
  background: #0d1511;
  color: var(--text);
}
input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(140,225,178,.12); }
.primary, .retry {
  min-height: 3.2rem;
  border: 0;
  border-radius: .85rem;
  background: var(--mint);
  color: #0b2115;
  font-weight: 850;
}
.error { min-height: 1.2em; margin: 1rem 0 0; color: var(--danger); }
.text-button, .manual-toggle, .icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.text-button { padding: .4rem; }
.manual-toggle { display: block; margin: 1rem auto 0; padding: .5rem; text-decoration: underline; text-underline-offset: .2rem; }
.icon-button {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.25rem;
}
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin-top: 1.1rem; }
.event-button {
  display: grid;
  place-items: center;
  gap: .7rem;
  min-height: 7.8rem;
  padding: .8rem .35rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--text);
  font-size: .88rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, opacity .12s ease;
}
.event-button:active { transform: scale(.97); }
.event-button:disabled { cursor: wait; opacity: .55; }
.event-icon { font-size: 1.7rem; }
.wake { background: linear-gradient(150deg, rgba(245,200,115,.18), rgba(245,200,115,.04)); }
.bed { background: linear-gradient(150deg, rgba(145,189,248,.16), rgba(145,189,248,.03)); }
.sleep { background: linear-gradient(150deg, rgba(157,133,240,.17), rgba(157,133,240,.03)); }
.manual-panel {
  margin-top: .8rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(8,13,10,.35);
}
.manual-panel .text-button { margin-top: .35rem; color: var(--mint); }
.status { min-height: 1.2em; margin: .9rem 0 0; text-align: center; color: var(--mint); }
.retry { width: 100%; margin-top: .7rem; }
.score { display: flex; align-items: baseline; gap: .25rem; color: var(--muted); }
.score strong { color: var(--text); font-size: 2rem; }
.progress-track { height: .55rem; margin: 1rem 0 .8rem; overflow: hidden; border-radius: 2rem; background: #0b110e; }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #d2ef9d); transition: width .35s ease; }
.session-list, .recent-list { display: grid; gap: .65rem; margin-top: 1rem; }
.session, .recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding-top: .7rem;
  border-top: 1px solid var(--line);
}
.session:first-child, .recent-row:first-child { border-top: 0; }
.session small, .recent-row small { display: block; margin-top: .2rem; color: var(--muted); }
.event-badge {
  flex: 0 0 auto;
  padding: .32rem .55rem;
  border-radius: 2rem;
  background: var(--mint-dark);
  color: var(--mint);
  font-size: .7rem;
  font-weight: 800;
}
.privacy-note { padding: .25rem 1rem; color: #74847b; font-size: .78rem; text-align: center; }
[hidden] { display: none !important; }
@media (min-width: 40rem) {
  .shell { padding-left: 1.5rem; padding-right: 1.5rem; }
  .card { padding: 1.4rem; }
  .event-button { min-height: 9rem; }
}
