:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --surface: #18181f;
  --surface-raised: #24242d;
  --text: #faf9ff;
  --muted: #b4b3c1;
  --line: #32323d;
  --accent: #f59e0b;
  --accent-text: #f59e0b;
  --on-accent: #0b0b10;
  --mint: #97e8c2;
  --coral: #ff9dba;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button, input, a { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, a, input { outline-offset: 5px; }
:focus-visible { outline: 2px solid var(--mint); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; object-fit: cover; }
h1, h2, p, figure { margin: 0; }
h1 { font-size: 34px; font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; }
h2, legend { font-size: 22px; font-weight: 650; line-height: 1.3; }
h2 { display: flex; align-items: center; gap: 12px; }
ul { list-style: none; padding: 0; margin: 0; }
.icon { width: 22px; height: 22px; flex: 0 0 22px; vertical-align: middle; }
.muted { color: var(--muted); }
.app-header {
  max-width: 760px; margin: auto; min-height: 80px; padding: max(16px, env(safe-area-inset-top)) 24px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: 19px; }
.brand img { flex: 0 0 36px; width: 36px; height: 36px; }
.header-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.main { width: 100%; max-width: 760px; margin: auto; padding: 26px 24px calc(140px + env(safe-area-inset-bottom)); }
.main:focus { outline: none; }
.bottom-nav {
  position: fixed; z-index: 10; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 8px max(16px, calc((100% - 712px) / 2)) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.bottom-nav a {
  min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; font-size: 12px; color: var(--muted); border-top: 2px solid transparent;
}
.bottom-nav a[aria-current="page"] { color: var(--accent-text); border-top-color: var(--accent-text); }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 30; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.offline-banner { position: sticky; top: 0; z-index: 20; padding: 10px 24px; text-align: center; font-size: 14px; background: #fae095; color: #17130b; }
.party-date { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.party-date .icon { color: var(--coral); }
.motto { color: var(--accent-text); font-size: 46px; line-height: 1.06; margin: 18px 0 28px; font-weight: 800; text-wrap: balance; }
.rsvp-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rsvp-button {
  display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 70px; padding: 14px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 700; font-size: 17px;
}
.rsvp-button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.rsvp-button[aria-pressed="false"] .icon { opacity: .5; }
.save-status { color: var(--muted); font-size: 14px; min-height: 28px; padding-top: 9px; }
.section { padding: 28px 0; border-top: 1px solid var(--line); }
.guests-section { margin-top: 24px; }
.count { font-size: 14px; font-weight: 600; color: var(--mint); }
.guest-list { display: flex; flex-wrap: wrap; gap: 18px 0; padding-top: 20px; }
.guest { flex: 0 0 48px; max-width: 48px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.guest .avatar { margin-right: -6px; border: 3px solid var(--bg); box-shadow: 7px 0 0 var(--bg); }
.guest + .guest { margin-left: -8px; }
.guest-name { font-size: 12px; max-width: 56px; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.avatar {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: var(--surface-raised);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  color: var(--mint); font-size: 15px; font-weight: 700; overflow: hidden;
}
.guest:nth-child(3n + 2) .avatar { color: var(--coral); }
.guest:nth-child(3n) .avatar { color: #fbd475; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-large { width: 96px; height: 96px; flex-basis: 96px; font-size: 28px; border: 1px solid var(--line); }
.question { padding: 26px 0 10px; margin: 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.question legend { float: left; padding: 0; width: 100%; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; clear: both; padding-top: 18px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; max-width: 100%;
  padding: 10px 16px 10px 12px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); cursor: pointer;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip-mark { width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid var(--muted); border-radius: 4px; display: grid; place-items: center; }
.chip-mark .icon { width: 14px; height: 14px; opacity: 0; }
.chip input[type="radio"] + .chip-mark { border-radius: 50%; }
.chip:has(input:checked) { border-color: var(--accent-text); color: var(--accent-text); }
.chip input:checked + .chip-mark { background: var(--accent); border-color: var(--accent-text); color: var(--on-accent); }
.chip input:checked + .chip-mark .icon { opacity: 1; }
.chip:has(input:focus-visible) { outline: 2px solid var(--mint); outline-offset: 4px; }
.chip-text { overflow-wrap: anywhere; min-width: 0; }
.question-status { display: block; min-height: 26px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.heading-emoji { margin-left: auto; font-size: 24px; }
.contribution-list { padding: 10px 0 20px; }
.contribution { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.contribution-detail { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.contribution-detail .muted { font-size: 13px; }
.contribution-text { overflow-wrap: anywhere; }
.contribution-empty { padding: 12px 0; }
.button { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 20px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; }
.primary { background: var(--accent); color: var(--on-accent); }
.secondary { background: var(--surface-raised); color: var(--text); border-color: var(--line); }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.icon-button:hover { color: var(--coral); background: var(--surface); }
.bring-form { display: flex; align-items: stretch; gap: 8px; }
input[type="text"] { width: 100%; min-width: 0; min-height: 54px; padding: 14px 16px; background: var(--surface); color: var(--text); border: 1px solid #53535f; border-radius: 8px; }
input::placeholder { color: var(--muted); opacity: 1; }
.field-label, .field > label { display: block; font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.add-button { flex: 0 0 auto; padding: 12px 16px; }
.message { font-size: 14px; color: var(--mint); border-left: 3px solid currentColor; padding: 10px 12px; margin: 16px 0; overflow-wrap: anywhere; }
.message.error { color: var(--coral); }
.party-page > .message { position: sticky; top: calc(var(--offline-height, 0px) + 12px); z-index: 3; background: var(--surface); }
.registration { max-width: 440px; margin: 0 auto; }
.registration .party-mark { display: block; margin-bottom: 16px; }
.registration h1 { font-size: 42px; }
.intro { color: var(--muted); margin-top: 12px; font-size: 18px; }
.profile-page { max-width: 440px; margin: auto; }
.profile-form { display: flex; flex-direction: column; gap: 24px; margin-top: 32px; }
.profile-form .message { margin: 0; }
.photo-picker { position: relative; display: flex; align-items: center; gap: 22px; cursor: pointer; min-height: 96px; align-self: flex-start; max-width: 100%; }
.photo-preview { display: block; flex: 0 0 96px; width: 96px; height: 96px; }
.photo-camera { position: absolute; top: 62px; left: 65px; width: 34px; height: 34px; display: grid; place-items: center; background: var(--mint); color: var(--bg); border: 3px solid var(--bg); border-radius: 50%; pointer-events: none; }
.photo-camera .icon { width: 17px; height: 17px; }
.photo-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-picker:has(input:focus-visible) { outline: 2px solid var(--mint); outline-offset: 5px; border-radius: 8px; }
.photo-label { font-weight: 600; color: var(--mint); }
.party-list { margin-top: 26px; }
.party-list-link { display: flex; align-items: center; gap: 16px; padding: 25px 0; border-top: 1px solid var(--line); min-height: 110px; }
.date-tile { flex: 0 0 58px; display: flex; flex-direction: column; align-items: center; border-left: 3px solid var(--party-color, var(--accent)); font-size: 13px; color: var(--muted); }
.date-tile strong { font-size: 30px; line-height: 1.2; color: var(--text); }
.party-list-detail { flex: 1; min-width: 0; }
.party-list-detail h2 { display: block; font-size: 23px; overflow-wrap: anywhere; margin-bottom: 8px; }
.party-list-detail time { font-size: 13px; }
.party-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.badge { font-size: 12px; color: var(--muted); }
.badge.yes { color: var(--mint); }
.badge.no { color: var(--coral); }
.empty-state { padding: 30px 0; }
.empty-state p { margin: 18px 0 24px; }
.empty-state .text-link { display: inline-flex; align-items: center; min-height: 48px; padding: 10px 16px; text-decoration: underline; }
.loading { padding: 32px 0; color: var(--muted); }
@media (hover: hover) {
  .rsvp-button:not([aria-pressed="true"]):hover, .chip:hover { border-color: var(--muted); }
  .party-list-link:hover h2 { color: var(--mint); }
  .button:hover { filter: brightness(1.1); }
}
@media (min-width: 680px) {
  .main { padding-top: 44px; }
  .motto { font-size: 64px; margin-bottom: 32px; }
  .rsvp-button { min-height: 80px; font-size: 20px; }
  .section { padding: 32px 0; }
  .registration, .profile-page { margin-top: 12px; }
}
@media (max-width: 360px) {
  .app-header { padding-left: 18px; padding-right: 18px; }
  .main { padding-left: 18px; padding-right: 18px; }
  .header-name { display: none; }
  .motto { font-size: 38px; }
  .rsvp-button { font-size: 15px; gap: 5px; }
  .rsvp-button .icon { width: 18px; flex-basis: 18px; }
  .party-list-link { gap: 10px; }
  .party-list-link > .icon { display: none; }
  .bring-form { flex-wrap: wrap; }
  .bring-form input { flex-basis: 100%; }
  .add-button { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .chip { transition: background-color .12s ease, border-color .12s ease; }
}

/* Host admin reuses the app's visual styles, never guest authentication. */
.admin-back { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 0; color: var(--mint); text-decoration: underline; }
.admin-page { min-width: 0; overflow-wrap: anywhere; }
.admin-page h1 { font-size: 30px; margin-bottom: 24px; }
.admin-page h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.admin-page h4 { margin: 0 0 12px; font-size: 16px; }
.admin-login { max-width: 440px; margin: auto; }
.admin-controls { border: 0; padding: 0; margin: 0; min-width: 0; width: 100%; }
.admin-form, .admin-fields { display: grid; gap: 20px; min-width: 0; }
.admin-form { margin-top: 24px; }
.admin-form .button { justify-self: start; max-width: 100%; white-space: normal; }
.admin-form .field { min-width: 0; }
.admin-form .message { margin: 0; }
.admin-form input[type="password"], .admin-form input[type="date"], .admin-form input[type="color"] {
  font: inherit; width: 100%; min-width: 0; min-height: 54px; padding: 12px 14px;
  color: var(--text); background: var(--surface); border: 1px solid #53535f; border-radius: 8px;
}
.admin-form input[type="color"] { height: 54px; padding: 8px; cursor: pointer; }
.admin-date-color { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 16px; }
.admin-heading { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.admin-heading h3 { flex: 1; min-width: 120px; }
.admin-heading .button { padding: 10px 14px; }
.admin-tools { display: flex; flex: 0 0 auto; gap: 4px; }
.admin-up .icon { transform: rotate(-90deg); }
.admin-down .icon { transform: rotate(90deg); }
.admin-hint { font-size: 14px; }
.admin-party-list { margin-top: 16px; }
.admin-party-row { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.admin-party-row h2 { font-size: 20px; }
.admin-party-row .button { flex: 0 0 auto; padding: 10px 14px; }
.admin-question { border-top: 1px solid var(--line); padding: 24px 0; }
.admin-type { border: 0; padding: 0; margin: 0; min-width: 0; }
.admin-type legend { font-size: 14px; font-weight: 600; }
.admin-type .chips { padding-top: 8px; }
.admin-options { display: grid; gap: 12px; min-width: 0; }
.admin-option-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: end; }
.admin-option-row .icon-button { margin-bottom: 5px; }
.admin-dashboard { display: grid; gap: 20px; margin-top: 24px; }
.admin-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.admin-counts dt { color: var(--muted); font-size: 14px; }
.admin-counts dd { margin: 4px 0 0; font-size: 28px; font-weight: 700; }
.admin-counts > :first-child dd { color: var(--mint); }
.admin-counts > :nth-child(2) dd { color: var(--coral); }
.admin-guests { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-guests li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-guests li > span:last-child { min-width: 0; }
.admin-tallies li + li { margin-top: 14px; }
.admin-tally-track { display: block; height: 8px; background: var(--surface-raised); margin-top: 6px; overflow: hidden; border-radius: 4px; }
.admin-tally-fill { display: block; height: 100%; background: var(--mint); }
.admin-tallies li:nth-child(2n) .admin-tally-fill { background: var(--coral); }
.admin-page button:disabled { cursor: not-allowed; }
@media (max-width: 400px) {
  .admin-date-color { grid-template-columns: minmax(0, 1fr); }
  .admin-date-color input[type="color"] { width: 110px; }
  .admin-guests { grid-template-columns: minmax(0, 1fr); }
  .admin-party-row { gap: 10px; }
  .admin-party-row .button .icon { display: none; }
}
