:root {
  --bg: #1c0c05;
  --bg-glow: #3b1d0d;
  --cream: #f4e8d6;
  --cream-soft: rgba(244, 232, 214, 0.82);
  --amber: #e4a95f;
  --glow: rgba(255, 186, 104, 0.5);

  --paper: #f8f2e8;
  --paper-2: #f0e6d6;
  --field: #fffdf9;
  --line: #dfcfb8;
  --ink: #2a1a10;
  --ink-soft: #6e5846;
  --ember: #9c2f1d;
  --ember-deep: #80230f;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Vertical room the table leaves for everything else, so it fits the viewport. */
  --chrome: 3rem;
  --photo-ratio: 2752 / 1536;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  color: var(--cream);
  background: radial-gradient(ellipse 80% 70% at 50% 58%, var(--bg-glow) 0%, var(--bg) 70%) fixed, var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: var(--bg); }

/* ---------- Stage: the title sits on the top edge of the photo ---------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-areas: "stack";
  align-content: center;
  justify-items: center;
  padding: clamp(0.5rem, 2vh, 1.5rem) 0;
}

.intro,
.table-frame { grid-area: stack; }

/* The title's bottom edge sits where the chair backs start, 13% down the photo (a relative `top`
   on a grid item resolves against the grid area, which is the table's height). It grows upward
   from there, so it never covers the chairs or the top row of plates. */
.intro {
  align-self: start;
  position: relative;
  z-index: 2;
  top: 13%;
  transform: translateY(-100%);
  padding: 0 16px 0.35rem;
  text-align: center;
  text-shadow: 0 2px 18px rgba(12, 5, 2, 0.8);
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, min(4.6vw, 7.5vh), 3.7rem);
  font-weight: 340;
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}

.lede {
  margin: 0.45rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(0.95rem, min(1.6vw, 2.6vh), 1.25rem);
  color: var(--cream-soft);
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.home-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---------- Two views: the intro, then the table ---------- */

/* The intro: the copy and the three dates sit in the middle of the table, which is dimmed and
   has no plates yet. */
.stage[data-view="intro"] .intro {
  align-self: center;
  top: auto;
  transform: none;
  width: 100%;
  max-width: 900px;
  padding: 1.5rem 16px;
}

.stage[data-view="intro"] .table-frame {
  align-self: center;
  opacity: 0.26;
  filter: saturate(0.8);
  pointer-events: none;
}

.stage[data-view="intro"] .seat { visibility: hidden; }
.stage[data-view="intro"] .home-link { pointer-events: none; }

.stage[data-view="intro"] .lede {
  max-width: 38rem;
  margin: 0.9rem auto 0;
  font-size: clamp(1.02rem, min(1.8vw, 2.8vh), 1.3rem);
  line-height: 1.45;
}

.table-frame { transition: opacity 0.6s ease, filter 0.6s ease; }

/* The table: the intro folds into a compact header (title + a tab per date), still anchored to
   the chair backs. The table gives up a little height so the header has room above them. */
.stage[data-view="table"] { --chrome: 6rem; }

.stage[data-view="table"] .intro-eyebrow,
.stage[data-view="table"] .intro-copy,
.stage[data-view="table"] .dates { display: none; }

.stage[data-view="table"] h1 { font-size: clamp(1.45rem, min(3.1vw, 5vh), 2.5rem); }

.stage[data-view="table"] .home-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

/* ---------- Date cards (intro) and tabs (table) ---------- */

.dates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  max-width: 780px;
  margin: 1.8rem auto 0;
  text-shadow: none;
}

.dates-loading {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-soft);
}

.date-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1rem 1.1rem;
  border: 1px solid rgba(228, 169, 95, 0.32);
  border-radius: 18px;
  background: rgba(24, 10, 4, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.date-card:hover,
.date-card:focus-visible {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber), 0 14px 44px rgba(255, 186, 104, 0.16);
  transform: translateY(-2px);
}

.card-when {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.card-weekday {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}

.card-date {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 360;
  line-height: 1.15;
}

.card-time {
  font-size: 0.88rem;
  color: var(--cream-soft);
  font-variant-numeric: tabular-nums;
}

.card-status {
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: rgba(228, 169, 95, 0.16);
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.date-card.is-full .card-status {
  background: rgba(244, 232, 214, 0.1);
  color: var(--cream-soft);
}

.date-card.is-closed { border-color: rgba(244, 232, 214, 0.14); }
.date-card.is-closed .card-when { opacity: 0.6; }

.date-card.is-closed .card-status {
  background: transparent;
  color: var(--cream-soft);
}

.date-tabs {
  display: none;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  text-shadow: none;
}

.stage[data-view="table"] .date-tabs { display: flex; }

.date-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 6.5rem;
  padding: 0.38rem 0.85rem 0.42rem;
  border: 1px solid rgba(244, 232, 214, 0.16);
  border-radius: 12px;
  background: rgba(24, 10, 4, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--cream-soft);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.date-tab:hover {
  border-color: rgba(228, 169, 95, 0.55);
  color: var(--cream);
}

.date-tab:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.date-tab[aria-current="true"] {
  border-color: var(--amber);
  background: rgba(59, 29, 13, 0.85);
  color: var(--cream);
  box-shadow: 0 0 20px rgba(255, 186, 104, 0.18);
}

.tab-date {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.tab-status {
  font-size: 0.7rem;
  color: var(--amber);
}

.date-tab.is-full .tab-status { color: var(--cream-soft); }

@media (max-width: 620px) {
  .dates {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-top: 1.3rem;
  }

  .date-card {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.85rem 1rem 0.85rem 1.15rem;
    text-align: left;
  }

  .card-when { align-items: flex-start; }
  .card-date { font-size: 1.3rem; }
}

/* ---------- The banner over a full or closed table ---------- */

.table-banner {
  grid-area: stack;
  align-self: center;
  justify-self: center;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: calc(100% - 32px);
  padding: 0.7rem 0.75rem 0.7rem 1.35rem;
  border: 1px solid rgba(228, 169, 95, 0.4);
  border-radius: 999px;
  background: rgba(24, 10, 4, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: fade-in 0.4s ease;
}

.banner-copy p { margin: 0; }

.banner-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 380;
}

.banner-copy .banner-note {
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--cream-soft);
}

.table-banner:has(#joinBtn[hidden]) { padding-right: 1.35rem; }

/* ---------- Table ---------- */

.table-frame {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

.table {
  position: relative;
  width: min(100%, 1600px, max(calc((100svh - var(--chrome)) * 2752 / 1536), 640px));
  aspect-ratio: var(--photo-ratio);
}

/* Holds the photo and its grain. The seats sit outside it, so the mask and the grain never touch them. */
.photo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Feather the floor into the page so the photo has no hard edge. */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
}

.table-photo {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}

/* Film grain: a tile of SVG noise blended over the photo, jumping to a new spot 24 times a second
   (12 keyframes over 0.5s). `opacity` sets how strong it is. */
.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  opacity: 0.55;
  animation: grain 0.5s steps(1) infinite;
}

@keyframes grain {
  0%      { background-position: 0 0; }
  8.333%  { background-position: -63px 41px; }
  16.667% { background-position: 87px -29px; }
  25%     { background-position: -21px -95px; }
  33.333% { background-position: 112px 66px; }
  41.667% { background-position: -98px 14px; }
  50%     { background-position: 36px 121px; }
  58.333% { background-position: -140px -52px; }
  66.667% { background-position: 71px -118px; }
  75%     { background-position: -45px 88px; }
  83.333% { background-position: 129px 23px; }
  91.667% { background-position: -112px -137px; }
  100%    { background-position: 0 0; }
}

.seat {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--d);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  container-type: inline-size;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* A slightly larger hit area than the plate itself, for fingers. */
.seat::after {
  content: "";
  position: absolute;
  inset: -14%;
  border-radius: 50%;
}

/* The glow ring around the plate. */
.seat::before {
  content: "";
  position: absolute;
  inset: -5%;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 226, 180, 0), 0 0 22px 2px rgba(255, 186, 104, 0);
  transition: box-shadow 0.25s ease;
}

.seat.is-free::before {
  animation: breathe 4.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.42s);
}

.seat:hover::before,
.seat:focus-visible::before {
  animation: none;
  box-shadow: 0 0 0 2px rgba(255, 228, 186, 0.95), 0 0 36px 8px var(--glow);
}

.seat:focus-visible { outline: none; }

.seat:disabled { cursor: default; }

.seat.is-held:not(.is-yours)::before,
.seat.is-held:not(.is-yours)::after,
.seat.is-empty::before,
.seat.is-empty::after { content: none; }

/* Your own booked plate keeps a steady ring. */
.seat.is-mine::before {
  animation: none;
  box-shadow: 0 0 0 2px rgba(228, 169, 95, 0.95), 0 0 30px 6px var(--glow);
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 226, 180, 0), 0 0 22px 2px rgba(255, 186, 104, 0); }
  50%      { box-shadow: 0 0 0 1.5px rgba(255, 226, 180, 0.35), 0 0 26px 4px rgba(255, 186, 104, 0.28); }
}

.seat-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.seat-hint {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(10px, 26cqw, 18px);
  color: #6a4630;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.seat:hover .seat-hint,
.seat:focus-visible .seat-hint {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .seat-hint { display: none; }
}

.seat-face {
  width: 84%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--ember);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 32cqw;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 0 0 max(1.5px, 2.5cqw) var(--cream), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.seat-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A held plate: dimmed, with a ring that drains as the hold runs out (--p is the share left). */
.seat-dim {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: rgba(26, 11, 4, 0.52);
}

.seat-ring {
  --ring: rgba(244, 232, 214, 0.7);
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--p, 1) * 360deg), rgba(244, 232, 214, 0.12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}

.seat.is-yours .seat-dim { background: rgba(228, 169, 95, 0.16); }

.seat.is-yours .seat-ring {
  --ring: var(--amber);
  filter: drop-shadow(0 0 5px var(--glow));
}

.seat.is-yours.is-warning .seat-ring { --ring: #ef7a54; }

.seat-name.seat-held {
  font-weight: 500;
  color: var(--cream-soft);
}

.seat.is-yours .seat-held {
  font-weight: 600;
  color: var(--amber);
}

.seat.is-fresh .seat-face {
  animation: settle 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

@keyframes settle {
  from { transform: scale(0.55); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* The hosts' plates at the heads of the table: already set, so they don't glow or take clicks. */
.seat.is-host { cursor: default; }

.seat.is-host::before,
.seat.is-host::after { content: none; }

.is-host .seat-face {
  background: var(--amber);
  color: var(--bg);
}

.seat-name {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  max-width: 220%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  background: rgba(22, 9, 3, 0.74);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--sans);
  font-size: clamp(10px, 16cqw, 13px);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cream);
  pointer-events: none;
}

/* Portrait phones: turn the table on its side so the plates stay big enough to tap.
   Everything inside a seat is turned back so faces and names stay upright. */
@media (orientation: portrait) and (max-width: 760px) {
  :root { --chrome: 8rem; }

  /* No room on top of a turned table, so the title goes above it and only just overlaps. */
  .stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .intro {
    align-self: center;
    top: auto;
    transform: none;
    padding-top: clamp(1.25rem, 4vh, 2.5rem);
    margin-bottom: -1rem;
  }

  h1 { font-size: 2.3rem; }

  .table-frame {
    --tw: min(100vw * 2752 / 1536, 100svh - var(--chrome));
    height: max(var(--tw), 420px);
  }

  .table {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(var(--tw), 420px);
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .seat-inner { transform: rotate(-90deg); }

  .stage[data-view="intro"] { display: grid; }

  .stage[data-view="intro"] .intro {
    align-self: center;
    margin-bottom: 0;
    padding-top: 1.5rem;
  }

  .stage[data-view="table"] { --chrome: 9rem; }
  .stage[data-view="table"] h1 { font-size: 1.75rem; }

  .date-tabs {
    gap: 0.3rem;
    padding: 0 8px;
  }

  .date-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.35rem 0.4rem 0.4rem;
  }

  .table-banner {
    align-self: center;
    margin: 0.25rem 16px 1.5rem;
    border-radius: 18px;
  }
}

/* ---------- Sheet (the details dialog) ---------- */

.sheet {
  --sheet-max: min(880px, calc(100svh - 2rem));
  width: min(560px, calc(100vw - 2rem));
  max-width: none;
  max-height: var(--sheet-max);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  overflow: hidden;
  color-scheme: light;
}

.sheet[open] { animation: sheet-in 0.32s cubic-bezier(0.2, 0.85, 0.25, 1); }
.sheet[open]::backdrop { animation: fade-in 0.32s ease; }

.sheet::backdrop {
  background: rgba(12, 5, 2, 0.64);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sheet-form {
  display: flex;
  flex-direction: column;
  max-height: var(--sheet-max);
}

.sheet-head { padding: 1.4rem 1.5rem 0.9rem; }

.sheet-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.sheet-head .eyebrow {
  margin-bottom: 0.35rem;
  color: var(--ember);
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 380;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem 1.5rem 1.5rem;
}

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}

.foot-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.sheet-small { width: min(460px, calc(100vw - 2rem)); }

/* The hold countdown: a line of text over a bar that drains (--p is the share left). */
.hold-line { margin-top: 0.9rem; }

.hold-text {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.hold-clock {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hold-bar {
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.hold-bar span {
  display: block;
  height: 100%;
  background: var(--ember);
  transform-origin: left center;
  transform: scaleX(var(--p, 1));
  transition: transform 0.25s linear;
}

.hold-line.is-warning .hold-text,
.hold-line.is-warning .hold-clock,
.hold-line.is-over .hold-text,
.hold-line.is-over .hold-clock { color: var(--ember); }

.hold-line.is-warning .hold-bar span { animation: urge 1s ease-in-out infinite; }

@keyframes urge {
  50% { opacity: 0.4; }
}

.sheet-notice {
  margin: 0 1.5rem 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid #ebc9b3;
  border-radius: 14px;
  background: #f8e5d8;
}

.sheet-notice p {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.form-error {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0;
  padding: 0.65rem 1.5rem;
  border-top: 1px solid #efd3c2;
  background: #fbeee6;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #a3361f;
}

.form-error .link-btn { color: #a3361f; }

/* After booking: the plate with your face on it. */
.sheet-done {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1.5rem 1.75rem;
  text-align: center;
}

.done-plate {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background-color: #3a1e10;
  background-image: url("assets/table.jpg");
  background-repeat: no-repeat;
  box-shadow: 0 8px 22px rgba(60, 28, 10, 0.3);
}

.done-face {
  display: grid;
  place-items: center;
  width: 64%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ember);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 2.1rem;
  box-shadow: 0 2px 6px rgba(60, 28, 10, 0.3);
  animation: settle 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.done-face img,
.card-face-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.done-title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 380;
}

.done-line {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.done-copy {
  max-width: 26rem;
  margin: 0.6rem auto 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- Note dialog (links from emails) and the waiting list ---------- */

.note-text {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.note-body .field { margin-top: 0.25rem; }

.note-status {
  margin: 0.6rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.note-status:empty { display: none; }

.wait-rows {
  display: grid;
  gap: 0.5rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.wait-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: var(--paper-2);
}

.wait-row div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.wait-row strong { font-size: 0.95rem; }

.wait-row span {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.date-checks {
  display: grid;
  gap: 0.5rem;
}

.date-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.date-check:has(input:checked) {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.date-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ember);
}

.date-check small {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-soft);
  text-align: right;
}

.date-check.is-disabled {
  background: transparent;
  color: var(--ink-soft);
  cursor: default;
}

/* Hidden from people, filled in by bots (see the backend's honeypot). */
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Phones: the sheet comes up from the bottom edge. */
@media (max-width: 560px) {
  .sheet {
    --sheet-max: 92svh;
    width: 100%;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }

  .sheet[open] { animation-name: sheet-up; }

  .sheet-head,
  .sheet-body,
  .sheet-done,
  .form-error,
  .sheet-foot { padding-left: 1.15rem; padding-right: 1.15rem; }

  .sheet-notice { margin-left: 1.15rem; margin-right: 1.15rem; }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

/* ---------- Form fields ---------- */

.photo-field {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem;
  border-radius: 16px;
  background: var(--paper-2);
}

.photo-preview {
  position: relative;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background-color: #3a1e10;
  background-image: url("assets/table.jpg");
  background-repeat: no-repeat;
  box-shadow: 0 6px 16px rgba(60, 28, 10, 0.28);
}

/* Smaller than the plate behind it, so the rim still reads as "your photo, on your plate". */
.photo-preview img {
  position: absolute;
  inset: 18%;
  width: 64%;
  height: 64%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(60, 28, 10, 0.3);
}

.photo-copy { min-width: 0; }
.photo-copy .field-label { margin-bottom: 0.15rem; }

.photo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.field {
  margin: 1.15rem 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field-label {
  display: block;
  margin: 0 0 0.45rem;
  padding: 0;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.counter {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.field-note {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
}

.error {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #a3361f;
}

input[type="text"],
input[type="email"],
textarea {
  display: block;
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
  color: var(--ink);
  font: 400 1rem/1.4 var(--sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input::placeholder,
textarea::placeholder { color: #a8927d; }

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(156, 47, 29, 0.14);
}

#dietNotes { margin-top: 0.75rem; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip { position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.48rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip span:hover { border-color: #c9b293; }

.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.chip input[type="checkbox"]:checked + span::before {
  content: "";
  width: 0.7em;
  height: 0.38em;
  margin-top: -0.18em;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 0.94rem/1.2 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:focus-visible,
.link-btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ember);
  color: #fff6ea;
}

.btn-primary:hover { background: var(--ember-deep); }

.btn-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover { background: rgba(42, 26, 16, 0.05); }

.btn-glow {
  background: var(--amber);
  color: var(--bg);
}

.btn-glow:hover { background: #f0bd7a; }
.btn-glow:focus-visible { outline-color: var(--cream); }

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.photo-actions .btn {
  padding: 0.5rem 0.95rem;
  font-size: 0.88rem;
  background: var(--field);
}

.photo-field:has(#photoInput:focus-visible) .photo-actions .btn {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: 600 0.86rem/1.2 var(--sans);
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-danger { color: #a3361f; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -0.35rem -0.5rem 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.icon-btn:hover { background: rgba(42, 26, 16, 0.06); color: var(--ink); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- A guest's card ---------- */

.card {
  width: min(380px, calc(100vw - 2rem));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  color-scheme: light;
}

.card[open] { animation: sheet-in 0.32s cubic-bezier(0.2, 0.85, 0.25, 1); }
.card[open]::backdrop { animation: fade-in 0.32s ease; }

.card::backdrop {
  background: rgba(12, 5, 2, 0.64);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.card-inner {
  position: relative;
  padding: 2.1rem 1.75rem 1.9rem;
  text-align: center;
}

.card-inner .icon-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  margin: 0;
}

.card-face {
  width: 116px;
  aspect-ratio: 1;
  margin: 0 auto 1.1rem;
}

.card-face-inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ember);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 2.8rem;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px var(--line), 0 12px 28px rgba(60, 28, 10, 0.25);
}

.card .eyebrow {
  margin-bottom: 0.3rem;
  color: var(--ember);
}

.card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 380;
  line-height: 1.1;
}

.card-intro {
  margin: 0.9rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.card-intro.is-empty {
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

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