:root {
  color-scheme: dark;
  --forest: #102b24;
  --forest-light: #183c31;
  --cream: #f7f0de;
  --red: #d84a3e;
  --red-dark: #b9362f;
  --gold: #efc873;
  --ink: #173028;
  --muted: #a7bbb1;
  --line: rgba(247, 240, 222, 0.16);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--forest); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 75% 5%, rgba(239, 200, 115, .09), transparent 25rem),
    linear-gradient(145deg, #0d251f, #15372d 60%, #102b24);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.snow {
  position: fixed; inset: 0; pointer-events: none; opacity: .22;
  background-image: radial-gradient(circle, #fff 1px, transparent 1.5px);
  background-size: 41px 41px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.topbar {
  width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0;
  display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line);
}
.brand { color: var(--cream); text-decoration: none; letter-spacing: .14em; font-size: .82rem; font-weight: 800; }
.brand span { color: var(--gold); margin-right: 8px; }
.tag { color: var(--muted); font: italic 1rem Georgia, serif; }
.admin-nav { display: flex; align-items: center; gap: 20px; }
.admin-nav[hidden] { display: none; }
.admin-nav a { color: var(--cream); text-decoration: none; font-size: .88rem; font-weight: 800; }
.admin-nav a:hover { color: var(--gold); }
.account { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .86rem; }
.account-avatar { color: var(--gold); font-size: .7rem; }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; min-height: calc(100vh - 155px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .75fr); gap: 7vw; align-items: center; padding: 64px 0 80px; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .2em; font-size: .74rem; font-weight: 800; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(3.2rem, 8vw, 7rem); line-height: .88; max-width: 720px; margin: 20px 0 28px; }
h1 em { color: var(--red); font-weight: inherit; }
.lead { color: #d1ddd6; font-size: clamp(1.05rem, 2vw, 1.25rem); line-height: 1.65; max-width: 640px; }
.rule { display: flex; gap: 10px; align-items: center; color: var(--cream); margin-top: 24px; font-size: .96rem; }
.rule span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--red); font-weight: 800; }

.card { position: relative; background: var(--cream); color: var(--ink); border-radius: 24px; padding: clamp(24px, 4vw, 42px); box-shadow: 0 28px 70px rgba(0,0,0,.24); }
.card::before { content: "✦"; position: absolute; top: -18px; right: 28px; display: grid; place-items: center; width: 42px; height: 42px; background: var(--red); color: white; border-radius: 50%; }
.card h2 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; margin-bottom: 12px; }
.hint { color: #66776f; line-height: 1.5; margin: 0 0 26px; }
label { display: block; font-size: .82rem; font-weight: 800; margin: 18px 0 8px; }
input, textarea { width: 100%; border: 1px solid #c9d0ca; background: white; color: var(--ink); border-radius: 12px; padding: 13px 14px; outline: none; font-size: 1rem; }
textarea { min-height: 92px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(216,74,62,.15); }
.people { display: grid; gap: 12px; margin-top: 16px; }
.person { display: grid; grid-template-columns: 1fr 36px; gap: 10px; align-items: center; padding: 12px; background: #e2eadf; border-radius: 16px; }
.single-badge { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; color: #397052; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.single-badge span { font-size: 1rem; line-height: 1; }
.icon-button { border: 0; background: transparent; color: #8d9993; font-size: 1.2rem; border-radius: 50%; width: 36px; height: 36px; }
.icon-button:hover { background: #e8e4d8; color: var(--red); }
.couple { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 10px; align-items: center; padding: 12px; background: #e9e3d5; border-radius: 16px; }
.couple .heart { grid-column: 1 / -1; color: var(--red); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 800; transition: transform .18s, background .18s; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--red); color: white; flex: 1; }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { background: #dfdacd; color: var(--ink); }
.button-ghost { background: transparent; color: var(--ink); border: 1px solid #bfc7c1; }
.login-actions { display: grid; grid-template-columns: 1fr; }
.button-register { background: transparent; color: var(--ink); border: 1px solid #bfc7c1; }
.button-register:hover { background: #ebe6da; }
.error { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: #f7d8d2; color: #842d28; line-height: 1.4; }

.page { padding: 64px 0 90px; max-width: 820px; margin: 0 auto; }
.page-head { text-align: center; margin-bottom: 38px; }
.page h1 { font-size: clamp(3rem, 8vw, 6rem); margin-left: auto; margin-right: auto; }
.links { display: grid; gap: 12px; margin-top: 24px; }
.link-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: white; border-radius: 14px; padding: 13px 14px; }
.link-name { font-weight: 800; }
.link-note { color: #6b7972; font-size: .84rem; margin-top: 3px; }
.copy { background: var(--forest); color: white; border: 0; border-radius: 999px; padding: 10px 15px; font-weight: 800; }
.copy.done { background: #3b7c63; }
.warning { margin-top: 22px; background: #fff3ca; border: 1px solid #ead18a; border-radius: 14px; padding: 14px 16px; color: #6c571d; line-height: 1.5; }
.gift-card { text-align: center; padding: clamp(32px, 7vw, 70px); overflow: hidden; }
.gift-card .closed { font-size: 5rem; margin: 8px 0 18px; }
.recipient { color: var(--red); font-family: Georgia, serif; font-size: clamp(3rem, 10vw, 6.5rem); line-height: .95; margin: 22px 0; overflow-wrap: anywhere; }
.secret-note { color: #6b7972; line-height: 1.55; }
.loading { padding: 120px 0; text-align: center; color: var(--muted); }
.login-card { max-width: 520px; justify-self: end; width: 100%; }
.lock { position: absolute; right: 28px; top: -18px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--red); color: white; border-radius: 50%; }
.dev-note { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid #d5d0c4; color: #6b7972; font-size: .85rem; }
.wide-page { max-width: 1120px; }
.admin-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.admin-bar h1 { margin: 12px 0 8px; }
.admin-bar .button-ghost { color: var(--cream); border-color: var(--line); flex: 0 0 auto; }
.compact-card { display: grid; grid-template-columns: .7fr 1.3fr; align-items: end; gap: 28px; margin-bottom: 34px; }
.compact-card h2 { font-size: 2rem; }
.compact-card .hint { margin-bottom: 0; }
.inline-create { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.event-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 28px; align-items: start; }
.event-list { display: grid; gap: 14px; }
.events-panel { scroll-margin-top: 24px; outline: none; }
#event-form { scroll-margin-top: 24px; }
.created-title { margin-top: 38px; }
.draft-list { display: grid; gap: 10px; }
.draft-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px solid rgba(239,200,115,.32); border-radius: 16px; background: rgba(239,200,115,.07); }
.draft-card strong, .draft-card small { display: block; }
.draft-card small { color: var(--muted); margin-top: 5px; }
.draft-badge { display: inline-block; margin-bottom: 7px; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 800; }
.draft-actions { display: flex; align-items: center; gap: 6px; }
.draft-actions .button { padding: 10px 14px; }
.draft-actions .icon-button { color: var(--muted); }
.success { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: #dcecdf; color: #275b3f; font-weight: 700; }
.event-card { position: relative; min-height: 220px; display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 20px; color: var(--cream); text-decoration: none; background: rgba(255,255,255,.035); transition: transform .18s, border-color .18s; }
.compact-event { min-height: 190px; }
.event-card:hover { transform: translateY(-3px); border-color: rgba(239,200,115,.55); }
.event-card h2 { font-size: 2rem; margin-top: 35px; }
.event-card p { color: var(--muted); }
.event-star { position: absolute; right: 22px; top: 20px; color: var(--gold); }
.open-label { margin-top: auto; font-size: .85rem; color: var(--gold); font-weight: 800; }
.empty { padding: 30px; border: 1px dashed var(--line); color: var(--muted); border-radius: 18px; text-align: center; grid-column: 1 / -1; line-height: 1.5; }
.back { color: var(--gold); font-size: .88rem; font-weight: 800; text-decoration: none; }
.round-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 28px; align-items: start; }
.dark-eyebrow { color: var(--red-dark); }
.form-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 14px; }
.form-grid textarea { min-height: 132px; line-height: 1.45; }
.card h3 { margin: 28px 0 0; font-family: Georgia, serif; font-size: 1.45rem; }
.section-title { margin: 8px 0 20px; }
.section-title h2 { font-size: 3rem; margin-top: 8px; }
.rounds { display: grid; gap: 12px; }
.round-card { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); overflow: hidden; }
.round-card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 20px; cursor: pointer; }
.round-card summary::-webkit-details-marker { display: none; }
.round-name { display: block; font-family: Georgia, serif; font-size: 1.35rem; }
.round-meta { display: block; color: var(--muted); margin-top: 5px; font-size: .85rem; }
.chevron { color: var(--gold); font-size: 1.4rem; transition: transform .2s; }
.round-card[open] .chevron { transform: rotate(180deg); }
.round-body { border-top: 1px solid var(--line); padding: 18px; }
.rule-box { color: #d7e1dc; line-height: 1.45; }
.rule-box p { color: var(--muted); margin: 5px 0 16px; white-space: pre-wrap; }
.round-body .link-row { color: var(--ink); }
.gift-rules { display: grid; gap: 10px; margin: 30px auto; max-width: 560px; text-align: left; }
.event-rules { display: grid; grid-template-columns: .7fr 1.3fr; gap: 10px; margin: 24px 0; }
.event-rules div { padding: 16px; border-radius: 14px; background: #e9e3d5; }
.event-rules span { display: block; color: #6b7972; text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 800; margin-bottom: 5px; }
.event-rules strong { white-space: pre-wrap; line-height: 1.45; }
.gift-rules div { padding: 16px; border-radius: 14px; background: #e9e3d5; }
.gift-rules span { display: block; color: #6b7972; text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 800; margin-bottom: 5px; }
.gift-rules strong { white-space: pre-wrap; line-height: 1.45; }
footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; gap: 42px; padding-top: 44px; }
  .hero-copy { text-align: center; }
  .rule { justify-content: center; }
  .couple { grid-template-columns: 1fr 36px; }
  .couple input { grid-column: 1; }
  .couple .icon-button { grid-column: 2; grid-row: 2 / span 2; }
  .link-row { grid-template-columns: 1fr; }
  .copy { width: 100%; }
  .login-card { justify-self: stretch; }
  .admin-bar { flex-direction: column; }
  .compact-card, .round-layout, .event-layout, .form-grid, .event-rules { grid-template-columns: 1fr; }
  .inline-create { grid-template-columns: 1fr; }
  .event-grid { grid-template-columns: 1fr; }
  .admin-nav { gap: 10px; }
  .account { padding: 7px 10px; }
  .draft-card { align-items: flex-start; flex-direction: column; }
  .draft-actions { width: 100%; }
  .draft-actions .button { flex: 1; }
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 16px; }
  .admin-nav { width: 100%; justify-content: space-between; gap: 8px; }
  .admin-nav a { font-size: .78rem; }
  .account { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
