:root {
  --bg: #fdf6ec;
  --surface: #ffffff;
  --ink: #2b1a1f;
  --muted: #7d6a6f;
  --accent: #7a1f3d;       /* maroon */
  --accent-ink: #ffffff;
  --gold: #d99a1e;
  --line: #ecdccb;
  --chosen: #fff4dc;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- name screen ---------- */
.name-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(circle at top, #fbe3b8, var(--bg) 60%);
}
.name-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 10px 30px rgba(122, 31, 61, .12);
  text-align: center;
}
.diya { font-size: 48px; }
.name-card h1 { margin: 6px 0 4px; color: var(--accent); font-size: 26px; }
.name-card p { margin: 0 0 20px; color: var(--muted); }
.name-card form { display: grid; gap: 10px; text-align: left; }
.name-card label { font-size: 14px; color: var(--muted); }
.name-card input {
  font-size: 17px;   /* ≥16px stops iOS zooming into the field */
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.name-card input:focus { border-color: var(--accent); }

.btn-primary {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 17px;
}
.btn-ghost {
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
}
.btn-ghost:disabled { visibility: hidden; }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 8px 0; min-height: 44px; }

/* ---------- top bar + event tabs ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--accent);
  color: var(--accent-ink);
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 16px 0;
  max-width: 720px;
  margin: 0 auto;
}
.topbar .link-btn { color: #fbe3b8; }
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
  max-width: 720px;
  margin: 0 auto;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .35);
  background: transparent;
  color: var(--accent-ink);
  white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: #2b1a1f; font-weight: 600; }
.tab .tick { margin-left: 4px; }

/* ---------- sections (Entry / Stage / Decor) ---------- */
.section-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 10px; }
.chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.category { scroll-margin-top: 110px; /* clears the sticky header */ }
.category + .category { margin-top: 28px; }
.category-title {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.category-title::after { content: ''; flex: 1; height: 1.5px; background: var(--line); }

/* ---------- options ---------- */
.content { max-width: 720px; margin: 0 auto; padding: 16px; }
.event-title { margin: 4px 0 2px; font-size: 24px; color: var(--accent); }
.event-hint { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

.options { display: grid; gap: 16px; }
@media (min-width: 640px) { .options { grid-template-columns: 1fr 1fr; } }

.option {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.option.chosen { border-color: var(--gold); background: var(--chosen); }

/* Media strip: one item fills the width; several swipe sideways with scroll-snap. */
.media {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: #1b1014;
  scrollbar-width: none;
}
.media::-webkit-scrollbar { display: none; }
.media > * {
  flex: 0 0 100%;
  scroll-snap-align: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 0;
  display: block;
}
/* Photos keep their own shape (stage shots are landscape) instead of being cropped to 4:5. */
.media > img { aspect-ratio: auto; height: auto; max-height: 75vh; object-fit: contain; align-self: center; }
.media > iframe { aspect-ratio: 9 / 16; max-height: 70vh; }
.media > video { aspect-ratio: 9 / 16; max-height: 75vh; object-fit: contain; background: #000; }
.media-count { font-size: 12px; color: var(--muted); padding: 6px 14px 0; }
.placeholder {
  display: grid !important;
  place-items: center;
  aspect-ratio: 16 / 9 !important;
  background: linear-gradient(135deg, #fbe3b8, #f3b6c4);
  color: var(--accent);
  font-size: 40px;
}

.option-body { padding: 12px 14px 14px; display: grid; gap: 10px; }
.option-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.option-title { margin: 0; font-size: 18px; }
.option-note { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); transition: width .3s; }

.vote-btn { width: 100%; }
.option.chosen .vote-btn { background: var(--gold); color: #2b1a1f; }

.voters { display: flex; flex-wrap: wrap; gap: 6px; }
.voter {
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f6ebe0;
  color: var(--ink);
}
.voter.me { background: var(--accent); color: var(--accent-ink); }

.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 18px; }

/* ---------- suggestions ---------- */
.notes { border-top: 1px dashed var(--line); padding-top: 6px; }
.notes summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}
.notes summary::-webkit-details-marker { display: none; }
.notes summary::after { content: '▾'; margin-left: auto; transition: transform .2s; }
.notes[open] summary::after { transform: rotate(180deg); }
.notes-count { color: var(--muted); font-weight: 400; }
.note-list { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 8px; }
.note-list li { background: #f6ebe0; border-radius: 12px; padding: 8px 12px; position: relative; }
.note-list strong { font-size: 13px; }
.note-list p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-del {
  position: absolute; top: 4px; right: 6px;
  border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px 6px;
}
.note-form { display: flex; gap: 8px; align-items: flex-end; }
.note-form textarea {
  flex: 1;
  font: inherit;
  font-size: 16px;   /* ≥16px stops iOS zooming into the field */
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  min-width: 0;
}
.note-form textarea:focus { outline: none; border-color: var(--accent); }
.section-notes {
  margin-top: 16px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-top-style: solid;
  border-radius: var(--radius);
  padding: 6px 14px 10px;
}

.pager { display: flex; justify-content: space-between; margin: 20px 0 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  transition: transform .25s;
  max-width: calc(100% - 32px);
  text-align: center;
  z-index: 10;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #b3261e; }
