:root {
  --pine-deep: #1c3b2b;
  --berry-red: #a8202a;
  --cream-warm: #fcf6e8;
  --cinnamon: #874621;
  --mistletoe: #6b8e6f;
  --pine-soft: #274d39;
  --berry-dark: #841820;
  --gold-accent: #d8a84e;
  --surface-card: #ffffff;
  --text-primary: #1c3b2b;
  --text-muted: #536b5e;
  --border-festive: #e8ded0;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Mitr", sans-serif;
  --ease-warm: cubic-bezier(.33, 1, .68, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  background-color: #14281e;
}

body {
  font-family: var(--font-body);
  background-color: #14281e;
  color: var(--text-primary);
  line-height: 1.65;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Mobile Frame Container */
.app-viewport {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background-color: var(--cream-warm);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

/* Canvas Snowfall Ambient (T67) */
canvas.snowfall {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

/* Floating Controls (Top Nav) */
.top-nav {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 1000;
}

.nav-btn {
  background: rgba(28, 59, 43, 0.88);
  color: var(--cream-warm);
  border: 1px solid rgba(252, 246, 232, 0.35);
  padding: 7px 13px;
  border-radius: 99px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.nav-btn:hover {
  transform: scale(1.05);
  background: var(--pine-deep);
}

/* Bilingual text toggle */
[data-l] {
  display: inline;
}

html[lang="th"] [data-l="en"] {
  display: none !important;
}

html[lang="en"] [data-l="th"] {
  display: none !important;
}

/* Hero Section (100dvh Lock Screen) */
.hero-section {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 20px 40px;
  text-align: center;
  background: radial-gradient(circle at 50% 30%, #264a37 0%, #1c3b2b 60%, #12241b 100%);
  color: var(--cream-warm);
  position: relative;
  box-sizing: border-box;
}

.badge-tag {
  display: inline-block;
  background: var(--berry-red);
  color: var(--cream-warm);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(168, 32, 42, 0.35);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
  color: #fffaf0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.hero-subtitle {
  font-size: 14px;
  color: #d8e5dc;
  font-weight: 300;
  max-width: 32ch;
  margin-inline: auto;
  text-wrap: balance;
  line-height: 1.6;
  margin-bottom: 18px;
}

.hero-subtitle .phrase {
  display: inline-block;
}

/* Tactile Layered SVG Gift Box */
.gift-box-stage {
  margin: 10px auto 20px;
  width: 220px;
  height: 230px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.4s var(--ease-warm);
}

.gift-box-stage:hover {
  transform: scale(1.03);
}

.gift-box-stage.wobble {
  animation: giftWobble 0.7s var(--ease-warm);
}

@keyframes giftWobble {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.04) rotate(-3deg); }
  50% { transform: scale(1.02) rotate(3deg); }
  75% { transform: scale(1.04) rotate(-1.5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.gift-lid-group {
  transition: transform 0.65s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.45s ease;
  transform-origin: 120px 80px;
}

/* Popped Lid: Fades & shifts cleanly without colliding with subtitle */
.box-opened .gift-lid-group {
  transform: translateY(-40px) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

.box-opened .gift-box-stage {
  cursor: default;
}

.unwrap-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--pine-deep);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 99px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  border: 1px dashed var(--berry-red);
  transition: transform 0.2s, background-color 0.2s;
}

.unwrap-hint:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

/* Fold Reveal Invitation Card (T77) */
.fold-reveal {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: scale(0.96) translateY(20px);
  transition: opacity 0.8s var(--ease-warm), max-height 0.9s var(--ease-warm), transform 0.8s var(--ease-warm);
}

.fold-reveal.revealed {
  opacity: 1;
  max-height: 5000px;
  transform: scale(1) translateY(0);
}

/* Card Content Layout */
.content-wrapper {
  padding: 18px 18px 40px;
}

.card-block {
  background: var(--surface-card);
  border-radius: 18px;
  padding: 24px 20px;
  margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(28, 59, 43, 0.08);
  border: 1px solid var(--border-festive);
}

.block-header {
  text-align: center;
  margin-bottom: 18px;
}

.block-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--pine-deep);
  font-weight: 700;
  margin-bottom: 4px;
}

.block-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Countdown Card (T60) */
.countdown-box {
  background: linear-gradient(135deg, var(--pine-deep) 0%, #29543e 100%);
  color: var(--cream-warm);
  border-radius: 18px;
  padding: 22px 18px;
  margin-bottom: 22px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(28, 59, 43, 0.18);
  border: 1px solid rgba(252, 246, 232, 0.15);
}

.countdown-title {
  font-size: 13px;
  letter-spacing: 0.05em;
  opacity: 0.92;
  margin-bottom: 16px;
  font-weight: 400;
  text-wrap: balance;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.count-unit {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 10px 8px;
  min-width: 64px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.count-val {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: #fffaf0;
}

.count-lbl {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

/* Bento Highlights Grid (T28) */
.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.bento-item {
  background: var(--surface-card);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 6px 20px rgba(28, 59, 43, 0.06);
  border: 1px solid var(--border-festive);
  display: flex;
  flex-direction: column;
}

.bento-item.full-span {
  grid-column: span 2;
}

.bento-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.bento-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--pine-deep);
  margin-bottom: 6px;
}

.bento-text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.highlight-draw {
  font-weight: 600;
  color: var(--cinnamon);
}

.swatch-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Schedule Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 12px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 36px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e2d7c5;
}

.time-item {
  display: flex;
  gap: 14px;
  position: relative;
}

.time-stamp {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--berry-red);
  background: var(--cream-warm);
  padding: 4px 8px;
  border-radius: 6px;
  height: fit-content;
  white-space: nowrap;
  border: 1px solid #ebdcc8;
  z-index: 1;
}

.time-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--pine-deep);
  margin-bottom: 2px;
}

.time-detail {
  font-size: 12px;
  color: var(--text-muted);
}

/* Venue Section */
.venue-box {
  background: #f7f3e8;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border-left: 4px solid var(--pine-deep);
}

.venue-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--pine-deep);
  margin-bottom: 4px;
}

.venue-address {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.venue-note {
  font-size: 11px;
  color: var(--cinnamon);
}

.map-action-wrap {
  margin-top: 10px;
}

.map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  background: var(--pine-deep);
  color: var(--cream-warm);
  text-decoration: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(28, 59, 43, 0.2);
  transition: transform 0.2s, background-color 0.2s;
}

.map-btn:hover {
  transform: translateY(-1px);
  background: var(--pine-soft);
}

/* RSVP Form & Attend / Decline Toggle */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--pine-deep);
  margin-bottom: 6px;
}

/* Segmented Attend / Decline Selector */
.attendance-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.attend-btn {
  background: #fbf8f0;
  border: 1.5px solid #dfd6c6;
  color: var(--text-muted);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.attend-btn:hover {
  border-color: var(--pine-soft);
  background: #f5eedf;
}

.attend-btn.active {
  background: var(--pine-deep);
  color: #fffaf0;
  border-color: var(--pine-deep);
  box-shadow: 0 3px 10px rgba(28, 59, 43, 0.22);
}

.attend-btn.active .attend-icon {
  transform: scale(1.1);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d4c8b6;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  background: #fffdf9;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--pine-deep);
  box-shadow: 0 0 0 3px rgba(28, 59, 43, 0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

.char-counter {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.consent-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--pine-deep);
}

.privacy-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 11.5px;
  font-family: var(--font-body);
  color: var(--berry-red);
  text-decoration: underline;
  cursor: pointer;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--berry-red);
  color: #fffaf0;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(168, 32, 42, 0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.submit-btn:hover {
  transform: translateY(-1px);
  background: var(--berry-dark);
}

.submit-status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  display: none;
}

.submit-status.error {
  display: block;
  background: #fde8e8;
  color: #9b1c1c;
  border: 1px solid #f8b4b4;
}

.submit-status.success {
  display: block;
  background: #def7ec;
  color: #03543f;
  border: 1px solid #bcf0da;
}

/* RSVP Success Confirmation Card (Post-submit state) */
.rsvp-success-card {
  background: #f6fbf8;
  border: 1.5px solid #2e7d32;
  border-radius: 16px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.1);
  animation: fadeInSuccess 0.4s ease;
}

@keyframes fadeInSuccess {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.success-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.success-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--pine-deep);
  margin-bottom: 6px;
}

.success-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 34ch;
  margin: 0 auto;
}

.success-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  padding: 6px 14px;
  border-radius: 99px;
  font-weight: 500;
  font-size: 12.5px;
  margin: 14px 0 16px;
}

.edit-rsvp-btn {
  background: #ffffff;
  border: 1px solid #1c3b2b;
  color: var(--pine-deep);
  padding: 8px 18px;
  border-radius: 99px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.edit-rsvp-btn:hover {
  background: var(--pine-deep);
  color: #ffffff;
}

/* Privacy Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  max-width: 380px;
  width: 100%;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  color: var(--pine-deep);
  position: relative;
}

.modal-close {
  margin-top: 16px;
  width: 100%;
  padding: 9px;
  background: var(--pine-deep);
  color: var(--cream-warm);
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  cursor: pointer;
}

/* Footer & Creator Pill (Playbook rule 2.1) */
.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 20px 10px 40px;
}

.credit-wrap {
  margin-top: 18px;
  text-align: center;
}

.site-credit {
  position: static;
  display: inline-block;
  margin: 0 auto;
  font: 500 11px/1.2 system-ui, "Noto Sans Thai", sans-serif;
  letter-spacing: .02em;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(28, 59, 43, 0.1);
  color: var(--pine-deep);
  border: 1px solid rgba(28, 59, 43, 0.22);
  text-decoration: none;
  opacity: .85;
  transition: opacity .2s, background-color .2s;
}

.site-credit:hover {
  opacity: 1;
  background: rgba(28, 59, 43, 0.18);
}

@media print {
  .site-credit, .top-nav {
    display: none;
  }
}
