:root {
  --primary: #1976d2;
  --accent: #00bfae;
  --background: #f2f5fc;
  --surface: #fff1;
  --success: #43a047;
  --error: #f77371;
  --ia: #fbc02d;
  --text: #222b45;
  --text-light: #7a869a;
  --button-radius: 1.3em;
}

/* FONDO animado con gradiente y burbujas SVG embebidas */
html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: transparent;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  color: var(--text);
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

/* Fondo gradiente suave + burbujas SVG */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 15% 15%, #1976d244 0 120px, transparent 200px),
    radial-gradient(circle at 90% 85%, #00bfae33 0 110px, transparent 200px),
    radial-gradient(circle at 60% 25%, #fbc02d33 0 90px, transparent 180px),
    linear-gradient(135deg, #e3e9f8 0%, #d0f2ff 100%);
  animation: gradientMove 14s ease-in-out infinite alternate;
}
@keyframes gradientMove {
  0% { background-position: 15% 15%, 90% 85%, 60% 25%; }
  100% { background-position: 22% 20%, 80% 80%, 65% 21%; }
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg width='320' height='200' fill='none' xmlns='http://www.w3.org/2000/svg'><circle cx='40' cy='60' r='19' fill='%2300bfae1a'/><circle cx='260' cy='100' r='26' fill='%231976d222'/><circle cx='120' cy='170' r='15' fill='%23fbc02d22'/><circle cx='220' cy='40' r='13' fill='%231976d222'/><circle cx='280' cy='170' r='8' fill='%2300bfae22'/></svg>");
  background-repeat: repeat;
  background-size: 320px 200px;
  opacity: 0.7;
  animation: bubbles 24s linear infinite alternate;
}

/* Alternativa con cartitas */
/*
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg width='90' height='90' xmlns='http://www.w3.org/2000/svg'><g opacity='0.20'><rect x='5' y='18' width='32' height='18' rx='4' fill='%231976d2'/><polyline points='5,18 21,32 37,18' fill='none' stroke='%23fff' stroke-width='2'/></g><g opacity='0.15' transform='rotate(-13 55 45)'><rect x='45' y='35' width='34' height='18' rx='4' fill='%23fbc02d'/><polyline points='45,35 62,49 79,35' fill='none' stroke='%231976d2' stroke-width='2'/></g><g opacity='0.13' transform='rotate(17 22 68)'><rect x='8' y='60' width='28' height='14' rx='3' fill='%2300bfae'/><polyline points='8,60 22,71 36,60' fill='none' stroke='%23fff' stroke-width='1.3'/></g></svg>");
  background-repeat: repeat;
  background-size: 120px 120px;
  opacity: 0.7;
  animation: bubbles 24s linear infinite alternate;
}
*/


@keyframes bubbles {
  0% { background-position: 0 0; }
  100% { background-position: 160px 100px; }
}

#game-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* Pantallas principales */
.screen {
  margin: auto;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  min-height: 540px;
  max-width: 430px;
  max-height: 100vh;
  background: var(--surface);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 10px 32px 0 #0002;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: fadeIn 0.7s;
  position: relative;
}

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

/* Para centrar el contenido vertical de la pantalla de juego */
.game-center {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Títulos y textos */
h1 {
  font-size: 2.2em;
  margin-bottom: 0.3em;
  font-weight: 700;
  color: var(--primary);
}
h2 {
  font-size: 1.25em;
  font-weight: 500;
  margin: 0.5em 0 0.3em 0;
  color: var(--text);
}
p, ul {
  color: var(--text-light);
  font-size: 1.08em;
  margin: 0.5em 0;
  line-height: 1.5;
}
ul { padding-left: 1.2em; }

button, .category-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--button-radius);
  font-weight: 600;
  font-size: 1.08em;
  letter-spacing: 0.03em;
  transition: background 0.17s, box-shadow 0.16s, transform 0.14s;
  box-shadow: 0 3px 15px 0 #1976d23d;
  cursor: pointer;
  outline: none;
  margin: 0.6em 0.8em;
  padding: 1.1em 2.2em;
}
button:active, .category-btn:active {
  background: var(--accent);
  transform: scale(0.97);
}
button.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
}

/* CAJA DEL CORREO */
.email-box {
  background: var(--background);
  border-radius: 1.2em;
  box-shadow: 0 4px 15px 0 #1976d220;
  padding: 1.2em 1em;
  margin: 2em 0 1.2em 0;
  width: 94%;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fadeInEmail 0.23s;
}
@keyframes fadeInEmail {
  from { opacity: 0; transform: translateX(30px);}
  to { opacity: 1; transform: translateX(0);}
}
.email-title {
  font-weight: 600;
  font-size: 1.09em;
  margin-bottom: 0.5em;
  color: var(--primary);
  text-align: center;
}
.email-body {
  font-size: 1.13em;
  color: var(--text);
  margin-bottom: 0.1em;
  text-align: center;
}

/* BOTONES DE CATEGORÍA EN 2x2 */
.category-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.7em 0.7em;
  margin-top: 2em;
  margin-bottom: 1.5em;
  place-items: center;
}
.category-btn {
  width: 98%;
  min-width: 120px;
  max-width: 200px;
  min-height: 3.6em;
  max-height: 4.5em;
  font-size: 1.08em;
  margin: 0;
  padding: 0.65em 0.1em;
  white-space: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.category-btn.peticiones { background: #1976d2; }
.category-btn.quejas { background: #e53935; }
.category-btn.reclamos { background: #fbc02d; color: #333;}
.category-btn.sugerencias { background: #43a047; }
.category-btn.selected {
  /*animation: btnPop 0.25s;*/
  box-shadow: 0 6px 30px 0 #0003;
  filter: brightness(1.22);
}
@keyframes btnPop {
  0% { transform: scale(1);}
  70% { transform: scale(1.17);}
  100% { transform: scale(1);}
}

/* TIMER */
.timer {
  font-size: 2.2em;
  font-weight: 600;
  color: var(--primary);
  margin: 0.4em auto 0 auto;
  letter-spacing: 0.07em;
  width: 100%;
  text-align: center;
  transition: color 0.15s;
}

/* Countdown y animación final */
.countdown {
  position: absolute;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(25, 118, 210, 0.92);
  color: #fff;
  display: flex;
  z-index: 10;
  align-items: center;
  justify-content: center;
  font-size: 5em;
  font-weight: 800;
  letter-spacing: 0.1em;
  animation: fadeIn 0.5s;
}
.end-animation {
  position: absolute;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(25, 118, 210, 0.93);
  color: #fff;
  display: flex;
  z-index: 20;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  font-weight: 700;
  animation: fadeIn 0.5s;
  letter-spacing: 0.08em;
}

/* Resultados centrados y destacados */
.result-box {
  background: var(--background);
  border-radius: 1.5em;
  box-shadow: 0 4px 15px 0 #1976d220;
  padding: 1.3em 1.3em 1.3em 1.3em;
  margin: 1.8em auto 1.2em auto;
  width: 92%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.ia-result {
  background: var(--ia);
  color: #222;
  margin: 1.1em auto 0 auto;
  font-weight: 600;
  border-radius: 1.5em;
  padding: 0.9em 0.8em 0.7em 0.8em;
  box-shadow: 0 2px 10px 0 #fbc02d42;
  font-size: 1.08em;
  width: 82%;
  text-align: center;
}
.success-message, .fail-message {
  font-size: 1.15em;
  margin: 1.1em 0 0.2em 0;
  font-weight: 700;
  text-align: center;
}
.success-message { color: var(--success);}
.fail-message { color: var(--error);}
.bottom-msg {
  color: var(--text-light);
  font-size: 1em;
  margin: 1.1em 0 0.6em 0;
  text-align: center;
}

@media (max-width: 430px) {
  .screen {
    width: 100vw;
    min-width: unset;
    max-width: unset;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
  .email-box { padding: 0.8em 0.3em; }
  .category-btn {
    min-width: 80px;
    font-size: 0.98em;
    padding: 0.6em 0.1em;
    min-height: 3.1em;
  }
  .category-row { gap: 0.5em 0.5em; }
}
@media (max-width: 370px) {
  .category-btn { font-size: 0.9em; min-width: 65px; }
}
::-webkit-scrollbar { display: none; }