/* ============================================================
   TETERA ROJA — Mientras Esperas & Minijuego Barista de Precisión
   Diseño Oficial: Fondo Blanco/Crema, Rojo Corporativo (#D90429 / #8E232E)
   ============================================================ */

:root {
  --color-dark:       #191214;
  --color-dark-2:     #241719;
  --color-brown:      #8E232E;
  --color-warm:       #7C5C58;
  --color-red:        #D90429;
  --color-red-dark:   #A60320;
  --color-cream:      #F8F3EC;
  --color-light:      #FDFBF8;
  --color-white:      #FFFFFF;
  --color-gold:       #D4A574;
  --color-border:     rgba(142, 35, 46, 0.15);

  --font-title:       'Barlow Condensed', sans-serif;
  --font-expressive:  'Lora', Georgia, serif;
  --font-body:        'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-light);
  color: var(--color-dark);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  overflow-x: hidden;
  position: relative;
}

/* Marca de Agua con Logo Tetera Roja de Fondo */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 380px;
  background-image: url('../favicon.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

.espera-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 32px);
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

/* Barra Superior de Navegación */
.top-nav-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-brown);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(25, 18, 20, 0.04);
  transition: all 0.2s ease;
}

.btn-back-home:hover, .btn-back-home:active {
  background: var(--color-cream);
  color: var(--color-red);
  transform: translateX(-2px);
}

/* Floating Top Bar for Saved Voucher */
.top-voucher-bar {
  background: var(--color-white);
  border: 1.5px solid rgba(217, 4, 41, 0.3);
  border-radius: 999px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(217, 4, 41, 0.08);
  transition: all 0.2s ease;
}

.top-voucher-bar:active {
  transform: scale(0.98);
  background: var(--color-cream);
}

.voucher-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-dark);
}

.voucher-bar-code {
  font-family: monospace;
  background: var(--color-red);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  letter-spacing: 1px;
}

.voucher-bar-action {
  font-size: 0.72rem;
  color: var(--color-brown);
  font-weight: 800;
}

/* Hero Section */
.espera-hero {
  text-align: center;
  margin: 6px 0 18px 0;
}

.hero-tag {
  display: inline-block;
  background: rgba(217, 4, 41, 0.08);
  border: 1px solid rgba(217, 4, 41, 0.25);
  color: var(--color-red);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--font-title);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--color-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.05;
  margin-bottom: 8px;
}

.hero-title span {
  color: var(--color-red);
}

.hero-subtitle {
  font-family: var(--font-expressive);
  font-size: 0.9rem;
  color: #666;
  line-height: 1.45;
  padding: 0 6px;
  font-style: italic;
}

/* Game Selection Card */
.game-card {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: 22px;
  padding: 24px 20px;
  box-shadow: 0 12px 35px rgba(25, 18, 20, 0.08);
  position: relative;
  overflow: hidden;
  text-align: center;
  margin-bottom: 20px;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--color-red), var(--color-brown));
  color: white;
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.game-icon-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.game-icon-visual img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(217, 4, 41, 0.22));
  transition: transform 0.25s ease;
}

.game-card:hover .game-icon-visual img {
  transform: scale(1.06);
}

.game-title {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--color-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.game-description {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.45;
  margin-bottom: 20px;
  padding: 0 8px;
}

.btn-play-game {
  width: 100%;
  background: linear-gradient(135deg, var(--color-red) 0%, var(--color-brown) 100%);
  color: var(--color-white);
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(217, 4, 41, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-play-game:active {
  transform: scale(0.97);
}

/* ============================================================
   BARISTA PRECISION GAME VIEW
   ============================================================ */
.game-viewport {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #FFFDFB 0%, #F4EFEB 90%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.game-viewport.active {
  opacity: 1;
  visibility: visible;
}

/* Marca de Agua en el Juego */
.game-viewport::before {
  content: '';
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  background-image: url('../favicon.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

/* Game Top HUD */
.game-hud {
  width: 100%;
  max-width: 440px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  z-index: 10;
}

.hud-btn-back {
  background: var(--color-white);
  border: 1px solid #DDD;
  color: var(--color-dark);
  padding: 7px 14px;
  border-radius: 8px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.hud-level-badge {
  background: var(--color-red);
  color: white;
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-score-box {
  text-align: center;
}

.hud-score-label {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-brown);
  letter-spacing: 1px;
}

.hud-score-num {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--color-dark);
  line-height: 1;
}

.hud-lives {
  font-size: 1.25rem;
  letter-spacing: 2px;
}

/* Game Canvas Container */
.game-canvas-box {
  width: 100%;
  max-width: 400px;
  height: 56vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

#baristaCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Banner de Nivel Especial 10 */
.level-10-banner {
  position: absolute;
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #D90429, #8E232E);
  color: white;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 15px rgba(217, 4, 41, 0.4);
  white-space: nowrap;
  animation: pulseBanner 1.2s infinite alternate;
}

@keyframes pulseBanner {
  0% { transform: translateX(-50%) scale(0.96); }
  100% { transform: translateX(-50%) scale(1.04); }
}

/* Feedback Toast / Text Overlay on Pour */
.pour-feedback-msg {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  z-index: 20;
}

.pour-feedback-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feedback-perfect {
  background: #2E7D32;
  color: white;
}

.feedback-good {
  background: #D4A574;
  color: #191214;
}

.feedback-fail {
  background: #D90429;
  color: white;
}

/* Pour Action Bar (Bottom Button / Touch Area) */
.pour-action-area {
  width: 100%;
  max-width: 440px;
  text-align: center;
  padding-bottom: 12px;
  z-index: 10;
}

.pour-hint {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 10px;
  font-weight: 600;
}

.btn-pour-hold {
  width: 100%;
  background: linear-gradient(135deg, var(--color-red) 0%, var(--color-brown) 100%);
  color: white;
  border: 3px solid #FFFFFF;
  border-radius: 18px;
  padding: 18px 20px;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(217, 4, 41, 0.35);
  transition: transform 0.1s ease, filter 0.1s ease;
  touch-action: none;
}

.btn-pour-hold:active, .btn-pour-hold.pouring {
  transform: scale(0.96);
  filter: brightness(1.15);
  box-shadow: 0 4px 15px rgba(217, 4, 41, 0.5);
}

/* Game Over Dialog */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 18, 20, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.game-over-overlay.active {
  opacity: 1;
  visibility: visible;
}

.game-over-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-white);
  color: var(--color-dark);
  border-radius: 22px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  border: 1.5px solid var(--color-border);
}

.game-over-title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-brown);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.game-over-score {
  font-family: var(--font-title);
  font-size: 3.4rem;
  font-weight: 900;
  color: var(--color-red);
  line-height: 1;
  margin: 10px 0 4px 0;
}

.game-over-record {
  font-size: 0.82rem;
  color: #777;
  font-weight: 700;
  margin-bottom: 16px;
}

.game-over-incentive {
  background: var(--color-cream);
  border: 1px solid rgba(217, 4, 41, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: #444;
  line-height: 1.4;
}

.btn-restart {
  width: 100%;
  background: linear-gradient(135deg, var(--color-red) 0%, var(--color-brown) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-secondary {
  width: 100%;
  background: transparent;
  color: #666;
  border: 1px solid #CCC;
  border-radius: 10px;
  padding: 10px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  cursor: pointer;
}

/* Full Voucher Modal */
.full-voucher-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 18, 20, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.full-voucher-overlay.active {
  opacity: 1;
  visibility: visible;
}

@keyframes bounceTrophy {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.victory-overlay.active {
  animation: fadeInVictory 0.4s ease forwards;
}

@keyframes fadeInVictory {
  from { opacity: 0; }
  to { opacity: 1; }
}

