/* Hill City Express: the Candlelight component library (a Christmas card in red velvet and gold).

   Every class in the shared contract, styled for both looks from design/tokens.css only.
   Phone first (390 px), safe-area aware, 48 px tap targets, visible focus, quiet motion.
   Laptop (720 px and up): one centered 680 px column, the tab bar floats as a capsule, sheets
   become centered dialogs. Below 341 px the ticket stacks.

   Every screen has one anatomy: a header (eyebrow, title, one line), one primary action, then
   tappable row cards, a list, a timeline or a sheet. The accent (--accent: gold foil at night,
   cranberry by day) is a fill and only for the main button, the picked option, the current step,
   the train in the timeline and the active tab; pills, labels and status never wear it. Gold is
   otherwise a hairline and the ink of eyebrows. Titles wear --heading, the italic special moments
   --flourish. Wax seals are only on Akshay's notes and on sealed answers. The lights (the room's
   glow, the string along the app bar, the hero's garland) are decoration only: never under words.

   Screen teams style their own screens in app/s-*.css, loaded after this file, using these
   classes; a new look for a shared component belongs here. */

/* ============================== Base ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: transparent;
  color: var(--text);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, figure, blockquote, ol, ul, menu, dl, dd { margin: 0; }
ol, ul, menu { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.appbar-title:focus, [data-title]:focus { outline: none; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.icon { display: block; flex: none; }
/* A row of small buttons is a <menu> of <li>: replies, Send and Copy, small choices. */
menu { display: flex; flex-wrap: wrap; gap: 10px; }
/* Times and prices keep their columns */
.tl-time, .row-trail, .row-value, .option-price, .amount, .seg small, .appbar-end, .stat-num, .count .num, .day-chip, .pill { font-variant-numeric: lining-nums tabular-nums; }
/* Playfair's old-style figures drop the 7 and the 9; dates and prices stand on the line */
.option-title, .card-title, .hero-title, .h1, .h2 { font-variant-numeric: lining-nums; }

/* ============================== Light ==============================
   The room the card sits in: one fixed layer behind everything, painted only with gradients
   (--page-light in tokens.css): a candle glow from above and a few gold lights out of focus behind
   the bar and at the very edges. It never moves, nothing is blurred, and it has faded out by
   230 px, so a hero's snow drift and every dot painted in --bg meet the page exactly. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--page-light);
}
@media print { body::before { content: none; } }

/* ============================== Shell ============================== */
.app { display: block; min-height: 100vh; min-height: 100dvh; }

/* ---- App bar: sticky, translucent, safe-area aware. Back is always top left. ---- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(var(--tap), 1fr) minmax(0, auto) minmax(var(--tap), 1fr);
  align-items: center;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  box-shadow: inset 0 -1px 0 var(--line);
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.appbar-back {
  grid-column: 1;
  justify-self: start;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 500 16px/1 var(--font-ui);
  letter-spacing: -.01em;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.appbar-back svg { width: 26px; height: 26px; }
.appbar-back span { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar-back:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.appbar-back:active { background: color-mix(in srgb, var(--text) 11%, transparent); }
.appbar-title {
  grid-column: 2;
  min-width: 0;
  max-width: 56vw;
  font: 600 17px/1.25 var(--font-ui);
  letter-spacing: -.012em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .18s var(--ease);
}
.appbar-end {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap);
  padding-right: 12px;
  color: var(--text-2);
  font: 500 15px/1 var(--font-ui);
}
/* A screen with its own large title keeps the bar's title hidden until that title scrolls under it. */
.appbar.has-large .appbar-title { opacity: 0; }
.appbar.has-large.is-condensed .appbar-title { opacity: 1; }

/* Over a hero picture the bar turns clear: the art runs to the top edge and Back floats on a
   glass pill. As the foot of the art slides under it, the bar's glass fades in (.appbar-fill, its
   opacity set by app.js as you scroll), so no word is ever cut by an empty frame. */
.appbar.is-clear {
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.appbar-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  box-shadow: inset 0 -1px 0 var(--line);
  opacity: var(--solid, 0);
  pointer-events: none;
}
.appbar.is-clear:not(.is-solid) .appbar-back {
  margin-left: 6px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 0 0 1px var(--edge), 0 4px 14px -8px rgba(0, 0, 0, .35);
}
/* A string of Christmas lights along the foot of the bar, inside it and clear of the words: the wire
   and bulbs (::after), and their glow (::before), which breathes slowly like candlelight. Opacity
   only, so it runs on the compositor. Over a hero the bar is clear and the hero wears its own. */
.appbar::before,
.appbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: env(safe-area-inset-top, 0px);
  height: 22px;
  background-position: center top;
  background-repeat: repeat-x;
  background-size: 148px 22px;
  pointer-events: none;
  transition: opacity .2s var(--ease);
}
.appbar::before {
  background-image: var(--bar-glow);
  opacity: var(--string-glow);
  animation: hce-candle 3.8s ease-in-out infinite alternate;
  animation-play-state: var(--art-twinkle, running);
}
.appbar::after { background-image: var(--bar-lights); }
@keyframes hce-candle { from { opacity: var(--string-glow); } to { opacity: calc(var(--string-glow) * .5); } }
.appbar.is-clear:not(.is-solid)::before,
.appbar.is-clear:not(.is-solid)::after { opacity: 0; animation: none; }
/* The Lights screens hang their own string, lit for mornings past: the bar's string would contradict it */
.appbar:has(+ .lights-screen)::before,
.appbar:has(+ .lights-screen)::after { content: none; }
/* The cross that closes the questions */
.appbar-close {
  appearance: none;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  margin-right: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.appbar-close:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }

/* ---- Screen: one column. On a short screen its main action settles at the foot, under the thumb. ---- */
.screen {
  --pad-top: max(20px, calc(env(safe-area-inset-top) + 8px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: var(--col);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding: var(--pad-top) max(var(--gutter), env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.appbar + .screen {
  --pad-top: 12px;
  min-height: calc(100vh - var(--bar-h) - env(safe-area-inset-top));
  min-height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top));
}
.app.has-tabbar .screen { padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
.screen > * { flex: none; }
.screen > .btn:not(.btn-block) { align-self: flex-start; }
.screen > .btn-quiet:not(.btn-block) { align-self: center; }
.screen > .eyebrow { margin-top: 14px; margin-bottom: -6px; }
.screen > .eyebrow:first-child { margin-top: 0; }
.screen > .progress:first-child { margin-top: 2px; }
.screen > .btn-lg, .screen > .screen-foot { margin-top: auto; }
.screen-foot { display: flex; flex-direction: column; gap: 8px; }
/* Moving between screens, as on a phone: a pushed screen comes in from the right, Back brings the
   last one in from the left, a tab cross-fades. The screen you leave fades out as a picture (app.js,
   ghost) while the next one arrives. Transform and opacity only, about a quarter second. */
@keyframes ui-in-fwd { from { opacity: 0; transform: translateX(44px); } to { opacity: 1; transform: none; } }
@keyframes ui-in-back { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes ui-in-tab { from { opacity: 0; } to { opacity: 1; } }
.screen[data-enter="fwd"] { animation: ui-in-fwd .3s cubic-bezier(.16, 1, .3, 1) .03s both; }
.screen[data-enter="back"] { animation: ui-in-back .3s cubic-bezier(.16, 1, .3, 1) .03s both; }
.screen[data-enter="tab"] { animation: ui-in-tab .2s ease-out both; }
.screen.ghost { animation: none; }

/* ---- Tab bar: fixed, at most four tabs ---- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  min-height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 4px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  box-shadow: inset 0 1px 0 var(--line);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  border-radius: 16px;
  color: var(--text-2);
  font: 500 12.5px/1.1 var(--font-ui);
  letter-spacing: .01em;
  text-decoration: none;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.tab svg { width: 26px; height: 26px; }
.tab:hover { color: var(--text); }
.tab.is-active, .tab[aria-current="page"] { color: var(--text); font-weight: 650; }
.tab.is-active svg, .tab[aria-current="page"] svg { color: var(--accent); stroke-width: 2.1; filter: drop-shadow(var(--tab-glow)); }

/* ============================== Type ==============================
   Titles are the card's lettering: Playfair Display in the heading color (champagne gold leaf at
   night, claret by day), with a little candle glow at night. Its italic is kept for the special
   moments and wears the flourish color. Eyebrows are small gold capitals. */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 10.8vw, 56px);
  line-height: 1.04;
  letter-spacing: -.016em;
  text-wrap: balance;
  color: var(--heading);
  text-shadow: var(--heading-glow);
}
.h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 8.2vw, 40px);
  line-height: 1.1;
  letter-spacing: -.012em;
  text-wrap: balance;
  color: var(--heading);
  text-shadow: var(--heading-glow);
}
.h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.22;
  letter-spacing: -.006em;
  text-wrap: balance;
  color: var(--heading);
}
/* The italic is for the special moments: "Krista, you are invited". */
.display em, .h1 em, .h2 em, .hero-title em { font-style: italic; font-weight: 500; letter-spacing: -.004em; color: var(--flourish); }
.eyebrow {
  display: block;
  font: 650 12.5px/1.3 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.lede { font-size: 18px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
.muted { color: var(--text-2); }
.fine { font-size: 14px; line-height: 1.45; color: var(--text-3); text-wrap: pretty; }
.fine.center { text-align: center; }
.fine:has(> svg:first-child) { display: flex; align-items: flex-start; gap: 8px; }
.fine > svg:first-child { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.lede a, .muted a, .fine a, .card-sub a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
/* A screen's header: eyebrow, title, one line */
.head { display: flex; flex-direction: column; gap: 6px; }
.head .lede { margin-top: 2px; }
/* A titled section of a screen */
.group { display: flex; flex-direction: column; gap: 10px; }
.group > .h2 { font-size: 20px; }
.group > .eyebrow + .list, .group > .eyebrow + .card { margin-top: -2px; }
.status-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

/* ============================== Surfaces ============================== */

/* ---- Card ---- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--sheen), var(--surface);
  color: var(--text);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--edge);
  overflow: hidden;
  text-decoration: none;
}
.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 2 / 1;
  background: var(--surface-2);
  --art-ground: var(--surface);
}
.card-media > svg, .card-media > .window { display: block; width: 100%; height: 100%; }
.card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 18px 20px 20px; }
.card-body > .btn { margin-top: 12px; }
.card-body > .pill { align-self: flex-start; margin-top: 6px; }
.card-body > .pill:first-child { margin: 0 0 4px; }
.card-body > .eyebrow + .card-title { margin-top: -2px; }
.card .stat-num { font-size: 46px; line-height: 1; letter-spacing: -.03em; }
.card-media + .card-body { padding-top: 14px; }
.card-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 540;
  font-size: 25px;
  line-height: 1.12;
  letter-spacing: -.014em;
  text-wrap: balance;
}
.card-sub { display: block; font-size: 15.5px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
.card .eyebrow { color: var(--gold-ink); }
.card-trail { display: inline-flex; align-items: center; gap: 10px; color: var(--text-3); }

/* A tappable card is a row: picture tile, words, chevron. */
.card-tap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  min-height: 80px;
  padding: 14px 16px 14px 14px;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.card-tap:not(:has(> .card-media)) { grid-template-columns: minmax(0, 1fr) auto; padding-left: 20px; }
.card-tap > .card-media {
  width: 52px;
  height: 52px;
  aspect-ratio: 1;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--tile);
  box-shadow: var(--tile-glow);
}
.card-tap > .card-media > svg { width: 38px; height: 38px; }
.card-tap > .card-media > .avatar { width: 40px; height: 40px; box-shadow: none; }
.card-tap > .card-body { padding: 0; gap: 2px; }
.card-tap .card-title { font-size: 20px; line-height: 1.2; }
.card-tap .card-sub { font-size: 14.5px; line-height: 1.4; }
.card-tap .eyebrow { font-size: 12.5px; letter-spacing: .08em; }
.card-tap .pill { margin-top: 6px; justify-self: start; align-self: flex-start; }
.card-tap > .card-trail, .card-tap > .chev { grid-column: -2; }
.card-tap:hover { box-shadow: var(--shadow-2), 0 0 0 1px var(--edge); }
.card-tap:active { transform: scale(.985); }
.chev { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; color: var(--text-3); }
.chev svg { width: 18px; height: 18px; }
.chev:empty::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}

/* The one next step: a picture band (the snowscape, or one small picture on a warm glow), then the
   words and one button. */
.card-next { display: flex; flex-direction: column; align-items: stretch; padding: 0; box-shadow: var(--shadow-2), 0 0 0 1px var(--edge); }
.card-next > .card-media {
  width: auto;
  height: 112px;
  aspect-ratio: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(ellipse 62% 120% at 50% 120%, color-mix(in srgb, var(--gold) 38%, transparent), transparent 70%),
    var(--surface-2);
  box-shadow: none;
}
.card-next > .card-media:has(> .window, > .snowscape) { height: auto; aspect-ratio: 2 / 1; background: var(--surface-2); }
/* a swag of Christmas lights across the top of the picture band */
.card-next > .card-media:not(:has(> .window, > .snowscape))::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 36px; background: var(--lights-band) 50% 0 / 160px 36px repeat-x; pointer-events: none; }
.card-next > .card-media > svg:not(.snowscape) { width: 64px; height: 64px; }
.card-next > .card-media > .avatar { width: 64px; height: 64px; }
.card-next > .card-media > .avatar svg { width: 30px; height: 30px; }
.card-next > .card-body { padding: 16px 20px 20px; gap: 6px; }
.card-next .card-title { font-size: 24px; }
.card-next .btn { margin-top: 12px; }
.card-next > .chev { position: absolute; right: 16px; bottom: 26px; }
/* Cards with a picture beside the words, and short notes about the plan */
.card-row { display: flex; gap: 14px; align-items: center; }
.card .card-art { flex: none; display: grid; place-items: center; }
.card .card-art svg { width: 56px; height: 56px; }
.card-note .card-body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 16px; }
.card .note-hand { font-family: var(--font-hand); font-size: 19px; line-height: 1.35; color: var(--gold-ink); }
.card .card-title.note-hand { font-size: 26px; font-weight: 700; }
.card .committed { align-items: flex-start; }
.card .pack-list { margin: 0; padding: 0 0 0 20px; list-style: disc; display: grid; gap: 4px; font-size: 16px; }
/* Two place cards across, on Home */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-2 > .card-tap { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-height: 132px; padding: 14px; }
.grid-2 > .card-tap > .card-media { width: 48px; height: 48px; border-radius: 14px; }
.grid-2 > .card-tap > .card-media > svg { width: 36px; height: 36px; }
.grid-2 > .card-tap > .chev { position: absolute; right: 12px; top: 16px; }
.grid-2 .card-title { font-size: 19px; }

/* ---- Grouped list of rows ---- */
.list {
  display: flex;
  flex-direction: column;
  background: var(--sheen), var(--surface);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--edge);
  overflow: hidden;
}
.list > .row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  min-height: 60px;
  margin: 0;
  padding: 11px 16px;
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  width: 100%;
  font: inherit;
  text-align: left;
  appearance: none;
}
.list > .row:not(:has(> .row-icon)) { grid-template-columns: minmax(0, 1fr) auto; }
.list > .row:not(:has(> .row-trail)):not(:has(> .row-icon)) { grid-template-columns: minmax(0, 1fr); }
.list > .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--line); }
.list > .row:has(> .row-icon) + .row:has(> .row-icon)::before { left: 70px; }
.list > a.row, .list > button.row { cursor: pointer; transition: background-color .15s var(--ease); }
/* the group clips its corners, so a row's focus ring is drawn inside the row */
.list > .row:focus-visible, .list :focus-visible { outline-offset: -3px; }
.list > .row:first-child:focus-visible { border-radius: var(--r-l) var(--r-l) 0 0; }
.list > .row:last-child:focus-visible { border-radius: 0 0 var(--r-l) var(--r-l); }
.list > .row:only-child:focus-visible { border-radius: var(--r-l); }
.list > a.row:hover, .list > button.row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.list > a.row:active, .list > button.row:active { background: color-mix(in srgb, var(--text) 7%, transparent); }
.row-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--tile);
  box-shadow: var(--tile-glow);
  color: var(--text);
}
.row-icon > svg { width: 32px; height: 32px; }
.row-icon:has(> .icon) { background: var(--surface-2); box-shadow: none; }
.row-icon > .icon { width: 21px; height: 21px; }
.row-icon:has(> .avatar) { background: none; box-shadow: none; }
.row-icon > .avatar { width: 40px; height: 40px; }
.row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-title { font: 500 16px/1.3 var(--font-ui); letter-spacing: -.005em; color: var(--text); }
.row-sub { font-size: 14px; line-height: 1.4; color: var(--text-2); }
.row-trail { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 15px; }
/* Rows that carry more: a day chip, a value, a sealed row, the decisions */
.row-icon.day-chip { background: var(--surface-2); box-shadow: none; font: 650 14px/1 var(--font-ui); color: var(--text); }
.day-chip b { font-weight: 650; }
.row-value { font: 600 15px/1.3 var(--font-ui); color: var(--text); text-align: right; }
.row-danger .row-title { font-weight: 600; }
.row-sealed .row-icon { background: none; box-shadow: none; }
.row-sealed .row-icon svg { width: 36px; height: 36px; }
.row-main > .row-sub.eyebrow { font-size: 12.5px; color: var(--gold-ink); }
.row-sub.hand { font-family: var(--font-hand); font-size: 17px; line-height: 1.3; color: var(--gold-ink); }
.row-sub.also { display: flex; align-items: center; gap: 6px; }
.row-trail.marks { gap: 2px; }
.row-trail.marks .mk svg { width: 22px; height: 22px; }
.row.is-match .row-icon { box-shadow: inset 0 0 0 2px var(--gold); }
.row.is-dim { opacity: .62; }
.row.is-today { background: color-mix(in srgb, var(--gold) 13%, transparent); }
.row.is-open .row-title { color: var(--text-2); }
@keyframes ui-land { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.row.is-live { animation: ui-land .44s var(--ease) both; animation-delay: calc(var(--i, 0) * 140ms + 60ms); }
.row.is-live .marks svg { animation: punch .42s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--i, 0) * 140ms + 360ms); }
.list > form.row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.list .part { display: flex; justify-content: space-between; gap: 10px; }
.list .part b, .amount { font-weight: 600; color: var(--text); }
.row-title .claim { display: inline-grid; vertical-align: -3px; margin-left: 4px; }
.row-title .claim svg { width: 17px; height: 17px; }
.row-title .claim .shape { fill: var(--text); stroke: none; }
.kid-card-row .list { box-shadow: none; border-radius: 0; background: none; }
.kid-card-row .card-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ---- A person's mark, small, inline ---- */
.mk { display: inline-grid; place-items: center; flex: none; }
.mk svg { width: 24px; height: 24px; display: block; }
.mk .shape { fill: var(--text); stroke: none; }
.mk.ghost svg { width: 17px; height: 17px; }
.mk.ghost .shape { fill: none; stroke: var(--text-2); stroke-width: 1.6; stroke-dasharray: 2.4 2.4; }

/* ---- Hero: the snowscape runs edge to edge and melts into the page ----
   Nothing here is positioned: the words after the art paint over its snow by document order, and
   whatever follows the hero (a big number, a card) can rise over the drift too. */
.hero { display: flex; flex-direction: column; gap: 10px; }
.hero-art {
  display: block;
  margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left)));
  margin-right: calc(-1 * max(var(--gutter), env(safe-area-inset-right)));
  aspect-ratio: 400 / 250;
  overflow: hidden;
  --art-ground: var(--bg);
}
.hero-art + * { margin-top: -30px; }
.screen > .hero:first-child { margin-top: calc(-1 * var(--pad-top)); }
.appbar.is-clear + .screen > .hero:first-child { margin-top: calc(-1 * (var(--pad-top) + var(--bar-h) + env(safe-area-inset-top))); }
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 11.8vw, 60px);
  line-height: 1.02;
  letter-spacing: -.018em;
  text-wrap: balance;
  color: var(--heading);
  text-shadow: var(--heading-glow);
}
.hero-title em { display: inline-block; }
/* The line under the greeting is written, not printed: the display italic in the flourish color */
.hero-sub { font: italic 500 21px/1.35 var(--font-display); letter-spacing: -.004em; color: var(--flourish); max-width: 34ch; text-wrap: pretty; }
/* The window: the drawing itself, tappable (a tap runs the train) */
.window { display: block; width: 100%; height: 100%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.window > svg { display: block; width: 100%; height: 100%; }
/* Its Christmas lights: on the first open app.js (wakeBulbs) lights the string one bulb after
   another; afterwards every third glow twinkles, a few steps a second so the phone barely notices. */
@keyframes hce-bulb-on { from { opacity: 0; } to { opacity: var(--o, 1); } }
@keyframes hce-twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(.66); } }
.window.waking .hce-on { animation: hce-bulb-on .7s var(--ease-out) both; }
.snowscape .sl-glow.tw { transform-box: fill-box; transform-origin: center; animation: hce-twinkle 4.8s steps(24) infinite; animation-play-state: var(--art-twinkle, running); }
.window.waking .snowscape .sl-glow.tw.hce-on { animation: hce-bulb-on .7s var(--ease-out) both, hce-twinkle 4.8s steps(24) infinite; animation-play-state: running, var(--art-twinkle, running); }

/* ---- Ticket: the signature object. Warm white stock by day, velvet at night, a gold hairline frame, tear lines cut with real
   notches (each part masks a half circle out of its corners, so the page shows through). ---- */
.ticket {
  --notch: 10px;
  --tk-pad: 22px;
  --frame: color-mix(in srgb, var(--gold) 80%, transparent);
  position: relative;
  display: flex;
  flex-direction: column;
  filter: var(--ticket-shadow);
}
.ticket-part {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 12px 16px;
  padding: 16px var(--tk-pad);
  background: var(--surface);
  color: var(--text);
  -webkit-mask: var(--m-tl) top left / 51% 51% no-repeat, var(--m-tr) top right / 51% 51% no-repeat, var(--m-bl) bottom left / 51% 51% no-repeat, var(--m-br) bottom right / 51% 51% no-repeat;
  mask: var(--m-tl) top left / 51% 51% no-repeat, var(--m-tr) top right / 51% 51% no-repeat, var(--m-bl) bottom left / 51% 51% no-repeat, var(--m-br) bottom right / 51% 51% no-repeat;
  --m-tl: radial-gradient(circle var(--notch) at 0 0, #0000 97%, #000);
  --m-tr: radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000);
  --m-bl: radial-gradient(circle var(--notch) at 0 100%, #0000 97%, #000);
  --m-br: radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000);
}
.ticket-part:first-child { --m-tl: linear-gradient(#000 0 0); --m-tr: linear-gradient(#000 0 0); border-radius: var(--r-l) var(--r-l) 0 0; padding-top: 22px; }
.ticket-part:last-child { --m-bl: linear-gradient(#000 0 0); --m-br: linear-gradient(#000 0 0); border-radius: 0 0 var(--r-l) var(--r-l); padding-bottom: 22px; }
.ticket-part:only-child { border-radius: var(--r-l); }
/* the printed frame, drawn part by part so the tear interrupts it */
.ticket-part::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  right: 8px;
  border: 3px double var(--frame);
  border-top: 0;
  border-bottom: 0;
  pointer-events: none;
}
.ticket-part:first-child::before { top: 8px; border-top: 3px double var(--frame); border-radius: calc(var(--r-l) - 7px) calc(var(--r-l) - 7px) 0 0; }
.ticket-part:last-child::before { bottom: 8px; border-bottom: 3px double var(--frame); border-radius: 0 0 calc(var(--r-l) - 7px) calc(var(--r-l) - 7px); }
.ticket-part:only-child::before { border-radius: calc(var(--r-l) - 7px); }
/* the tear line between two parts: a gold perforation */
.ticket-part + .ticket-part { background: radial-gradient(circle, color-mix(in srgb, var(--gold) 75%, transparent) 0 1px, transparent 1.4px) 0 0 / 7px 2px repeat-x, var(--sheen), var(--surface); }
.ticket-part > * { grid-column: 1 / -1; position: relative; min-width: 0; }
.ticket-part > .stat { grid-column: auto; }
.ticket-part > .stat.is-end { text-align: right; align-items: flex-end; }
.ticket-part > .stat.is-wide { grid-column: 1 / -1; text-align: left; align-items: flex-start; }
.ticket .eyebrow { color: var(--gold-ink); }
.ticket .stat-label { color: var(--text-2); letter-spacing: .08em; white-space: nowrap; }
.ticket .stat-num { font-size: 23px; line-height: 1.15; letter-spacing: -.012em; }
.ticket .stat-text { font-size: 15.5px; line-height: 1.45; color: var(--text); }
/* Top line: what it is, and ADMIT FOUR in a printed box */
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 2px; }
.ticket-head .eyebrow { color: var(--gold-ink); }
.ticket-admit {
  flex: none;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--frame);
  color: var(--text);
  font: 700 12.5px/1.2 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* The four travellers, punched in when they are coming */
.punches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.punch { display: flex; flex-direction: column; align-items: center; gap: 7px; font: 500 14px/1.2 var(--font-ui); color: var(--text-2); text-align: center; }
.punch .avatar { width: 46px; height: 46px; }
.punch:not(.is-in) .avatar { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 50%, transparent); color: var(--text-3); }
.punch:not(.is-in) .avatar .shape { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-dasharray: 2.4 2.4; }
.punch.is-in { color: var(--text); }
.punches.live .punch.is-pop .avatar svg { animation: punch .42s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: var(--d, 0s); }
.ticket-mistletoe { position: absolute; top: -6px; left: calc(37.5% - 15px); width: 30px; height: 30px; pointer-events: none; }
.ticket-mistletoe svg { width: 30px; height: 30px; }
/* The stub: the last part, torn off below the marks */
.ticket-stub { display: flex; flex-direction: column; gap: 4px; }
.ticket-stub b, .ticket-stub .holder { font-family: var(--font-display); font-weight: 560; font-size: 20px; line-height: 1.2; }
.ticket-stub > span { color: var(--text-2); font-size: 15.5px; line-height: 1.4; }
/* The count on the stub, with the booking stamp */
.count-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.count .num { font: 520 46px/1 var(--font-display); letter-spacing: -.03em; color: var(--text); }
.count .num.today { font-size: 34px; }
.count .unit { font: 500 15px/1.3 var(--font-ui); color: var(--text-2); }

/* ---- Akshay's notes: cream card stock and navy ink in both looks, a small wax seal ---- */
.note-block { display: flex; flex-direction: column; gap: 12px; }
.note {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 24px 20px;
  border-radius: var(--r-m);
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 40%), var(--paper-grain), var(--note-paper);
  color: var(--note-ink);
  box-shadow: inset 0 0 0 1px var(--note-line), inset 0 0 30px rgba(170, 118, 52, .1), var(--shadow-1);
}
/* On Akshay's paper the focus ring is holly, in either look */
.note, .env, .note-list > form.note-edit { --focus: var(--note-focus); }
.note > .liner { display: none; }
.note-seal, .note > .wax { position: absolute; top: -14px; right: 18px; display: block; width: 44px; height: 44px; filter: drop-shadow(0 3px 3px rgba(60, 10, 14, .35)); transform: rotate(10deg); }
.note-seal svg, .note > .wax svg { width: 44px; height: 44px; }
.note-hand, .note .body { margin: 0; font: 400 21px/1.45 var(--font-hand); color: var(--note-ink); }
.note .body { display: flex; flex-direction: column; gap: 8px; }
.note-hand + .note-hand { margin-top: 4px; }
.note-sign, .note .sign { align-self: flex-end; margin-top: 4px; font: 700 21px/1.2 var(--font-hand); color: var(--note-ink); }
.note-ps { font-size: 19px; }
.note .eyebrow { color: var(--note-ink-2); }
.note .fine, .note .from { color: var(--note-ink-2); }
/* What Akshay sees under his note: Krista's heart and replies */
.note-from { display: flex; flex-direction: column; gap: 6px; }
.note-from p { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-2); }
.note-from svg { width: 18px; height: 18px; flex: none; }
.note-from .shape { fill: var(--text); }
/* Akshay's notes as he will send them (Settings) */
.note.note-card, .note.note-edit { padding: 16px 18px 12px; gap: 8px; }
.note-card .note-hand { display: flex; flex-direction: column; gap: 4px; font-size: 19px; line-height: 1.38; }
.note-card.is-off { opacity: .62; }
.note-card.is-off .note-hand { text-decoration: line-through; }
.note-actions { display: flex; gap: 6px; margin-top: 2px; }
.note .btn-quiet { color: var(--note-ink); }
.note .btn-quiet:hover { background: rgba(29, 46, 92, .07); color: var(--note-ink); }
/* Notes kept on the keepsake */
.note.kept { padding-top: 34px; }
.note.kept .body { font-size: 18.5px; gap: 0; }
.note.kept .body span { padding: 8px 0; }
.kept-rule { display: block; height: 0; border-top: 1px dashed var(--note-line); }

/* ---- The envelope: a note still sealed. Tap the seal to open it. ---- */
.env {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 18px 159px 18px 22px;
  border: 0;
  border-radius: var(--r-m);
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 40%), var(--paper-grain), var(--note-paper);
  color: var(--note-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--note-line), inset 0 0 30px rgba(170, 118, 52, .1), var(--shadow-1);
  transition: transform .15s var(--ease);
}
.env:active { transform: scale(.99); }
.env > .liner { display: none; }
.env > .flap {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 116px;
  background:
    linear-gradient(to bottom right, transparent calc(50% - .6px), var(--note-line) calc(50% - .6px) calc(50% + .6px), transparent calc(50% + .6px)) top / 100% 50% no-repeat,
    linear-gradient(to top right, transparent calc(50% - .6px), var(--note-line) calc(50% - .6px) calc(50% + .6px), transparent calc(50% + .6px)) bottom / 100% 50% no-repeat,
    linear-gradient(to left, rgba(149, 115, 48, .1), rgba(149, 115, 48, 0));
}
.env > .wax { position: absolute; right: 116px; top: 50%; transform: translate(50%, -50%) rotate(-8deg); filter: drop-shadow(0 3px 3px rgba(60, 10, 14, .38)); }
.env > .wax svg { display: block; width: 54px; height: 54px; }
.env > .to { display: block; font: 400 25px/1.1 var(--font-hand); color: var(--note-ink); }
.env > .sub { display: block; margin-top: 5px; font-size: 14.5px; line-height: 1.35; color: var(--note-ink-2); max-width: 22ch; text-wrap: balance; }
.us-gate .env { text-align: left; }

/* A wax seal you can tap */
.seal-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 3px rgba(60, 10, 14, .38));
}
.seal-btn svg { display: block; }
.sealed-gate .seal-btn, .seal-big { min-width: 96px; min-height: 96px; }

/* ---- Share card: the message preview and Send ---- */
.share-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--sheen), var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--edge);
}
.share-card > .eyebrow { margin-bottom: 2px; }
/* The message bubble is neutral: Krista's words, not a button */
.share-msg {
  align-self: flex-end;
  max-width: 88%;
  padding: 11px 15px 12px;
  border-radius: 21px 21px 6px 21px;
  background: var(--surface-2);
  color: var(--text);
}
.share-text { margin: 0; font-size: 16.5px; line-height: 1.38; }
.share-link { margin: 6px 0 0; font-size: 14px; line-height: 1.3; color: var(--text-2); overflow-wrap: anywhere; }
.share-actions { display: flex; flex-direction: column; gap: 10px; }
.share-card figure { align-self: flex-end; width: 88%; overflow: hidden; border-radius: 20px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--edge); }
.share-card figure > .card-media { aspect-ratio: 400 / 190; --art-ground: var(--surface-2); }
.share-card figcaption { display: flex; flex-direction: column; gap: 1px; padding: 10px 14px 12px; }
.share-card figcaption strong { font: 600 15px/1.3 var(--font-ui); }
.share-card figcaption span { font-size: 13.5px; line-height: 1.35; color: var(--text-2); overflow-wrap: anywhere; }
.share-card menu { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; margin-top: 4px; }

/* ============================== Controls ============================== */

/* ---- Buttons ---- */
.btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  min-height: var(--tap);
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 16px/1.2 var(--font-ui);
  letter-spacing: -.008em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: scale(.98); }
/* The main button is the card's seal: gold foil lit by the candles at night, cranberry velvet with
   a gold foil edge by day (--btn-fill and --btn-finish in tokens.css). */
.btn-primary {
  background: var(--btn-fill);
  color: var(--on-accent);
  font-weight: 650;
  box-shadow: var(--btn-finish);
}
.btn-primary:hover { background: var(--btn-fill); filter: brightness(1.05) saturate(1.04); }
.btn-primary:active { background: var(--accent-press); filter: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--edge-strong); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: color-mix(in srgb, var(--surface) 92%, var(--text)); }
.btn-secondary.is-picked, .btn-secondary[aria-pressed="true"] { border-color: color-mix(in srgb, var(--text) 60%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 60%, transparent); }
.btn-quiet { background: transparent; color: var(--text-2); font-weight: 550; }
.btn-quiet:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.btn-block { display: flex; width: 100%; }
.btn-block + .btn-quiet.btn-block { margin-top: -8px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; }
.btn-danger, .btn-primary.btn-danger { background: var(--danger); color: var(--on-danger); box-shadow: none; }
.btn-primary.btn-danger:hover { background: var(--danger); filter: brightness(1.06); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .42; pointer-events: none; box-shadow: none; }
a.btn { text-decoration: none; }

/* ---- Chips: small round choices and links (note replies, road links) ---- */
.chip, .chip-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--edge-strong), var(--shadow-1);
  font: 550 15.5px/1.2 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
}
.chip svg, .chip-btn svg { width: 18px; height: 18px; flex: none; }
.chip .shape, .chip-btn .shape { fill: none; stroke: currentColor; stroke-width: 1.6; }
/* A chip that is on fills in, like a picked option: one way to show picked everywhere */
.chip.is-on, .chip-btn.on, .chip[aria-pressed="true"], .chip-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--accent-ring), var(--shadow-1); font-weight: 650; }
.chip.is-on .shape, .chip-btn.on .shape, .chip[aria-pressed="true"] .shape, .chip-btn[aria-pressed="true"] .shape { fill: currentColor; stroke: none; }

/* ---- Options: one question, one tap ---- */
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-auto-rows: auto;
  align-content: center;
  align-items: center;
  column-gap: 16px;
  row-gap: 0;
  width: 100%;
  min-height: 88px;
  margin: 0;
  padding: 16px 18px 16px 16px;
  border: 1.5px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color .18s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
div.option { cursor: default; }
.option:hover { border-color: color-mix(in srgb, var(--text) 34%, transparent); }
.option:active { transform: scale(.99); }
.option > * { grid-column: 2; }
.option-art {
  grid-column: 1;
  grid-row: 1 / span 6;
  align-self: center;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--tile);
  box-shadow: var(--tile-glow);
}
.option-art svg { width: 44px; height: 44px; }
.option-title {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -.012em;
}
.option-sub { margin-top: 3px; font-size: 15px; line-height: 1.4; color: var(--text-2); }
.option-price { font-weight: 600; color: var(--text); }
.option > .pill { justify-self: start; margin-top: 8px; }
.option-check, .option-marks { grid-column: -2; grid-row: 1 / span 6; align-self: center; }
.option:not(:has(> .option-art)) { grid-template-columns: minmax(0, 1fr) auto; }
.option:not(:has(> .option-art)) > :not(.option-check):not(.option-marks) { grid-column: 1; }
/* The ring: unpicked at half the ink, picked filled with the accent and a check */
.option-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--text) 50%, transparent);
  transition: background-color .18s var(--ease), border-color .18s var(--ease);
}
.option.is-picked, .option[aria-checked="true"], .option[aria-pressed="true"] {
  border-color: var(--accent-ring);
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--accent-glow), var(--shadow-1);
}
.option.is-picked .option-check, .option[aria-checked="true"] .option-check, .option[aria-pressed="true"] .option-check,
.option.is-punching .option-check { background: var(--accent-ring); border-color: var(--accent-ring); }
.option.is-picked .option-check::after, .option[aria-checked="true"] .option-check::after, .option[aria-pressed="true"] .option-check::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--on-accent);
  -webkit-mask: var(--i-check) center / 16px no-repeat;
  mask: var(--i-check) center / 16px no-repeat;
}
/* While a tap punches the option, the ring shows your mark for a moment */
.option.is-punching { transform: translateY(-2px); }
.option-check .mk svg { width: 16px; height: 16px; }
.option-check .mk .shape { fill: var(--on-accent); }
.option.is-punching .option-check .mk svg, .option.is-live .option-check::after { animation: punch .34s cubic-bezier(.2, .9, .3, 1.4) both; }
/* A settled pick (the car you both ended up with) wears a gold ring */
.option.is-won { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 16%, transparent), var(--shadow-1); }
/* Who picked it: the people's marks, side by side */
.option-marks { display: inline-flex; gap: 2px; }
.option:has(> .option-marks):has(> .option-check) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.option:has(> .option-marks):has(> .option-check) > .option-marks { grid-column: 3; margin-right: -6px; }
.option:not(:has(> .option-art)):has(> .option-marks):has(> .option-check) { grid-template-columns: minmax(0, 1fr) auto auto; }
.option:not(:has(> .option-art)):has(> .option-marks):has(> .option-check) > .option-marks { grid-column: 2; }
.option:not(:has(> .option-sub)) > .option-art,
.option:not(:has(> .option-sub)) > .option-check,
.option:not(:has(> .option-sub)) > .option-marks { grid-row: 1; }
.option-marks .mk svg { width: 22px; height: 22px; }
/* Messages to pick from, as speech bubbles */
.options-bubbles .option { min-height: 58px; border-radius: 22px 22px 22px 8px; padding: 12px 16px; }
.options-bubbles .option-title { font: 500 16.5px/1.38 var(--font-ui); letter-spacing: 0; }

/* ---- Segmented control ---- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.seg {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 52px;
  padding: 4px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-2);
  font: 600 15.5px/1.15 var(--font-ui);
  text-align: center;
  cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.seg small { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.seg.is-active, .seg[aria-selected="true"], .seg[aria-pressed="true"] { background: var(--seg-on, var(--surface)); color: var(--text); font-weight: 700; box-shadow: var(--shadow-1), inset 0 0 0 1px color-mix(in srgb, var(--gold) 60%, transparent); }
.seg.is-active small, .seg[aria-selected="true"] small, .seg[aria-pressed="true"] small { color: var(--text); }

/* ---- Progress ---- */
.progress { position: relative; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent-ring); transition: width .5s var(--ease-out); }

/* ---- Steps: one tracker for the whole trip (stepsEl). Numbered circles, a check once done. ---- */
.steps {
  --steps-bg: var(--bg);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.card .steps, .list .steps { --steps-bg: var(--surface); }
.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font: 500 13px/1.2 var(--font-ui);
  text-align: center;
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--steps-bg);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 50%, transparent);
  color: var(--text-2);
  font: 650 13px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.step + .step::after {
  content: "";
  position: absolute;
  top: 13.25px;
  right: calc(50% + 18px);
  left: calc(-50% + 18px);
  height: 1.5px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--text) 22%, transparent);
}
.step.is-done::before { content: ""; background: var(--text-2) var(--step-check) center / 16px no-repeat; box-shadow: none; }
.step.is-done + .step::after { background: var(--text-2); }
.step.is-current { color: var(--text); font-weight: 650; }
.step.is-done::before { background-color: var(--good); }
.step.is-done + .step::after { background: var(--good); }
.step-wait { display: block; margin-top: -4px; font: 500 12px/1.25 var(--font-ui); color: var(--text-2); }
.step.is-current::before { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent), var(--accent-glow); color: var(--on-accent); }
/* A longer ladder than the four steps keeps only the current label in sight */
.steps:has(> .step:nth-child(5)) > .step:not(.is-current) > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.steps:has(> .step:nth-child(5)) > .step.is-current { white-space: nowrap; }

/* ---- Pills: status, never the accent ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-2);
  font: 600 13px/1.15 var(--font-ui);
  letter-spacing: .005em;
  white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.pill-good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.pill-wait, .pill-accent { background: color-mix(in srgb, var(--wait) 17%, transparent); color: var(--wait); }

/* ---- Avatar: a person's mark on a warm tile with a gold ring ---- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--tile);
  color: var(--holly);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 65%, transparent);
  font: 600 16px/1 var(--font-ui);
}
.avatar svg { width: 22px; height: 22px; }
.avatar .shape, .avatar path { fill: currentColor; }

/* ---- Fields: one line or a short note ---- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--text);
  font: 500 16.5px/1.35 var(--font-ui);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { min-height: 104px; resize: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.field input.hand, .field textarea.hand { font: 400 19px/1.4 var(--font-hand); }
.field .count { align-self: flex-end; font-size: 13px; color: var(--text-3); }
.field .count:empty { display: none; }
.note-write .count { margin-top: -4px; font-variant-numeric: lining-nums tabular-nums; }
.field .actions { display: flex; gap: 8px; margin-top: 4px; }
.field .actions .btn { flex: 1; }
.field label.eyebrow { margin-bottom: -2px; }
/* On a note the field is paper and the ink stays navy */
.note .field input, .note .field textarea { background: #FFFDF7; color: var(--note-ink); border-color: var(--note-line); }

/* ---- Switch: on and off, with its knob on the side it says ---- */
.switch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: 600 15px/1.2 var(--font-ui);
  cursor: pointer;
}
.switch .track { position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px; background: color-mix(in srgb, var(--text) 22%, transparent); transition: background-color .18s var(--ease); }
.switch .track i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .18s var(--ease); }
.switch.is-on, .switch[aria-pressed="true"] { color: var(--text); }
.switch.is-on .track, .switch[aria-pressed="true"] .track { background: var(--good); }
.switch.is-on .track i, .switch[aria-pressed="true"] .track i { left: 23px; }

/* ---- A checklist line: a box that takes a check ---- */
.check {
  appearance: none;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.check .box { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 50%, transparent); color: var(--on-accent); }
.check .box svg { width: 15px; height: 15px; }
.check.on .box { background: var(--good); box-shadow: none; color: var(--bg); }

/* ---- Picture cards, three or four across (Brex's picks, Krista's approvals) ---- */
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.picks.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pick {
  appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 112px;
  padding: 12px 6px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--edge);
  font: 600 15.5px/1.15 var(--font-ui);
  text-align: center;
  cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .18s var(--ease);
}
div.pick { cursor: default; }
.pick:active { transform: scale(.97); }
.pick svg { width: 52px; height: 52px; }
.picks.four .pick { min-height: 92px; font-size: 13.5px; }
.picks.four .pick svg { width: 38px; height: 38px; }
.pick.is-picked { box-shadow: 0 0 0 2.5px var(--accent-ring), var(--shadow-1); }
.pick.is-picked::after {
  content: "";
  position: absolute;
  top: -7px;
  right: -7px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-ring);
  box-shadow: 0 0 0 2px var(--bg);
}
.pick.is-picked::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: -7px;
  right: -7px;
  width: 26px;
  height: 26px;
  background: var(--on-accent);
  -webkit-mask: var(--i-check) center / 15px no-repeat;
  mask: var(--i-check) center / 15px no-repeat;
}

/* ---- Stamp: booked, used, kept. Ink, never cranberry. ---- */
.stamp {
  display: inline-block;
  padding: 7px 11px;
  border: 3px double color-mix(in srgb, var(--good) 85%, transparent);
  border-radius: 9px;
  color: var(--good);
  font: 750 13px/1 var(--font-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  transform: rotate(-6deg);
}
.stamp.small { padding: 5px 8px; font-size: 12.5px; }
.stamp.wait { padding: 6px 10px; border: 1.5px dashed color-mix(in srgb, var(--text) 40%, transparent); color: var(--text-2); font-weight: 600; letter-spacing: .01em; text-transform: none; transform: none; }
@keyframes stamp { 0% { transform: rotate(-6deg) scale(2); opacity: 0; } 100% { transform: rotate(-6deg) scale(1); opacity: 1; } }
.live > .stamp, .live .stamp:not(.wait) { animation: stamp .32s cubic-bezier(.2, .9, .3, 1.3) both; }

/* ============================== Feedback ============================== */

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100% - 32px);
  min-height: 48px;
  margin: 0 auto;
  padding: 12px 20px 12px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: 550 15px/1.3 var(--font-ui);
  box-shadow: var(--shadow-2);
}
.toast.is-entering { animation: ui-toast .42s var(--ease-out) both; }
.toast.is-high { top: calc(var(--bar-h) + 10px + env(safe-area-inset-top)); bottom: auto; }
.toast::before { content: ""; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i-check) center / 18px no-repeat; mask: var(--i-check) center / 18px no-repeat; }
/* A line that says something did not work wears an alert mark (a ring with a stroke and a dot), never the tick. */
.toast.is-error::before {
  --alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.6v5M12 16.4h.01'/%3E%3C/svg%3E");
  -webkit-mask-image: var(--alert);
  mask-image: var(--alert);
}
.app.has-tabbar .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }
@keyframes ui-toast { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---- Offline and retry ---- */
.offline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.4;
}
.offline svg { width: 20px; height: 20px; flex: none; color: var(--text-3); }
.retry {
  appearance: none;
  align-self: flex-start;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 15px/1.3 var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* The signal pill: pinned under the app bar, so the page never jumps under her thumb */
.net-pill {
  position: fixed;
  top: calc(var(--bar-h) + 8px + env(safe-area-inset-top));
  left: 50%;
  z-index: 35;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  min-height: 36px;
  margin: 0;
  padding: 7px 14px 7px 11px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--edge-strong);
  font: 550 13.5px/1.3 var(--font-ui);
  text-decoration: none;
}
.net-pill svg { width: 18px; height: 18px; flex: none; color: var(--text-2); }
.retry.net-pill { cursor: pointer; }
.offline.net-pill { pointer-events: none; }
.app:not(:has(.appbar)) .net-pill { top: calc(10px + env(safe-area-inset-top)); }

/* ---- Bottom sheet (a centered dialog on a laptop) ---- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sheet-backdrop.is-entering { animation: ui-fade .25s var(--ease) both; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 81;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  max-width: var(--col);
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px max(var(--gutter), env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -1px 0 var(--edge), 0 -18px 50px -20px rgba(0, 0, 0, .45);
}
.sheet.is-entering { animation: ui-sheet .42s var(--ease-out) both; }
.sheet-grip { position: relative; align-self: center; flex: none; width: 40px; height: 5px; margin-bottom: 4px; border-radius: 3px; background: color-mix(in srgb, var(--text) 20%, transparent); touch-action: none; cursor: grab; }
.sheet-grip::before { content: ""; position: absolute; inset: -14px -70px; }
.sheet-x {
  appearance: none;
  position: absolute;
  top: 10px;
  right: max(10px, env(safe-area-inset-right));
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-2);
  cursor: pointer;
}
.sheet-x::after { content: ""; position: absolute; inset: -6px; }
.sheet-x:hover { color: var(--text); background: color-mix(in srgb, var(--text) 12%, transparent); }
.sheet > .h2:first-of-type, .sheet > h2 { padding-right: 40px; }
.sheet .stack { display: flex; flex-direction: column; gap: 10px; }
@keyframes ui-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================== Content blocks ============================== */

/* ---- Timeline: one day of the plan ---- */
.timeline { position: relative; display: flex; flex-direction: column; margin: 0; padding: 4px 0; list-style: none; }
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 72px 20px minmax(0, 1fr);
  grid-auto-rows: auto;
  column-gap: 12px;
  row-gap: 0;
  padding-bottom: 22px;
}
.tl-item::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -2px;
  left: calc(72px + 12px + 10px - .75px);
  width: 1.5px;
  background: var(--line);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-item > * { grid-column: 3; }
.tl-item > .tl-time {
  grid-column: 1;
  grid-row: 1 / span 8;
  padding-top: 1px;
  text-align: right;
  font: 600 14px/1.45 var(--font-ui);
  color: var(--text-2);
  white-space: nowrap;
}
.tl-item > .tl-dot {
  grid-column: 2;
  grid-row: 1 / span 8;
  justify-self: center;
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--text) 50%, transparent);
  background: var(--bg);
}
.tl-title { font: 600 16.5px/1.4 var(--font-ui); letter-spacing: -.008em; color: var(--text); }
.tl-sub { margin-top: 2px; font-size: 15px; line-height: 1.45; color: var(--text-2); }
.tl-sub.hand, .tl-sub.two-hand { font: 400 17px/1.35 var(--font-hand); color: var(--gold-ink); }
.tl-tag {
  justify-self: start;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-2);
  font: 600 13px/1.15 var(--font-ui);
}
.tl-action { justify-self: start; margin-top: 8px; min-height: var(--tap); padding: 0 18px; font-size: 15px; }
/* The moment of the day: the train (the one accent dot) */
.tl-item.is-star .tl-dot, .tl-item[aria-current] .tl-dot {
  width: 15px;
  height: 15px;
  margin-top: 4px;
  border: 0;
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent), var(--accent-glow);
}
.tl-item.is-star .tl-title, .tl-item[aria-current] .tl-title { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 22px; line-height: 1.2; letter-spacing: -.006em; color: var(--flourish); }
.tl-item.is-star .tl-time, .tl-item[aria-current] .tl-time { color: var(--text); }
/* The hour for two: a small heart instead of a dot, the title in Akshay's hand */
.tl-item.is-two .tl-dot { width: 16px; height: 16px; margin-top: 4px; border: 0; background: none; }
.tl-item.is-two .tl-dot svg { display: block; width: 16px; height: 16px; }
.tl-item.is-two .tl-dot .shape { fill: var(--gold-ink); stroke: none; }
.tl-item.is-two .tl-title { font: 700 19px/1.3 var(--font-hand); color: var(--text); }
/* A stop already stamped on the day */
.tl-item.is-done .tl-dot { border-color: var(--good); background: var(--good); }

/* ---- Stat ---- */
.stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-num { font-family: var(--font-display); font-weight: 540; font-size: 24px; line-height: 1.12; letter-spacing: -.012em; }
.stat-label { font: 600 12.5px/1.3 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }

/* ---- Waiting and empty ---- */
.waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 8px 8px;
  text-align: center;
}
.waiting > svg { width: 88px; height: 88px; }
.waiting > .card-media, .waiting > .window, .waiting > svg.snowscape { width: min(240px, 70%); height: auto; aspect-ratio: 400 / 250; margin: 0; border-radius: var(--r-xl); overflow: hidden; --art-ground: var(--surface-2); }
.waiting > p, .waiting > .lede { max-width: 32ch; font-size: 17px; line-height: 1.45; color: var(--text-2); text-wrap: balance; }
.waiting > .fine { font-size: 14.5px; color: var(--text-3); }
.waiting > .h2, .waiting > .h1 { color: var(--text); }
.waiting .seal-big svg, .sealed-gate .seal-btn svg { width: 96px; height: 96px; }
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  border-radius: var(--r-l);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text-2);
  text-align: center;
  font-size: 15.5px;
}
.empty > svg { width: 64px; height: 64px; }
.empty > .icon { width: 28px; height: 28px; color: var(--text-3); }
.empty .lede { font-size: 16.5px; max-width: 30ch; }

/* ---- The bare address and the quiet hour: the scene and one calm line ---- */
.locked-screen .hero-title { margin-top: 0; }
.locked-screen .locked { display: flex; flex-direction: column; gap: 10px; }
.locked-screen .lede { max-width: 30ch; }
.quiet-screen { justify-content: center; }
.quiet-screen .waiting { gap: 12px; }
.quiet-screen .waiting > .window { width: min(300px, 82%); }

/* ============================== Small phones ============================== */
@media (max-width: 340px) {
  :root { --gutter: 16px; }
  .ticket { --tk-pad: 18px; }
  .ticket-part > .stat { grid-column: 1 / -1; }
  .ticket-part > .stat.is-end { text-align: left; align-items: flex-start; }
  .punches { gap: 2px; }
  .punch { font-size: 13px; }
  .punch .avatar { width: 42px; height: 42px; }
  .option { column-gap: 12px; padding-inline: 14px; }
  .option-art { width: 50px; height: 50px; }
  .option-art svg { width: 38px; height: 38px; }
  .tl-item { grid-template-columns: 62px 20px minmax(0, 1fr); column-gap: 10px; }
  .tl-item::before { left: calc(62px + 10px + 10px - .75px); }
  .env { padding-right: 141px; }
  .env > .flap { width: 98px; }
  .env > .wax { right: 98px; }
}

/* ============================== Wider windows: one centered column ============================== */
@media (min-width: 720px) {
  :root { --gutter: 32px; }
  .screen { gap: 18px; --pad-top: 28px; }
  .appbar + .screen { --pad-top: 20px; }
  .appbar { padding-inline: max(8px, calc((100% - var(--col)) / 2 + 12px)); }
  .tabbar {
    left: 50%;
    right: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: min(460px, calc(100% - 32px));
    min-height: 64px;
    padding: 4px 8px;
    translate: -50% 0;
    border-radius: 999px;
    box-shadow: var(--shadow-2), 0 0 0 1px var(--edge);
  }
  .tab { flex-direction: row; gap: 8px; min-height: 52px; border-radius: 999px; font-size: 14px; }
  .tab svg { width: 22px; height: 22px; }
  .tab.is-active, .tab[aria-current="page"] { background: color-mix(in srgb, var(--text) 6%, transparent); }
  .app.has-tabbar .screen { padding-bottom: 128px; }
  /* The hero becomes a rounded panel, cropped to its middle band so the next action stays in view */
  .hero-art { margin-inline: 0; height: 220px; aspect-ratio: auto; border-radius: var(--r-xl); box-shadow: 0 0 0 1px var(--edge); --art-ground: var(--art-snow); --lights-y: 14px; }
  .hero-art > .window { height: 100%; overflow: hidden; }
  .hero-art > .window > svg { height: auto; aspect-ratio: 400 / 250; position: relative; top: 50%; translate: 0 -54%; }
  .hero-art + * { margin-top: 10px; }
  .screen > .hero:first-child, .appbar.is-clear + .screen > .hero:first-child { margin-top: 0; }
  .appbar.is-clear .appbar-fill { opacity: 1; }
  .appbar.is-clear:not(.is-solid)::before { opacity: var(--string-glow); animation: hce-candle 3.8s ease-in-out infinite alternate; animation-play-state: var(--art-twinkle, running); }
  .appbar.is-clear:not(.is-solid)::after { opacity: 1; }
  .appbar.is-clear:not(.is-solid) .appbar-back { margin-left: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .appbar.is-clear .appbar-title { opacity: 1; }
  .card-media, .card-next > .card-media:has(> .window, > .snowscape) { aspect-ratio: 5 / 2; }
  .options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .options-bubbles { grid-template-columns: minmax(0, 1fr); }
  /* Sheets become centered dialogs, with no grip to drag */
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(560px, calc(100% - 48px));
    max-height: 82vh;
    max-height: 82dvh;
    margin: 0;
    padding: 24px 28px 26px;
    translate: -50% -50%;
    border-radius: 28px;
    box-shadow: var(--shadow-2), 0 0 0 1px var(--edge);
  }
  .sheet.is-entering { animation: ui-dialog .3s var(--ease-out) both; }
  .sheet-grip { display: none; }
  .sheet-x { top: 14px; right: 14px; }
  .a2hs { left: 50%; right: auto; width: min(460px, calc(100% - 32px)); translate: -50% 0; }
  .app.has-tabbar .a2hs { bottom: 100px; }
  .toast { bottom: 32px; }
  .app.has-tabbar .toast { bottom: 100px; }
}
@keyframes ui-dialog { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ============================== Motion ============================== */
@keyframes punch { 0% { transform: scale(1.9) rotate(-10deg); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1); } }
/* ============================== Add to Home Screen ==============================
   One gentle card for the two adults, floating above the tab bar on Home until they close it. */
.a2hs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 32px;
  gap: 12px;
  align-items: start;
  padding: 14px 10px 14px 14px;
  border-radius: var(--r-l);
  background: var(--sheen), var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--edge-strong);
}
.app:not(.has-tabbar) .a2hs { bottom: calc(16px + env(safe-area-inset-bottom)); }
.a2hs.is-entering { animation: ui-toast .5s var(--ease-out) .6s both; }
.a2hs-icon img { display: block; width: 52px; height: 52px; border-radius: 12px; box-shadow: 0 0 0 1px var(--edge-strong), var(--shadow-1); }
.a2hs-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.a2hs-main strong { font: 560 19px/1.2 var(--font-display); color: var(--heading); }
.a2hs-main p { font-size: 14.5px; line-height: 1.4; color: var(--text-2); }
.a2hs-main .btn { margin-top: 8px; min-height: 44px; }
.a2hs-close { appearance: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-2); cursor: pointer; position: relative; }
.a2hs-close::after { content: ""; position: absolute; inset: -8px; }
.a2hs-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.a2hs-steps li { display: flex; align-items: center; gap: 10px; font: 600 14.5px/1.3 var(--font-ui); color: var(--text); counter-increment: a2hs; }
.a2hs-steps li::before { content: counter(a2hs); flex: none; width: 18px; font: 650 13px/1 var(--font-ui); color: var(--gold-ink); text-align: center; }
.a2hs-key { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--accent-ring); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.a2hs-key svg { width: 20px; height: 20px; }
.a2hs-steps.is-big { gap: 12px; margin: 4px 0 8px; counter-reset: a2hs; }
.a2hs-steps.is-big li { font-size: 17px; }
.a2hs-steps.is-big .a2hs-key { width: 44px; height: 44px; }
.a2hs-steps { counter-reset: a2hs; }

/* ============================== Opening ==============================
   The first open with nothing saved: the snowscape and the name at once, three lights breathing
   while the view arrives. The page shell (index.html) paints the same name before any script runs. */
.loading-shimmer { display: flex; justify-content: center; gap: 14px; margin-top: 18px; }
.loading-shimmer i { width: 9px; height: 12px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: var(--bulb-red); box-shadow: 0 0 14px 2px color-mix(in srgb, var(--bulb-red) 55%, transparent); animation: hce-breathe 1.4s ease-in-out infinite alternate; }
.loading-shimmer i:nth-child(2) { background: var(--bulb-gold); box-shadow: 0 0 14px 2px color-mix(in srgb, var(--bulb-gold) 55%, transparent); animation-delay: .25s; }
.loading-shimmer i:nth-child(3) { background: var(--bulb-green); box-shadow: 0 0 14px 2px color-mix(in srgb, var(--bulb-green) 55%, transparent); animation-delay: .5s; }
@keyframes hce-breathe { from { opacity: .35; transform: scale(.86); } to { opacity: 1; transform: none; } }
.boot { display: grid; place-items: center; align-content: center; gap: 22px; min-height: 100vh; min-height: 100dvh; padding: 24px; text-align: center; }
.boot-name { font: 500 clamp(36px, 10vw, 54px)/1.05 var(--font-display); letter-spacing: -.016em; color: var(--heading); text-shadow: var(--heading-glow); }

/* ============================== Celebrations ==============================
   celebrate(kind, el) in app.js draws a short moment in this layer, outside #app, so the re-render
   that follows the tap cannot cut it short. Taps pass through it. Nothing here under reduced motion.
   One moment is .fx-show.is-<kind>; each piece in it is an <i class="fx-...">, so the two never meet. */
.fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; contain: strict; }
.fx-show, .fx-show > * { pointer-events: none; }
.fx-show > i { position: absolute; left: 0; top: 0; display: block; will-change: transform, opacity; }
.fx-bloom { border-radius: 50%; mix-blend-mode: screen; opacity: 0; }
[data-look="day"] .fx-bloom { mix-blend-mode: multiply; filter: saturate(.8); }
.fx-bit, .fx-flake, .fx-blob { border-radius: 50%; }
.fx-flake { box-shadow: 0 0 6px rgba(255, 240, 210, .6); }
.fx-blob { border-radius: 46% 54% 52% 48% / 52% 46% 54% 48%; }
.fx-star { color: var(--bulb-gold); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--bulb-gold) 70%, transparent)); }
.fx-star svg, .fx-heart svg { display: block; width: 100%; height: 100%; }
.fx-heart { color: var(--bulb-red); filter: drop-shadow(0 4px 10px rgba(120, 10, 30, .35)); }
.fx-heart .shape, .fx-heart path { fill: var(--bulb-red); }
.fx-garland { position: absolute; left: 0; width: 100%; }
.fx-garland svg { display: block; overflow: visible; }
.fx-garland .fx-glow { filter: blur(8px); }
.fx-seal svg { display: block; width: 112px; height: 112px; filter: drop-shadow(0 8px 14px rgba(60, 10, 14, .45)); }
.fx-seal.is-left { clip-path: polygon(0 0, 54% 0, 44% 38%, 56% 62%, 46% 100%, 0 100%); }
.fx-seal.is-right { clip-path: polygon(54% 0, 100% 0, 100% 100%, 46% 100%, 56% 62%, 44% 38%); }
.fx-env svg { display: block; filter: drop-shadow(0 10px 16px rgba(30, 6, 10, .4)); }
.fx-show > i.fx-stamp { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; border: 4px double currentColor; background: color-mix(in srgb, var(--bg-elev) 82%, transparent); box-shadow: 0 10px 24px -10px rgba(30, 6, 10, .45); }
.fx-clip { position: absolute; overflow: hidden; }
.fx-glint { position: absolute; top: -20%; bottom: -20%; left: 0; width: 45%; background: linear-gradient(90deg, transparent, rgba(255, 250, 230, .85), transparent); mix-blend-mode: overlay; }

@media (prefers-reduced-motion: reduce) {
  .fx, .screen.ghost { display: none !important; }
  .loading-shimmer i { animation: none !important; opacity: 1; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  /* the lights stay lit and still */
  .appbar::before, .snowscape .sl-glow { animation: none !important; }
}
