/* ── Reset & base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  width: 1280px;
  height: 720px;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #000;
  user-select: none;
}

/* ── Screens ─────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════
   ENTRADA DEL HOSPITAL
══════════════════════════════════════════════════════════════════════ */
#screen-entrance {
  display: none;
  background: linear-gradient(180deg, #5DADE2 0%, #85C1E9 55%, #A9DFBF 100%);
}
#screen-entrance.active { display: block; }

.sky {
  position: absolute;
  inset: 0;
}

/* Nubes */
.clouds { position: absolute; inset: 0; pointer-events: none; }
.cloud {
  position: absolute;
  background: rgba(255,255,255,0.85);
  border-radius: 50px;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.c1 { width: 180px; height: 50px; top: 80px; left: 100px; animation: drift 18s linear infinite; }
.c1::before { width: 90px; height: 70px; top: -30px; left: 20px; }
.c1::after  { width: 70px; height: 55px; top: -20px; left: 80px; }
.c2 { width: 220px; height: 55px; top: 50px; left: 700px; animation: drift 24s linear infinite; }
.c2::before { width: 100px; height: 80px; top: -35px; left: 30px; }
.c2::after  { width: 80px;  height: 65px; top: -25px; left: 110px; }
.c3 { width: 140px; height: 40px; top: 120px; left: 400px; animation: drift 30s linear infinite reverse; }
.c3::before { width: 70px; height: 55px; top: -25px; left: 15px; }
.c3::after  { width: 60px; height: 45px; top: -15px; left: 70px; }
@keyframes drift { from { transform: translateX(-300px); } to { transform: translateX(1600px); } }

/* Edificio */
.building {
  position: absolute;
  bottom: 148px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
}

.building-top {
  background: linear-gradient(135deg, #C0392B 0%, #96281B 100%);
  padding: 14px 24px 10px;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: white;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
}

.cross-flag {
  background: white;
  color: #C0392B;
  width: 36px; height: 36px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
}

.building-body {
  background: #FDFEFE;
  border: 3px solid #D5DBDB;
  border-top: none;
  padding: 24px 32px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.windows-row { display: flex; gap: 18px; }

.win {
  width: 72px; height: 72px;
  background: #AED6F1;
  border: 3px solid #85C1E9;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}
.win.lit { background: #FEF9E7; border-color: #F9E79F; }
.win::after {
  content: '';
  position: absolute;
  top: 0; left: 50%; bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.5);
}
.win::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: rgba(255,255,255,0.5);
}

/* Puerta entrada */
.entrance-door {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.door-panel {
  width: 80px; height: 100px;
  background: linear-gradient(135deg, #27AE60 0%, #1E8449 100%);
  border: 3px solid #1A5C36;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  position: relative;
}
.door-panel::after {
  content: '';
  position: absolute;
  top: 50%;
  background: #F4D03F;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.door-panel.left::after  { right: 8px; }
.door-panel.right::after { left: 8px; }

/* Calle y pasto */
.sidewalk {
  position: absolute;
  bottom: 48px; left: 0; right: 0;
  height: 100px;
  background: linear-gradient(180deg, #D5D8DC 0%, #BFC9CA 100%);
}
.sidewalk::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: #99A3A4;
}

.grass {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50px;
  background: linear-gradient(180deg, #58D68D 0%, #27AE60 100%);
}

/* Botón entrar */
.btn-primary {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1ABC9C 0%, #148F77 100%);
  color: white;
  border: none;
  padding: 18px 52px;
  font-size: 22px;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { transform: translateX(-50%) translateY(-3px); box-shadow: 0 10px 32px rgba(0,0,0,0.35); }
.btn-primary:active { transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════════════════════════
   SELECCIÓN DE EQUIPO
══════════════════════════════════════════════════════════════════════ */
#screen-team {
  display: none;
  background: linear-gradient(135deg, #EAF6FF 0%, #E9F7EF 100%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 48px;
}
#screen-team.active { display: flex; }

.team-title {
  font-size: 38px;
  font-weight: 800;
  color: #1A5276;
  text-align: center;
}

.team-cards { display: flex; gap: 60px; }

.team-card {
  width: 320px;
  background: white;
  border-radius: 24px;
  padding: 44px 36px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
  border: 3px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.team-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  border-color: #1ABC9C;
}
.team-card:active { transform: translateY(-4px); }

.card-icon { font-size: 80px; margin-bottom: 18px; }
.team-card h2 { font-size: 22px; font-weight: 800; color: #17202A; margin-bottom: 14px; }
.team-card ul { list-style: none; color: #5D6D7E; font-size: 15px; line-height: 2; }
.team-card ul li::before { content: '• '; color: #1ABC9C; font-weight: 700; }

/* ══════════════════════════════════════════════════════════════════════
   PANTALLA DE JUEGO
══════════════════════════════════════════════════════════════════════ */
#screen-game {
  display: none;
  flex-direction: column;
}
#screen-game.active { display: flex; }

/* HUD */
.hud {
  height: 58px;
  background: linear-gradient(90deg, #1A5276 0%, #1F618D 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  color: white;
  flex-shrink: 0;
}

.hud-block { display: flex; flex-direction: column; align-items: flex-start; min-width: 120px; }
.hud-block.right { align-items: flex-end; }
.hud-label { font-size: 11px; font-weight: 700; letter-spacing: 2px; opacity: 0.7; text-transform: uppercase; }
.hud-value { font-size: 26px; font-weight: 900; line-height: 1; }

.hud-timer-wrap {
  font-size: 36px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.12);
  padding: 6px 28px;
  border-radius: 30px;
  letter-spacing: 2px;
}
.hud-timer-wrap.urgent { background: #C0392B; animation: blink 0.6s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* Sala de espera */
.room-scene {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.room-wall {
  position: absolute;
  inset: 0;
  bottom: 100px;
  background: linear-gradient(180deg, #F8F9FA 0%, #EAECEE 100%);
}

.room-floor {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100px;
  background: linear-gradient(180deg, #D5D8DC 0%, #BFC9CA 100%);
  border-top: 3px solid #AAB7B8;
}

.wall-sign {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #99A3A4;
  text-transform: uppercase;
}

.ceiling-lamp {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 16px;
  background: #FDFEFE;
  border: 2px solid #F0B27A;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 0 50px 12px rgba(255,245,200,0.5);
}

/* Ventanas en la pared */
.window-wall {
  position: absolute;
  top: 40px;
  width: 100px; height: 90px;
  background: linear-gradient(135deg, #AED6F1 0%, #85C1E9 100%);
  border: 4px solid #D5DBDB;
  border-radius: 4px;
}
.window-wall::before, .window-wall::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.4);
}
.window-wall::before { top: 0; bottom: 0; left: 50%; width: 2px; }
.window-wall::after  { left: 0; right: 0; top: 50%; height: 2px; }
.window-wall.left  { left: 40px; }
.window-wall.right { right: 40px; }

/* Sillas */
.chairs-area {
  position: absolute;
  bottom: 98px;
  left: 80px;
  display: flex;
  gap: 10px;
}

.chair {
  width: 50px;
  height: 52px;
  background: #2980B9;
  border-radius: 6px 6px 2px 2px;
  position: relative;
  border: 2px solid #1A5276;
}
.chair::after {
  content: '';
  position: absolute;
  bottom: -10px; left: -4px; right: -4px;
  height: 10px;
  background: #1A5276;
  border-radius: 0 0 4px 4px;
}
.chair::before {
  content: '';
  position: absolute;
  top: 0; left: 4px; right: 4px;
  height: 26px;
  background: #3498DB;
  border-radius: 4px 4px 0 0;
}

/* Recepción */
.reception {
  position: absolute;
  right: 60px;
  bottom: 96px;
}

.desk {
  width: 240px;
}

.desk-surface {
  height: 22px;
  background: #784212;
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid #512E5F;
}

.desk-front {
  height: 84px;
  background: #935116;
  border-radius: 0 0 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.desk-front span {
  color: #FAD7A0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
}

.receptionist-figure {
  position: absolute;
  bottom: 108px;
  left: 80px;
  font-size: 44px;
  filter: drop-shadow(2px 2px 6px rgba(0,0,0,0.2));
  animation: receptionist-idle 3s ease-in-out infinite;
}
@keyframes receptionist-idle {
  0%,100%{ transform: rotate(-3deg); }
  50%    { transform: rotate(3deg); }
}

/* ── Pacientes ─────────────────────────────────────────────────────── */
.patient {
  position: absolute;
  bottom: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              bottom 0.3s ease,
              opacity 0.5s ease,
              transform 0.5s ease;
}

.patient-body {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.2));
}

.patient.idle .patient-body {
  animation: idle-sway 2.4s ease-in-out infinite;
}
@keyframes idle-sway {
  0%,100%{ transform: rotate(-4deg) translateY(0); }
  50%    { transform: rotate(4deg) translateY(-5px); }
}

.patient.active .patient-body {
  font-size: 52px;
  animation: active-bounce 0.5s ease-out;
}
@keyframes active-bounce {
  0%  { transform: scale(0.8) translateY(10px); }
  60% { transform: scale(1.1) translateY(-6px); }
  100%{ transform: scale(1) translateY(0); }
}

.patient.correct .patient-body { animation: happy-jump 0.6s ease-out; }
@keyframes happy-jump {
  0%  { transform: translateY(0) scale(1); }
  35% { transform: translateY(-22px) scale(1.15); }
  70% { transform: translateY(-8px) scale(0.95); }
  100%{ transform: translateY(0) scale(1); }
}

.patient.wrong .patient-body { animation: sad-shake 0.5s ease-out; }
@keyframes sad-shake {
  0%,100%{ transform: translateX(0) rotate(0); }
  25%    { transform: translateX(-10px) rotate(-5deg); }
  75%    { transform: translateX(10px) rotate(5deg); }
}

.patient.leaving {
  opacity: 0;
  transform: translateY(-30px);
}

/* ── Globo de pregunta ─────────────────────────────────────────────── */
.question-popup {
  position: absolute;
  pointer-events: none;
  z-index: 30;
}

.bubble-question {
  background: white;
  border: 3px solid #1ABC9C;
  border-radius: 18px;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 700;
  color: #17202A;
  max-width: 480px;
  min-width: 200px;
  text-align: center;
  line-height: 1.45;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  animation: pop-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes pop-in {
  from { transform: scale(0.5) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0);     opacity: 1; }
}

.bubble-tail {
  width: 20px; height: 20px;
  background: white;
  border-right: 3px solid #1ABC9C;
  border-bottom: 3px solid #1ABC9C;
  transform: rotate(45deg);
  margin: -12px auto 0;
  position: relative;
  z-index: -1;
}

/* ── Panel de respuestas ───────────────────────────────────────────── */
.answer-panel {
  height: 160px;
  background: rgba(255,255,255,0.97);
  border-top: 3px solid #1ABC9C;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.answers-grid {
  display: flex;
  gap: 18px;
  justify-content: center;
  width: 100%;
}

.answer-btn {
  flex: 1;
  max-width: 280px;
  background: white;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 3px solid;
  font-size: 15px;
  font-weight: 600;
  color: #17202A;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-align: left;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.answer-btn:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.answer-btn:active { transform: translateY(0); }

.answer-btn[data-key="A"] { border-color: #2E86C1; }
.answer-btn[data-key="B"] { border-color: #229954; }
.answer-btn[data-key="C"] { border-color: #D35400; }
.answer-btn[data-key="D"] { border-color: #7D3C98; }

.answer-letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900;
  color: white;
  flex-shrink: 0;
}

.answer-btn[data-key="A"] .answer-letter { background: #2E86C1; }
.answer-btn[data-key="B"] .answer-letter { background: #229954; }
.answer-btn[data-key="C"] .answer-letter { background: #D35400; }
.answer-btn[data-key="D"] .answer-letter { background: #7D3C98; }

.answer-btn.correct { background: #EAFAF1; border-color: #1E8449; }
.answer-btn.wrong   { background: #FDEDEC; border-color: #C0392B; }
.answer-btn.disabled { pointer-events: none; opacity: 0.45; }

/* ══════════════════════════════════════════════════════════════════════
   RESULTADO
══════════════════════════════════════════════════════════════════════ */
#screen-result {
  display: none;
  align-items: center;
  justify-content: center;
}
#screen-result.active { display: flex; }

.result-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1A5276 0%, #148F77 100%);
  opacity: 0.92;
}

.result-card {
  position: relative;
  background: white;
  border-radius: 28px;
  padding: 60px 80px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  animation: card-appear 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes card-appear {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.result-trophy { font-size: 72px; }
.result-card h1 { font-size: 48px; font-weight: 900; color: #1A5276; }

.result-row { display: flex; gap: 64px; }

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.result-stat span {
  font-size: 60px;
  font-weight: 900;
  color: #1ABC9C;
  line-height: 1;
}
.result-stat.accent span { color: #229954; }
.result-stat.muted  span { color: #E74C3C; }
.result-stat label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #85929E;
}

/* Resultado: btn no tiene transform-X porque no es absoluto */
.result-card .btn-primary {
  position: static;
  transform: none;
}
.result-card .btn-primary:hover { transform: translateY(-3px); }
.result-card .btn-primary:active { transform: translateY(0); }
