:root {
  --primary: #e67e22;
  --secondary: #27ae60;
  --dark-bg: #1e1e24;
  --counter-granite: linear-gradient(135deg, #2c3e50, #000000);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 15px;
  font-family: 'Montserrat', sans-serif;
  background: #121212;
  color: #ffffff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  position: relative;
  background: #1a1a1a;
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 900px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  border: 1px solid #333;
  transition: all 0.3s ease;
}

/* ESTILO PANTALLA COMPLETA */
.game-container:fullscreen, .game-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  background: #121212;
}

/* BOTÓN DE PANTALLA COMPLETA EN LA ESQUINA SUPERIOR DERECHA */
.btn-fullscreen {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #2a2a2a;
  border: 1px solid #f39c12;
  color: #f39c12;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: transform 0.2s, background 0.2s, color 0.2s;
}

.btn-fullscreen:hover {
  background: #f39c12;
  color: #111;
  transform: scale(1.1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-right: 50px;
}

h1 {
  margin: 0;
  font-size: 1.8rem;
  color: #f39c12;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.hud {
  display: flex;
  gap: 15px;
}

.badge {
  background: #2a2a2a;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 1rem;
  border: 1px solid #444;
}

/* ESCENA DE LA PIZZERÍA */
.restaurant-stage {
  background: radial-gradient(circle at 50% 30%, #3a3a3a 0%, #111111 100%);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  position: relative;
  overflow: hidden;
  border: 2px solid #222;
}

/* LADO IZQUIERDO: CLIENTE */
.left-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 320px;
  position: relative;
}

/* BOCADILLO DE DIÁLOGO */
.speech-bubble {
  background: #ffffff;
  color: #111111;
  border-radius: 12px;
  padding: 10px 20px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  margin-bottom: 10px;
  z-index: 10;
  position: relative;
  transition: all 0.3s ease;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 8px 0 8px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}

.fraction-target {
  font-size: 2.2rem;
  font-weight: 900;
  color: #d35400;
}

/* BOCADILLO CUANDO EL CLIENTE SE ENOJA */
.speech-bubble.angry {
  background: #2c2c2c;
  color: #ffffff;
  border: 2px solid #ff4757;
  animation: realAnger 0.4s ease-in-out;
}

.speech-bubble.angry::after {
  border-color: #2c2c2c transparent transparent transparent;
}

.speech-bubble.angry .fraction-target {
  color: #ff4757;
}

/* CLIENTE CONTENEDOR Y ANIMACIONES AVANZADAS */
.realistic-client-wrapper {
  position: relative;
  width: 250px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 2;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease-out;
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to right, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
}

.client-avatar-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0px 10px 20px rgba(0,0,0,0.7));
  transition: transform 0.2s ease;
}

/* Gestos corporales de enojo real (Sin ponerse rojo) */
@keyframes realAnger {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  15% { transform: translateY(-10px) scale(1.08) rotate(-4deg); }
  30% { transform: translateY(5px) scale(1.05) rotate(3deg); }
  45% { transform: translateY(-8px) scale(1.08) rotate(-3deg); }
  60% { transform: translateY(3px) scale(1.05) rotate(2deg); }
  75% { transform: translateY(-4px) scale(1.06) rotate(-2deg); }
  100% { transform: translateY(0) scale(1.05) rotate(0deg); }
}

.realistic-client-wrapper.angry .client-avatar-svg {
  animation: realAnger 0.6s ease-in-out infinite;
}

/* Desplazamiento ultra suave hacia la derecha con desvanecimiento */
.realistic-client-wrapper.exit-right {
  transform: translateX(380px) !important;
  opacity: 0 !important;
}

/* Entrada del nuevo cliente desde la izquierda */
.realistic-client-wrapper.enter-left {
  transform: translateX(-400px);
  opacity: 0;
}

.character-shadow {
  position: absolute;
  bottom: 0;
  width: 180px;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 70%);
  z-index: 1;
}

/* MOSTRADOR Y CAJA REGISTRADORA */
.counter-top {
  width: 100%;
  height: 40px;
  background: var(--counter-granite);
  border-top: 3px solid #f39c12;
  border-radius: 6px;
  position: relative;
  z-index: 3;
  margin-top: -15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}

.cash-register-realistic {
  position: absolute;
  bottom: 35px;
  left: 15px;
  width: 95px;
  height: 70px;
  background: linear-gradient(180deg, #34495e, #1a252f);
  border-radius: 8px;
  border: 2px solid #555;
  box-shadow: inset -3px 0 5px rgba(0,0,0,0.5), -5px 10px 15px rgba(0,0,0,0.6);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cr-screen-glow {
  background: #00ff66;
  color: #003311;
  font-family: monospace;
  font-weight: bold;
  font-size: 0.75rem;
  padding: 3px;
  border-radius: 3px;
  text-align: center;
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.6);
}

.cr-keys {
  height: 25px;
  background: #111;
  border-radius: 3px;
  border-top: 2px solid #f1c40f;
}

.cr-slot {
  height: 10px;
  background: #222;
  border-radius: 2px;
}

/* LADO DERECHO: MESÓN Y CONTROLES */
.right-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.pizza-tray {
  background: radial-gradient(circle, #2a2a2a 0%, #151515 100%);
  padding: 15px;
  border-radius: 50%;
  box-shadow: 0 15px 35px rgba(0,0,0,0.8), inset 0 0 15px rgba(255,255,255,0.05);
  border: 4px solid #333;
  margin-bottom: 15px;
}

canvas {
  display: block;
  cursor: pointer;
}

.controls-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selector-box {
  background: #2a2a2a;
  padding: 10px 15px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #444;
  font-weight: bold;
}

select {
  font-family: 'Montserrat', sans-serif;
  background: #111;
  color: #fff;
  border: 1px solid #f39c12;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: bold;
  outline: none;
}

.btn-deliver {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #e67e22, #d35400);
  border: none;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
  transition: transform 0.1s;
}

.btn-deliver:active {
  transform: scale(0.97);
}

/* ALERTA ROJA CENTRADA EN PANTALLA */
.warning-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: #ff4757;
  color: #ffffff;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(255, 71, 87, 0.6), 0 0 20px rgba(0,0,0,0.8);
  border: 2px solid #ffffff;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
}

.warning-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.warning-toast.hidden {
  display: none;
}

/* MODAL FIN DE JUEGO */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-content {
  background: #222;
  border: 2px solid #f39c12;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 360px;
}

.final-score { font-size: 1.8rem; font-weight: 900; color: #27ae60; }
.btn-restart {
  background: #27ae60; color: #fff; border: none; padding: 12px 24px;
  font-weight: 900; border-radius: 10px; cursor: pointer;
}