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

:root {
  --pink-500: #FF6B9D;
  --pink-400: #FF85B1;
  --pink-300: #FFB6C1;
  --pink-200: #FFD4DE;
  --pink-100: #FFF0F3;
  --pink-white: #FFF5F8;
  --deep-pink: #FF1493;
  --text-dark: #2D2D2D;
  --text-light: #666;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(255, 107, 157, 0.15);
  --shadow-lg: 0 8px 40px rgba(255, 107, 157, 0.25);
  --radius: 16px;
  --radius-sm: 12px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--pink-white);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
}

.hidden {
  display: none !important;
}

/* ==================== GATE ==================== */

#gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pink-100) 0%, var(--white) 50%, var(--pink-200) 100%);
  z-index: 1000;
  padding: 20px;
}

.gate-container {
  text-align: center;
  width: 100%;
  max-width: 360px;
  animation: fadeInUp 0.6s ease-out;
}

.gate-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

.gate-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--pink-500);
  margin-bottom: 8px;
}

.gate-subtitle {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 32px;
  font-weight: 300;
}

.pin-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  direction: ltr;
}

.pin-digit {
  width: 60px;
  height: 72px;
  border: 2px solid var(--pink-300);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'Heebo', sans-serif;
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.pin-digit:focus {
  border-color: var(--pink-500);
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.2);
  transform: scale(1.05);
}

.pin-digit.filled {
  border-color: var(--deep-pink);
  background: var(--pink-100);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--pink-500), var(--deep-pink));
  color: var(--white);
  font-size: 1.125rem;
  font-weight: 700;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 56px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.gate-error {
  color: #E53E3E;
  font-size: 0.875rem;
  margin-top: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gate-error.visible {
  opacity: 1;
}

/* ==================== CONFETTI ==================== */

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* ==================== HERO ==================== */

#hero {
  text-align: center;
  padding: 48px 20px 32px;
  background: linear-gradient(180deg, var(--pink-200) 0%, var(--pink-white) 100%);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--deep-pink);
  animation: heroReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-shadow: 0 2px 10px rgba(255, 20, 147, 0.3);
}

.hero-subtitle {
  font-size: 1.5rem;
  margin-top: 12px;
  animation: heroReveal 0.8s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ==================== VIDEOS SECTION ==================== */

#videos-section {
  padding: 24px 0 40px;
  position: relative;
  z-index: 4;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0 20px;
  margin-bottom: 16px;
}

#videos-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 0 20px;
  perspective: 1000px;
}

/* ==================== GIFT BOXES ==================== */

.gift-box {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  animation: giftBounce 3s ease-in-out infinite;
}

.gift-box:nth-child(2n) { animation-delay: -0.5s; }
.gift-box:nth-child(3n) { animation-delay: -1s; }

.gift-box:nth-child(4n+1) { --box-color: var(--pink-300); --box-edge: #F0A0B5; }
.gift-box:nth-child(4n+2) { --box-color: var(--pink-400); --box-edge: #E87599; }
.gift-box:nth-child(4n+3) { --box-color: var(--pink-200); --box-edge: #F0C0CC; }
.gift-box:nth-child(4n+4) { --box-color: var(--pink-500); --box-edge: #E05588; }

.gift-box-lid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: var(--box-color, var(--pink-300));
  border-radius: var(--radius) var(--radius) 4px 4px;
  z-index: 3;
  transition: transform 0.5s cubic-bezier(0.5, -0.5, 0.5, 1.5), opacity 0.3s 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gift-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gift-ribbon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14%;
  height: 100%;
  background: var(--deep-pink);
  opacity: 0.8;
  border-radius: 2px;
}

.gift-ribbon::after {
  content: '';
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  height: 14%;
  background: var(--deep-pink);
  opacity: 0.8;
  border-radius: 2px;
}

.gift-bow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.5, -0.8, 0.5, 1.5);
  line-height: 1;
}

.gift-box-body {
  position: absolute;
  top: 28%;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--box-color, var(--pink-300));
  border-radius: 4px 4px var(--radius) var(--radius);
  border-top: 3px solid var(--box-edge, #F0A0B5);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.gift-box-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s 0.2s ease, transform 0.4s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: scale(0.9);
  padding: 8px;
}

.gift-box-content video,
.gift-box-content .gift-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  position: absolute;
  inset: 0;
}

.gift-play-btn {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.gift-play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent var(--deep-pink);
  margin-right: -2px;
}

.gift-box-title {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 8px;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Wiggle shake on tap */
.gift-box.shaking {
  animation: giftShake 0.5s ease-in-out;
}

/* Gift box open state */
.gift-box.open {
  animation: none;
}

.gift-box.open .gift-box-lid {
  transform: translateY(-80%) scale(0.7) rotate(8deg);
  opacity: 0;
}

.gift-box.open .gift-ribbon,
.gift-box.open .gift-bow {
  opacity: 0;
}

.gift-box.open .gift-bow {
  transform: translateX(-50%) translateY(-30px) scale(0.5);
}

.gift-box.open .gift-box-body {
  background: var(--white);
  border-color: var(--pink-300);
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.2);
}

.gift-box.open .gift-box-content {
  opacity: 1;
  transform: scale(1);
}

@keyframes giftBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes giftShake {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(-6deg) scale(1.04); }
  30% { transform: rotate(6deg) scale(1.04); }
  45% { transform: rotate(-4deg); }
  60% { transform: rotate(4deg); }
  75% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}

/* ==================== SURPRISE GIFT BOX ==================== */

#surprise-container {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.surprise-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #B8860B;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

.gift-box-surprise {
  flex: 0 0 180px;
  width: 180px;
  aspect-ratio: 4 / 5;
  animation: giftBounce 3s ease-in-out infinite;
}

.gift-box-surprise .gift-box-lid {
  background: linear-gradient(135deg, #FFD700, #FF6B9D);
}

.gift-box-surprise .gift-box-body {
  background: linear-gradient(135deg, #FFD700, #FF6B9D);
  border-color: #DAA520;
}

.surprise-ribbon::before {
  background: #DAA520 !important;
}

.surprise-ribbon::after {
  background: #DAA520 !important;
}

.surprise-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  z-index: 10;
  transition: opacity 0.5s ease;
}

/* Surprise unlocked state (not locked, not unlocking) */
.gift-box-surprise:not(.gift-box-locked):not(.gift-box-unlocking) .surprise-lock {
  display: none;
}

/* Locked state */
.gift-box-locked {
  filter: grayscale(0.6) brightness(0.85);
  cursor: not-allowed;
}

.gift-box-locked .gift-box-body {
  box-shadow: none;
}

/* Unlocking animation */
.gift-box-unlocking {
  animation: surpriseUnlock 1.5s ease-out forwards;
}

.gift-box-unlocking .surprise-lock {
  opacity: 0;
}

.gift-box-unlocking .gift-box-body {
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 107, 157, 0.3);
}

@keyframes surpriseUnlock {
  0% { transform: scale(1); filter: grayscale(0.6) brightness(0.85); }
  30% { transform: scale(1.12); filter: grayscale(0) brightness(1.1); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); filter: grayscale(0) brightness(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ==================== MODAL ==================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  animation: modalSlideUp 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.75rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  backdrop-filter: blur(10px);
}

#modal-video {
  width: 100%;
  max-height: 80vh;
  display: block;
  background: #000;
}

.modal-title {
  padding: 12px 16px;
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  text-align: center;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.empty-state-text {
  font-size: 1.125rem;
  font-weight: 500;
}

/* ==================== TOAST ==================== */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45, 45, 45, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-family: 'Heebo', sans-serif;
  font-weight: 500;
  z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s 2.7s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==================== DESKTOP ==================== */

@media (min-width: 768px) {
  .hero-title {
    font-size: 4rem;
  }

  .pin-digit {
    width: 70px;
    height: 80px;
    font-size: 2rem;
  }

  #videos-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 0 40px;
  }

  .gift-box {
    aspect-ratio: 3 / 4;
  }

  .gift-box-surprise {
    flex: 0 0 220px;
    width: 220px;
    aspect-ratio: 3 / 4;
  }

  .gift-bow {
    font-size: 2.2rem;
  }

  .modal-content {
    border-radius: 20px;
  }
}
