:root {
  --bg: #faf6f1;
  --fg: #3a322e;
  --muted: #8a7a74;
  --line: rgba(58, 50, 46, 0.10);
  --accent: #c4a07a;
  --accent-2: #d9a8a8;
  --glass: rgba(255, 255, 255, 0.62);
  --radius: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: Manrope, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.wash {
  pointer-events: none;
  position: fixed;
  inset: -18%;
  z-index: 0;
  background:
    radial-gradient(50% 42% at 18% 10%, rgba(217, 168, 168, 0.28), transparent 58%),
    radial-gradient(44% 38% at 88% 16%, rgba(196, 160, 122, 0.22), transparent 52%),
    radial-gradient(40% 46% at 62% 92%, rgba(232, 214, 200, 0.55), transparent 58%),
    #faf6f1;
  filter: blur(12px);
  animation: washShift 18s ease-in-out infinite alternate;
}

@keyframes washShift {
  to { transform: translate3d(3%, -3%, 0) scale(1.04); }
}

#petals {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.cover, .invite, .scene-evening { position: relative; z-index: 2; }

.cover {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(36px, env(safe-area-inset-bottom));
  gap: 6px;
  transition: opacity 0.7s ease, transform 0.7s ease, filter 0.7s ease;
}

.cover.is-open {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(10px);
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
  animation: rise 0.9s ease both;
}

.cover-date {
  font-family: Unbounded, sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 4vw, 22px);
  letter-spacing: 0.28em;
  color: var(--accent);
  margin-top: 16px;
  animation: rise 1s 0.08s ease both;
}

.cover-title {
  font-family: Unbounded, sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 14vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.05em;
  color: #3a322e;
  animation: rise 1s 0.16s ease both;
}

.cover-join {
  width: min(560px, 94vw);
  margin: 22px 0 8px;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  animation: rise 1s 0.28s ease both;
}

.who {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: clamp(18px, 3.8vw, 26px);
  color: #5c504a;
  cursor: pointer;
  padding: 12px 2px;
  min-height: 48px;
  white-space: nowrap;
}

.who-a { text-align: right; }
.who-b { text-align: left; color: #a57c7c; }
.who.is-from { color: #3a322e; }
.who.is-to { color: #8a5555; }

.rail {
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.rail-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c4a07a;
  box-shadow: 0 0 0 7px rgba(196, 160, 122, 0.18);
  flex: 0 0 auto;
  z-index: 1;
  animation: knobPulse 1.7s ease-in-out infinite;
}

.rail-track {
  flex: 1;
  height: 3px;
  margin: 0 2px;
  border-radius: 99px;
  background: repeating-linear-gradient(
    90deg,
    rgba(196, 160, 122, 0.85) 0 7px,
    transparent 7px 14px
  );
  position: relative;
  overflow: hidden;
}

.rail-fill {
  position: absolute;
  left: 0;
  top: -3px;
  height: 9px;
  width: 0%;
  background: #a57c52;
  border-radius: 99px;
}

.rail-chev {
  position: absolute;
  left: 54%;
  top: 50%;
  transform: translate(-50%, -58%);
  color: #c4a07a;
  font-size: 34px;
  line-height: 1;
  font-weight: 300;
  pointer-events: none;
  animation: chevSlide 1.5s ease-in-out infinite;
}

.cover-join.is-drawing .rail-chev,
.cover-join.is-drawing .rail-knob {
  animation: none;
}

.rail-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #d9a8a8;
  flex: 0 0 auto;
}

.instruction {
  margin-top: 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  animation: rise 1s 0.4s ease both;
}

.hold-progress {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.invite {
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: safe center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.invite[hidden] { display: none !important; }
.invite.show .card { animation: cardIn 0.85s cubic-bezier(.16,1,.3,1) both; }

.card {
  width: min(440px, 100%);
  padding: 28px 24px 26px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,250,246,.78));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(90, 60, 50, 0.10);
  backdrop-filter: blur(20px);
}

.card-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }

.pill {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #4a3230;
  font-weight: 700;
}

.pill.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.card h2 {
  font-family: Unbounded, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin: 10px 0 28px;
}

.card h2 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent-2);
}

.time-block { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.time {
  font-family: Unbounded, sans-serif;
  font-weight: 800;
  font-size: 64px;
  letter-spacing: -0.06em;
  line-height: 1;
}
.time-label { font-size: 14px; color: var(--muted); }
.place-name { font-weight: 700; font-size: 18px; }
.place-addr { color: var(--muted); margin-top: 4px; }
.map {
  display: inline-block;
  margin-top: 8px;
  color: #a57c52;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 28px 0 22px;
}

.countdown div {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 4px 10px;
  text-align: center;
}

.countdown b {
  display: block;
  font-family: Unbounded, sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.countdown span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.actions { display: flex; justify-content: center; align-items: center; }
.actions .btn { width: auto; min-width: 200px; padding: 14px 40px; }
.card-note { margin-top: 12px; text-align: center; font-size: 13px; color: var(--muted); }

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  padding: 14px 16px;
  min-height: 48px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn.fill {
  background: var(--fg);
  color: var(--bg);
  border-color: transparent;
}

.btn.ghost { background: rgba(58, 50, 46, 0.04); }

.scene-evening {
  min-height: 100svh;
  padding: 20px 20px 64px;
  max-width: 980px;
  margin: 0 auto;
}

.eve-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 28px;
}

.eve-header p {
  font-family: Unbounded, sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}

.back {
  justify-self: start;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.eve-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
}

.panel h3 {
  font-family: Unbounded, sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.panel-lead {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
  color: var(--muted);
}

#garden {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background: #e8ddd4;
  border: 1px solid var(--line);
}

.star-caption { margin-top: 10px; font-size: 13px; color: var(--muted); }

form label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  outline: none;
}

input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.form-hint { margin: -4px 0 12px; font-size: 13px; color: #a57c52; }
form .btn { width: 100%; margin-top: 4px; }

.candelabra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.candle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulse 1.6s ease-in-out infinite;
}

.wishes {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.wish-card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  font-size: 15px;
}

.wish-card b {
  display: block;
  font-family: Unbounded, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #a57c52;
  margin-bottom: 6px;
}

.eve-foot {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.modal, .toast-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden], .toast-overlay[hidden], [hidden] { display: none !important; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(58, 50, 46, 0.28); }
.ticket-wrap { position: relative; z-index: 1; }

.ticket {
  display: flex;
  width: min(560px, 92vw);
  min-height: 200px;
  background: #fffaf6;
  color: var(--fg);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.ticket.for-pdf {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 40;
  width: 720px !important;
  min-height: 280px;
  flex-direction: row !important;
  border-radius: 0;
  opacity: 1;
}

.ticket.for-pdf .stub {
  width: 140px !important;
  min-height: 280px;
  flex-direction: column !important;
}
.ticket.for-pdf .ticket-body { padding: 28px 32px; }

.stub {
  width: 128px;
  background: var(--accent-2);
  color: #4a3230;
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.stub-kicker { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 700; }
.stub-mono { font-family: Unbounded, sans-serif; font-size: 22px; font-weight: 800; }
.serial { font-size: 11px; font-weight: 700; }

.barcode {
  width: 80%;
  height: 28px;
  background: repeating-linear-gradient(90deg, #3a322e 0 2px, transparent 2px 4px, #3a322e 4px 5px, transparent 5px 8px);
}

.ticket-body { padding: 22px 24px; flex: 1; }
.tk { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); }
.ticket-body h3 {
  font-family: Unbounded, sans-serif;
  font-size: 40px;
  letter-spacing: -0.05em;
  font-weight: 800;
}
.tk-name { font-size: 22px; font-weight: 700; margin: 4px 0 12px; }
.ticket-body ul { list-style: none; color: var(--muted); font-size: 15px; line-height: 1.6; }
.tk-guest { margin-top: 12px; font-size: 13px; color: #a57c52; }
.ticket-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }

.toast-overlay { background: rgba(58, 50, 46, 0.32); }
.toast-card {
  max-width: 420px;
  text-align: center;
  padding: 32px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fffaf6;
}
.toast-kicker { letter-spacing: 0.32em; text-transform: uppercase; font-size: 11px; color: #a57c52; margin-bottom: 14px; }
.toast-text { font-size: 18px; line-height: 1.5; margin-bottom: 22px; }

@keyframes knobPulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(196, 160, 122, 0.18); }
  50% { box-shadow: 0 0 0 11px rgba(196, 160, 122, 0.08); }
}
@keyframes chevSlide {
  0%, 100% { transform: translate(-70%, -58%); opacity: 0.4; }
  50% { transform: translate(-18%, -58%); opacity: 1; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse {
  50% { transform: scale(0.75); opacity: 0.6; }
}

@media (max-width: 720px) {
  .eve-grid { grid-template-columns: 1fr; }
  .ticket { flex-direction: column; width: 100%; }
  .stub { width: 100%; flex-direction: row; min-height: 72px; }
  .stub-mono { font-size: 20px; }
  .modal, .toast-overlay {
    padding: 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    align-items: end;
  }
  .toast-card { width: 100%; padding: 24px 18px; }
  .ticket-actions { width: 100%; }
  .ticket-actions .btn { flex: 1; }
}
@media (max-width: 560px) {
  .cover-join {
    flex-direction: column;
    min-height: 168px;
    gap: 8px;
  }
  .who-a, .who-b { text-align: center; }
  .who-hint { display: none; }
}
@media (max-width: 380px) { .time { font-size: 44px; } }
@media (max-height: 720px) {
  .cover { gap: 4px; }
  .cover-title { font-size: clamp(40px, 12vh, 64px); }
  .cover-join { margin: 8px 0; min-height: 88px; }
  .instruction { margin-top: 12px; }
}
@media (pointer: coarse) {
  .btn { min-height: 52px; }
  .map { padding: 8px 0; display: inline-block; }
}
@media print {
  body * { visibility: hidden; }
  .ticket, .ticket * { visibility: visible; }
  .ticket { position: absolute; left: 0; top: 0; }
  .ticket-actions, .modal-backdrop { display: none !important; }
}
