/* ======= Reset / base ======= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Fredoka', 'Comic Sans MS', system-ui, sans-serif;
  background: linear-gradient(to bottom, #5c94fc 0%, #5c94fc 70%, #e39f6b 70%, #d07a3c 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: #1a1a1a;
  overflow-x: hidden;
}

/* Nubes decorativas en el fondo */
body::before,
body::after {
  content: '☁️';
  position: fixed;
  font-size: 48px;
  opacity: 0.9;
  pointer-events: none;
}
body::before { top: 6%; left: 8%; }
body::after  { top: 14%; right: 10%; font-size: 64px; }

#app {
  width: 100%;
  max-width: 760px;
  position: relative;
  z-index: 1;
}

/* ======= Pantallas ======= */
.screen {
  display: none;
  background: #fff8e7;
  border: 6px solid #000;
  border-radius: 16px;
  box-shadow: 0 10px 0 #000, 0 12px 30px rgba(0, 0, 0, 0.3);
  padding: 28px 24px;
  text-align: center;
}

.screen.active {
  display: block;
  animation: pop-in 0.35s ease-out;
}

@keyframes pop-in {
  0%   { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ======= Title ======= */
.title {
  font-family: 'Press Start 2P', monospace;
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: 2px;
  margin-bottom: 14px;
  text-shadow: 3px 3px 0 #000;
}
.title-mario    { color: #e52521; display: inline-block; }
.title-multiply { color: #049cd8; display: inline-block; margin-left: 6px; }

.subtitle {
  font-size: 20px;
  margin-bottom: 24px;
  color: #333;
}

/* ======= Panel de configuración ======= */
.panel {
  background: #fff;
  border: 4px solid #000;
  border-radius: 12px;
  padding: 22px;
  text-align: left;
  box-shadow: 0 6px 0 #000;
}

.panel h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  margin-bottom: 10px;
  color: #e52521;
}

.lock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.lock-header h2 { margin-bottom: 0; }

.small-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  background: #fbe84c;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 #000;
  transition: transform 0.08s, box-shadow 0.08s;
}
.small-btn:hover  { transform: translateY(-1px); box-shadow: 0 4px 0 #000; }
.small-btn:active { transform: translateY(2px);  box-shadow: 0 1px 0 #000; }
.small-btn.secondary { background: #fff; }

.pin-entry {
  background: #fff;
  border: 3px dashed #000;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.pin-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 10px;
}
#pin-input {
  width: 100px;
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  padding: 6px 8px;
  border: 3px solid #000;
  border-radius: 6px;
  text-align: center;
  letter-spacing: 6px;
}
.pin-actions {
  display: flex;
  gap: 8px;
}
.pin-error {
  color: #c62828;
  font-weight: 700;
  margin-top: 8px;
  min-height: 20px;
  font-size: 15px;
}

.config-fields.locked {
  pointer-events: none;
  opacity: 0.55;
  filter: grayscale(0.4);
}

.panel > p {
  margin-bottom: 14px;
  font-size: 17px;
}

.tables-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.tables-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fbe84c;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.1s;
  user-select: none;
}

.tables-list label:hover {
  transform: translateY(-2px);
}

.tables-list label:has(input:checked) {
  background: #49b649;
  color: #fff;
}

.tables-list input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* ======= Botones principales ======= */
.primary-btn {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #fff;
  background: #e52521;
  border: 4px solid #000;
  border-radius: 10px;
  padding: 16px 28px;
  cursor: pointer;
  box-shadow: 0 6px 0 #000;
  transition: transform 0.08s, box-shadow 0.08s;
  width: 100%;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #000;
}

.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #000;
}

/* ======= HUD del juego ======= */
#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #000;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  margin-bottom: 18px;
}

.hud-item { letter-spacing: 1px; }

/* ======= Track (camino de Mario) ======= */
#track {
  position: relative;
  height: 110px;
  background: linear-gradient(
    to bottom,
    #5c94fc 0%,
    #5c94fc 55%,
    #49b649 55%,
    #49b649 70%,
    #c48843 70%,
    #8b5a2b 100%
  );
  border: 4px solid #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

#track-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background-image:
    linear-gradient(90deg, transparent 49%, rgba(0,0,0,0.25) 49%, rgba(0,0,0,0.25) 51%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(0,0,0,0.25) 49%, rgba(0,0,0,0.25) 51%, transparent 51%);
  background-size: 40px 40px;
}

#yoshi {
  position: absolute;
  bottom: 22px;
  left: 2%;
  width: 60px;
  height: 60px;
  transition: left 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.35));
}

#yoshi svg {
  width: 100%;
  height: 100%;
  display: block;
}

#yoshi.jump {
  animation: jump 0.45s ease-in-out;
}

@keyframes jump {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-40px) rotate(-10deg); }
}

#flag {
  position: absolute;
  bottom: 28px;
  right: 2%;
  font-size: 44px;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.4));
}

/* ======= Tiempo máximo en config ======= */
.time-config {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 12px;
}
.time-config input {
  width: 80px;
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  padding: 6px 8px;
  border: 3px solid #000;
  border-radius: 6px;
  text-align: center;
}

/* Timer en HUD */
#timer { transition: color 0.2s; }
#timer.low {
  color: #fbe84c;
  animation: timer-pulse 0.6s ease-in-out infinite;
}
#timer.danger {
  color: #ff6b6b;
  animation: timer-pulse 0.4s ease-in-out infinite;
}
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

/* ======= Toggle de música en config ======= */
.music-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
}
.music-toggle input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* ======= Botón de música en HUD ======= */
.music-btn {
  background: #fbe84c;
  border: 3px solid #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.08s;
}
.music-btn:hover { transform: scale(1.1); }
.music-btn:active { transform: scale(0.95); }

/* ======= Pregunta y respuestas ======= */
.question {
  font-family: 'Press Start 2P', monospace;
  font-size: 42px;
  background: #fbe84c;
  border: 4px solid #000;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 6px 0 #000;
  letter-spacing: 3px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.answer-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 26px;
  background: #049cd8;
  color: #fff;
  border: 4px solid #000;
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  box-shadow: 0 6px 0 #000;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}

.answer-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #000;
}

.answer-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #000;
}

.answer-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.answer-btn.correct {
  background: #49b649;
  animation: flash 0.4s ease-in-out 2;
}

.answer-btn.wrong {
  background: #e52521;
  animation: shake 0.4s ease-in-out;
}

@keyframes flash {
  0%, 100% { filter: brightness(1);   }
  50%      { filter: brightness(1.4); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

.feedback {
  min-height: 28px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.feedback.ok   { color: #2e7d32; }
.feedback.bad  { color: #c62828; }

/* ======= Pantalla victoria / derrota ======= */
.win-title, .lose-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  margin-bottom: 16px;
  text-shadow: 2px 2px 0 #000;
}
.win-title  { color: #e52521; }
.lose-title { color: #444; }

.win-sub, .lose-sub {
  font-size: 20px;
  margin-bottom: 18px;
}

.joke-box {
  background: #fff;
  border: 4px dashed #000;
  border-radius: 12px;
  padding: 22px;
  font-size: 20px;
  line-height: 1.5;
  margin-bottom: 18px;
  white-space: pre-line;
  text-align: left;
}

.win-stats {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  margin-bottom: 18px;
  color: #b8860b;
}

/* ======= Trofeos (banner en config) ======= */
.trophy-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fbe84c 0%, #ffb300 100%);
  border: 4px solid #000;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 18px;
  box-shadow: 0 4px 0 #000;
  flex-wrap: wrap;
}
.trophy-banner #trophy-count { font-size: 22px; color: #b8860b; }

/* ======= Superpremio screen ======= */
#super-screen {
  background: linear-gradient(180deg, #fff8e7 0%, #ffe29a 100%);
  position: relative;
  overflow: hidden;
}
#super-screen::before,
#super-screen::after {
  content: '✨';
  position: absolute;
  font-size: 40px;
  animation: sparkle 1.8s ease-in-out infinite;
}
#super-screen::before { top: 8%;  left: 6%; }
#super-screen::after  { top: 8%; right: 6%; animation-delay: 0.6s; }
@keyframes sparkle {
  0%, 100% { transform: scale(1)   rotate(0deg);   opacity: 0.7; }
  50%      { transform: scale(1.4) rotate(20deg);  opacity: 1;   }
}

.super-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 32px;
  color: #fbe84c;
  text-shadow: 3px 3px 0 #e52521, 6px 6px 0 #000;
  animation: bounce-title 0.9s ease-in-out infinite;
  margin-bottom: 18px;
  letter-spacing: 2px;
}
@keyframes bounce-title {
  0%, 100% { transform: translateY(0)    rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate( 2deg); }
}

.super-sub {
  font-size: 22px;
  margin-bottom: 10px;
}

.super-yoshi {
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
  animation: spin-yoshi 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px #ffd54a);
}
.super-yoshi svg { width: 100%; height: 100%; display: block; }
@keyframes spin-yoshi {
  0%, 100% { transform: scale(1)    rotate(-5deg); }
  50%      { transform: scale(1.15) rotate( 5deg); }
}

.super-jokes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}
.super-jokes .joke-box { margin-bottom: 0; font-size: 18px; }

.super-stars {
  font-size: 32px;
  letter-spacing: 6px;
  margin: 6px 0;
  animation: rainbow 1.4s ease-in-out infinite;
}
@keyframes rainbow {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%      { opacity: 0.5; transform: scale(1.08); }
}

/* ======= Responsive ======= */
@media (max-width: 500px) {
  .title    { font-size: 28px; }
  .question { font-size: 30px; padding: 16px; }
  .answer-btn { font-size: 20px; padding: 14px; }
  #hud      { font-size: 11px; padding: 8px 10px; }
  #flag { font-size: 34px; }
  #yoshi { width: 48px; height: 48px; }
}
