/* /book, /m/:id and /mine (WP2). Prefix: book- (PLAN.md §3.5). Generic atoms come from WP1 (.btn .input .textarea
   .field .swatch .sheet .chip); this file lays out the page and styles the page-specific controls: the scarcity
   calendar, relationship/tone chips, segmented radios, emoji picker, counter ring, live preview, Ticket, mobile bar.
   Motion: transform/opacity/filter only (the Ticket's 900 ms clip-path print-in is the one exception the plan asks
   for), --dur-* tokens, everything calm under reduced motion and Calm mode (html[data-calm]).
   Colours: tokens.css's semantic ones, so the page follows the light or dark scheme. The marquee sign, the preview's stage, the
   Ticket's stub and the toast are night objects in both (brand tokens); the cards and the Ticket's name panel keep their theme. */

.book-body { --book-bar-h: 0px; }
.book {
  --book-panel: color-mix(in srgb, var(--surface) 88%, transparent);
  --book-raise: var(--surface-2);
  --book-ring: color-mix(in srgb, var(--candle) 55%, transparent);
  --lvl-plenty: var(--success);
  --lvl-filling: var(--accent-ink);
  --lvl-almost: var(--party-ink);
  --lvl-full: var(--text-3);
  position: relative;
  padding-block-end: var(--space-8);
  isolation: isolate;
}
/* a soft stage glow behind the hero (decorative, static) */
.book::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 420px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 70% at 15% 0%, color-mix(in srgb, var(--violet) 22%, transparent), transparent 70%),
    radial-gradient(45% 60% at 85% 10%, color-mix(in srgb, var(--party) 14%, transparent), transparent 70%);
}

/* ── Hero (+ the marquee sign on desktop: the name is the hero) ───────────────────────────────────────── */
.book-hero { padding-block: var(--space-6) var(--space-5); }
.book-hero__text { min-width: 0; }
.book-sign { display: none; }
@media (min-width: 1024px) {
  /* only the /book hero has a sign: /m and /mine keep a single text column */
  .book-hero--sign { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: var(--space-7); align-items: center; }
  .book-sign { display: block; perspective: 900px; }
  .book-sign__board {
    --bulb: var(--candle);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 176px;
    padding: 28px 30px;
    border-radius: 18px;
    background:
      radial-gradient(circle, var(--bulb) 2.2px, transparent 3px) 7px 7px / 16px 16px repeat-x,
      radial-gradient(circle, var(--bulb) 2.2px, transparent 3px) 7px calc(100% - 7px) / 16px 16px repeat-x,
      radial-gradient(circle, var(--bulb) 2.2px, transparent 3px) 7px 7px / 16px 16px repeat-y,
      radial-gradient(circle, var(--bulb) 2.2px, transparent 3px) calc(100% - 7px) 7px / 16px 16px repeat-y,
      linear-gradient(160deg, var(--night-700), var(--night-900) 70%);
    box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px color-mix(in srgb, var(--candle) 45%, transparent), inset 0 0 60px color-mix(in srgb, var(--party) 12%, transparent);
    transform: rotateY(-8deg) rotateX(3deg);
    text-align: center;
  }
  .book-sign__board::after {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--candle) 30%, transparent);
    pointer-events: none;
  }
  .book-sign__k { color: var(--ink-3); font: 800 .625rem/1.2 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; }
  /* the name is never clipped (an overflow box would cut its glow into a rectangle): client/pages/book.ts shrinks the
     font until the name fits the board on one line */
  .book-sign__name {
    display: block;
    align-self: stretch;
    white-space: nowrap;
    font: italic 400 clamp(2rem, 3.4vw, 3rem)/1.1 var(--font-name);
    color: var(--ink);
    text-shadow: 0 0 18px color-mix(in srgb, var(--candle) 70%, transparent), 0 0 48px color-mix(in srgb, var(--party) 45%, transparent);
  }
  .book-sign__when { color: var(--candle); font: 700 .75rem/1.3 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
  /* two slow blinks when the page opens, then still (WCAG 2.2.2: nothing blinks for more than 5 seconds) */
  .book-sign__board { animation: book-marquee 2.4s steps(2) 2; }
}
.book-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-2);
  font: 600 var(--step-small)/1.2 var(--font-ui);
  letter-spacing: .02em;
}
.book-eyebrow__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 22%, transparent);
}
.book-title {
  margin-block-start: var(--space-3);
  font-size: clamp(2rem, 4.2vw + 1rem, 3.75rem);
  font-weight: 800;
  font-variation-settings: 'wdth' 85;
  letter-spacing: -0.035em;
  line-height: 1;
}
.book-lede { margin-block-start: var(--space-3); max-width: 46ch; color: var(--text-2); }

/* ── Layout ───────────────────────────────────────────────────────────────────────────────────────────── */
.book-layout { display: grid; gap: var(--space-6); align-items: start; }
.book-layout > * { min-width: 0; }
@media (min-width: 1024px) {
  .book-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: var(--space-7); }
}
@media (min-width: 1200px) {
  .book-layout { grid-template-columns: minmax(0, 1fr) minmax(380px, 440px); }
}
@media (min-width: 1440px) {
  .book-layout { grid-template-columns: minmax(0, 1fr) minmax(440px, 520px); }
}

.book-form { display: flex; flex-direction: column; gap: var(--space-5); }
.book-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--book-panel);
}
@media (min-width: 640px) { .book-step { padding: var(--space-6); border-radius: var(--radius-l); } }
.book-step__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.book-step__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--step-h3);
  letter-spacing: -0.01em;
}
.book-step__n {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-ink);
  color: var(--accent-ink);
  font: 800 .9375rem/1 var(--font-display);
}
.book-step__sub { color: var(--text-3); font-size: var(--step-small); }

.book-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; border: 0; padding: 0; }
.book-field > .field__label, .book-field legend { padding: 0; margin-block-end: var(--space-2); }
fieldset.book-field > .field__label { float: left; width: 100%; }
fieldset.book-field > .field__label + * { clear: both; }
.book-optional {
  margin-inline-start: var(--space-1);
  color: var(--text-3);
  font-weight: 400;
  font-size: .8125rem;
}
.book-optional::before { content: '· '; }
.book-input { width: 100%; }
.book-input--name {
  font-family: var(--font-name);
  font-style: italic;
  font-size: 1.625rem;
  line-height: 1.2;
}
.book-input--age { max-width: 9rem; }
.book-row { display: grid; gap: var(--space-5); }
@media (min-width: 560px) { .book-row { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); align-items: start; } }
.book-warn { color: var(--accent-ink); }
.book-error { color: var(--danger); font-weight: 600; font-size: var(--step-small); }
.book-error::before { content: '⚠︎ '; }
.book-field.is-invalid .book-input, .book-field.is-invalid .book-textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.book-milestone {
  align-self: start;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--candle) 16%, transparent);
  color: var(--accent-ink);
  font-size: var(--step-small);
  font-weight: 600;
}
/* The form says out loud when it changed the theme by itself ("Switched to Golden Gala for turning 30. Undo"). */
.book-nudge { margin-block-start: var(--space-2); color: var(--text-2); font-size: var(--step-small); font-weight: 500; line-height: 1.45; }
/* On /book each note sits in a slot that keeps two lines of room whether or not a note is showing, so the note, its text arriving
   a frame later and Undo never move anything below it. Two lines is the most any note needs from 320 px up (the age's note lives
   in a 15rem column from 560 px, where "Switched to Golden Gala for turning 30. Undo" wraps). The slot has the note's own type
   size and line height, so 2 * 1.45em is never less than two of its lines. It is a minimum: for a reader whose text size is larger
   still, a note that needs a third line makes room for it instead of being cut off or laid over what follows. */
.book-nudge-slot { margin-block-start: var(--space-2); font-size: var(--step-small); line-height: 1.45; min-block-size: calc(2 * 1.45em); }
.book-nudge-slot > .book-nudge { margin: 0; }
.book-nudge::before {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-inline-end: 8px;
  border-radius: 50%; background: var(--accent-ink); vertical-align: .05em;
}
.book-nudge__undo {
  position: relative;
  padding: 0; border: 0; background: none; color: var(--accent-ink);
  font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .2em;
}
.book-nudge__undo::after { content: ''; position: absolute; inset: -14px -10px; }      /* a 44 px target without a 44 px line */

/* A booking made in this tab, offered again after a reload (sessionStorage). */
.book-last { margin-block-start: var(--space-3); color: var(--text-2); font-size: var(--step-small); }
.book-last b { color: var(--text); font-weight: 700; }
.book-last__show {
  position: relative; margin-inline-start: var(--space-2); padding: 0; border: 0; background: none;
  color: var(--accent-ink); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .2em;
}
.book-last__show::after { content: ''; position: absolute; inset: -14px -10px; }

/* ── Calendar (radiogroup; grid ≥ 768 px, snap strip below) ───────────────────────────────────────────── */
.book-cal { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.book-cal__dow { display: none; }
.book-cal__grid {
  display: flex;
  gap: var(--space-2);
  margin-inline: calc(-1 * var(--space-4));
  padding: 12px var(--space-4) var(--space-2);   /* the top 12px hold the LIVE / NEW tag (it overhangs the cell by 8px) */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--space-4);
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--space-4), #000 calc(100% - var(--space-5)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--space-4), #000 calc(100% - var(--space-5)), transparent);
}
.book-cal__grid::-webkit-scrollbar { display: none; }
.book-day {
  --lvl: var(--lvl-plenty);
  position: relative;
  flex: 0 0 74px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  justify-items: start;
  gap: 2px;
  min-height: 104px;
  padding: 10px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--book-raise);
  color: var(--text);
  text-align: start;
  scroll-snap-align: start;
  transition: transform var(--dur-1) var(--ease-out);   /* §3.6: only transform/opacity/filter animate */
  -webkit-tap-highlight-color: transparent;
}
.book-day[data-level="filling"] { --lvl: var(--lvl-filling); }
.book-day[data-level="almost"] { --lvl: var(--lvl-almost); }
.book-day[data-level="full"] { --lvl: var(--lvl-full); }
.book-day__top { display: flex; align-items: baseline; gap: 6px; width: 100%; }
.book-day__dow { color: var(--text-3); font: 600 .6875rem/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: .08em; }
.book-day__mon { color: var(--accent-ink); font: 700 .6875rem/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: .08em; }
.book-day__num {
  font: 800 1.625rem/1 var(--font-display);
  font-variation-settings: 'wdth' 80;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
/* LIVE / NEW: a tag on the cell's top edge, clear of the month label, the number and the meter */
.book-day__badge {
  position: absolute;
  top: -8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 2px var(--bg);
  font: 800 .5625rem/1.3 var(--font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.book-day__badge--live { background: var(--party); color: var(--night-950); }
.book-day__badge--live::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-inline-end: 4px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
  animation: book-pulse 1.6s var(--ease-io) infinite;
}
.book-day__badge--new { background: var(--volt); color: var(--night-950); }
.book-day__meter {
  align-self: end;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
}
.book-day__fill {
  display: block;
  width: 100%; height: 100%;
  border-radius: inherit;
  background: var(--lvl);
  transform-origin: left center;
  transform: scaleX(max(var(--fill, 0), .04));
  transition: transform var(--dur-3) var(--ease-out);
}
.book-day__left { color: var(--text-3); font-size: .6875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* scarcity has weight where it is happening: a quiet "Plenty", a brighter bar and count as seats go */
.book-day[data-level="plenty"] .book-day__left { opacity: .7; }
.book-day[data-level="plenty"] .book-day__meter { opacity: .6; }
.book-day[data-level="almost"] .book-day__left { color: var(--party-ink); font-weight: 800; }
.book-day[data-level="filling"] .book-day__left { color: var(--accent-ink); font-weight: 700; }
.book-day[data-level="filling"] .book-day__meter, .book-day[data-level="almost"] .book-day__meter { height: 5px; }
.book-day[data-level="almost"]:not([aria-checked="true"]) { border-color: color-mix(in srgb, var(--party) 45%, transparent); background: color-mix(in srgb, var(--party) 8%, var(--surface-2)); }
.book-day[data-level="almost"] .book-day__fill { box-shadow: 0 0 10px var(--party); }
.book-day[data-today] .book-day__num { color: var(--party-ink); }

@media (hover: hover) {
  .book-day:not([aria-disabled="true"]):not(.book-day--locked):hover { border-color: color-mix(in srgb, var(--accent-ink) 45%, transparent); transform: translateY(-2px); }
}
.book-day:not(.book-day--locked):active { transform: scale(.97); }
.book-day[aria-checked="true"] {
  border-color: var(--accent-ink);
  background: color-mix(in srgb, var(--candle) 16%, var(--surface-2));
  box-shadow: 0 0 0 1px var(--accent-ink), 0 8px 28px -10px color-mix(in srgb, var(--candle) 70%, transparent);
}
.book-day[aria-checked="true"] .book-day__num { color: var(--accent-ink); }
.book-day[aria-disabled="true"]:not(.book-day--locked) { cursor: not-allowed; background: transparent; }
.book-day[aria-disabled="true"]:not(.book-day--locked) .book-day__num { color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 2px; }
.book-day:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.book-day--locked {
  flex-basis: 108px;
  border-style: dashed;
  background: transparent;
  color: var(--text-3);
  cursor: default;
}
.book-day--locked .book-day__num { color: var(--text-3); }
.book-day__opens { display: flex; flex-direction: column; align-self: end; gap: 1px; font-size: .6875rem; line-height: 1.3; white-space: nowrap; }
.book-day__opens-k { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.book-day__opens time { color: var(--text-2); font: 700 .8125rem/1.2 var(--font-ui); font-variant-numeric: tabular-nums; }

@media (min-width: 768px) {
  .book-cal__dow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-2);
    color: var(--text-3);
    font: 700 .6875rem/1 var(--font-ui);
    letter-spacing: .1em;
    text-transform: uppercase;
    text-align: center;
  }
  .book-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .book-day { min-height: 92px; padding: 9px 10px 8px; }
  .book-day__dow { display: none; }
  .book-day--locked .book-day__dow { display: inline; }
}

.book-day.book-day--locked { padding-inline: 8px; }   /* a Sunday cell is one column wide: the countdown still fits */

.book-cal__legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); color: var(--text-3); font-size: .75rem; }
.book-legend { display: inline-flex; align-items: center; gap: 6px; }
.book-legend::before { content: ''; width: 10px; height: 4px; border-radius: 2px; background: var(--lvl-plenty); }
.book-legend[data-level="filling"]::before { background: var(--lvl-filling); }
.book-legend[data-level="almost"]::before { background: var(--lvl-almost); }
.book-legend[data-level="full"]::before { background: var(--lvl-full); }
.book-legend--live { color: var(--party-ink); font-weight: 700; }
.book-legend--live::before { width: 7px; height: 7px; border-radius: 50%; background: var(--party); animation: book-pulse 1.6s var(--ease-io) infinite; }

.book-cal__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text-2);
  font-size: var(--step-small);
  font-weight: 500;
}
.book-cal__summary::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.book-cal__summary[data-state="plenty"]::before { background: var(--lvl-plenty); }
.book-cal__summary[data-state="filling"]::before { background: var(--lvl-filling); }
.book-cal__summary[data-state="almost"]::before { background: var(--lvl-almost); }
.book-cal__summary:not([data-state="empty"]):not([data-state=""]) { color: var(--text); }

.book-later { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.book-later__toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font-weight: 600;
  font-size: var(--step-small);
  text-decoration: underline;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, var(--accent-ink) 45%, transparent);
}
.book-later__toggle[aria-expanded="true"] { text-decoration-color: var(--accent-ink); }
.book-later__panel { display: flex; flex-direction: column; gap: var(--space-2); width: min(100%, 22rem); }
.book-later__msg:empty { margin-block-start: calc(-1 * var(--space-2)); }       /* stays mounted (a live region that is display:none is not announced when it fills); no gap while empty */
.book-later__msg { color: var(--text-2); font-size: var(--step-small); }

/* ── Chips: relationship and tone (visually hidden radios, visible focus on the face) ─────────────────── */
.book-cats__list, .book-tones__list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.book-chip { position: relative; display: inline-flex; }
.book-chip input, .book-seg__opt input, .book-emoji__opt input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.book-chip__face {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--book-raise);
  color: var(--text-2);
  font-size: .9375rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur-1) var(--ease-out);
  pointer-events: none;
}
.book-chip__emoji { font-size: 1.05em; }
.book-chip:hover .book-chip__face { border-color: color-mix(in srgb, var(--text) 30%, transparent); color: var(--text); }
.book-chip:active .book-chip__face { transform: scale(.97); }
.book-chip input:checked + .book-chip__face {
  border-color: var(--accent-ink);
  background: color-mix(in srgb, var(--candle) 18%, var(--surface-2));
  color: var(--text);
}
.book-chip input:focus-visible + .book-chip__face,
.book-seg__opt input:focus-visible + span,
.book-emoji__opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.book-tone .book-chip__face { min-height: 36px; padding: 6px 12px; font-size: .875rem; }

/* segmented radios (timing, reveal): one row that shares the track, so nothing wraps inside the pill at 320 px */
.book-seg__opts {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: 28rem;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
}
.book-seg__opt { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.book-seg__opt span {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
/* options of unequal length (Reveal: "Sealed until the day" / "Open now") share the track by content, not equally */
.book-seg--auto .book-seg__opt { flex: 1 1 auto; }
@media (max-width: 359px) { .book-seg__opt span { padding-inline: 6px; font-size: .8125rem; } }
.book-seg__opt:hover span { color: var(--text); }
.book-seg__opt input:checked + span { background: var(--candle); color: var(--night-900); }

/* ── Message, counter ring, Inspire me ────────────────────────────────────────────────────────────────── */
.book-msg__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.book-msg__head .field__label { margin: 0; }
.book-inspire { flex: none; }
.book-msg { position: relative; }
.book-textarea { width: 100%; min-height: 8.5rem; padding-inline-end: 3.5rem; line-height: 1.5; }
.book-counter {
  --c: var(--text-3);
  position: absolute;
  inset-block-end: 10px;
  inset-inline-end: 10px;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  pointer-events: none;
}
.book-counter__ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.book-counter__track { fill: none; stroke: color-mix(in srgb, var(--text) 14%, transparent); stroke-width: 3; }
.book-counter__bar {
  fill: none;
  stroke: var(--c);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: calc(var(--p, 0) * 100) 100;   /* updated per keystroke, no transition (§3.6) */
}
.book-counter__n {
  color: var(--c);
  font: 700 .625rem/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.book-counter[data-state="warn"] { --c: var(--accent-ink); }
.book-counter[data-state="max"], .book-counter[data-state="over"] { --c: var(--danger); }
.book-counter:not([data-state="ok"]) .book-counter__n { opacity: 1; }
.book-counter.is-wiggling { animation: book-wiggle 420ms var(--ease-out); }

/* ── Themes and emoji ─────────────────────────────────────────────────────────────────────────────────── */
.book-themes__list, .book-themes__sizer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  grid-auto-rows: 1fr;       /* every row as tall as the tallest: a reorder (a category, a milestone) never changes the height */
  gap: var(--space-3);
}
/* Two lines of name in every swatch. Rows are as tall as their tallest name, and a filter chip hides and shows swatches, so a row of one-line
   names used to be a line shorter than a row with "Midnight Fireworks" in it: the form below moved by three lines when a chip or a nudge
   changed what was on show. A fixed height keeps the list the same height whatever is shown. */
.book-themes__list .swatch__name, .book-themes__sizer .swatch__name { min-height: 2.4em; }
/* The sizer (ThemeSizer in GreetingFields.tsx) shares the list's grid cell, so the list is never shorter than the first chip's 12 swatches */
.book-themes__stack { display: grid; grid-template-columns: minmax(0, 1fr); }
.book-themes__stack > * { grid-area: 1 / 1; align-self: start; }
.book-themes__sizer { visibility: hidden; pointer-events: none; }
/* The filter chips over the swatches (round 13; theme-chips.ts shows them). A single-choice radiogroup: the face matches the relationship chips,
   the checked one takes the same candle wash. A 44 px target. From 768 px they wrap; below that they are one line that scrolls sideways (nine
   family chips wrapped into five rows, 260 px, on a phone), fading out at whichever edge has more, and theme-chips.ts scrolls the checked one
   into view. It is the bar that scrolls, never the page (book.e2e.mjs checks scrollWidth). */
.theme-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-end: var(--space-3); }
@media (max-width: 767px) {
  .theme-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* room for the focus ring (2 px line + 2 px offset), which the scroll box would clip, taken back from the margins so nothing moves */
    padding-block: 4px;
    margin-block: -4px calc(var(--space-3) - 4px);
    /* the fade is a mask, so it shows the page behind it in either scheme; theme-chips.ts sets data-more to start, end or both */
    --fade-start: 0px;
    --fade-end: 0px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent 100%);
  }
  .theme-chips::-webkit-scrollbar { display: none; }
  .theme-chips[data-more~="start"] { --fade-start: 28px; }
  .theme-chips[data-more~="end"] { --fade-end: 28px; }
  .theme-chip { flex: none; }
}
.theme-chip {
  min-height: 44px;     /* a 44 px target everywhere (Playwright's touch emulation does not set pointer: coarse, so no media query: a phone and a laptop alike) */
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--book-raise);
  color: var(--text-2);
  font: 600 .875rem/1.2 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out);
}
.theme-chip:hover { border-color: color-mix(in srgb, var(--text) 30%, transparent); color: var(--text); }
.theme-chip:active { transform: scale(.97); }
.theme-chip[aria-checked="true"] { border-color: var(--accent-ink); background: color-mix(in srgb, var(--candle) 18%, var(--surface-2)); color: var(--text); }
.theme-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.book-emoji__list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* A theme has 9 to 14 emoji, so its list is one row or two on a desktop and two or three on a phone, and a nudge that changes
   the theme (a category, a tone, a milestone age) used to move everything below by a row. The real list shares one grid cell with
   an invisible copy of the widest row (EmojiSizer in GreetingFields.tsx), so the cell is always as tall as the widest theme needs
   and the list is laid out from its top (align-self: start: a wrapping flex container given spare height would spread its rows). */
.book-emoji__stack { display: grid; grid-template-columns: minmax(0, 1fr); }
.book-emoji__stack > * { grid-area: 1 / 1; align-self: start; }
.book-emoji__sizer { display: flex; flex-wrap: wrap; gap: var(--space-2); visibility: hidden; pointer-events: none; }
.book-emoji__opt { position: relative; display: inline-flex; }
.book-emoji__opt span {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding-inline: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--book-raise);
  font-size: 1.375rem;
  line-height: 1;
  pointer-events: none;
  transition: transform var(--dur-1) var(--ease-out);
}
.book-emoji__opt--none span { padding-inline: 12px; color: var(--text-3); font: 600 .8125rem/1 var(--font-ui); }
.book-emoji__opt:hover span { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.book-emoji__opt:active span { transform: scale(.94); }
.book-emoji__opt input:checked + span {
  border-color: var(--accent-ink);
  background: color-mix(in srgb, var(--candle) 16%, var(--surface-2));
  box-shadow: 0 0 0 1px var(--accent-ink);
}

/* ── Surprise settings ────────────────────────────────────────────────────────────────────────────────── */
.book-surprise { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--bg); }
.book-surprise__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-height: 52px;
  padding: 12px var(--space-4);
  cursor: pointer;
  list-style: none;
}
.book-surprise__summary::-webkit-details-marker { display: none; }
.book-surprise__summary::after {
  content: '';
  width: 8px; height: 8px;
  margin-inline-start: auto;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur-2) var(--ease-out);
}
.book-surprise[open] > .book-surprise__summary::after { transform: rotate(-135deg) translateY(-2px); }
.book-surprise__title { font-weight: 700; }
.book-surprise__now { color: var(--text-3); font-size: var(--step-small); }
.book-surprise__body { display: flex; flex-direction: column; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.book-unwrap { color: var(--text-2); font-size: var(--step-small); }

/* ── Submit ───────────────────────────────────────────────────────────────────────────────────────────── */
.book-submit { display: flex; flex-direction: column; gap: var(--space-4); }
.book-turnstile:empty { display: none; }
.book-alert {
  display: flex;
  gap: var(--space-2);
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 60%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--text);
  font-weight: 600;
}
.book-alert { scroll-margin: calc(var(--header-h) + var(--space-4)) 0 calc(var(--book-bar-h) + var(--space-4)); }
.book-alert:focus { outline: none; }
/* the status heading takes the focus once a seat is freed (manage.ts): not a control, so no ring, and clear of the sticky header */
.book-m-status__title { scroll-margin-top: calc(var(--header-h) + var(--space-4)); }
.book-m-status__title:focus { outline: none; }
.book-alert::before { content: '!'; flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--coral); color: var(--night-950); font: 800 .8125rem/1 var(--font-ui); }
.book-submit__btn { width: 100%; justify-content: center; }
.book-submit__btn bdi, .book-bar__submit bdi { font-weight: 800; }
/* "Reserve [Maya]’s seat on 3 Nov": the name shrinks with an ellipsis, the rest (and the date) never does. The label
   ignores the pointer, so a mouse press always lands on the button itself even while the label is being rebuilt. */
.book-submit__label { display: flex; justify-content: center; min-width: 0; max-width: 100%; white-space: nowrap; pointer-events: none; }
.book-submit__pre, .book-submit__post { flex: none; white-space: pre; }
.book-submit__name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.book-submit__btn .icon, .book-bar__submit .icon { pointer-events: none; }
/* While it works the button says what it is doing ("Checking…", "Reserving…") with a spinner, instead of just dimming. */
.book-submit__busy { display: none; align-items: center; justify-content: center; gap: .6em; }
.book-submit__btn[aria-busy="true"] > :not(.book-submit__busy), .book-bar__submit[aria-busy="true"] > :not(.book-submit__busy) { display: none; }
.book-submit__btn[aria-busy="true"] > .book-submit__busy, .book-bar__submit[aria-busy="true"] > .book-submit__busy { display: inline-flex; }
.book-submit__busy .book-spinner { border-color: color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; }
.book-fine { color: var(--text-3); font-size: .8125rem; text-align: center; }
.book-fine a { color: var(--text-2); }

/* ── Aside: sticky live preview + sponsor slot ────────────────────────────────────────────────────────── */
.book-aside { display: none; }
/* /m on phones: the greeting's card sits above the status and the edit form (there is no bottom bar there) */
.book--manage .book-aside { display: block; order: -1; }
.book--manage .book-aside[hidden] { display: none; }
@media (min-width: 1024px) {
  .book-aside { display: block; position: sticky; top: calc(var(--header-h) + var(--space-4)); }
  .book--manage .book-aside { order: 0; }
  .book-aside__inner { display: flex; flex-direction: column; gap: var(--space-5); }
}
.book-preview { display: flex; flex-direction: column; gap: var(--space-3); }
.book-preview__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.book-preview__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font: 700 .75rem/1.2 var(--font-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.book-preview__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--party); animation: book-pulse 1.6s var(--ease-io) infinite; }
.book-preview__title--off .book-preview__dot { background: var(--text-3); animation: none; }
.book-preview__hint { color: var(--text-3); font-size: .8125rem; }
/* The stage: a night sky in the theme's colours (--t-* come from the stage element, re-themed by preview.ts),
   the card as the screen, a floor glow and the apron line. The card keeps the Grand Display's 16:9. */
.book-preview__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-3) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--night-950);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  isolation: isolate;
}
.book-preview__sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 60%, transparent 100%), radial-gradient(1px 1px at 28% 8%, #fff 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 44% 26%, #fff 60%, transparent 100%), radial-gradient(1px 1px at 61% 12%, #fff 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 76% 22%, #fff 60%, transparent 100%), radial-gradient(1px 1px at 90% 9%, #fff 60%, transparent 100%),
    radial-gradient(1px 1px at 8% 48%, #fff 60%, transparent 100%), radial-gradient(1px 1px at 93% 44%, #fff 60%, transparent 100%),
    radial-gradient(110% 70% at 50% 108%, color-mix(in srgb, var(--t-a1, var(--violet)) 38%, transparent), transparent 70%),
    radial-gradient(90% 60% at 50% -20%, color-mix(in srgb, var(--t-a3, var(--volt)) 22%, transparent), transparent 70%),
    var(--night-950);
}
.book-preview__fx { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
/* A positioning wrapper only. The card (WP1's .gcard--preview) owns its box: 16:9 while its text fits, taller when it does not
   (docs/wp-notes/WP1.md deviation 10), so the wrapper must not fix the height, clip, or add a second shadow and radius. */
.book-preview__card {
  position: relative;
  z-index: 2;
}
.book-preview__card > .gcard { width: 100%; }
.book-preview__card .gcard { transition: opacity var(--dur-2) var(--ease-out); }
.book-preview__card[data-empty-name] [data-f="recipient"],
.book-preview__card[data-empty-message] [data-f="message"] { opacity: .72; }      /* ghost text, still 4.5:1 */
.book-preview__floor {
  position: relative;
  z-index: 1;
  height: 22px;
  margin: calc(-1 * var(--space-3)) var(--space-2) 0;
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--t-a1, var(--candle)) 45%, transparent), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}
.book-preview__apron {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 20px;
  color: var(--ink-2);                 /* on the night stage in both schemes */
  font: 600 .75rem/1.3 var(--font-ui);
  letter-spacing: .02em;
}
.book-preview__apron-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--t-a1, var(--candle)); box-shadow: 0 0 8px var(--t-a1, var(--candle)); }
.book-preview__apron:has([data-preview-when]:empty) { display: none; }
/* "Watch full-screen demo" under the stage (aside) and under it in the phone sheet: a quiet link, the play mark in the accent
   and the "opens in a new tab" arrow in the text's colour (preview.ts keeps its href on the selected theme) */
.book-demo { margin: 0; }
.book-demo__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding-inline: 2px;
  border-radius: 8px;
  color: var(--text-2);
  font: 600 .875rem/1.2 var(--font-ui);
  text-decoration: none;
}
.book-demo__link .icon:first-child { color: var(--accent-ink); }
.book-demo__link .icon:nth-of-type(2) { opacity: .8; }
.book-demo__link:hover { color: var(--text); text-decoration: underline; text-underline-offset: .18em; }
.book-sheet__stage + .book-demo { margin-block-start: var(--space-3); }
.book-aside__ad:empty { display: none; }
.book-perks { display: flex; flex-direction: column; gap: var(--space-2); padding: 0; margin: 0; list-style: none; color: var(--text-2); font-size: var(--step-small); }
.book-perks li { display: flex; gap: var(--space-2); }
.book-perks li::before { content: '✓'; flex: none; color: var(--success); font-weight: 800; }

/* ── Mobile bottom bar (preview sheet + submit) ───────────────────────────────────────────────────────── */
.book-bar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: var(--z-sheet);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-deep) 86%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
@media (max-width: 1023px) {
  /* The bar is fixed to the bottom of the screen: the page keeps its height (and the safe area) free under the footer,
     so the last controls on the page (Calm mode) can be reached instead of sitting behind the Reserve button. */
  .book-body:has(.book-bar:not([hidden])) { --book-bar-h: 76px; }
  .book-body:has(.book-bar:not([hidden])) .site-footer { padding-block-end: calc(var(--book-bar-h) + env(safe-area-inset-bottom)); }
  .book-submit__btn[data-testid="book-submit"] { display: none; }
}
@media (min-width: 1024px) { .book-bar { display: none; } }
.book-bar__preview {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: start;
}
.book-bar__swatch {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  font: var(--t-name-style, italic) var(--t-name-weight, 400) 1rem/1 var(--t-font-name, var(--font-name));
}
.book-bar__text { display: flex; flex-direction: column; min-width: 0; }
.book-bar__k { color: var(--text-3); font: 700 .625rem/1.3 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
.book-bar__v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .875rem; }
.book-bar__submit { flex: 1 1 auto; min-width: 0; justify-content: center; }
@media (max-width: 479px) {
  /* phones: the swatch alone opens the preview, so "Reserve Maya’s seat on 3 Nov" fits */
  .book-bar__preview { padding: 3px; max-width: none; }
  .book-bar__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ── Sheets (date full, mobile preview, confirm) ──────────────────────────────────────────────────────── */
@media (min-width: 640px) { .book-sheet { width: min(100% - 2 * var(--gutter), 30rem); } }   /* phones keep the sheet's full width */
.book-sheet__title { font-size: var(--step-h3); }
.book-sheet__text { margin-block-start: var(--space-2); color: var(--text-2); }
.book-sheet__list { display: flex; flex-direction: column; gap: var(--space-2); margin-block-start: var(--space-4); }
.book-sheet__list:empty { display: none; }
.book-suggest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 52px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  transition: transform var(--dur-1) var(--ease-out);
}
.book-suggest:hover { border-color: var(--accent-ink); }
.book-suggest:active { transform: scale(.98); }
.book-suggest__left { color: var(--success); font-size: var(--step-small); }
.book-sheet__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin-block-start: var(--space-5); }
/* the email code step (round 3): one input per step, the code set large and spaced like the email shows it */
.book-otp__step { margin-block-start: var(--space-4); }
.book-otp__code { font: 800 1.75rem/1.2 var(--font-display); letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.book-otp__links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-3); }
.book-otp__dev { padding: 8px 12px; border: 1px dashed var(--accent-ink); border-radius: var(--radius-s); color: var(--accent-ink); }
.book-sheet__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-block-end: var(--space-4); }
.book-sheet__stage { min-width: 0; }
@media (min-width: 640px) { .book-sheet--preview { width: min(100% - 2 * var(--gutter), 34rem); } }

/* ── Ticket ───────────────────────────────────────────────────────────────────────────────────────────── */
.book-done { display: flex; flex-direction: column; gap: var(--space-5); max-width: 44rem; padding-block-start: var(--space-6); scroll-margin-top: var(--header-h); }   /* the sticky header never covers "Seat reserved" */
.book-done:focus { outline: none; }
.book-done__head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.book-eyebrow--done .book-eyebrow__dot { background: var(--candle); box-shadow: 0 0 0 4px color-mix(in srgb, var(--candle) 25%, transparent); }
.book-done__title { font-size: clamp(2rem, 5vw + 1rem, 3.5rem); font-weight: 800; letter-spacing: -0.035em; font-variation-settings: 'wdth' 85; }

.book-ticket {
  --notch: 13px;
  --stub: clamp(92px, 26%, 150px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--stub);
  border-radius: 22px;
  isolation: isolate;
}
/* stage light behind the ticket instead of a drop shadow: a shadow showed through the perforation notches as
   near-black dots (audit); the glow reads as light through the cut-outs */
.book-ticket::before {
  content: '';
  position: absolute;
  inset: 12% 4% -18%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(55% 60% at 50% 55%, color-mix(in srgb, var(--candle) 28%, transparent), color-mix(in srgb, var(--party) 12%, transparent) 55%, transparent 75%);
  filter: blur(18px);
  pointer-events: none;
}
.book-ticket__main, .book-ticket__stub {
  -webkit-mask: radial-gradient(circle var(--notch) at var(--nx) 0, #0000 98%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle var(--notch) at var(--nx) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle var(--notch) at var(--nx) 0, #0000 98%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle var(--notch) at var(--nx) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
}
.book-ticket__main {
  --nx: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-5) var(--space-5) var(--space-5);
  border-radius: 22px 0 0 22px;
  overflow: hidden;
  container-type: inline-size;
}
@media (max-width: 479px) { .book-ticket__main { padding: var(--space-4); } }
.book-ticket__main::after {
  content: '';
  position: absolute;
  inset: 12px 0 12px auto;
  border-right: 2px dashed color-mix(in srgb, var(--t-text, var(--ink)) 35%, transparent);
}
.book-ticket__kicker {
  display: flex;
  flex-wrap: wrap;
  color: var(--t-muted, var(--text-2));
  font: 800 .6875rem/1.2 var(--font-ui);
  letter-spacing: .22em;
  text-transform: uppercase;
  white-space: nowrap;
}
.book-ticket__kicker-sep { white-space: pre; }
@media (max-width: 479px) { .book-ticket__kicker { font-size: .625rem; letter-spacing: .14em; } }
@media (max-width: 359px) {
  /* a deliberate two-line kicker beats a stray wrap */
  .book-ticket__kicker { flex-direction: column; gap: 1px; }
  .book-ticket__kicker-sep { display: none; }
}
/* The name is the hero: one line, sized by its grapheme count (--chars, set by ticket.ts) inside the main
   panel's width (a size container), then measured by fitLine(); never broken mid-word (audit). */
.book-ticket__name {
  margin-block: var(--space-1);
  font-family: var(--t-font-name, var(--font-name));
  font-style: var(--t-name-style, italic);
  font-weight: var(--t-name-weight, 400);
  font-stretch: var(--t-name-stretch, 100%);
  font-size: max(1rem, min(clamp(2.25rem, 9vw, 4rem), calc(150cqi / max(var(--chars, 6), 3))));
  line-height: .95;
  letter-spacing: -0.01em;
  color: var(--t-text, var(--ink));
  text-wrap: balance;
}
.book-ticket__date { font: 800 1.0625rem/1.3 var(--font-display); color: var(--t-text, var(--ink)); }
.book-ticket__window { color: var(--t-muted, var(--text-2)); font-size: .8125rem; }
.book-ticket__stub {
  --nx: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-4) var(--space-2);
  border-radius: 0 22px 22px 0;
  background: linear-gradient(160deg, var(--candle), var(--coral) 140%);
  color: var(--night-900);
  text-align: center;
}
.book-ticket__seat-k { font: 800 .625rem/1.2 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; }
.book-ticket__seat {
  font: 800 clamp(2.25rem, 8vw, 3.5rem)/1 var(--font-display);
  font-variation-settings: 'wdth' 75;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.book-ticket__of { font: 700 .8125rem/1.2 var(--font-ui); opacity: .75; }
/* Phones: the ticket stands upright (name panel on top, seat stub underneath, the perforation runs across), so the
   name gets the full width of the screen instead of what a side stub leaves (a 24-letter name was 16px tall). */
@media (max-width: 479px) {
  .book-ticket { grid-template-columns: minmax(0, 1fr); --notch: 12px; }
  .book-ticket__main, .book-ticket__stub { --nx: 0; }
  .book-ticket__main {
    border-radius: 22px 22px 0 0;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000) left / 51% 100% no-repeat,
                  radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000) right / 51% 100% no-repeat;
    mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000) left / 51% 100% no-repeat,
          radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000) right / 51% 100% no-repeat;
  }
  .book-ticket__main::after { inset: auto 14px 0; height: 0; border-right: 0; border-bottom: 2px dashed color-mix(in srgb, var(--t-text, var(--ink)) 35%, transparent); }
  .book-ticket__stub {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-radius: 0 0 22px 22px;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000) left / 51% 100% no-repeat,
                  radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000) right / 51% 100% no-repeat;
    mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000) left / 51% 100% no-repeat,
          radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000) right / 51% 100% no-repeat;
  }
  .book-ticket__seat { font-size: 2.5rem; }
}
.book-done.is-printing .book-ticket { animation: book-print 900ms var(--ease-out) both; }
.book-done.is-printing .book-done__head { animation: book-rise var(--dur-4) var(--ease-out) both; }
.book-done.is-fading .book-ticket, .book-done.is-fading .book-done__head { animation: book-fade 250ms linear both; }

.book-done__note {
  padding: 12px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  color: var(--text);
}
.book-done__note[data-status="pending"] { background: color-mix(in srgb, var(--candle) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); }
.book-done__note:empty { display: none; }
.book-done__actions { display: flex; flex-direction: column; gap: var(--space-4); }
.book-done__more { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.book-copy { display: flex; flex-direction: column; gap: var(--space-2); }
.book-copy__row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.book-copy__input { flex: 1 1 14rem; min-width: 0; font-size: .9375rem; color: var(--text-2); }
.book-copy__btn { flex: none; justify-content: center; }
@media (max-width: 479px) {
  .book-copy__input { flex-basis: 100%; }
  .book-copy__btn { flex: 1 1 0; }
}
.book-private { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--bg); }
.book-private__summary { display: flex; align-items: center; gap: var(--space-2); min-height: 48px; padding: 10px var(--space-4); font-weight: 700; cursor: pointer; }
.book-private__summary::before { content: '🔒'; font-size: .9em; }
.book-private__body { display: flex; flex-direction: column; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.book-private__warn { color: var(--text-2); font-size: var(--step-small); }
.book-private__warn strong { color: var(--accent-ink); }

.book-confetti { position: fixed; inset: 0; z-index: var(--z-toast); width: 100vw; height: 100vh; pointer-events: none; }
.book-toast {
  position: fixed;
  inset-inline: 0;
  inset-block-end: calc(var(--space-5) + var(--book-bar-h, 0px));
  z-index: var(--z-toast);
  width: fit-content;
  max-width: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--night-700);
  box-shadow: var(--shadow-1);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--step-small);
  text-align: center;
  animation: book-rise var(--dur-3) var(--ease-out) both;
}

/* ── Manage (/m) and My greetings (/mine) ─────────────────────────────────────────────────────────────── */
.book-state { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-6) 0; color: var(--text-2); }
.book-state--error { flex-direction: column; align-items: flex-start; }
.book-state__text { color: var(--text); font-size: 1.125rem; font-weight: 600; max-width: 40ch; }
.book-state__more { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.book-spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text) 20%, transparent);
  border-top-color: var(--accent-ink);
  animation: book-spin .9s linear infinite;
}
.book-m-main { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.book-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--book-panel);
}
.book-panel__title { font-size: var(--step-h3); }
.book-m-status__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.book-m-status__title { font-size: var(--step-h2); }
.book-m-status__seat { color: var(--text-3); font: 700 .8125rem/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
.book-m-status__text { color: var(--text-2); }
.book-badge {
  --tone: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--tone) 18%, transparent);
  color: var(--tone);
  font: 800 .75rem/1.4 var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.book-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.book-badge[data-tone="warn"] { --tone: var(--accent-ink); }
.book-badge[data-tone="bad"] { --tone: var(--danger); }
.book-badge[data-tone="off"] { --tone: var(--text-3); }
.book-m-lock { color: var(--text-3); font-size: var(--step-small); }
.book-m-lock:empty { display: none; }
.book-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.book-danger p { color: var(--text-2); }
.book-danger__btn { align-self: flex-start; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
/* "Yes, free the seat" is a destructive confirmation: coral, never the yellow of the safe primary action */
.book-danger__confirm { --btn-bg: var(--coral); --btn-fg: var(--night-950); }

.book--mine .book-lede { margin-block-end: var(--space-5); }
.book-mine { display: flex; flex-direction: column; gap: var(--space-3); padding: 0; list-style: none; max-width: 48rem; }
.book-mine__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--book-panel);
}
.book-mine__item[data-state="live"] { border-color: color-mix(in srgb, var(--party) 55%, transparent); }
.book-mine__item[data-state="past"] { opacity: .75; }
.book-mine__main { min-width: 0; }
.book-mine__when { display: flex; align-items: center; gap: 6px; color: var(--text-3); font: 700 .75rem/1.3 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.book-mine__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.book-mine__item[data-state="live"] .book-mine__when { color: var(--party-ink); }
.book-mine__item[data-state="live"] .book-mine__dot { background: var(--party); animation: book-pulse 1.6s var(--ease-io) infinite; }
.book-mine__item[data-state="past"] .book-mine__dot { background: var(--text-3); }
.book-mine__name { font: italic 400 2rem/1.1 var(--font-name); text-shadow: 0 0 24px color-mix(in srgb, var(--candle) 35%, transparent); }
.book-mine__seat { color: var(--text-2); font-size: var(--step-small); }
.book-mine__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.book-mine-empty {
  display: grid;
  gap: var(--space-5);
  align-items: center;
  max-width: 48rem;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--book-panel);
}
@media (min-width: 640px) { .book-mine-empty { grid-template-columns: 14rem minmax(0, 1fr); } }
.book-mine-empty__ticket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-5) var(--space-4);
  border: 2px dashed color-mix(in srgb, var(--candle) 45%, transparent);
  border-radius: 18px;
  background:
    radial-gradient(circle 11px at 100% 0, var(--surface) 98%, transparent) top right / 51% 51% no-repeat,
    radial-gradient(circle 11px at 100% 100%, var(--surface) 98%, transparent) bottom right / 51% 51% no-repeat,
    radial-gradient(circle 11px at 0 0, var(--surface) 98%, transparent) top left / 51% 51% no-repeat,
    radial-gradient(circle 11px at 0 100%, var(--surface) 98%, transparent) bottom left / 51% 51% no-repeat,
    color-mix(in srgb, var(--candle) 6%, transparent);
  color: var(--text-3);
  text-align: center;
  transform: rotate(-3deg);
}
.book-mine-empty__k { font: 800 .625rem/1.2 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; }
.book-mine-empty__name { font: italic 400 1.75rem/1.1 var(--font-name); color: var(--text-2); }
.book-mine-empty__seat { font: 700 .75rem/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.book-mine-empty__text { display: flex; flex-direction: column; gap: var(--space-3); color: var(--text-2); }

/* ── Motion ───────────────────────────────────────────────────────────────────────────────────────────── */
@keyframes book-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
@keyframes book-wiggle {
  0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); }
}
@keyframes book-print {
  from { clip-path: inset(0 0 100% 0 round 22px); transform: translateY(-10px); }
  to { clip-path: inset(0 0 0 0 round 22px); transform: none; }
}
@keyframes book-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes book-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes book-spin { to { transform: rotate(1turn); } }
/* the marquee bulbs blink in two phases (a filter on the board only; well under 3 flashes a second) */
@keyframes book-marquee { 0% { filter: brightness(1); } 50% { filter: brightness(1.18); } 100% { filter: brightness(1); } }

@media (prefers-reduced-motion: reduce) {
  .book *, .book *::before, .book *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .book-day__badge--live::before, .book-preview__dot, .book-legend--live::before, .book-mine__dot, .book-sign__board { animation: none !important; }
  .book-done.is-fading .book-ticket, .book-done.is-fading .book-done__head { animation-duration: 250ms !important; }
}
html[data-calm] .book *, html[data-calm] .book *::before, html[data-calm] .book *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
html[data-calm] .book-done.is-fading .book-ticket, html[data-calm] .book-done.is-fading .book-done__head { animation-duration: 250ms !important; }

@media (forced-colors: active) {
  .book-chip input:checked + .book-chip__face, .book-seg__opt input:checked + span, .book-emoji__opt input:checked + span,
  .book-day[aria-checked="true"] { outline: 3px solid Highlight; outline-offset: 1px; }
  .book-day__fill, .book-legend::before, .book-cal__summary::before { forced-color-adjust: none; }
  .book-preview__fx, .book-confetti { display: none; }
  .book-ticket__main, .book-ticket__stub { -webkit-mask: none; mask: none; border: 1px solid CanvasText; }
  .book-sign__board, .book-preview__sky, .book-preview__floor, .book-ticket::before { display: none; }
}
