body {
  margin: 0;
  overflow: hidden;
}

#sky {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(#315ec6, #7daef0);
  z-index: 1;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 70;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffcc00;
  box-sizing: border-box;
  transition: transform 0.45s ease;
}

header.curtain-moving {
  transform: translateY(100vh);
}

header.initial-down {
  transform: translateY(100vh);
  transition: none;
}

header a {
  text-decoration: none;
  color: #ff0060;
  font-family: helvetica, sans-serif;
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 8px 0;
  width: 100%;
  max-width: 160px;
  text-align: center;
  white-space: nowrap;
  border: 2px solid #ff0060;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

header a:hover {
  background: #ff0060;
  color: #ffcc00;
}

header a.active {
  background: #ff0060;
  color: #ffcc00;
  cursor: not-allowed;
  opacity: 0.8;
}

#curtain {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #ffcc00;
  transform: translateY(-100%);
  transition: transform 0.45s ease;
  pointer-events: none;
  will-change: transform;
}

#curtain.active {
  transform: translateY(0);
  pointer-events: auto;
}

#curtain.initial-close {
  transform: translateY(0);
  pointer-events: none;
  transition: none;
}

.curtain-bg {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #ffcc00;
}

.curtain-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(calc(100vw - 200px), calc(100vh - 200px));
  height: min(calc(100vw - 200px), calc(100vh - 200px));
  transform: translate(-50%, -50%);
  background: url('imagenes/logo.png') center center / contain no-repeat;
}

#carousel-wrap {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 5;
  pointer-events: none;
}

.cloud-btn {
  position: absolute;
  font-family: 'Rubik Spray Paint', cursive;
  font-size: clamp(32px, 5vw, 48px);
  color: #fff;
  transform: translate(-50%, -50%);
  transition: transform 0.3s ease;
  text-shadow:
    -2px -2px 0 #000,
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0   -2px 0 #000,
     0    2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  text-decoration: none;
}

.cloud-btn:hover {
  transform: translate(-50%, -50%) scale(1.25);
  color: #ff0060;
  text-shadow:
    -2px -2px 0 #000,
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0   -2px 0 #000,
     0    2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000,
    0 0 8px rgba(255, 0, 96, 0.6);
}

.wavy-letter {
  display: inline-block;
  transition: transform 0.3s ease;
}

.cloud-btn:hover .wavy-letter {
  color: #ff0060;
  animation: wavy 0.8s ease-in-out infinite;
}

@keyframes wavy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-3deg); }
  75% { transform: translateY(4px) rotate(2deg); }
}

/* RESPONSIVE */
/* ====== RESPONSIVE BREAKPOINTS ====== */
/* Mobile: 320px - 480px (iPhone) */
/* Tablet: 481px - 1023px (iPad) */
/* Desktop: 1024px+ (Laptops) */

/* MOBILE: 320px - 480px */
@media (max-width: 480px) {
  /* Header adjustments */
  header {
    gap: 3px;
    padding: 6px 4px;
  }

  header a {
    font-size: 10px;
    max-width: 90px;
    padding: 5px 0;
    letter-spacing: 0px;
  }

  /* Carousel buttons - responsive sizing */
  #carousel-wrap {
    position: absolute;
    top: 48%;
    pointer-events: none;
  }

  .cloud-btn {
    font-size: clamp(28px, 7vw, 34px);
  }

  /* Pato responsive positioning */
  #pato-wrap {
    top: 72%;
  }

  #pato,
  .pato-anim {
    width: 180px;
  }

  /* Curtain logo adjustments */
  .curtain-logo {
    width: min(calc(100vw - 100px), calc(100vh - 100px));
    height: min(calc(100vw - 100px), calc(100vh - 100px));
  }

  /* Fix tap highlight on iOS */
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* TABLET: 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {
  header {
    gap: 4px;
    padding: 8px 5px;
  }

  header a {
    font-size: 11px;
    max-width: 110px;
    padding: 6px 0;
  }

  .cloud-btn {
    font-size: clamp(28px, 6vw, 36px);
  }

  #pato,
  .pato-anim {
    width: 100px;
  }
}

/* DESKTOP: 769px+ */
@media (min-width: 769px) {
  .cloud-btn {
    font-size: 48px;
  }

  #pato,
  .pato-anim {
    width: 80px;
  }
}

/* LAPTOP 1024px-1200px: Ajustes para pantallas con escala 125% */
@media (min-width: 1024px) and (max-width: 1200px) {
  header {
    gap: 6px;
    padding: 8px 8px;
  }

  header a {
    font-size: 11px;
    max-width: 130px;
    padding: 6px 0;
  }

  .cloud-btn {
    font-size: clamp(28px, 4vw, 40px);
  }

  #pato,
  .pato-anim {
    width: clamp(60px, 8vw, 120px);
  }

  .curtain-logo {
    width: min(calc(100vw - 150px), calc(100vh - 150px));
    height: min(calc(100vw - 150px), calc(100vh - 150px));
  }
}

/* ====== SOBRE-MÍ PAGE RESPONSIVE ====== */

/* MOBILE: Hide non-essential NERV elements */
@media (max-width: 480px) {
  #nerv-left-bars,
  #nerv-vertical-bars,
  #nerv-wave,
  #nerv-rings {
    display: none;
  }

  /* 3D Model takes priority space */
  #pato-3d {
    height: 55vh;
  }

  /* Main text centered and readable */
  #code-text {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    max-width: 92%;
    margin: 10px auto 80px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 5px;
  }

  /* Compact clock in mobile */
  #nerv-clock {
    font-size: 9px;
    padding: 4px 8px;
    top: 5px;
    right: 5px;
  }

  #nerv-clock .clock-label {
    font-size: 7px;
  }

  /* Compact status bar */
  #nerv-status {
    font-size: 9px;
    padding: 4px 12px;
    bottom: 10px;
    gap: 5px;
  }

  #nerv-status .status-bar {
    width: 80px;
    height: 6px;
  }

  /* Adjust frame corners for mobile */
  .nerv-frame .corner {
    width: 15px;
    height: 15px;
  }

  .nerv-frame::before {
    top: 40px;
    left: 3px;
    right: 3px;
    bottom: 3px;
  }

  .nerv-frame .corner-tl { top: 40px; left: 3px; }
  .nerv-frame .corner-tr { top: 40px; right: 3px; }
  .nerv-frame .corner-bl { bottom: 3px; left: 3px; }
  .nerv-frame .corner-br { bottom: 3px; right: 3px; }
}

/* TABLET: Improve readability */
@media (min-width: 481px) and (max-width: 1023px) {
  #pato-3d {
    height: 60vh;
  }

  #code-text {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    max-width: 85%;
    margin: 20px auto;
    padding: 15px;
    font-size: 13px;
    line-height: 1.6;
  }
}

/* ====== LOADING INDICATOR (ON CURTAIN) ====== */
#loading-indicator {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 61;
  text-align: center;
  font-family: 'Courier New', monospace;
  border: 1px solid #ff0060;
  padding: 10px 20px;
  border-radius: 2px;
  pointer-events: none;
  min-width: 280px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

#loading-title {
  font-size: 12px;
  font-weight: bold;
  color: #ff0060;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

#loading-bar {
  font-size: 15px;
  margin: 0;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #ff0060;
  display: inline-block;
  letter-spacing: 1px;
  color: #ff0060;
  font-weight: bold;
  white-space: pre;
}

#loading-detail {
  font-size: 11px;
  font-weight: bold;
  color: #ff0060;
  margin-top: 6px;
  opacity: 0.85;
}

@media (max-width: 480px) {
  #loading-indicator {
    bottom: 8%;
    min-width: 200px;
    padding: 8px 12px;
  }
  #loading-title { font-size: 10px; }
  #loading-bar { font-size: 12px; }
  #loading-detail { font-size: 10px; }
}
