/* Reset y configuración básica */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  transition: background 4s ease, color 4s ease;
  padding: 0 1rem;
  overflow-x: hidden;
}

/* Barra de navegación minimalista */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  animation: fadeIn 0.8s ease;
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.coleccion-selector,
.voice-selector {
  padding: 0.5rem 1rem;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.coleccion-selector {
  min-width: 180px;
  font-weight: 600;
}

.coleccion-selector:hover,
.voice-selector:hover {
  background: rgba(255, 255, 255, 0.05);
}

.coleccion-selector:focus,
.voice-selector:focus {
  outline: none;
  border-width: 2px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.nav-btn.active {
  border-width: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.voice-selector {
  min-width: 160px;
  max-width: 200px;
  display: none;
}

.voice-selector.visible {
  display: block;
}

/* Header */
header {
  margin-top: 12vh;
  animation: fadeIn 1s ease-in;
}

h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 1px;
  transition: color 4s ease;
}

h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-top: 0.5rem;
  transition: color 4s ease;
  opacity: 0.9;
}

/* Información de colección */
.collection-info {
  margin-top: 3vh;
  max-width: 600px;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  animation: slideDown 0.6s ease;
}

.collection-name {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.collection-desc {
  font-size: 0.95rem;
  opacity: 0.8;
  font-style: italic;
}

/* Main content */
main {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  margin-top: 4vh;
  width: 100%;
  max-width: 700px;
}

.message-container {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem 1rem;
}

.message-text {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0;
  max-width: 700px;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-right: 0.15em solid currentColor;
  overflow: hidden;
  min-height: 2em;
  transition: opacity 2s ease;
  margin: 0;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: currentColor; }
}

.message-text.complete {
  border-right: none;
  animation: none;
}

/* CTA Button */
.cta {
  margin-top: 4vh;
  padding: 1.1rem 3rem;
  border: 3px solid currentColor;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s ease;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cta:hover {
  background: currentColor;
  color: var(--bg-color);
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.cta:active {
  transform: scale(1.02);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 2rem 0;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 4s ease;
}

footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading state */
.loading {
  font-size: 1.2rem;
  opacity: 0.7;
  animation: pulse 2s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-left,
  .navbar-right {
    gap: 0.5rem;
  }

  .coleccion-selector {
    min-width: 140px;
    font-size: 0.85rem;
  }

  .voice-selector {
    min-width: 130px;
    font-size: 0.85rem;
  }

  .nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  header {
    margin-top: 14vh;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .message-text {
    font-size: 1.4rem;
  }

  .cta {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  .collection-info {
    margin-top: 2vh;
    padding: 0.8rem;
  }

  .collection-name {
    font-size: 1.1rem;
  }

  .collection-desc {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0.5rem 0.5rem;
  }

  .navbar-left {
    width: 100%;
    justify-content: center;
  }

  .navbar-right {
    width: 100%;
    justify-content: center;
  }

  .coleccion-selector {
    width: 100%;
    text-align: center;
  }

  .voice-selector {
    flex: 1;
  }

  body {
    padding: 0 0.5rem;
  }

  header {
    margin-top: 18vh;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1rem;
  }

  .message-text {
    font-size: 1.2rem;
  }
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
  .collection-info,
  .tag {
    background: rgba(255, 255, 255, 0.15);
  }
}

/* Estados de accesibilidad */
button:focus-visible,
select:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}
