/* Drebbel, the night shift's app.
   Calm and plain, after Apple's own apps: large titles, grouped lists, one
   clear action per card. Near black at night, light by day (the home's own
   schedule decides). One tint, the brand's sonar teal. Amber only for an
   alert that is ringing, never anything else. No red anywhere.
   Text follows the phone's text size: 1rem is the body size iOS picks. */

:root {
  --night: #0e1a2b;
  --sonar: #4fc1b0;
  --sonar-deep: #1f8f80;
  --lamp: #f2c14e;
  --lamp-ink: #241a03;

  /* Night: near black with a trace of the brand's navy, so a dark ward stays dark. */
  --bg: #05080c;
  --surface: #11161d;
  --surface-2: #1a212b;
  --fill: rgba(150, 165, 185, 0.16);
  --fill-strong: rgba(150, 165, 185, 0.26);
  --sep: rgba(197, 206, 214, 0.11);
  --label: #f1f4f6;
  --label-2: rgba(226, 232, 240, 0.64);
  --label-3: rgba(226, 232, 240, 0.4);
  --tint: var(--sonar);
  --on-tint: #03211c;
  --tint-soft: rgba(79, 193, 176, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --scrim: rgba(0, 0, 0, 0.55);

  --r-card: 16px;
  --r-group: 12px;
  --r-btn: 14px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: dark;
}
:root[data-mode='day'] {
  --bg: #eef1f0;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --fill: rgba(14, 26, 43, 0.06);
  --fill-strong: rgba(14, 26, 43, 0.1);
  --sep: rgba(14, 26, 43, 0.12);
  --label: #0e1a2b;
  --label-2: rgba(14, 26, 43, 0.62);
  --label-3: rgba(14, 26, 43, 0.38);
  --tint: var(--sonar-deep);
  --on-tint: #ffffff;
  --tint-soft: rgba(31, 143, 128, 0.12);
  --shadow: 0 1px 2px rgba(14, 26, 43, 0.04);
  --scrim: rgba(14, 26, 43, 0.35);
  color-scheme: light;
}

/* ---- Base ------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
/* Controls behave like controls: no text selection, no callout, no double-tap zoom. */
button,
a,
label,
.tile,
.row,
.tabs,
.navbar,
.takeover {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html {
  touch-action: manipulation;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
@supports (font: -apple-system-body) {
  html {
    font: -apple-system-body;
  }
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: var(--bg);
  color: var(--label);
  font-family:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue',
    sans-serif;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  transition:
    background-color 0.6s ease,
    color 0.6s ease;
}
button,
input,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  text-align: inherit;
}
:focus-visible {
  outline: 2px solid var(--tint);
  outline-offset: 2px;
  border-radius: 6px;
}
.hidden {
  display: none !important;
}
.tnum {
  font-variant-numeric: tabular-nums;
}
svg {
  display: block;
}

/* With the app on an iPhone's home screen, content scrolls under a calm band, not under the clock. */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-top);
  z-index: 6;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 52px) var(--gutter) calc(var(--safe-bottom) + 112px);
}
#app.push {
  animation: push 0.42s var(--spring) both;
}
#app.pop {
  animation: pop 0.42s var(--spring) both;
}

/* ---- The bar at the top: glass once the large title has scrolled away ------------ */
:root {
  --glass: color-mix(in srgb, var(--surface) 62%, transparent);
  --glass-edge: rgba(255, 255, 255, 0.12);
}
:root[data-mode='day'] {
  --glass: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(14, 26, 43, 0.08);
}
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  height: calc(var(--safe-top) + 52px);
  padding: var(--safe-top) 64px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    backdrop-filter 0.25s ease;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: saturate(1.8) blur(22px);
  -webkit-backdrop-filter: saturate(1.8) blur(22px);
  box-shadow: 0 0.5px 0 var(--sep);
}
.nav-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.2s ease,
    transform 0.25s var(--spring);
}
.navbar.scrolled .nav-title {
  opacity: 1;
  transform: none;
}
.nav-back {
  position: absolute;
  left: 12px;
  bottom: 4px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--label);
  background: var(--glass);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  box-shadow:
    inset 0 0 0 0.5px var(--glass-edge),
    0 4px 16px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}
.nav-back:active {
  transform: scale(0.92);
}
.nav-back svg {
  width: 22px;
  height: 22px;
  margin-left: -2px;
}

/* ---- Large titles, as in iOS ------------------------------------------------------ */
.nav {
  padding: 0 0 14px;
}
h1 {
  font-size: 2rem;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--label-2);
  font-size: 0.882rem;
}
.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tint);
  flex: none;
}
.status .dot.off {
  background: var(--label-3);
}
.status .sep {
  color: var(--label-3);
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 0.765rem;
  font-weight: 600;
  letter-spacing: 0;
}

/* A connection lost during a shift: plain, impossible to miss, not alarming. */
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.941rem;
  line-height: 1.35;
}
.banner svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--label-2);
  margin-top: 1px;
}
.banner.strong {
  background: var(--label);
  color: var(--bg);
}
.banner.tap {
  width: 100%;
  text-align: left;
  color: var(--label);
}
.banner.tap svg {
  color: var(--tint);
}
.banner.strong svg {
  color: var(--bg);
}

/* ---- Sections, grouped lists ----------------------------------------------------- */
.section {
  margin-top: 28px;
}
.section > .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 8px;
}
.section > .head h2 {
  margin: 0;
  font-size: 1.294rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section > .head .aside {
  color: var(--label-2);
  font-size: 0.882rem;
}
.section > .note {
  padding: 8px 16px 0;
  color: var(--label-2);
  font-size: 0.765rem;
  line-height: 1.35;
}
.caption {
  padding: 0 16px 6px;
  color: var(--label-2);
  font-size: 0.765rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.group {
  background: var(--surface);
  border-radius: var(--r-group);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  text-align: left;
  font-size: 1rem;
}
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
  transform-origin: top;
}
.row.icon + .row::before,
.row + .row.icon::before {
  left: 60px;
}
button.row:active,
a.row:active {
  background: var(--fill);
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row .sub {
  margin-top: 2px;
  color: var(--label-2);
  font-size: 0.882rem;
  line-height: 1.3;
}
.row .value {
  color: var(--label-2);
  text-align: right;
  flex: none;
  max-width: 55%;
}
.row .chev {
  width: 8px;
  height: 13px;
  color: var(--label-3);
  flex: none;
}
.row > svg:not(.chev) {
  width: 22px;
  height: 22px;
  flex: none;
}
.row.tinted {
  color: var(--tint);
}
.row .glyph {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--fill);
  color: var(--label-2);
}
.row .glyph svg {
  width: 19px;
  height: 19px;
}
.row input[type='text'],
.row input[type='time'],
.row select {
  background: transparent;
  border: 0;
  outline: none;
  text-align: right;
  color: var(--label-2);
  max-width: 55%;
  min-height: 32px;
  padding: 0;
}
.row select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2px;
}
.row input[type='time']::-webkit-calendar-picker-indicator {
  display: none;
}

.switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  transition: background-color 0.25s ease;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.15),
    0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s var(--spring);
}
.switch input:checked + span {
  background: var(--tint);
}
.switch input:checked + span::after {
  transform: translateX(20px);
}

/* ---- Buttons --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: var(--r-btn);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition:
    transform 0.15s ease,
    opacity 0.2s ease,
    background-color 0.2s ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn svg {
  width: 20px;
  height: 20px;
}
.btn.filled {
  background: var(--tint);
  color: var(--on-tint);
}
.btn.gray {
  background: var(--fill);
  color: var(--label);
}
.btn.plain {
  color: var(--tint);
  min-height: 44px;
  padding: 0 8px;
}
.btn.wide {
  width: 100%;
}
.btn.small {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.882rem;
}
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ---- Alerts ------------------------------------------------------------------------ */
.alerts {
  display: grid;
  gap: 12px;
}
.alert {
  border-radius: var(--r-card);
  padding: 18px 18px 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.45s var(--spring) both;
}
.alert .kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--label-2);
  font-size: 0.882rem;
  font-weight: 500;
}
.alert .kicker svg {
  width: 18px;
  height: 18px;
}
.alert .room {
  margin-top: 6px;
  font-size: 1.647rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.alert .what {
  margin-top: 3px;
  font-size: 1.059rem;
  line-height: 1.3;
  font-weight: 500;
}
.alert .btn {
  width: 100%;
  margin-top: 16px;
}
/* The one amber thing on screen: an alert nobody has answered yet. */
.alert.open {
  background: var(--lamp);
  color: var(--lamp-ink);
  box-shadow: 0 10px 30px -12px rgba(242, 193, 78, 0.55);
}
.alert.open .kicker {
  color: rgba(36, 26, 3, 0.7);
}
.alert.open .btn {
  background: var(--lamp-ink);
  color: #fff7e3;
}

.calm {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.calm .badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint-soft);
  color: var(--tint);
  flex: none;
}
.calm .badge svg {
  width: 22px;
  height: 22px;
}
.calm b {
  display: block;
  font-size: 1.059rem;
  font-weight: 600;
}
.calm span {
  color: var(--label-2);
  font-size: 0.882rem;
}

/* ---- Rooms, after the Home app's tiles ---------------------------------------------- */
.rooms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 560px) {
  .rooms {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-height: 132px;
  padding: 14px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.15s ease;
}
.tile:active {
  transform: scale(0.97);
}
.tile .glyph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label-2);
}
.tile .glyph svg {
  width: 20px;
  height: 20px;
}
.tile.in-bed .glyph {
  background: var(--tint-soft);
  color: var(--tint);
}
.tile.awake .glyph {
  background: var(--fill-strong);
  color: var(--label);
}
.tile .name {
  margin-top: auto;
  padding-top: 14px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.tile .state {
  margin-top: 2px;
  color: var(--label-2);
  font-size: 0.882rem;
  line-height: 1.25;
}
.tile.dim .name,
.tile.dim .state {
  color: var(--label-3);
}
.add-room {
  margin-top: 14px;
}

/* ---- One room ------------------------------------------------------------------------ */
.now {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.now .glyph {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label-2);
  flex: none;
}
.now .glyph svg {
  width: 28px;
  height: 28px;
}
.now.in-bed .glyph {
  background: var(--tint-soft);
  color: var(--tint);
}
.now b {
  display: block;
  font-size: 1.294rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.now span {
  color: var(--label-2);
  font-size: 0.941rem;
}

.chart {
  padding: 16px;
  border-radius: var(--r-group);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chart .bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--fill);
}
.chart .bar i {
  flex: 1;
}
.chart .bar i.b {
  background: var(--tint);
}
.chart .bar i.o {
  background: var(--label-2);
}
.chart .bar i.e {
  background: var(--fill-strong);
}
.chart .bar i.u {
  background: var(--label-3);
}
.chart .axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--label-3);
  font-size: 0.706rem;
}
.chart .legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  color: var(--label-2);
  font-size: 0.824rem;
}
.chart .legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart .legend span::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}

.grid-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 4px;
  color: var(--label-2);
  font-size: 0.765rem;
}
.grid-head .grow {
  flex: 1;
}
.grid-head span:not(.grow) {
  width: 51px;
  text-align: center;
}

/* ---- History ----------------------------------------------------------------------- */
.days {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 16px;
}
.days .label {
  font-weight: 600;
  text-align: center;
  flex: 1;
}
.days .btn {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 1.647rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: var(--label-2);
  font-size: 0.824rem;
}
.outcome {
  color: var(--label-2);
  font-size: 0.882rem;
  flex: none;
}
.outcome.fall {
  color: var(--label);
  font-weight: 600;
}

/* ---- Tab bar ---------------------------------------------------------------------------- */
.tabs {
  position: fixed;
  z-index: 5;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(10px, calc(var(--safe-bottom) - 8px));
  width: min(calc(100% - 40px), 420px);
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: saturate(1.8) blur(26px);
  -webkit-backdrop-filter: saturate(1.8) blur(26px);
  box-shadow:
    inset 0 0 0 0.5px var(--glass-edge),
    0 10px 34px rgba(0, 0, 0, 0.22);
}
.tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0 6px;
  border-radius: 999px;
  color: var(--label-2);
  font-size: 0.647rem;
  font-weight: 600;
  letter-spacing: 0;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}
.tabs button svg {
  width: 24px;
  height: 24px;
}
.tabs button.on {
  color: var(--tint);
  background: var(--fill);
}

/* ---- Full pages: joining, setting up ------------------------------------------------------ */
.page {
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 72px);
  display: flex;
  flex-direction: column;
  margin-top: -28px;
}
.page .hero {
  width: 64px;
  height: 64px;
  margin: 24px 0 20px;
  color: var(--tint);
}
.page .hero svg {
  width: 100%;
  height: 100%;
}
.page h1 {
  margin-top: 0;
}
.page .lead {
  margin: 10px 0 24px;
  color: var(--label-2);
  font-size: 1.059rem;
  line-height: 1.4;
}
.page .end {
  margin-top: auto;
  display: grid;
  gap: 4px;
  padding-top: 24px;
  padding-bottom: 8px;
}
.field {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-btn);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.059rem;
  outline: none;
}
.field:focus {
  box-shadow: 0 0 0 2px var(--tint);
}
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 14px;
}
h1 + .steps {
  margin-top: 22px;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  line-height: 1.4;
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint-soft);
  color: var(--tint);
  font-weight: 700;
  font-size: 0.882rem;
}
.progress {
  display: flex;
  gap: 6px;
  margin: 4px 0 8px;
}
.progress i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
  transition: background-color 0.3s ease;
}
.progress i.on {
  background: var(--tint);
}
.live {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.live .tick {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: var(--on-tint);
  flex: none;
  animation: pop 0.45s var(--spring) both;
}
.live .tick svg {
  width: 20px;
  height: 20px;
}
.done-mark {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: var(--on-tint);
  margin: 40px 0 24px;
  animation: pop 0.5s var(--spring) both;
}
.done-mark svg {
  width: 44px;
  height: 44px;
}
.radar {
  position: relative;
  width: 96px;
  height: 56px;
  flex: none;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.radar i {
  position: absolute;
  bottom: 0;
  border: 2px solid var(--tint);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  opacity: 0.25;
}
.radar b {
  position: absolute;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tint);
  transition: bottom 0.4s ease;
}
.ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 8px auto 0;
}
.ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.ring circle {
  transition: stroke-dashoffset 1s linear;
}
.ring .n {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--fill-strong);
  border-top-color: var(--tint);
  animation: spin 0.9s linear infinite;
  flex: none;
}

/* ---- The alert, full screen: what the night shift sees first ---------------------------- */
.takeover {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 40px) 28px calc(var(--safe-bottom) + 20px);
  background: var(--lamp);
  color: var(--lamp-ink);
  animation: fade 0.25s ease both;
}
.takeover .pulse {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lamp-ink);
  color: var(--lamp);
}
.takeover .pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--lamp-ink);
  animation: ripple 1.8s ease-out infinite;
}
.takeover .pulse svg {
  width: 36px;
  height: 36px;
}
.takeover .room {
  margin-top: 32px;
  font-size: 3.2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.takeover .what {
  margin-top: 12px;
  font-size: 1.53rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.takeover .meta {
  margin-top: 12px;
  font-size: 1.059rem;
  opacity: 0.72;
}
.takeover .actions {
  margin-top: auto;
  display: grid;
  gap: 6px;
}
.takeover .btn.go {
  min-height: 64px;
  border-radius: 18px;
  font-size: 1.235rem;
  background: var(--lamp-ink);
  color: #fff7e3;
}
.takeover .btn.later {
  color: var(--lamp-ink);
  opacity: 0.75;
}

/* ---- Sheets, from the bottom ---------------------------------------------------------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  animation: fade 0.25s ease both;
}
.sheet {
  width: calc(100% - 16px);
  max-width: 664px;
  max-height: 92dvh;
  overflow: auto;
  overscroll-behavior: contain;
  margin-bottom: max(8px, calc(var(--safe-bottom) - 12px));
  padding: 8px 20px 20px;
  border-radius: 34px;
  background: var(--surface-2);
  color: var(--label);
  animation: up 0.45s var(--spring) both;
  box-shadow:
    inset 0 0 0 0.5px var(--glass-edge),
    0 20px 60px rgba(0, 0, 0, 0.35);
}
:root[data-mode='day'] .sheet {
  background: var(--bg);
}
.sheet .grab {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-strong);
  margin: 0 auto 14px;
}
.sheet h3 {
  margin: 4px 0 6px;
  font-size: 1.294rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sheet p {
  margin: 0 0 18px;
  color: var(--label-2);
  line-height: 1.4;
}
.sheet .group {
  background: var(--surface);
}
:root[data-mode='day'] .sheet .group {
  background: #fff;
}
.sheet .choices {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.sheet .choices .btn {
  width: 100%;
}
.sheet ul.points {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.sheet ul.points li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet ul.points li svg {
  width: 22px;
  height: 22px;
  color: var(--tint);
  flex: none;
}
.qr {
  width: 232px;
  margin: 4px auto 14px;
  padding: 14px;
  border-radius: 20px;
  background: #fff;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.qr svg {
  width: 100%;
  height: 100%;
}

/* ---- Toast ---------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 10px);
  z-index: 40;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 40px);
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  background: var(--label);
  color: var(--bg);
  font-size: 0.941rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: rise 0.35s var(--spring) both;
}
.toast svg {
  width: 20px;
  height: 20px;
  flex: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.toast {
  animation-name: toast-in;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.96);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes up {
  from {
    transform: translateY(110%);
  }
}
@keyframes push {
  from {
    transform: translateX(30%);
    opacity: 0;
  }
}
@keyframes pop {
  from {
    transform: translateX(-20%);
    opacity: 0.3;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ripple {
  from {
    transform: scale(1);
    opacity: 0.6;
  }
  to {
    transform: scale(1.45);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
