/* The two accent colours follow the car on screen (set from app.js), and
   animate when switching cars. */
@property --a1 { syntax: "<color>"; inherits: true; initial-value: #5b8cff; }
@property --a2 { syntax: "<color>"; inherits: true; initial-value: #2dd4bf; }
html { transition: --a1 .45s ease, --a2 .45s ease; }

:root {
  --bg: #0a0f1f;
  --card: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .09);
  --text: #eef1fa;
  --muted: #8a93b2;
  --a1: #5b8cff;
  --a2: #2dd4bf;
  --item: 58px;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { overscroll-behavior: none; }

body {
  background: radial-gradient(120% 70% at 50% -10%, color-mix(in srgb, var(--a1) 32%, var(--bg)) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  /* Exactly one screen tall: the wheel takes whatever height is left. */
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.2vh, 20px);
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
}

.top { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: .2px; }

.chip {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.actions { display: flex; gap: 8px; }
.bell { display: grid; place-items: center; padding: 6px 10px; color: var(--muted); }
.bell[hidden] { display: none; }
.bell svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell.on { color: #06101f; border-color: transparent; background: linear-gradient(135deg, var(--a1), var(--a2)); }
.bell.busy { opacity: .5; pointer-events: none; }

/* Status card */
.status {
  text-align: center;
  flex: none;
  padding: clamp(12px, 2.4vh, 22px) 16px clamp(12px, 2.2vh, 20px);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .8);
}
.label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; }
.big { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 2px 0 6px; }
.big span { font-size: 22px; color: var(--muted); }
.big strong {
  font-size: clamp(56px, 11vh, 92px);
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.meta { color: var(--muted); font-size: 15px; }
.meta b { color: var(--text); font-weight: 600; }
.status.bump strong { animation: bump .6s ease; }
@keyframes bump {
  0% { transform: scale(.7); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* Wheel picker */
.picker { position: relative; flex: 1 1 0; min-height: calc(var(--item) * 3); }
.wheel {
  position: relative;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  perspective: 500px;
  outline: none;
  -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
  mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.spacer { height: calc(var(--item) * 2); } /* resized to half the wheel in app.js */
.item {
  height: var(--item);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  scroll-snap-align: center;
  font-size: 30px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  will-change: transform, opacity;
  transition: color .15s;
}
.item small { font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.item.sel { color: var(--text); }
.item.here::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--a2);
  box-shadow: 0 0 10px var(--a2);
}
.highlight {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--item);
  transform: translateY(-50%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--a1) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--a1) 35%, transparent);
  box-shadow: inset 0 0 30px color-mix(in srgb, var(--a1) 15%, transparent);
  pointer-events: none;
}
.wheel:focus-visible + .highlight, .picker:focus-within .highlight { border-color: color-mix(in srgb, var(--a1) 60%, transparent); }

/* Buttons */
.primary {
  flex: none;
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 18px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #06101f;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--a2) 70%, transparent);
  cursor: pointer;
  transition: transform .1s, opacity .2s;
}
.primary:active { transform: scale(.98); }
.primary:disabled { opacity: .5; }

.mode:empty { display: none; }
.mode { flex: none; text-align: center; color: var(--muted); font-size: 12px; min-height: 1em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: #1a2446;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Name dialog */
dialog {
  width: min(360px, calc(100% - 32px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background: #121a33;
  color: var(--text);
}
dialog::backdrop { background: rgba(3, 6, 15, .7); backdrop-filter: blur(4px); }
dialog h2 { font-size: 22px; margin-bottom: 6px; }
dialog p { color: var(--muted); margin-bottom: 16px; }
dialog input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font: inherit;
  font-size: 17px;
}
dialog input:focus { outline: 2px solid var(--a1); outline-offset: 1px; }

/* ---------- Cars ---------- */
.title-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 19px;
  font-weight: 650;
  cursor: pointer;
}
.title-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn svg { flex: none; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.top { gap: 12px; }
.actions { flex: none; }

/* No car yet: only the welcome card. */
.welcome { display: none; }
.app.empty .welcome {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding-bottom: 10vh;
}
.app.empty .status, .app.empty .picker, .app.empty #save { display: none; }
.app.empty .title-btn { visibility: hidden; }
.welcome img { border-radius: 24px; box-shadow: 0 16px 40px -16px color-mix(in srgb, var(--a1) 60%, transparent); }
.welcome h2 { font-size: 26px; }
.welcome p { color: var(--muted); max-width: 30ch; }
.welcome .primary { margin-top: 8px; }
.welcome .hint { font-size: 14px; }

.secondary {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.car-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.car-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
}
.car-list li.active { border-color: color-mix(in srgb, var(--a1) 55%, transparent); background: color-mix(in srgb, var(--a1) 12%, transparent); }
.car-list .pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.car-list .pick b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.car-list .pick small { color: var(--muted); font-size: 13px; }
.car-list .icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.car-list .icon:active { background: rgba(255, 255, 255, .08); }
.car-list .icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.field { display: block; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.privacy { display: block; margin-top: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 10px; }
.danger {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, .45);
  background: rgba(248, 113, 113, .12);
  color: #fca5a5;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.text-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; padding: 8px; cursor: pointer; }

/* Header: keep the name chip from crowding out the car name on narrow phones. */
#who { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Car colours */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  cursor: pointer;
}
.swatch[aria-checked="true"] { outline-color: var(--text); }
.car-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-left: 14px; }
.car-list .pick { padding-left: 10px; }
