:root {
  --bg: #121212;
  --text: #ffffff;
  --card-bg: #2e2e2e;
  --accent: #4b3c7c;
  --highlight: #ffffff;
  --circle: #ffffff;
}

.light-mode {
  --bg: #f0f0f0;
  --text: #111111;
  --card-bg: #ffffff;
  --accent: #9575CD;
  --highlight: #000000;
  --circle: #d3d3d3;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: sans-serif;
  margin: 0;
  padding-top: 60px;
  /* Aumentado para que el contenido no se pise con el nav fijo */
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

a {
  color: var(--text);
  text-decoration: none;
}

.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 20px;
}

.navbar-content {
  display: flex;
  justify-content: center;
  /* ✅ Centra todo */
  align-items: center;
  gap: 40px;
  /* Espacio entre elementos */
  width: 100%;
  max-width: 1100px;
  text-align: center;
  /* Por si acaso */
  flex-wrap: wrap;
  /* Que se acomode en móvil */
}

.nav-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  /* o 16px si prefieres menos espacio */
  list-style: none;
  margin: 0;
  padding: 0;
}


/* Animación al ocultar navbar */
.navbar.hide {
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}

.navbar {
  transition: transform 0.3s ease-in-out;
}

.navbar a {
  font-weight: 500;
  transition: text-shadow 0.2s ease;
}

/* Solo en escritorio */
@media (hover: hover) and (pointer: fine) {
  body:not(.light-mode) .navbar a:hover {
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
    /* Blanco más difuso */
  }

  body.light-mode .navbar a:hover {
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    /* Sombra oscura sutil */
  }
}

.switch {
  width: 50px;
  height: 26px;
  background: var(--card-bg);
  /* 🔥 Fondo igual que el navbar según modo */
  border-radius: 50px;
  border: 2px solid #b0b0b0;
  /* 🔥 Borde gris oscurito */
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 2px;
  transition: background 0.3s, border 0.3s;
}

.slider {
  width: 22px;
  height: 22px;
  background: #b0b0b0;
  /* 🔥 Pelotita del mismo color que el borde */
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.3s ease;
}

body.light-mode .slider {
  transform: translateX(24px);
}

.presentation {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  padding: 40px 20px;
}

.avatar-circle {
  width: min(40vw, 300px);
  /* Se adapta al ancho de pantalla, hasta 300px */
  aspect-ratio: 1 / 1;
  /* Siempre cuadrado */
  border-radius: 50%;
  background: var(--circle);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(0.75);
  /* 🔥 Reduce el tamaño sin tocar el padding */
}

.presentation h1 {
  font-size: 32px;
  margin: 0;
}

.presentation p {
  font-size: 18px;
  max-width: 600px;
}

/* RANDOMIZER */
/* Esto mantiene centrado el contenido de cartas */
.container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
  /* ✅ evita que las cartas se compriman */
}

.row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.card-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ===============================
   ANIMACIÓN DE GIRO DE CARTAS
   =============================== */

.card-container {
  perspective: 1000px;
  width: 240px;
  /* 🔧 reducido de 250px */
  height: 336px;
  /* 🔧 reducido proporcionalmente */
  margin: auto;
}

.card-flip {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.8s ease;
  transform-style: preserve-3d;
}

.card-container:hover .card-flip {
  will-change: transform;
}


.card-container.flipped .card-flip {
  transform: rotateY(180deg);
}

.card-container.unflipped .card-flip {
  transform: rotateY(0deg);
  transition: transform 0.8s ease;
}

.card-back,
.card-front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}

.card-back img,
.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-front {
  transform: rotateY(180deg);
}

.layout-wrapper {
  padding: 40px 20px;
  box-sizing: border-box;
}

.container-with-message {
  position: relative;
  width: fit-content;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  /* ✅ Añadir esta línea */
  max-width: 95vw;
}

.message-box {
  position: absolute;
  left: 100%;
  /* Justo a la derecha de .container */
  top: 50%;
  transform: translateY(-50%);
  margin-left: 40px;
  /* Espacio entre cartas y mensaje */
  width: 240px;
  background: var(--card-bg);
  color: var(--text);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  text-align: center;
  transition: background 0.3s, color 0.3s;
}

/* Modo claro */
body.light-mode .message-box {
  background: var(--card-bg);
  color: var(--text);
}

/* En móvil que se coloque debajo */
/* Responsive */
@media (max-width: 1100px) {
  .layout-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .container-with-message {
    flex-direction: column;
    align-items: center;
  }

  .message-box {
    position: static;
    transform: none;
    margin: 20px 0 0;
    width: 100%;
    max-width: 300px;
  }
}

.image-slot {
  width: 260px;
  height: 366px;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  position: relative;
}



.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

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

.checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkboxes label {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.white input {
  accent-color: white;
}

.blue input {
  accent-color: #1e90ff;
}

.black input {
  accent-color: black;
}

.red input {
  accent-color: red;
}

.green input {
  accent-color: green;
}

.colorless input {
  accent-color: gray;
}

.controls-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* 🔥 Centrado vertical */
  gap: 20px;
  /* Más espacio entre líneas */
  min-height: 100%;
  /* Ocupa el alto de la fila */
}

.control-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  width: 100%;
}

button#randomize {
  padding: 12px 24px;
  font-size: 18px;
  background: #c0c0c0;
  /* Por defecto (modo claro) */
  color: var(--text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

body:not(.light-mode) button#randomize {
  background: #888888;
  /* Gris más oscuro para modo oscuro */
}

button#randomize:hover {
  background: #b0b0b0;
  transform: scale(1.03);
}

body:not(.light-mode) button#randomize:hover {
  background: #777777;
  /* Hover aún más oscuro en modo oscuro */
}

.middle {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 30px 0;
}


@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ===============================
   OPCIONAL: Estilo responsive suave
   =============================== */

@media (max-width: 768px) {
  .card-container {
    width: 150px;
    /* 🔧 reducido de 160px */
    height: 208px;
    /* 🔧 proporcional */
  }

  .image-slot {
    max-width: 160px;
    /* igual que .card-container */
  }

  .navbar-content {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 10px;
  }
}



.nav-links li {
  flex: 1 1 auto;
  text-align: center;
}

.switch {
  align-self: center;
  margin-top: 10px;
}