:root {
  --bg: #faf7ff;
  --card: #ffffff;
  --text: #1b1033;
  --muted: #6b6380;
  --border: #e6e0f2;
  --accent: #7c3aed;
  --accent-text: #ffffff;
  --accent-soft: #f1eaff;
  --radius: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120b22;
    --card: #1d1433;
    --text: #f3efff;
    --muted: #a59cbd;
    --border: #2f2550;
    --accent: #a78bfa;
    --accent-text: #120b22;
    --accent-soft: #2a1f4a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--page-text, var(--text));
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; color: var(--muted); font-weight: 600; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.hero { text-align: center; padding: 24px 8px 8px; }
.hero p { margin: 6px 0 0; }
.emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.when { font-weight: 600; margin: 8px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card > * + * { margin-top: 10px; }
.card.stack > * + * { margin-top: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.9rem; }
label .muted { font-weight: 400; display: inline; }

input, textarea {
  font: inherit;
  font-weight: 400;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--fill, var(--bg));
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .btn {
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}
button:disabled { opacity: 0.6; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; }

.topbar { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.topbar a { text-decoration: none; font-weight: 600; }

.share.highlight { border-color: var(--accent); background: var(--accent-soft); }
.share-row { display: flex; gap: 8px; }
.share-row input { flex: 1; min-width: 0; font-size: 0.875rem; }
.share-buttons { display: flex; gap: 8px; }
.share-buttons > * { flex: 1; }
.whatsapp { background: #25d366; border-color: #25d366; color: #fff; }

.description { white-space: pre-wrap; }

.rsvp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rsvp button { padding: 12px 4px; font-size: 0.9rem; }
.rsvp button.selected { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.count {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  text-align: center;
  vertical-align: middle;
}
.guest-group { margin-top: 14px; }
.guests { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.guests li { background: var(--fill, var(--bg)); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; }
.badge { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.badge.you { color: var(--accent); }

.events { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.event-link {
  display: flex; flex-direction: column;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
.event-link.past { opacity: 0.6; }

.danger-zone { border-color: #e5484d55; }
button.danger { background: #e5484d; border-color: #e5484d; color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  max-width: calc(100% - 32px);
}

fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 4px; }
.hint { margin: 0; }

.theme { margin: 10px 0 0; }
.theme-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.playlist-note { font-weight: 600; }
iframe.spotify { width: 100%; border: 0; border-radius: 12px; display: block; background: var(--fill, var(--bg)); }
.spotify-btn { display: block; background: #1db954; border-color: #1db954; color: #fff; }

.comments {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.comments li.empty { background: none; border: none; padding: 0; }
.comments p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--accent); font-weight: 600; }
.mention.me { background: var(--accent-soft); border-radius: 4px; padding: 0 2px; }
.comment-gif { display: block; margin-top: 6px; max-width: min(220px, 100%); height: auto; border-radius: 10px; }

.comment-form { position: relative; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.comment-input {
  width: 100%;
  min-width: 0;
  min-height: 3.2em;
  max-height: 40vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--fill, var(--bg));
  color: var(--text);
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.comment-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.comment-input.empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.composer-bar { display: flex; gap: 6px; align-items: center; }
.composer-bar .primary { margin-left: auto; }
.composer-bar .tool { width: 40px; height: 40px; padding: 0; font-size: 1.15rem; line-height: 1; display: grid; place-items: center; }
.composer-bar .tool[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.composer-bar .gif-tool { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.03em; }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--fill, var(--bg)); }
.emoji-panel button { border: none; background: none; padding: 6px 0; font-size: 1.4rem; line-height: 1; border-radius: 8px; }
.emoji-panel button:hover { background: var(--accent-soft); }
.gif-panel { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--fill, var(--bg)); }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 280px; overflow-y: auto; }
.gif-grid button { padding: 0; border: none; border-radius: 8px; overflow: hidden; background: var(--accent-soft); aspect-ratio: 1; }
.gif-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-grid p { grid-column: 1 / -1; margin: 4px 0; }
.gif-credit { margin: 0; text-align: right; font-size: 0.75rem; }
.mention-list { position: absolute; bottom: calc(100% - 4px); left: 0; z-index: 5; list-style: none; margin: 0; padding: 4px; min-width: 200px; max-width: 100%; max-height: 260px; overflow-y: auto; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.mention-list button { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; padding: 6px 8px; text-align: left; border-radius: 8px; color: inherit; }
.mention-list [aria-selected="true"] button, .mention-list button:hover { background: var(--accent-soft); }

.music h3 { margin-top: 16px; }
.song-search input { font-size: 1rem; }
.tracks { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.tracks:empty { display: none; }
.tracks li { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; background: var(--fill, var(--bg)); }
.tracks li.empty { background: none; }
.tracks img, .tracks .cover { width: 40px; height: 40px; border-radius: 6px; flex: none; object-fit: cover; display: grid; place-items: center; background: var(--accent-soft); }
.track-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.track-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-side { flex: none; font-size: 0.85rem; color: var(--muted); max-width: 35%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-song { padding: 6px 12px; font-size: 0.85rem; background: #1db954; border-color: #1db954; color: #fff; }
.connect-box { border: 1px dashed var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.connect-box p { margin: 0; }

/* Event background picture (set by the host). Cards stay opaque so text stays readable. */
body.has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45)), var(--bg-image) center / cover no-repeat;
}
body.has-bg .topbar,
body.has-bg .container > p.center {
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
}
body.has-bg .container > p.center { align-self: center; }
body.has-bg .hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
}

/* Organizer-only floating buttons to change the background. */
.bg-control {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  z-index: 5;
}
.bg-fab {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
  background: var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
#bg-remove { padding: 10px 14px; }
.container:has(.bg-control) { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
body:has(.bg-control) .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* Organizer-only color picker, opened from the 🎨 button. */
.color-picker {
  color: var(--text);
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 6;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: calc(100% - 32px);
}
.color-picker { max-height: calc(100dvh - 110px - env(safe-area-inset-bottom)); overflow-y: auto; }
.color-picker[hidden] { display: none; }
.color-picker p { margin: 0 0 8px; }
.swatches { display: grid; grid-template-columns: repeat(5, 40px); gap: 10px; margin-bottom: 14px; }
.custom-colors { display: grid; gap: 8px; margin-bottom: 12px; }
.custom-colors label { flex-direction: row; align-items: center; gap: 10px; font-size: 0.95rem; }
.custom-colors .bg-row #bg-match { margin-left: auto; min-height: 0; padding: 4px 0; }
/* With a photo the page color only shows at the edges, and those follow the photo. */
body.has-bg .custom-colors .bg-row { display: none; }
.bg-auto { display: flex; align-items: center; gap: 8px; margin: 0; }
.custom-colors input[type="color"] { width: 44px !important; height: 32px; padding: 2px; border-radius: 8px; flex: none; cursor: pointer; }
#color-save { width: 100%; }
/* Per-card style: small "Aa" button on each card (hosts), opening a bottom sheet. */
[data-card] { position: relative; }
.card-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--border);
  opacity: 0.75;
}
.card-edit:hover, .card-edit:focus-visible { opacity: 1; }
.event-hero .card-edit { color: #fff; background: rgba(0, 0, 0, 0.25); border-color: rgba(255, 255, 255, 0.35); }
.card-editing { outline: 3px solid var(--accent); outline-offset: 3px; }
.card-style-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  z-index: 8;
  display: grid;
  gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
}
.card-style-panel[hidden] { display: none; }
.card-style-head, .card-style-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-style-row { display: grid; grid-template-columns: 48px 1fr 44px 36px; align-items: center; gap: 8px; }
.card-style-label { font-weight: 600; font-size: 0.9rem; }
.card-style-row select { font: inherit; font-size: 0.95rem; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--fill, var(--bg)); color: var(--text); }
.card-style-row input[type="color"] { width: 44px !important; height: 36px; padding: 2px; border-radius: 8px; cursor: pointer; }
.card-style-row [hidden] { visibility: hidden; display: inline; }
#card-style-save { min-width: 140px; }
body:has(.card-style-panel:not([hidden])) .bg-control { display: none; }
body:has(.card-style-panel:not([hidden])) .container { padding-bottom: 280px; }
.swatch {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--swatch) 0 42%, var(--swatch-bg) 44%);
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--border);
}
.swatch.selected { box-shadow: 0 0 0 3px var(--text); }

/* ---------- Modern look ---------- */

:root {
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(27, 16, 51, 0.04), 0 8px 24px rgba(27, 16, 51, 0.07);
  --radius: 20px;
}
@media (prefers-color-scheme: dark) {
  :root { --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35); }
}

h1, h2, .hero h1 { font-family: var(--display); letter-spacing: -0.01em; }
h1 { font-weight: 800; }
h2 { font-weight: 600; font-size: 1.2rem; }

.card { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--border) 60%, transparent); }
button, .btn { transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease; }
button:active:not(:disabled), .btn:active { transform: scale(0.97); }
.primary { box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.rsvp button.selected { box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Over a photo: blurred backdrop + frosted cards. */
body.has-bg::before { filter: blur(22px) saturate(1.3); transform: scale(1.12); }
body.has-bg .card {
  background: color-mix(in srgb, var(--card) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-color: color-mix(in srgb, #fff 25%, transparent);
}

/* Event hero header */
.event-hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: flex-end;
  color: #fff;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #120b22));
}
.event-hero.has-photo { min-height: 300px; background: var(--hero-image) center / cover no-repeat, #120b22; }
.event-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.6) 100%);
}
.event-hero:not(.has-photo)::after { background: radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.25), transparent 45%); }
.hero-inner { position: relative; z-index: 1; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; }
.event-hero h1 { font-size: 2.1rem; line-height: 1.05; margin: 2px 0; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); }
.event-hero p { margin: 0; }
.hero-when { font-weight: 600; }
.hero-theme, .chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-weight: 600;
  font-size: 0.9rem;
}
.chip { background: #fff; color: #1b1033; font-size: 0.8rem; letter-spacing: 0.02em; }
.hero-invite { opacity: 0.9; font-weight: 500; }
.hero-going { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.going-line { margin: -4px 0 0; }

/* Avatars */
.avatar {
  --size: 36px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--size) * 0.4);
  font-weight: 700;
  color: #fff;
  background: hsl(var(--hue) 65% 52%);
  vertical-align: middle;
  user-select: none;
}
.avatar.sm { --size: 26px; }
.avatar.more { background: rgba(0, 0, 0, 0.55); }
.faces { display: inline-flex; }
.faces .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
.faces .avatar + .avatar { margin-left: -8px; }
.guests li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; }
.hello { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

/* Comments with avatars */
.comments li.empty { display: block; }

/* Confetti */
.confetti {
  position: fixed;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 50;
  animation: confetti 1.3s ease-out forwards;
}
@keyframes confetti {
  35% { transform: translate(calc(var(--dx) * 0.6), var(--dy)) rotate(calc(var(--rot) * 0.4)); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 480px)) rotate(var(--rot)); opacity: 0; }
}

.event-info p { margin: 0.35rem 0; }

.card, .color-picker { color: var(--text); }

/* Guest chips are buttons for hosts (tap to make co-host). */
.guests li:has(.guest-chip) { padding: 0; }
.guest-chip { all: unset; display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; cursor: pointer; border-radius: 999px; }
.guest-chip:focus-visible { outline: 2px solid var(--accent); }
.emoji-panel[hidden], .gif-panel[hidden], .mention-list[hidden] { display: none; }

/* Reactions */
.comment-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.9rem; line-height: 1.4; background: var(--card); border: 1px solid var(--border); color: inherit; }
.reaction span { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.reaction.on { border-color: var(--accent); background: var(--accent-soft); }
.reaction.on span { color: var(--accent); }
.comments li { -webkit-touch-callout: none; }
.comments li.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Notifications bell */
.topbar-right { display: flex; align-items: center; gap: 8px; }
.bell { position: relative; width: 38px; height: 38px; padding: 0; border-radius: 999px; font-size: 1.1rem; display: grid; place-items: center; }
.bell[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center; }
.bell-count[hidden], .notif-panel[hidden] { display: none; }
.notif-panel { margin-top: 8px; }
.notif-panel h2 { margin-top: 0; }
.notifs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.notifs button { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: none; background: none; padding: 8px; border-radius: 10px; color: inherit; font-weight: 400; line-height: 1.35; }
.notifs .avatar { flex: none; }
.notifs .notif-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.notifs li.unread button { background: var(--accent-soft); }
.notifs button:hover { background: var(--accent-soft); }

/* Host menu for one guest (co-host, merge duplicate, remove) */
.guest-menu { width: min(420px, calc(100vw - 32px)); padding: 20px; color: var(--text); border: 1px solid var(--border); }
.guest-menu::backdrop { background: rgb(0 0 0 / 0.45); }
.guest-menu h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.guest-menu h3 { margin: 18px 0 4px; font-size: 1rem; }
.guest-menu p { margin: 0 0 8px; }
.guest-menu > button:not(.link) { width: 100%; }
.guest-menu > button.link { display: block; margin: 14px auto 0; }
.merge-row { display: flex; gap: 8px; }
.merge-row select { flex: 1; min-width: 0; font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--fill, var(--bg)); color: var(--text); }
button.link.remove-guest { color: #e5484d; margin-top: 18px; }

/* Quoted replies */
.quote { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; margin: 4px 0 2px; padding: 4px 10px; text-align: left; border: none; border-left: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); color: inherit; font-weight: 400; font-size: 0.85rem; line-height: 1.35; }
.quote strong { color: var(--accent); font-size: 0.8rem; }
.quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.quote.gone span { font-style: italic; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--accent-soft); font-size: 0.85rem; }
.reply-bar[hidden] { display: none; }
.reply-label { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.reply-label .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .link { text-decoration: none; font-size: 1rem; color: var(--muted); }
[data-live="songs"]:empty { display: none; }

/* Photo album */
.photo-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.photo-thumb { padding: 0; border: none; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--accent-soft); box-shadow: none; }
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-setting { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; color: var(--muted); cursor: pointer; }
.photo-setting input { width: 20px; height: 20px; flex: none; margin: 0; padding: 0; accent-color: var(--accent); }
.photo-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: none; background: #000; color: #fff; display: flex; flex-direction: column; }
.photo-viewer:not([open]) { display: none; }
.photo-viewer::backdrop { background: #000; }
.pv-top, .pv-bottom { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.pv-bottom { justify-content: center; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.pv-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-size: 0.9rem; }
.pv-who > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-count { color: #bbb; font-size: 0.85rem; }
.pv-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.pv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.pv-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.14); color: #fff; border: none; box-shadow: none; text-decoration: none; font-weight: 600; }
.pv-nav { justify-content: center; position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 1.6rem; line-height: 1; }
.pv-nav[data-act="prev"] { left: 10px; }
.pv-nav[data-act="next"] { right: 10px; }
.pv-nav[hidden], .pv-btn[hidden] { display: none; }

/* Pictures in comments */
.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments[hidden] { display: none; }
.attachment { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--accent-soft); }
.attachment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border-radius: 999px; border: none; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.7rem; line-height: 22px; }
.comment-pics { display: grid; gap: 4px; margin-top: 6px; max-width: 260px; }
.comment-pics.multi { grid-template-columns: 1fr 1fr; }
.comment-pics a { display: block; border-radius: 10px; overflow: hidden; background: var(--accent-soft); }
.comment-pics img { display: block; width: 100%; height: auto; }
.comment-pics.multi img { aspect-ratio: 1; object-fit: cover; height: 100%; }

/* Pinned message and edits */
#pinned:empty { display: none; }
#pinned { margin-bottom: 10px; }
.pinned { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 12px; text-align: left; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); color: inherit; font-weight: 400; line-height: 1.35; }
.pinned-label { font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.pinned-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.reply-bar.editing { border-left-color: #f59e0b; }

/* Chat-style comments: bubbles, grouped by author, mine on the right */
.comments { gap: 2px; padding: 2px; overflow-x: hidden; }
.comments li.comment { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 0; background: none; border: none; touch-action: pan-y; }
.comments li.comment:not(.cont) { margin-top: 8px; }
.comments li.comment:first-child { margin-top: 0; }
.comments li.mine { flex-direction: row-reverse; }
.comments li.cont .avatar { visibility: hidden; height: 0; }
.bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: calc(100% - 76px); }
.mine .bubble-wrap { align-items: flex-end; max-width: calc(100% - 36px); }
.bubble { position: relative; max-width: 100%; padding: 6px 12px 5px; border-radius: 18px; background: var(--fill, var(--bg)); border: 1px solid var(--border); line-height: 1.4; }
.theirs:not(.cont) .bubble { border-top-left-radius: 6px; }
.mine .bubble { background: var(--accent-soft); border-color: transparent; }
.mine:not(.cont) .bubble { border-top-right-radius: 6px; }
.tagged .bubble { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.is-pinned .bubble { border-color: var(--accent); }
.bubble .author { display: block; font-size: 0.8rem; color: hsl(var(--hue) 60% 42%); }
@media (prefers-color-scheme: dark) { .bubble .author { color: hsl(var(--hue) 70% 70%); } }
.bubble p { margin: 0; }
.bubble .comment-gif, .bubble .comment-pics { margin-top: 4px; }
.bubble.media-only { padding: 4px; min-width: 120px; min-height: 60px; }
.bubble.media-only .comment-gif, .bubble.media-only .comment-pics { margin-top: 0; }
.bubble.media-only .author { padding: 0 8px 2px; }
.stamp { float: right; display: inline-flex; gap: 4px; align-items: baseline; margin: 6px 0 -2px 10px; font-size: 0.7rem; color: var(--muted); line-height: 1; white-space: nowrap; }
.stamp .edited { font-style: italic; }
.bubble.media-only .stamp { position: absolute; right: 10px; bottom: 9px; margin: 0; padding: 3px 6px; border-radius: 999px; background: rgb(0 0 0 / 0.45); color: #fff; }
.comment-foot { margin: -6px 8px 0; position: relative; z-index: 1; gap: 4px; }
.comment-foot .reaction { padding: 0 6px; font-size: 0.85rem; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.more-btn { align-self: center; flex: none; width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; opacity: 0.55; }
.more-btn:hover, .more-btn:focus-visible { opacity: 1; background: var(--accent-soft); }
@media (hover: hover) and (pointer: fine) {
  .more-btn { opacity: 0; }
  li.comment:hover .more-btn, .more-btn:focus-visible { opacity: 1; }
}
@media (pointer: coarse) {
  .bubble { -webkit-user-select: none; user-select: none; }
}
.swipe-reply { position: absolute; left: -36px; top: 50%; translate: 0 -50%; font-size: 1.1rem; opacity: var(--swipe, 0); scale: calc(0.6 + var(--swipe, 0) * 0.4); pointer-events: none; }
.comments li.flash .bubble { animation: flash 1.6s ease-out; }
.comments li.flash { animation: none; }

/* Message menu (long-press / ⋯) */
dialog.sheet { width: min(480px, 100vw); max-width: 100vw; margin: auto auto 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); border: none; border-radius: 22px 22px 0 0; background: var(--card); color: var(--text); box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25); }
@media (min-width: 560px) { dialog.sheet { margin: auto; border-radius: 22px; } }
dialog.sheet[open] { animation: sheet-up 0.18s ease-out; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
dialog.sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.sheet-reactions, .sheet-more { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px; padding: 4px; border-radius: 999px; background: var(--fill, var(--bg)); }
.sheet-more { border-radius: 16px; justify-content: flex-start; margin-top: 6px; max-height: 160px; overflow-y: auto; }
.sheet-more[hidden], .sheet-reactions .more[hidden] { display: none; }
.sheet-reactions button, .sheet-more button { width: 40px; height: 40px; padding: 0; border: none; border-radius: 50%; background: none; font-size: 1.45rem; line-height: 1; }
.sheet-reactions button.on, .sheet-more button.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.sheet-reactions .more { font-size: 1.1rem; color: var(--muted); }
.sheet-preview { display: flex; flex-direction: column; gap: 1px; margin: 12px 4px 4px; padding: 6px 12px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--accent-soft); font-size: 0.85rem; }
.sheet-preview span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-likers { margin: 6px 6px 0; font-size: 0.8rem; color: var(--muted); }
.sheet-actions { display: flex; flex-direction: column; margin-top: 8px; border-radius: 14px; overflow: hidden; background: var(--fill, var(--bg)); }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: none; border-radius: 0; background: none; color: inherit; font: inherit; font-weight: 500; text-align: left; }
.sheet-item + .sheet-item { border-top: 1px solid var(--border); }
.sheet-item span { width: 24px; text-align: center; }
.sheet-item:hover { background: var(--accent-soft); }
.sheet-item.danger { color: #e5484d; }
.sheet-cancel { display: block; width: 100%; margin-top: 8px; padding: 12px; border-radius: 14px; border: none; background: var(--fill, var(--bg)); color: var(--muted); font: inherit; font-weight: 600; }
.comments-hint { margin: 6px 0 0; text-align: center; }

/* ---------- Nuit blanche ----------
   Dark by default, bright accent, big rounded tiles, one typeface.
   Host color themes still override the tokens below (set inline on body by applyColor). */

:root {
  --bg: #111014;
  --card: #1e1c24;
  --text: #f4f1fa;
  --muted: #b5b0c2;
  --border: #2c2934;
  --fill: #2c2934;
  --accent: #c6f432;
  --accent-text: #111014;
  --accent-soft: #343d1c;
  --radius: 24px;
  --shadow: none;
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111014;
    --card: #1e1c24;
    --text: #f4f1fa;
    --muted: #b5b0c2;
    --border: #2c2934;
    --accent: #c6f432;
    --accent-text: #111014;
    --accent-soft: #343d1c;
    --shadow: none;
  }
}

body { font-family: var(--display); font-size: 16px; }
/* Long words (names, links, titles) break instead of running off the card on narrow phones. */
body { overflow-wrap: break-word; }
.event-hero h1, .hero h1 { max-width: 100%; }
.container { gap: 10px; padding-left: 12px; padding-right: 12px; }
h1 { font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-weight: 600; }

/* Tiles */
.card { border: none; border-radius: var(--radius); padding: 18px; box-shadow: none; }
.card > * + * { margin-top: 12px; }
body.has-bg .card { border: none; }
fieldset { border-color: var(--border); border-radius: 18px; }

/* Controls: filled, no outlines, chunky */
input, textarea, .comment-input, .card-style-row select, .merge-row select, .plus-setting select {
  border: none;
  border-radius: 14px;
  background: var(--fill, var(--bg));
  padding: 13px 14px;
}
button, .btn { border: none; border-radius: 16px; background: var(--fill, var(--bg)); padding: 13px 18px; min-height: 44px; }
.primary, .primary:hover { box-shadow: none; font-weight: 800; }
.primary { background: var(--accent); color: var(--accent-text); }
button.link { min-height: 0; }
.composer-bar .tool { border-radius: 50%; }
.composer-bar .primary { border-radius: 999px; padding: 10px 20px; }

/* RSVP */
.rsvp button { min-height: 56px; border-radius: 18px; font-size: 0.95rem; }
.rsvp button.selected { box-shadow: none; font-weight: 800; }

/* Guests and chips */
.guests li { border: none; background: var(--fill, var(--bg)); }
.count { background: var(--accent); color: var(--accent-text); font-weight: 800; }
.theme-pill { background: var(--accent); color: var(--accent-text); }
.event-link { border: none; border-radius: 20px; padding: 16px 18px; }
.event-link strong, .event-link b { font-size: 1.05rem; }

/* Hero: a solid accent tile with huge type (a photo keeps the dark overlay) */
.event-hero { border-radius: 28px; min-height: 220px; box-shadow: none; }
.event-hero:not(.has-photo) { background: var(--accent); color: var(--accent-text); }
.event-hero:not(.has-photo)::after { display: none; }
.event-hero h1 { font-size: clamp(2.6rem, 13vw, 3.6rem); line-height: 0.92; text-shadow: none; }
.event-hero.has-photo h1 { text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35); }
.hero-inner { padding: 22px 20px 24px; gap: 10px; }
.hero-when { font-size: 1rem; }
.chip { background: var(--accent-text); color: var(--accent); font-weight: 800; font-size: 0.85rem; padding: 6px 12px; }
.event-hero.has-photo .chip { background: var(--accent); color: var(--accent-text); }
.event-hero:not(.has-photo) .hero-theme { background: color-mix(in srgb, var(--accent-text) 12%, transparent); }
.event-hero:not(.has-photo) .faces .avatar { box-shadow: 0 0 0 2px var(--accent); }
.event-hero:not(.has-photo) .card-edit { color: var(--accent-text); background: color-mix(in srgb, var(--accent-text) 12%, transparent); border-color: transparent; }
body.has-bg .hero { border: none; }

/* Floating host buttons and sheets */
.bg-fab { border-radius: 999px; background: var(--card); color: var(--text); }
.color-picker, .card-style-panel, .mention-list, .guest-menu { border: none; }
.toast { background: var(--accent); color: var(--accent-text); font-weight: 600; }

/* Chat bubbles on the dark default: lighter author names (light themes get darker ones) */
.bubble { border: none; }
.mine .bubble { background: var(--accent-soft); }
.bubble .author { color: hsl(var(--hue) 75% 74%); }
body.light-ui .bubble .author { color: hsl(var(--hue) 60% 38%); }

/* Event page as a two-column grid of tiles. Cards are full width unless the host makes them
   half width ("Aa" › Taille); applyCardStyles writes each card's order and width. */
.container:has(> [data-card]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
.container:has(> [data-card]) > * { grid-column: 1 / -1; min-width: 0; }
.container:has(> [data-card]) > p.center { order: 99; }
#app > [data-card].solo { grid-column: 1 / -1; }
.container:has(> [data-card]) > [data-card]:not([data-card="hero"]) { container-type: inline-size; }
.container:has(> [data-card]) > [data-card] > * + * { margin-top: 12px; }

/* Narrow (half-width) tiles */
@container (max-width: 260px) {
  .rsvp { grid-template-columns: 1fr; }
  .rsvp button { min-height: 48px; }
  h2 { font-size: 1.1rem; }
  .guests li { font-size: 0.85rem; }
  .composer-bar { flex-wrap: wrap; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Layout row in the "Aa" sheet */
.card-layout-row { display: grid; grid-template-columns: 48px 1fr 44px 44px; align-items: center; gap: 8px; }
.card-layout-row[hidden] { display: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--fill, var(--bg)); }
.seg button { min-height: 36px; padding: 6px 8px; border-radius: 10px; background: none; font-size: 0.9rem; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.card-layout-row .move { min-height: 44px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.card-layout-row .move:disabled { opacity: 0.35; cursor: default; }
.half-hint { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text); }
.half-hint[hidden] { display: none; }

/* ---------- Icons (inline SVG, no emojis in the interface) ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 > .icon { color: var(--accent); width: 1.05em; height: 1.05em; }
legend .icon { color: var(--accent); }
.hero-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.hero-icon .icon { width: 32px; height: 32px; }
.hero-when, .hero-theme, .hero-invite { display: inline-flex; align-items: center; gap: 8px; }
.going-line, .event-link .small { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.event-link .small { justify-content: flex-start; }
button .icon, .btn .icon { vertical-align: -0.2em; }
.bg-fab, .pv-btn, .sheet-item, .remove-guest, #delete-event, #photo-add { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.sheet-item { justify-content: flex-start; }
.sheet-item span { display: grid; place-items: center; }
.composer-bar .tool .icon, .bell .icon { width: 20px; height: 20px; }
.bell { color: var(--text); }
.pinned-label, .reply-label > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.pinned-label .icon, .reply-label .icon, .stamp .icon { width: 0.95em; height: 0.95em; }
.swipe-reply .icon { width: 22px; height: 22px; color: var(--accent); }
.attachment button .icon { width: 12px; height: 12px; }
.tracks .cover .icon { color: var(--accent); }
.card p.muted .icon { vertical-align: -0.18em; margin-right: 2px; }

/* RSVP: icon above label in narrow tiles, inline otherwise */
.rsvp button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.15; }
.rsvp button .icon { width: 18px; height: 18px; }

/* Address card */
.event-info { display: flex; flex-direction: column; gap: 12px; }
.card.event-info > * + * { margin-top: 0; }
.place { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: 0; }
.place-icon { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.place-icon .icon { width: 22px; height: 22px; }
.place-text { display: flex; flex-direction: column; min-width: 0; }
.place-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.place-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.place-go { display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: flex-start; padding: 10px 16px; min-height: 44px; }
.event-info .description { margin: 0; }
.edit-details { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 14px; min-height: 40px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); }
.edit-details:hover { color: var(--text); }
.event-info .edit-details { margin-top: auto; }

/* Host "Aa" button: keep it off the card's first line */
[data-card]:has(> .card-edit) > :first-child { padding-right: 40px; }
.card-edit { width: 32px; height: 32px; min-height: 0; top: 12px; right: 12px; font-family: var(--display); font-weight: 800; font-size: 0.8rem; background: var(--fill, var(--bg)); border: none; opacity: 0.9; }
.event-hero .card-edit { top: 14px; right: 14px; }

/* Narrow (half-width) tiles: every card stays readable */
@container (max-width: 260px) {
  .card { padding: 16px; }
  h2 { font-size: 1.05rem; padding-right: 0; gap: 6px; }
  .rsvp button { flex-direction: row; justify-content: flex-start; text-align: left; padding: 10px 12px; min-height: 44px; font-size: 0.9rem; }
  .place { flex-direction: column; align-items: flex-start; gap: 10px; }
  .place-go, .edit-details { align-self: stretch; }
  .guests { gap: 4px; }
  .guests li, .guest-chip { font-size: 0.85rem; max-width: 100%; }
  .guest-chip, .guests li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .badge { display: none; }
  .comments { max-height: 360px; }
  .comments li.comment > .avatar { display: none; }
  .bubble-wrap, .mine .bubble-wrap { max-width: calc(100% - 14px); }
  .more-btn { position: absolute; top: -2px; right: -6px; width: 24px; height: 24px; min-height: 0; font-size: 0.95rem; z-index: 2; }
  .mine .more-btn { right: auto; left: -6px; }
  .card-edit { width: 26px; height: 26px; top: 8px; right: 8px; font-size: 0.7rem; }
  [data-card]:has(> .card-edit) > :first-child { padding-right: 22px; }
  #photo-add { font-size: 0.9rem; padding: 10px 12px; }
  #photo-add .icon { display: none; }
  .edit-details { font-size: 0.85rem; justify-content: center; }
  .composer-bar { flex-wrap: wrap; gap: 6px; }
  .composer-bar .tool { width: 36px; height: 36px; min-height: 0; }
  .composer-bar .primary { margin-left: 0; flex: 1 0 100%; }
  .comments-hint { display: none; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  #photo-add { align-self: stretch; width: 100%; }
  .photo-add { flex-direction: column; align-items: stretch; }
  .tracks li { gap: 8px; }
  .track-side { display: none; }
  iframe.spotify { height: 152px; }
}

/* ---------- RSVP card: three equal answers ---------- */
.rsvp-status { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.rsvp-status strong { color: var(--text); }
.rsvp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rsvp button {
  display: grid; grid-template-rows: auto auto auto; justify-items: center; align-content: center; gap: 6px;
  min-height: 104px; padding: 14px 6px; border-radius: 20px; text-align: center; line-height: 1.1;
  background: var(--fill, var(--bg)); color: var(--text); font-size: 1rem; font-weight: 700;
}
.rsvp-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 8%, transparent); }
.rsvp button .rsvp-ic .icon { width: 20px; height: 20px; }
.rsvp button.selected { background: var(--accent); color: var(--accent-text); font-weight: 800; }
.rsvp button.selected .rsvp-ic { background: color-mix(in srgb, var(--accent-text) 14%, transparent); }

/* Half width: three equal rows, icon left, count right */
@container (max-width: 260px) {
  .rsvp { grid-template-columns: 1fr; gap: 6px; }
  .rsvp button {
    grid-template-columns: auto 1fr auto; grid-template-rows: none; justify-items: start; align-items: center;
    min-height: 52px; padding: 8px 12px 8px 8px; border-radius: 16px; gap: 10px; text-align: left; font-size: 0.95rem;
  }
  .rsvp-ic { width: 34px; height: 34px; }
  .rsvp button .rsvp-ic .icon { width: 18px; height: 18px; }
  .rsvp-status { font-size: 0.8rem; }
  .rsvp button { grid-template-columns: auto 1fr; padding-right: 10px; }
  .rsvp-label { white-space: nowrap; }
  /* Fill the tile when its neighbour is taller: the three answers share the height. */
  .rsvp { flex: 1; grid-auto-rows: 1fr; }
}
.card[data-card="rsvp"] { display: flex; flex-direction: column; }

/* ---------- Plus-ones: who comes with the guest ---------- */
.plus-ones { margin-top: 12px; padding: 12px; border-radius: 18px; background: var(--fill, var(--bg)); display: grid; gap: 8px; }
.plus-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plus-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.plus-label .icon { flex: none; width: 20px; height: 20px; color: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--text); border: none; }
.stepper button:not(:disabled):hover { background: var(--accent); color: var(--accent-text); }
.stepper button:disabled { opacity: 0.35; cursor: default; }
.stepper output { min-width: 2.2em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.plus-names { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; cursor: pointer; font-size: 0.9rem; color: var(--accent); }
.plus-names > span:first-child { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus-names:focus-visible { outline: 2px solid var(--accent); border-radius: 8px; }
.plus-edit { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.plus-names .icon { width: 14px; height: 14px; }
.plus-hint { margin: 0; }
.guests li.companion { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); }
.guests li.companion.anon { padding-right: 12px; }
.plus-setting { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-weight: 400; }
.plus-setting .icon { flex: none; }
.plus-setting span { flex: 1; }
.plus-setting select { width: auto; flex: none; font: inherit; color: var(--text); background: var(--fill, var(--bg)); border: none; border-radius: 10px; padding: 8px 10px; }
.plus-ones > * { min-width: 0; }
.plus-dialog .plus-form { display: grid; gap: 8px; margin-top: 8px; }
.plus-name-row { display: flex; gap: 6px; align-items: center; }
.plus-name-row input { flex: 1; min-width: 0; }
.plus-name-row .icon-btn { flex: none; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--fill, var(--bg)); color: var(--muted); border: none; }
.plus-add { justify-self: start; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.plus-dialog .plus-form > .link { justify-self: center; }

@container (max-width: 260px) {
  .plus-ones { padding: 10px; }
  .plus-row { flex-wrap: wrap; }
  .plus-label > span { font-size: 0.85rem; }
  .plus-edit > span { display: none; }
  .stepper button { width: 32px; height: 32px; }
  .plus-hint { font-size: 0.75rem; }
  .plus-setting span { display: none; }
}

/* Around the page (overscroll, phone navigation bar): the darkened photo color, not the plain page color. */
body.has-bg { background: var(--photo-bg, var(--bg)); }
