:root {
  --cream: #FBF6E6;
  --sage: #EEF0D6;
  --olive: #6E7043;
  --olive-dark: #5F6133;
  --line: #A9AB7A;
  --line-soft: #D9DBB8;
  --rose: #8E4A55;
  --ink: #4A4B2E;
  --muted: #5F6040;
  --blush: #F3C9C4;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: Nunito, system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: var(--rose); font-weight: 700; }
a:hover { color: #6F3641; }
.script { font-family: 'Delius Swash Caps', cursive; font-weight: 400; }
.rose { color: var(--rose); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.media { position: relative; }
.media img, .media video { display: block; width: 100%; height: auto; }
.sound-btn { position: absolute; right: 12px; bottom: 12px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 22px; background: rgba(74, 75, 46, 0.85); color: #fff; font: inherit; font-weight: 700; }
.jump { padding: 20px 24px 8px; display: flex; flex-direction: column; gap: 10px; }
.jump p { margin: 0; }

.panel { padding: 14px; }
.panel-full { flex: 1; display: flex; }
.panel-full .frame { flex: 1; justify-content: center; }
.frame { border: 2px solid var(--line); border-radius: 20px; background: var(--sage); padding: 36px 20px 24px; display: flex; flex-direction: column; gap: 24px; }
.head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.head p { margin: 0; }
.head h1 { margin: 0; font-size: 40px; line-height: 1.1; color: var(--olive-dark); }
.head .script.rose { font-size: 18px; }
.heart { width: 72px; height: 72px; border-radius: 50%; background: var(--blush); color: var(--rose); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }

.form { display: flex; flex-direction: column; gap: 18px; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 700; }
input[type=text], input[type=password], input[type=url], input[type=datetime-local], textarea { width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--cream); color: var(--ink); font: inherit; }
input[type=file] { font: inherit; max-width: 100%; }
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; }
.choice { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--cream); font-weight: 600; cursor: pointer; }
.choice:has(input:checked) { border: 2px solid var(--olive); }
.choice input, .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--olive); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 24px; border-radius: 28px; font-family: 'Delius Swash Caps', cursive; font-size: 20px; font-weight: 400; text-decoration: none; cursor: pointer; text-align: center; }
.btn-solid { border: 0; background: var(--olive); color: #fff; }
.btn-solid:hover { background: var(--olive-dark); color: #fff; }
.btn-line { border: 1.5px solid var(--olive); background: transparent; color: var(--olive-dark); font-size: 18px; }
.btn-line:hover { background: var(--cream); color: var(--olive-dark); }
.btn-danger { border: 0; background: #8E2F3C; color: #fff; }
.btn-small { min-height: 44px; padding: 0 16px; font-family: Nunito, sans-serif; font-size: 15px; font-weight: 700; }
.link-btn { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--rose); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-direction: column; gap: 12px; }

.note, .flash { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--cream); border: 1px solid var(--line); font-size: 15px; }
.flash-error { border-color: #8E2F3C; color: #7A2431; }
.flash-ok { border-color: var(--olive); }

.summary { margin: 0; padding: 4px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--cream); }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.summary div:last-child { border-bottom: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; text-align: right; }

/* front of the card: card + RSVP button fit in the visible screen (svh = height with Safari's bars showing) */
.face-front { display: flex; flex-direction: column; height: 100vh; height: 100svh; min-height: 440px; }
.face-front .media { flex: 1 1 auto; min-height: 0; }
.face-front .media img, .face-front .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.face-front .jump { flex: none; padding: 14px 24px calc(28px + env(safe-area-inset-bottom, 0px)); gap: 6px; }

/* card flip (only when JavaScript is on; otherwise the RSVP link scrolls) */
.js-flip { perspective: 1600px; }
.js-flip .flipper { display: grid; transform-style: preserve-3d; transition: transform 0.8s cubic-bezier(.22,.8,.24,1); }
.js-flip .face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--cream); }
.js-flip .face-back { transform: rotateY(180deg); }
.js-flip.flipped .flipper { transform: rotateY(180deg); }
.js-flip.no-anim .flipper { transition: none; }
/* back of the card: the form fits the visible screen; scrolls inside only if a message makes it taller */
.face-back { display: flex; flex-direction: column; height: 100vh; height: 100svh; min-height: 440px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.face-back .panel { flex: 1 0 auto; display: flex; padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
.face-back .frame { flex: 1; justify-content: center; padding: 18px 16px 16px; gap: 14px; }
.face-back .head { gap: 4px; }
.face-back .head h1 { font-size: 32px; }
.face-back .head .script.rose { font-size: 16px; }
.face-back .form { gap: 10px; }
.face-back fieldset { gap: 8px; }
.face-back legend { margin-bottom: 6px; }
.face-back .field { gap: 4px; }
.face-back .choice, .face-back input[type=text] { min-height: 46px; }
.face-back .btn { min-height: 52px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .js-flip .flipper { transition: none; } }

/* admin */
.admin-wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 20px; }
.admin-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.admin-top h1 { margin: 0; font-size: 30px; color: var(--olive-dark); }
.admin-top p { margin: 4px 0 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row form { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--sage); display: flex; flex-direction: column; }
.stat .num { font-size: 34px; font-weight: 700; line-height: 1.1; color: var(--olive-dark); }
.stat .lbl { font-size: 14px; color: var(--muted); }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--sage); display: flex; flex-direction: column; gap: 16px; }
.card h2 { margin: 0; font-size: 20px; }
.card p { margin: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.card.danger { border-color: #8E2F3C; }
.chip { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--cream); color: var(--ink); text-decoration: none; font-size: 15px; }
.chip.on { border: 2px solid var(--olive); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td form { margin: 0; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.tag-yes { background: #DDE3B4; color: #3F4220; }
.tag-no { background: var(--blush); color: #6F2A36; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .stat .num { font-size: 28px; } .admin-top h1 { font-size: 24px; } }
