:root {
  --bg: #F2F1ED;
  --surface: #FFFFFF;
  --ink: #141518;
  --ink-2: #3A3D44;
  --muted: #74777E;
  --hair: rgba(20, 21, 24, 0.08);
  --hair-2: rgba(20, 21, 24, 0.14);
  --free: #1E9E61;
  --free-bg: #E2F4E9;
  --mine: #3355FF;
  --mine-bg: #E8EDFF;
  --taken: #A8A49B;
  --danger: #D23C2A;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow:
    0 0 0 1px var(--hair),
    0 16px 40px -12px rgba(20, 21, 24, 0.22),
    0 2px 6px rgba(20, 21, 24, 0.06);
  --top: max(16px, env(safe-area-inset-top));
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

/* ---------- Shell ---------- */
.app { position: fixed; inset: 0; height: 100dvh; overflow: hidden; }
.scene {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 30%, #FAF9F6 0%, var(--bg) 60%, #E9E7E1 100%);
}
.scene .gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.scene .gl-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.bar {
  position: absolute;
  top: var(--top);
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 5;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; user-select: none; -webkit-user-select: none; }
.wordmark { font-weight: 750; font-size: 22px; letter-spacing: -0.04em; }
.wordmark .dot { color: var(--mine); }
.brand-sub { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: -0.01em; }
.bar-actions { display: flex; align-items: center; gap: 8px; }

.btn-ghost {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px var(--hair);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.btn-ghost:active { transform: scale(0.97); }

/* ---------- Faces ---------- */
.face {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--s, 28px);
  height: var(--s, 28px);
  border-radius: 50%;
  overflow: hidden;
  background: var(--fbg, #EDEAE4);
  color: var(--ink-2);
  font-size: calc(var(--s, 28px) * 0.38);
  font-weight: 650;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 1px rgba(20, 21, 24, 0.06) inset;
}
.face img { width: 100%; height: 100%; display: block; opacity: 1; transition: opacity 200ms ease; }
@starting-style { .face img { opacity: 0; } }

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(20, 21, 24, 0.12);
  transition: transform 160ms var(--ease-out);
}
.avatar:active { transform: scale(0.95); }
.avatar .face { --s: 36px; }
.avatar select {
  position: absolute;
  inset: 0;
  opacity: 0;
  font-size: 16px; /* 16px stops iOS from zooming on focus */
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .btn-ghost:focus-visible, .seg-item:focus-visible, .icon-btn:focus-visible, .pin:focus-visible .pin-in, .elevator button:focus-visible {
  outline: 2px solid var(--mine);
  outline-offset: 2px;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-secondary { background: rgba(20, 21, 24, 0.06); color: var(--ink); }
.btn-danger { background: rgba(210, 60, 42, 0.08); color: var(--danger); }
.btn-link { background: transparent; color: var(--ink-2); height: 40px; font-size: 15px; font-weight: 550; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #2A2C31; }
  .btn-secondary:hover { background: rgba(20, 21, 24, 0.09); }
  .btn-danger:hover { background: rgba(210, 60, 42, 0.12); }
  .btn-ghost:hover { background: #fff; }
  .btn-link:hover { color: var(--ink); }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 21, 24, 0.06);
  color: var(--ink-2);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- Segmented control (sliding highlight) ---------- */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 0 0 1px var(--hair);
  user-select: none;
  -webkit-user-select: none;
}
.seg-hl {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hair), 0 2px 8px rgba(20, 21, 24, 0.08);
}
.seg[data-ready] .seg-hl { transition: transform 220ms var(--ease-out), width 220ms var(--ease-out); }
.seg-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 150ms ease;
}
.seg-item[aria-selected="true"] { color: var(--ink); }
.seg-top { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.seg-sub { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg-sub[data-zero], .seg-sub .cnt[data-zero] { color: var(--danger); }
.seg-sub .cnt { display: inline-flex; align-items: center; gap: 3px; }
.seg-sub .cnt svg { width: 14px; height: 14px; flex: none; }
.seg-sub .me-dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--mine); vertical-align: 1px; }

.days {
  position: absolute;
  top: calc(var(--top) + 50px);
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  z-index: 4;
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- Elevator: the floor switch ---------- */
.elevator {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  top: calc(var(--top) + 130px);
  z-index: 4;
  display: grid;
  gap: 0;
  padding: 4px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 0 0 1px var(--hair), 0 8px 24px -10px rgba(20, 21, 24, 0.2);
  user-select: none;
  -webkit-user-select: none;
}
.elev-hl {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 0;
  border-radius: 14px;
  background: var(--ink);
}
.elevator[data-ready] .elev-hl { transition: transform 260ms var(--ease-out), height 260ms var(--ease-out); }
.elevator button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 1px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 150ms ease, transform 160ms var(--ease-out);
}
.elevator button:active { transform: scale(0.95); }
.elevator button b { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.elevator button span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; transition: color 150ms ease; }
.elevator button[aria-selected="true"] { color: #fff; }
.elevator button[aria-selected="true"] span { color: rgba(255, 255, 255, 0.65); }

/* ---------- Pins (3D labels) ---------- */
/* --lift is set per frame by the scene when a pin would cover a neighbour. */
.pin {
  all: unset;
  --lift: 0px;
  display: inline-flex;
  justify-content: center;
  min-width: 44px;
  padding: 9px 7px; /* the pill is 26px; the padding makes a 44px tap target */
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pin-in {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px 0 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--hair), 0 4px 12px -2px rgba(20, 21, 24, 0.2);
  font: 650 12px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transform: translateY(var(--lift));
  transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.pin:active .pin-in { transform: translateY(var(--lift)) scale(0.94); }
.pin i { width: 7px; height: 7px; border-radius: 50%; background: var(--free); flex: none; }
.pin .face { --s: 22px; margin-left: -5px; }
.pin[data-state="mine"] .pin-in { background: var(--mine); color: #fff; padding-left: 3px; }
.pin[data-state="mine"] .face { --s: 24px; margin-left: 0; box-shadow: 0 0 0 2px #fff; }
.pin[data-selected] .pin-in { background: var(--ink); color: #fff; }
/* Others' spots show just the face in a white ring; the number appears on hover or selection. */
.pin[data-state="taken"] .pin-in { padding: 2px; color: var(--ink-2); }
.pin[data-state="taken"] .face { --s: 26px; margin: 0; }
.pin[data-state="taken"] .pin-id { display: none; padding: 0 8px 0 2px; }
.pin[data-state="taken"]:is([data-hover], [data-selected]) .pin-id { display: inline; }
@media (hover: hover) and (pointer: fine) {
  .pin:hover .pin-in, .pin[data-hover] .pin-in { transform: translateY(calc(var(--lift) - 2px)); }
}
/* Portals: the ramp and lift pins switch floor. Same pill, a blue arrow says "this moves you". */
.pin[data-portal] .pin-in { padding-left: 7px; gap: 6px; }
.pin[data-portal] svg { width: 12px; height: 12px; flex: none; color: var(--mine); }
.pin[data-portal="street"] { pointer-events: none; }
.pin[data-portal="street"] .pin-in { background: rgba(255, 255, 255, 0.7); color: var(--muted); box-shadow: 0 0 0 1px var(--hair); }
.pin[data-portal="street"] svg { color: var(--muted); }
/* Two spots under one finger: a small chooser at the tap, one more tap decides. */
.chooser {
  position: absolute;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hair), 0 8px 24px -8px rgba(20, 21, 24, 0.3);
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: auto;
  opacity: 1;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
@starting-style { .chooser { opacity: 0; transform: translate(-50%, calc(-100% - 4px)) scale(0.96); } }
.chooser .pin { padding: 6px 2px; min-width: 0; }
.chooser .pin-in { box-shadow: none; background: rgba(20, 21, 24, 0.05); }
.floor-tag {
  font: 650 12px/1 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
.floor-tag b { color: var(--ink); font-size: 20px; letter-spacing: -0.03em; margin-right: 6px; }

/* ---------- Text ---------- */
.eyebrow { margin: 0; font-size: 13px; color: var(--muted); font-weight: 550; letter-spacing: -0.005em; }
.fine { margin: 10px 2px 0; font-size: 13px; color: var(--muted); text-wrap: pretty; }
.actions { display: grid; gap: 8px; }

/* ---------- Toast ---------- */
/* Toasts never cover a control: on a phone they float just above the sheet, on desktop they sit bottom-left. */
.toaster {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--sheet-h, 0px) + 12px);
  z-index: 50;
  pointer-events: none;
}
@media (min-width: 760px) {
  .toaster { left: 24px; right: auto; bottom: 24px; width: 380px; }
}
.toast {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 16px 40px -12px rgba(20, 21, 24, 0.45);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: transform 300ms var(--ease-out), opacity 300ms var(--ease-out);
}
.toast[data-open] { opacity: 1; transform: none; }
.toast[data-closing] { opacity: 0; transform: translateY(12px) scale(0.97); transition-duration: 180ms; }
.toast .face { --s: 28px; margin-left: -6px; }
.toast-msg { flex: 1; text-wrap: pretty; }
.toast-msg b { font-weight: 650; }
.toast[data-tone="error"] .toast-msg::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #FF6B57; vertical-align: 1px; }
.toast-action {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.toast-action:active { transform: scale(0.96); }

/* ---------- Rules dialog ---------- */
.rules {
  width: min(560px, 100vw);
  max-height: min(88dvh, 820px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out),
    overlay 200ms allow-discrete,
    display 200ms allow-discrete;
}
.rules[open] { opacity: 1; transform: none; }
@starting-style { .rules[open] { opacity: 0; transform: scale(0.96); } }
.rules::backdrop {
  background: rgba(20, 21, 24, 0);
  transition: background-color 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete;
}
.rules[open]::backdrop { background: rgba(20, 21, 24, 0.32); }
@starting-style { .rules[open]::backdrop { background: rgba(20, 21, 24, 0); } }
.rules-inner { padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: inherit; overscroll-behavior: contain; }
.rules-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.rules h2 { margin: 0; font-size: 24px; letter-spacing: -0.03em; line-height: 1.15; }
.rules h3 { margin: 26px 0 10px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rules ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.rules li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hair); }
.rules li:first-child { border-top: 0; }
.rules li .n {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(20, 21, 24, 0.05); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.rules li p { margin: 0; text-wrap: pretty; }
.rules li p b { font-weight: 650; }
.rules li p span { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }
.rules .sub { margin: 6px 0 0; color: var(--muted); }
@media (max-width: 640px) {
  .rules {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition:
      opacity 400ms var(--ease-drawer),
      transform 400ms var(--ease-drawer),
      overlay 400ms allow-discrete,
      display 400ms allow-discrete;
  }
  .rules[open] { transform: none; }
  @starting-style { .rules[open] { transform: translateY(100%); } }
}

/* ---------- Sheet + ticket ---------- */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--hair), 0 -18px 40px -18px rgba(20, 21, 24, 0.25);
}
@media (min-width: 760px) {
  .sheet {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 392px;
    border-radius: 26px;
    padding: 16px;
    box-shadow: var(--shadow);
  }
  .grabber { display: none; }
}
.grabber { width: 36px; height: 5px; margin: 0 auto 10px; border-radius: 999px; background: rgba(20, 21, 24, 0.12); }
/* Car/Bike switch: a small segmented control in the ticket's top row. */
.kind { flex: none; margin: -4px 0; }
.kind .seg { padding: 3px; border-radius: 10px; background: rgba(20, 21, 24, 0.06); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.kind .seg-hl { top: 3px; bottom: 3px; border-radius: 8px; }
.kind .seg-item { min-height: 30px; padding: 0 12px; }
.kind .seg-top { font-size: 13px; }
.ticket-wrap { touch-action: pan-y; }
.ticket {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: #F7F6F3;
  box-shadow: 0 0 0 1px var(--hair) inset;
}
.ticket[data-state="mine"] { background: var(--mine-bg); }
.ticket[data-state="taken"] { background: #EFEDE8; }
.ticket[data-state="taken"] .ticket-id { color: var(--ink-2); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.ticket-top .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ticket-top .who .face { --s: 24px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.01em; flex: none;
}
.badge-mine { background: var(--mine); color: #fff; }
.ticket-id {
  margin: 6px 0 0;
  font-size: 64px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.ticket-id.small { font-size: 34px; letter-spacing: -0.035em; }
.ticket-meta { margin-top: 6px; color: var(--ink-2); font-weight: 550; }
.perf { position: relative; height: 1px; margin: 16px -18px; background-image: linear-gradient(90deg, var(--hair-2) 50%, transparent 50%); background-size: 8px 1px; }
.perf::before, .perf::after { content: ""; position: absolute; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); }
.perf::before { left: -9px; }
.perf::after { right: -9px; }

/* Phone held sideways: the sheet floats at the right as on desktop, so the day tabs keep to the left of it. */
@media (min-width: 760px) and (max-height: 520px) {
  .days { left: 88px; right: auto; width: min(420px, calc(100vw - 460px)); margin: 0; }
}
/* Phone (or any short screen): the 3D is the hero, so every control gets tighter. */
@media (max-width: 759px), (max-height: 520px) {
  .days { top: calc(var(--top) + 46px); }
  .seg-item { min-height: 42px; padding: 4px; gap: 1px; }
  .seg-top { font-size: 13px; }
  .seg-sub { font-size: 11px; }
  .elevator { top: calc(var(--top) + 110px); border-radius: 16px; }
  .elev-hl { border-radius: 12px; }
  .elevator button { width: 46px; height: 46px; border-radius: 12px; }
  .elevator button b { font-size: 15px; }
  .elevator button span { font-size: 10px; }
  .sheet { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  .grabber { margin-bottom: 8px; }
  .ticket { padding: 12px 16px; }
  .ticket-id { margin-top: 2px; font-size: 44px; letter-spacing: -0.045em; }
  .ticket-id.small { font-size: 26px; letter-spacing: -0.03em; }
  .ticket-meta { margin-top: 2px; font-size: 14px; }
  .perf { margin: 12px -16px; }
  .actions { gap: 2px; }
  .btn { height: 46px; }
  .btn-link { height: 36px; }
  .fine { display: none; }
}

/* Content swap and first entrance. */
.swap-in { animation: swap-in 200ms var(--ease-out) both; }
@keyframes swap-in { from { opacity: 0; transform: translateY(4px); filter: blur(2px); } }
.enter { animation: enter 360ms var(--ease-out) both; }
.enter-2 { animation-delay: 60ms; }
.enter-3 { animation-delay: 120ms; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  .swap-in { animation: fade-in 150ms ease both; }
  .enter { animation: fade-in 200ms ease both; }
  @keyframes fade-in { from { opacity: 0; } }
  .seg[data-ready] .seg-hl, .elevator[data-ready] .elev-hl { transition: none; }
  .toast, .toast[data-closing] { transform: none; transition: opacity 180ms ease; }
  .rules { transform: none !important; transition: opacity 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .pin:hover .pin-in, .pin[data-hover] .pin-in { transform: translateY(var(--lift)); }
}

/* ---------- Faces from Workspace photos ---------- */
.face { position: relative; }
.face .ini { position: absolute; inset: 0; display: grid; place-items: center; }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Avatar menu ---------- */
.avatar { border: 0; padding: 0; background: none; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: calc(100vw - 32px);
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
  z-index: 20;
}
.menu[data-open] { opacity: 1; transform: none; pointer-events: auto; }
.menu .who { display: flex; align-items: center; gap: 10px; }
.menu .who .face { --s: 40px; }
.menu .who b { display: block; font-weight: 650; overflow-wrap: anywhere; }
.menu .who div > span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: break-word; }
.menu .badge { margin-top: 10px; }
.menu .btn { margin-top: 12px; height: 42px; }
.bar-actions { position: relative; }
.bar-actions[hidden] { display: none; }

/* ---------- Sign-in page ---------- */
.signin {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 5;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.signin-card {
  width: min(380px, 100%);
  padding: 22px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.signin-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.04em; }
.signin-card p { margin: 0 0 16px; color: var(--muted); }
.signin-card .btn { text-decoration: none; }
.app[data-mode="signin"] .gl-labels { display: none; }

/* ---------- Offline bar and busy states ---------- */
.offline-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  text-align: center;
  transform: translateY(-100%);
  transition: transform 200ms var(--ease-out);
}
.offline-bar[data-show] { transform: none; }
.app[data-offline] [data-act] { opacity: 0.45; pointer-events: none; }
.btn[aria-busy="true"] { opacity: 0.7; pointer-events: none; }

/* ---------- Admin reason field ---------- */
.reason { display: grid; gap: 8px; margin-top: 4px; }
.reason input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--hair-2);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming on focus */
}
.badge-blocked { background: rgba(20, 21, 24, 0.08); color: var(--ink-2); }
.ticket[data-spot-state="blocked"] { background: #F1F0EC; }
.pin[data-state="blocked"] .pin-in { background: #E9E7E1; color: var(--ink-2); }
.pin[data-state="blocked"] i { background: var(--taken); }

@media (prefers-reduced-motion: reduce) {
  .menu, .offline-bar { transition: opacity 150ms ease; transform: none; }
}

/* ---------- Cancel confirmation (a small rules dialog; a bottom sheet on phones) ---------- */
@media (min-width: 641px) { .confirm { width: min(420px, 100vw); } }
.confirm h2 { font-size: 22px; }
.confirm .actions { margin-top: 20px; }

/* Names come from Google and can be one very long word: let them wrap instead of widening the sheet. */
.eyebrow, .toast-msg { overflow-wrap: anywhere; min-width: 0; }

/* ---------- My bookings ---------- */
.menu .btn + .btn { margin-top: 8px; }
.history .rules-head { position: sticky; top: -24px; margin: -24px -24px 0; padding: 24px 24px 12px; background: var(--surface); z-index: 1; }

/* Links that look like buttons. */
a.btn { text-decoration: none; }
.btn .ico { width: 18px; height: 18px; flex: none; }

/* Floor buttons count cars and bikes apart, like the day tabs. */
.elevator button { width: auto; min-width: 56px; padding: 0 6px; }
.elevator button [data-fsub] { display: flex; gap: 4px; }
.elevator button .cnt { display: inline-flex; align-items: center; gap: 2px; color: inherit; }
.elevator button .cnt svg { width: 11px; height: 11px; flex: none; }
.elevator button .cnt[data-zero] { color: var(--danger); }
@media (max-width: 759px), (max-height: 520px) { .elevator button { min-width: 46px; padding: 0 5px; } }

/* Waiting list */
.seg-sub .me-dot.wait { background: var(--muted); }
.ticket[data-spot-state="waiting"] { background: #F4F2EC; }
