html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  background: url('bg.webp') no-repeat top center fixed;
  background-size: cover;
  background-color: #d1d2ca;
  color: #111;
  font-family: sans-serif;
  padding: env(safe-area-inset-top);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

#texter-canvas {
  pointer-events: none; /* Let clicks pass through to the gesture canvas */
  z-index: 10;
}

#canvas {
  /* The gesture canvas */
  z-index: 1;
}

#message {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 5px white;
  z-index: 20;
  display: none;
}

#debug {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 14px;
  background: rgba(255,255,255,0.8);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ddd;
  z-index: 20;
}

#debugToggle {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 50px;
  opacity: 0;
  z-index: 100;
  cursor: default;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

#center-text {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #574935; /* Matching the UI reference */
  font-family: "Georgia", serif; /* Matching the cursor trail font */
  font-size: 18px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 15;
  width: 100%;
  transition: opacity 0.5s ease; /* Smooth fade for text replacement */
}

/* After the transition, nudge the invitation text down slightly */
body.transitioned #center-text {
  padding-top: 60px;
}

#primary-contact-name {
  font-family: "Georgia", serif; /* Matching the cursor trail font */
  font-size: 18px;
  line-height: 1.6;
  color: #8a8a8a;
  text-transform: uppercase;
  margin-bottom: 24px;
  display: none;
}

#footer {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  letter-spacing: 2px;
  color: #574935; /* Matching the UI reference */
  pointer-events: auto;
  z-index: 15;
  user-select: none;
}

button {
  background: #eee;
  color: #574935;
  border: 1px solid #ccc;
  padding: 8px 16px;
  margin: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: #ddd;
  color: #574935;
}

#flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 5000; /* High z-index to cover everything including text */
}

@keyframes flash-animation {
  0% { opacity: 0; }
  10% { opacity: 1; }
  100% { opacity: 0; }
}

.flash-active {
  animation: flash-animation 1.5s ease-out forwards;
}

#rsvp-link {
  display: block; 
  margin-top: 40px; 
  color: #574935; 
  text-decoration: none; 
  font-family: "Courier New", Courier, monospace; 
  font-size: 16px; 
  letter-spacing: 1px;
  pointer-events: auto; /* Enable clicking */
  cursor: pointer;
  text-decoration: underline;
}

/* RSVP overlay */
#rsvp-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(209, 210, 202, 0.97);
  z-index: 4000;
}

#rsvp-overlay.open {
  display: flex;
}

.rsvp-inner {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 40px 28px 56px;
  box-sizing: border-box;
  font-family: "Georgia", serif;
  color: #574935;
}

.rsvp-back {
  position: absolute;
  top: 16px;
  left: 8px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
}

.rsvp-back:hover {
  background: none;
}

.rsvp-intro-text {
  font-family: "Georgia", serif; /* Matching the cursor trail font */
  font-size: 18px;
  line-height: 1.6;
  color: #574935;
  margin-top: 60px;
  text-align: left;
}

.rsvp-section {
  margin-top: 40px;
}

.rsvp-label {
  font-family: "Georgia", serif;
  font-size: 14px;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.rsvp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.rsvp-name {
  font-size: 18px;
}

.rsvp-options {
  display: flex;
  gap: 16px;
  font-size: 18px;
}

.rsvp-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #aea79e;
  cursor: pointer;
}

.rsvp-toggle:hover {
  background: none;
  color: #574935;
}

.rsvp-toggle.selected {
  color: #574935;
  background: none;
}

.rsvp-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #574935;
  padding: 6px 0;
  font-family: "Georgia", serif;
  font-size: 16px; /* Avoid iOS zoom on focus */
  background: transparent;
  outline: none;
}

.rsvp-input::placeholder {
  color: #aea79e;
}

.rsvp-submit {
  margin: 40px 0px 0px 0px;
  width: 100%;
  padding: 12px 0;
  border: 1px solid #574935;
  background: transparent;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  letter-spacing: 1px;
}

@media (max-width: 768px) {
  #footer {
    font-size: 12px; /* 200% of original 14px */
    padding-bottom: 0px;
  }
  
  #center-text {
    font-size: 16px;
    padding: 0 20px; /* Add some padding on small screens */
  }
}

@media (min-width: 769px) {
  html, body {
    background: url('desktop-bg.webp') no-repeat top center fixed !important;
    background-size: cover !important;
    background-color: #f1f1ef !important;
  }
}


body.transitioned #center-text .primary-name {
  font-family: "Georgia", serif; /* Matching the cursor trail font */
  font-size: 18px;
  line-height: 1.6;
  color: #574935;
  margin-bottom: 28px;
}


body.transitioned #center-text .guest-list {
  margin-top: 30px;
  text-align: left;
  font-size: 16px;
}

body.transitioned #center-text .guest-list ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
}

body.transitioned #center-text .guest-list li {
  font-family: "Courier New", Courier, monospace;
  margin-bottom: 4px;
}
