:root {
  --bg: #17142e; --bg2: #1f1b3d; --card: #272248; --card2: #302a58; --ink: #f6f1ea; --muted: #b3acc4; --line: #3d3669;
  --gold: #f2b33d; --red: #e2543a; --teal: #7bc4b8; --yes: #3f9d68; --maybe: #c9902a; --no: #6f6a85;
  --radius: 14px; --shadow: 0 6px 24px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.wrap { max-width: 680px; margin: 0 auto; padding: 16px 16px 110px; }
.av { width: 28px; height: 28px; display: block; flex: none; }

/* header */
header.top { background: var(--bg2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .wrap { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand h1 { margin: 0; font: 700 24px/1.1 Georgia, "Times New Roman", serif; letter-spacing: .5px; }
.brand h1 span { color: var(--gold); }
.me { display: flex; align-items: center; gap: 8px; }
.me .av { width: 32px; height: 32px; }
.me select { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; max-width: 150px; }
nav.tabs { display: flex; gap: 2px; }
nav.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; }
nav.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--gold); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 12px 0; }
.ws-head { display: flex; gap: 14px; align-items: flex-start; }
.datebox { flex: 0 0 58px; text-align: center; border-radius: 12px; background: var(--bg); padding: 6px 0; border: 1px solid var(--line); }
.datebox .d { font: 700 24px/1 Georgia, serif; color: var(--gold); }
.datebox .m, .datebox .w { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.ws-main { flex: 1; min-width: 0; }
.ws-title { font-weight: 700; margin: 0 0 2px; font-size: 17px; }
.ws-meta { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; color: #2b2540; background: var(--gold); border-radius: 999px; padding: 2px 9px; margin-left: 6px; vertical-align: 2px; }
.ws-notes { font-size: 14px; margin-top: 10px; white-space: pre-wrap; color: #e3dcf2; }
.roles { display: grid; gap: 8px; margin-top: 12px; font-size: 14px; }
.role { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role .lbl { flex: 0 0 92px; color: var(--muted); }
.role .none { color: var(--red); font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px 2px 3px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); }
.chip b { font-weight: 700; letter-spacing: .5px; }
.chip .av { width: 24px; height: 24px; }
.chip.yes { background: #1f4a37; border-color: #2f7a55; }
.chip.maybe { background: #54401a; border-color: #8c6a24; }
.chip.no { opacity: .55; text-decoration: line-through; }
.chip.open { border-style: dashed; color: var(--muted); }
.chip.big { font-size: 15px; padding: 4px 14px 4px 4px; cursor: pointer; }
.chip.big .av { width: 32px; height: 32px; }
.people { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.count { font-size: 13px; color: var(--muted); margin-top: 12px; }

.rsvp { display: flex; gap: 6px; margin-top: 12px; }
.rsvp button { flex: 1; border: 1.5px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 9px 4px; cursor: pointer; font-weight: 600; font-size: 14px; }
.rsvp button.on[data-s="yes"] { background: var(--yes); border-color: var(--yes); }
.rsvp button.on[data-s="maybe"] { background: var(--maybe); border-color: var(--maybe); color: #1d1a24; }
.rsvp button.on[data-s="no"] { background: var(--no); border-color: var(--no); }

.row-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; text-decoration: underline; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { color: #ff9b86; }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.fab { position: fixed; right: max(16px, calc(50% - 324px)); bottom: calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 8px 24px rgba(226,84,58,.45); border-radius: 999px; padding: 14px 22px; z-index: 6; }

.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
h2.section { font: 700 19px Georgia, serif; margin: 26px 0 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0; }
.pickme { text-align: center; }
.pickme .people { justify-content: center; }

table.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stats th, table.stats td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.stats th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.stats .n { text-align: right; font-variant-numeric: tabular-nums; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
details.card summary { cursor: pointer; font-weight: 600; }
.loglist { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.loglist li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.loglist b { color: var(--ink); }

/* forms */
form.stack, .stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
input, select, textarea { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg2); width: 100%; color-scheme: dark; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.err { color: #ff9b86; font-size: 14px; min-height: 1.2em; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100% - 24px)); background: var(--card); color: var(--ink); box-shadow: 0 24px 70px rgba(0,0,0,.55); max-height: 92vh; }
dialog::backdrop { background: rgba(10,8,24,.65); }
dialog .inner { padding: 20px; }
dialog h3 { margin: 0 0 4px; font: 700 21px Georgia, serif; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
fieldset.avpicker { border: 0; padding: 0; margin: 0; }
fieldset.avpicker legend { font-size: 14px; font-weight: 600; margin-bottom: 6px; padding: 0; }
#avGrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avpick { position: relative; cursor: pointer; border-radius: 50%; padding: 3px; border: 3px solid transparent; }
.avpick input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.avpick .av { width: 100%; height: auto; }
.avpick:has(input:checked) { border-color: var(--gold); }
.avpick:has(input:focus-visible) { outline: 2px solid var(--gold); }

.toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); background: #fff; color: #1d1a24; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; pointer-events: auto; }
.toast .link { color: #b3302a; font-weight: 700; }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); text-align: center; }
.login-logo { width: 92px; height: 92px; margin: 0 auto 6px; display: block; }
.login-card h1 { font: 700 32px Georgia, serif; margin: 0 0 4px; }
.login-card form { display: grid; gap: 12px; margin-top: 18px; text-align: left; }

/* splash */
#splash { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; transition: opacity .5s; }
#splash.out { opacity: 0; pointer-events: none; }
#logo3d { width: min(100%, 640px); height: 46vh; opacity: 0; }
.sp-text { text-align: center; padding: 0 24px; max-width: 560px; opacity: 0; transform: translateY(12px); }
.sp-label { color: var(--gold); text-transform: uppercase; letter-spacing: 3px; font-size: 12px; font-weight: 700; }
.sp-suggest { font: 700 clamp(20px, 5vw, 28px)/1.25 Georgia, serif; margin: 8px 0 14px; }
.sp-tap { font-size: 12px; color: var(--muted); }
.curtain { position: absolute; top: 0; bottom: 0; width: 51%; z-index: 2; background:
  repeating-linear-gradient(90deg, #b3302a 0 26px, #9c2822 26px 38px); box-shadow: inset 0 -30px 40px rgba(0,0,0,.35); }
.curtain.l { left: 0; border-right: 2px solid #5a1410; }
.curtain.r { right: 0; border-left: 2px solid #5a1410; }
#splash.go .curtain.l { transform: translateX(-102%); transition: transform 1.2s cubic-bezier(.7,0,.2,1) .3s; }
#splash.go .curtain.r { transform: translateX(102%); transition: transform 1.2s cubic-bezier(.7,0,.2,1) .3s; }
#splash.go #logo3d { opacity: 1; transition: opacity .8s 1s; }
#splash.go .sp-text { opacity: 1; transform: none; transition: opacity .6s 1.6s, transform .6s 1.6s; }
@media (prefers-reduced-motion: reduce) { #splash { display: none !important; } }
