/* ============================================
   🧸 Baby Shower Invitation - Design System
   Theme: Ositos / Bears - Boy
   ============================================ */

/* === IMPORTS === */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

/* === DESIGN TOKENS === */
:root {
  --blue: #7EB8D4;
  --blue-light: #B8D8E8;
  --blue-lighter: #E8F4FD;
  --blue-dark: #5A9AB5;
  --beige: #F5E6D3;
  --beige-light: #FFF8F0;
  --gold: #D4A574;
  --gold-light: #E8C9A0;
  --brown: #A67C52;
  --brown-dark: #5C4A3E;
  --pink: #F2C4CE;
  --pink-light: #FAE4EA;
  --mint: #98D8C8;
  --lavender: #DDA0DD;
  --white: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(92, 74, 62, 0.08);
  --shadow-md: 0 4px 20px rgba(92, 74, 62, 0.12);
  --shadow-lg: 0 8px 40px rgba(92, 74, 62, 0.16);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-full: 9999px;
  --font-body: 'Quicksand', sans-serif;
  --font-display: 'Playfair Display', serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === RESET === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  color: var(--brown-dark);
  background: var(--beige-light);
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input {
  font-family: inherit;
  outline: none;
}

/* === SCREENS === */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s ease;
  transform: translateY(30px);
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  z-index: 10;
}

/* === BUTTONS === */
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md), 0 0 0 0 rgba(126, 184, 212, 0.4);
  transition: var(--transition);
  animation: pulse-glow 2s ease-in-out infinite;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.2) 50%, transparent 60%);
  transition: 0.5s;
  transform: translateX(-100%);
}

.btn-primary:active::after {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-secondary {
  background: var(--beige);
  color: var(--brown);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.btn-secondary:active {
  transform: scale(0.95);
}

/* ========================
   WELCOME SCREEN
   ======================== */
#screen-welcome {
  background: linear-gradient(180deg, var(--blue-lighter) 0%, var(--beige-light) 60%, var(--pink-light) 100%);
}

.clouds-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 100px;
  filter: blur(2px);
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud-1 {
  width: 120px;
  height: 40px;
  top: 8%;
  left: -20%;
  animation: cloud-drift 25s linear infinite;
}

.cloud-1::before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 20px;
}

.cloud-1::after {
  width: 60px;
  height: 60px;
  top: -30px;
  left: 50px;
}

.cloud-2 {
  width: 100px;
  height: 35px;
  top: 18%;
  left: -15%;
  animation: cloud-drift 30s linear infinite 5s;
  opacity: 0.6;
}

.cloud-2::before {
  width: 45px;
  height: 45px;
  top: -22px;
  left: 15px;
}

.cloud-2::after {
  width: 55px;
  height: 55px;
  top: -28px;
  left: 40px;
}

.cloud-3 {
  width: 140px;
  height: 45px;
  top: 30%;
  left: -25%;
  animation: cloud-drift 35s linear infinite 10s;
  opacity: 0.5;
}

.cloud-3::before {
  width: 55px;
  height: 55px;
  top: -28px;
  left: 25px;
}

.cloud-3::after {
  width: 65px;
  height: 65px;
  top: -32px;
  left: 60px;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 20px;
  z-index: 2;
  text-align: center;
  animation: fade-slide-up 1s ease-out 0.3s both;
}

.bear-welcome {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  background: radial-gradient(circle, white 60%, transparent 100%);
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(92, 74, 62, 0.15));
}

.welcome-content h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--brown-dark);
  line-height: 1.3;
}

.welcome-content h1 em {
  color: var(--blue);
  font-style: italic;
}

.welcome-content p {
  font-size: 1.05rem;
  color: var(--brown);
  font-weight: 500;
  opacity: 0.8;
}

.welcome-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem !important;
}

.welcome-subtitle .paw {
  font-size: 1.2rem;
}

/* Decorative floating elements */
.floating-elements {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.float-star {
  position: absolute;
  font-size: 1.2rem;
  animation: sparkle 2s ease-in-out infinite;
}

/* ========================
   GAME SCREEN
   ======================== */
#screen-game {
  background: linear-gradient(180deg, #C9E8F7 0%, #E8F4FD 40%, #D4EFDF 100%);
  padding: 0;
  justify-content: flex-start;
}

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
}

.game-score-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  font-size: 1.1rem;
}

.game-score-box .score-num {
  color: var(--blue-dark);
  font-size: 1.3rem;
  min-width: 24px;
  text-align: center;
  transition: var(--transition);
}

.game-score-box .score-target {
  color: var(--brown);
  opacity: 0.5;
}

.score-pop {
  animation: score-bump 0.3s ease-out;
}

.game-timer-box {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 4;
}

.timer-circle-progress {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-circle-progress.warning {
  stroke: #FF6B6B;
}

.timer-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brown-dark);
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.game-instructions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 25;
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(15px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  width: 85%;
}

.game-instructions h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--blue-dark);
}

.game-instructions p {
  font-size: 0.95rem;
  color: var(--brown);
  margin-bottom: 16px;
  font-weight: 500;
}

.game-instructions .goal-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brown-dark);
  margin-bottom: 20px;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: rgba(232, 244, 253, 0.6);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.countdown-overlay.active {
  opacity: 1;
  visibility: visible;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--blue-dark);
  animation: countdown-pop 0.8s ease-out;
  text-shadow: 0 4px 20px rgba(90, 154, 181, 0.3);
}

/* ========================
   GAME OVER OVERLAY
   ======================== */
.game-over-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(255, 248, 240, 0.95);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}

.game-over-overlay.active {
  opacity: 1;
  visibility: visible;
}

.game-over-content {
  text-align: center;
  padding: 30px;
  animation: fade-slide-up 0.6s ease-out;
}

.game-over-bear {
  width: 120px;
  margin: 0 auto 16px;
}

.game-over-bear img {
  width: 100%;
  filter: drop-shadow(0 5px 15px rgba(92, 74, 62, 0.15));
}

.bear-sad {
  animation: shake-sad 1s ease-in-out;
}

.game-over-content h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.game-over-content p {
  color: var(--brown);
  font-weight: 500;
  margin-bottom: 24px;
}

.game-over-content .score-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 20px;
}

/* ========================
   INVITATION SCREEN
   ======================== */
#screen-invite {
  background: linear-gradient(180deg, var(--blue-lighter) 0%, var(--white) 30%, var(--beige-light) 100%);
  padding: 20px;
}

#confetti-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.invite-content {
  width: 100%;
  max-width: 380px;
  z-index: 2;
  animation: fade-slide-up 0.8s ease-out;
}

.invite-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  text-align: center;
}

.invite-header {
  margin-bottom: 20px;
}

.invite-bear {
  width: 100px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle, white 60%, transparent 100%);
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 5px 15px rgba(92, 74, 62, 0.1));
}

.invite-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.invite-header .invite-sub {
  font-size: 1rem;
  color: var(--brown);
  font-weight: 600;
  margin-top: 4px;
}

.invite-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  margin: 20px 0;
}

.invite-baby-name {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-style: italic;
  color: var(--blue);
  margin: 12px 0;
  letter-spacing: 1px;
}

/* Detail Cards Grid */
.invite-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 12px;
}

.detail-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 14px 8px 12px;
  background: var(--beige-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(212, 165, 116, 0.12);
}

.detail-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 2px;
}

.detail-card-label {
  font-size: 0.65rem;
  color: var(--brown);
  opacity: 0.5;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-card-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown-dark);
  line-height: 1.2;
  word-break: break-word;
}

/* Maps card special styling */
.detail-card-maps {
  text-decoration: none;
  background: linear-gradient(135deg, var(--blue-lighter), rgba(184, 216, 232, 0.3));
  border: 1.5px solid var(--blue-light);
  transition: var(--transition);
}

.detail-card-maps:active {
  transform: scale(0.95);
}

.detail-card-maps .detail-card-value {
  color: var(--blue-dark);
}

/* ========================
   TABLES / MESAS SCREEN
   ======================== */
#screen-mesas {
  background: linear-gradient(180deg, var(--beige-light) 0%, var(--blue-lighter) 100%);
  padding: 20px;
  justify-content: flex-start;
  padding-top: 20px;
}

.mesas-header {
  text-align: center;
  margin-bottom: 16px;
  z-index: 2;
  flex-shrink: 0;
}

.mesas-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--brown-dark);
}

.mesas-header p {
  font-size: 0.9rem;
  color: var(--brown);
  opacity: 0.7;
  font-weight: 500;
  margin-top: 4px;
}

.mesas-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brown);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.available {
  background: var(--mint);
}

.legend-dot.occupied {
  background: #FF8A80;
}

.legend-dot.selected {
  background: var(--blue);
}

.mesas-scroll {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: 500px;
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.mesas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px;
}

.mesa-unit {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mesa-center {
  position: absolute;
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--beige), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brown);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.silla {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 3;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.silla.available {
  background: var(--mint);
}

.silla.available:active {
  transform: scale(1.15);
}

.silla.occupied {
  background: #FF8A80;
  cursor: default;
  font-size: 0.45rem;
}

.silla.selected {
  background: var(--blue);
  animation: pulse-glow 1s ease-in-out infinite;
}

.mesa-full {
  opacity: 0.45;
}

.silla-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--brown-dark);
  color: var(--white);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.6rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.silla.occupied:hover .silla-tooltip,
.silla.occupied:active .silla-tooltip {
  opacity: 1;
}

/* === SPECIAL TABLES === */
.mesas-special-divider {
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px 0 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--brown);
  opacity: 0.6;
}

.mesas-special-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mesa-special-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(245, 230, 211, 0.5));
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(212, 165, 116, 0.3);
  box-shadow: var(--shadow-sm);
}

.mesa-special-emoji {
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
}

.mesa-special-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brown);
  text-align: center;
  line-height: 1.2;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(92, 74, 62, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease-out;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.modal-card .modal-mesa-label {
  font-size: 0.9rem;
  color: var(--brown);
  opacity: 0.7;
  margin-bottom: 20px;
}

.modal-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--blue-light);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  margin-bottom: 20px;
  color: var(--brown-dark);
}

.modal-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(126, 184, 212, 0.15);
}

.modal-card input::placeholder {
  color: var(--brown);
  opacity: 0.3;
}

.modal-buttons {
  display: flex;
  gap: 10px;
}

.modal-buttons button {
  flex: 1;
}

/* === CONFIRMATION TOAST === */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--brown-dark);
  color: var(--white);
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ========================
   ANIMATIONS
   ======================== */
@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

@keyframes cloud-drift {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(calc(100vw + 200px));
  }
}

@keyframes sparkle {

  0%,
  100% {
    opacity: 0;
    transform: scale(0.5) rotate(0deg);
  }

  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: var(--shadow-md), 0 0 0 0 rgba(126, 184, 212, 0.4);
  }

  50% {
    box-shadow: var(--shadow-md), 0 0 0 8px rgba(126, 184, 212, 0);
  }
}

@keyframes fade-slide-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes score-bump {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.4);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes countdown-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes shake-sad {

  0%,
  100% {
    transform: rotate(0);
  }

  20% {
    transform: rotate(-8deg);
  }

  40% {
    transform: rotate(8deg);
  }

  60% {
    transform: rotate(-5deg);
  }

  80% {
    transform: rotate(5deg);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes bounce-in {
  0% {
    transform: scale(0);
  }

  60% {
    transform: scale(1.15);
  }

  80% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1);
  }
}

/* ========================
   ENVELOPE INTRO
   ======================== */
#screen-envelope {
  background: linear-gradient(180deg, #E8F4FD 0%, #F2C4CE 50%, #FFF8F0 100%);
}

.envelope-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
}

.envelope-hint {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brown);
  opacity: 0.7;
  animation: float 2s ease-in-out infinite;
  letter-spacing: 0.3px;
}

.envelope-wrapper {
  cursor: pointer;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}

.envelope {
  position: relative;
  width: 260px;
  height: 180px;
  transition: transform 0.3s;
}

.envelope-wrapper:active .envelope {
  transform: scale(0.95);
}

/* Back panel - full rectangle */
.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #EDD9C4, #E0CBAF);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(92, 74, 62, 0.2), 0 2px 8px rgba(92, 74, 62, 0.1);
}

/* Letter inside the envelope */
.envelope-letter {
  position: absolute;
  top: 8%;
  left: 8%;
  right: 8%;
  height: 60%;
  background: white;
  border-radius: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.letter-content {
  text-align: center;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.5s ease 0.7s;
}

.letter-emoji {
  display: block;
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.letter-text {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--blue-dark);
  line-height: 1.4;
}

/* Front bottom panel - covers bottom half with V shape at top */
.envelope-front {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(175deg, #F0DECA, #F5E6D3);
  border-radius: 0 0 10px 10px;
  z-index: 3;
  clip-path: polygon(0 40%, 50% 0%, 100% 40%, 100% 100%, 0 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

/* Heart seal on the front */
.envelope-front::after {
  content: '💌';
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  opacity: 0.6;
}

/* Top flap - triangular, opens upward */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52%;
  background: linear-gradient(180deg, #DCC9B0, #E5D4BE);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 5;
  transform-origin: top center;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Inner shadow lines to give depth */
.envelope-back::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.01));
  z-index: 1;
  border-radius: 10px 10px 0 0;
}

/* Envelope opening animation */
#screen-envelope.opening .envelope-flap {
  transform: rotateX(-180deg);
}

#screen-envelope.opening .envelope-letter {
  transform: translateY(-110px) scale(1.05);
  z-index: 10;
}

#screen-envelope.opening .letter-content {
  opacity: 1;
}

#screen-envelope.opened {
  animation: fade-out 0.8s ease-in 0.5s forwards;
}

/* Floating sparkles on envelope */
.envelope-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.envelope-sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 1.2rem;
  animation: sparkle 2.5s ease-in-out infinite;
  animation-delay: var(--d);
}

/* ========================
   DOWNLOAD OVERLAY
   ======================== */
.download-overlay {
  position: fixed;
  inset: 0;
  background: rgba(232, 244, 253, 0.95);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
  padding: 20px;
}

.download-overlay.active {
  opacity: 1;
  visibility: visible;
}

.download-content {
  text-align: center;
  animation: fade-slide-up 0.6s ease-out;
  max-width: 340px;
}

.download-bear {
  width: 130px;
  margin: 0 auto 16px;
}

.bear-celebrate {
  width: 100%;
  animation: float 2s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(92, 74, 62, 0.15));
}

.download-content h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--brown-dark);
  margin-bottom: 8px;
}

.download-content p {
  color: var(--brown);
  font-weight: 500;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.btn-download {
  margin-bottom: 12px;
  display: block;
  width: 100%;
}

.btn-link {
  background: none;
  color: var(--brown);
  opacity: 0.6;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  transition: opacity 0.2s;
}

.btn-link:active {
  opacity: 1;
}

/* ========================
   ACHIEVEMENT TOAST
   ======================== */
.achievement-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px) scale(0.8);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--brown-dark);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 100;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  white-space: nowrap;
  pointer-events: none;
  border: 2px solid var(--gold-light);
}

.achievement-toast.show {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
}

/* ========================
   COUNTDOWN BADGE
   ======================== */
.countdown-section {
  margin: 12px 0;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--blue-lighter), rgba(242, 196, 206, 0.3));
  padding: 10px 20px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(126, 184, 212, 0.3);
}

.countdown-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.countdown-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brown);
  opacity: 0.7;
}

/* ========================
   INVITE MESSAGE
   ======================== */
.invite-message {
  font-style: italic;
  color: var(--brown);
  font-weight: 500;
  font-size: 0.95rem;
  margin: 16px 0 20px;
  opacity: 0.8;
}

/* Maps Button */
.btn-maps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px 24px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(232, 244, 253, 0.8));
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 2px solid var(--blue-light);
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-maps:active {
  transform: scale(0.95);
  background: var(--blue-lighter);
}

/* ========================
   ANIMATIONS (continued)
   ======================== */
@keyframes fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* ========================
   RESPONSIVE
   ======================== */
@media (min-width: 480px) {
  .welcome-content h1 {
    font-size: 2.2rem;
  }

  .bear-welcome {
    width: 220px;
    height: 220px;
  }

  .invite-header h2 {
    font-size: 2.4rem;
  }

  .mesas-grid {
    gap: 24px;
  }

  .envelope {
    width: 300px;
    height: 200px;
  }
}

@media (min-width: 768px) {
  .mesas-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 700px;
  }
}

@media (max-height: 650px) {
  .bear-welcome {
    width: 130px;
    height: 130px;
  }

  .welcome-content h1 {
    font-size: 1.5rem;
  }

  .welcome-content {
    gap: 14px;
  }

  .envelope {
    width: 200px;
    height: 130px;
  }
}