* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

pantalla-ajustes,
pantalla-flashcard,
pantalla-cierre {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(1rem, 3vmin, 2.5rem);
  gap: clamp(1rem, 3vmin, 2rem);
}

pantalla-ajustes:not([hidden]),
pantalla-flashcard:not([hidden]),
pantalla-cierre:not([hidden]) {
  display: flex;
}

pantalla-ajustes[hidden],
pantalla-flashcard[hidden],
pantalla-cierre[hidden] {
  display: none;
}

.fila-niveles {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.etiqueta-nivel {
  font-size: clamp(0.85rem, 2vmin, 1.1rem);
  font-weight: 600;
}

.boton-nivel {
  min-height: 2.2rem;
  min-width: 3.4rem;
  font-size: clamp(0.85rem, 2vmin, 1.1rem);
  font-weight: 600;
  border-radius: 999px;
}

.boton-nivel--apagado {
  opacity: 0.5;
}

.contador {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vmin, 2rem);
}

.numero-flashcards {
  font-family: inherit;
  font-size: clamp(3rem, 12vmin, 6rem);
  min-width: 4ch;
  max-width: 4ch;
  text-align: center;
  border: none;
  border-bottom: 0.1em solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0;
}

.maximo-flashcards {
  font-size: clamp(1rem, 3vmin, 1.5rem);
  color: #888;
}

.boton-contador {
  font-size: clamp(1.75rem, 5vmin, 2.5rem);
  min-width: 4.5rem;
  min-height: 4.5rem;
  border-radius: 0.75rem;
}

.fila-elementos-visibles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.etiqueta-elementos-visibles {
  font-size: clamp(0.75rem, 1.8vmin, 0.95rem);
  color: #888;
}

.casilla-elemento-visible {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.2rem;
  font-size: clamp(0.75rem, 1.8vmin, 0.95rem);
}

.casilla-elemento-visible input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
}

.casilla-elemento-visible input[type="checkbox"]:disabled {
  opacity: 0.5;
}

.boton-empezar {
  display: block;
  width: 100%;
  min-height: 4rem;
  font-size: clamp(1.2rem, 2.8vmin, 1.75rem);
  padding: 1rem;
  border-radius: 0.75rem;
}

.cabecera-historia {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.avance-historia {
  font-size: clamp(1.1rem, 2.5vmin, 1.5rem);
}

.boton-circular {
  flex-shrink: 0;
  width: clamp(2.5rem, 6vmin, 3.25rem);
  height: clamp(2.5rem, 6vmin, 3.25rem);
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(47, 111, 82, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.boton-circular svg {
  width: 55%;
  height: 55%;
}

.boton-historia-nueva {
  flex-shrink: 0;
  border: none;
  border-radius: 0.75rem;
  background: #2f6f52;
  color: #fff;
  font-size: clamp(0.85rem, 2vmin, 1.05rem);
  padding: 0.5rem 1.1rem;
  white-space: nowrap;
}

.carta-historia {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vmin, 2rem);
  border-radius: 1.5rem;
  background: #f4f4f4;
}

.emoji-carta {
  font-size: clamp(5rem, 25vmin, 9rem);
  line-height: 1;
}

.fila-ingles {
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 1.5vmin, 1rem);
}

.fila-ingles:not([hidden]) {
  display: flex;
}

.fila-ingles[hidden] {
  display: none;
}

.ingles-carta {
  font-size: clamp(2rem, 7vmin, 3.5rem);
  text-align: center;
}

.boton-voz {
  width: clamp(1.75rem, 4.5vmin, 2.5rem);
  height: clamp(1.75rem, 4.5vmin, 2.5rem);
}

.espanol-carta {
  font-size: clamp(1.25rem, 4.5vmin, 2rem);
  text-align: center;
}

.pie-historia {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: clamp(0.75rem, 2vmin, 1.5rem);
}

.boton-navegacion {
  flex: 1;
  min-height: 4rem;
  font-size: clamp(1.2rem, 2.8vmin, 1.75rem);
  padding: 1rem 2rem;
  border-radius: 0.75rem;
}

.boton-navegacion:disabled {
  opacity: 0.4;
}

pantalla-ajustes,
pantalla-flashcard,
pantalla-cierre {
  text-align: center;
  background: linear-gradient(180deg, #eef6f2, #dcece4);
}

pantalla-ajustes h1,
.avance-historia,
.mensaje-cierre {
  color: #2f6f52;
}

.mensaje-cierre {
  font-size: clamp(1.5rem, 4vmin, 2.25rem);
  text-align: center;
}

.emojis-cierre {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.5rem, 2vmin, 1rem);
}

.emoji-cierre {
  font-size: clamp(2.5rem, 8vmin, 4rem);
  line-height: 1;
}

pantalla-ajustes .boton-empezar,
pantalla-flashcard .boton-navegacion,
pantalla-cierre .boton-navegacion {
  border: none;
  color: #fff;
  background: #2f6f52;
}
