/* ==========================================================================
   EL ROSCO RENAC - Tema Clínico Claro (Estilo Hospitalario Institucional)
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --color-renac-navy: #1b365d;
  --color-renac-blue: #0284c7;
  --color-renac-light: #e0f2fe;
  --color-border: #e2e8f0;
  
  --status-pending: #0284c7;
  --status-passed: #f59e0b;
  --status-passed-bg: #fef3c7;
  --status-correct: #10b981;
  --status-correct-bg: #d1fae5;
  --status-wrong: #ef4444;
  --status-wrong-bg: #fee2e2;
  --status-active: #2563eb;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 35px -5px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   Header Institucional
   ========================================================================== */
.header-renac {
  background-color: #ffffff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-badge {
  background: linear-gradient(135deg, #1b365d, #0284c7);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.brand-title-group h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-renac-navy);
  letter-spacing: -0.3px;
}

.brand-title-group p {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: var(--color-renac-blue);
  border-color: #cbd5e1;
}

.header-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-renac-light);
  color: var(--color-renac-blue);
  border: 1px solid #bae6fd;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-link-btn:hover {
  background: #bae6fd;
  color: #0369a1;
}

/* ==========================================================================
   Marcador Superior (Scoreboard)
   ========================================================================== */
.scoreboard-strip {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  padding: 10px 24px;
}

.scoreboard-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.stat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.stat-dot.correct { background-color: var(--status-correct); }
.stat-dot.wrong { background-color: var(--status-wrong); }
.stat-dot.passed { background-color: var(--status-passed); }
.stat-dot.remaining { background-color: #94a3b8; }

.turn-pill {
  font-size: 13px;
  color: var(--text-secondary);
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

/* ==========================================================================
   Layout Principal del Juego
   ========================================================================== */
.main-game-layout {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 20px;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 580px) minmax(360px, 1fr);
  gap: 36px;
  align-items: center;
}

@media (max-width: 960px) {
  .main-game-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 16px auto;
  }
}

/* ==========================================================================
   Círculo del Rosco (Visualización Circular)
   ========================================================================== */
.rosco-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 540px;
  margin: 0 auto;
}

.rosco-circle-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.letter-node {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--color-border);
  color: var(--color-renac-navy);
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  transform: translate(-50%, -50%);
  z-index: 5;
}

@media (max-width: 600px) {
  .letter-node {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }
}

.letter-node:hover:not(.locked) {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: var(--shadow-md);
  border-color: var(--color-renac-blue);
  color: var(--color-renac-blue);
}

/* Estados de las letras */
.letter-node.unanswered {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--color-renac-navy);
}

.letter-node.active {
  background: var(--status-active);
  color: #ffffff;
  border-color: #ffffff;
  transform: translate(-50%, -50%) scale(1.28);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25), var(--shadow-lg);
  z-index: 10;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4), var(--shadow-lg); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0), var(--shadow-lg); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), var(--shadow-lg); }
}

.letter-node.passed {
  background: var(--status-passed);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.letter-node.correct {
  background: var(--status-correct);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.letter-node.wrong {
  background: var(--status-wrong);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   Contenedor Central del Rosco (Imagen y Letra)
   ========================================================================== */
.rosco-center-stage {
  position: absolute;
  width: 62%;
  height: 62%;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  border: 4px solid #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.rosco-center-stage:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-xl);
}

.center-image-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.center-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}

.placeholder-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-renac-navy);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.image-zoom-overlay {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0.95;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  white-space: nowrap;
}

.rosco-center-stage:hover .image-zoom-overlay {
  opacity: 1;
  background: #0284c7;
  border-color: #ffffff;
  transform: translateX(-50%) scale(1.08);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

.center-letter-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(27, 54, 93, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 3;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Panel de Pregunta y Formulario (Lado Derecho)
   ========================================================================== */
.question-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.clue-card {
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.clue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px;
}

.clue-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-renac-navy);
  background: var(--color-renac-light);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.clue-letter-big {
  color: var(--status-active);
  font-size: 16px;
  font-weight: 900;
}

.lap-counter-tag {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.clue-text {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 80px;
}

/* Formulario de Respuesta */
.answer-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.answer-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-primary);
  background: #f8fafc;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.answer-input:focus {
  background: #ffffff;
  border-color: var(--status-active);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.answer-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-size: 16px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-renac-navy);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: #152c4d;
  box-shadow: var(--shadow-md);
}

.btn-pass {
  background: var(--status-passed-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.btn-pass:hover {
  background: #fde68a;
  color: #92400e;
}

.helper-shortcuts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px;
}

.kbd-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Modal Lightbox HD (Para ampliar imágenes clínicas)
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-modal.open .lightbox-content {
  transform: scale(1);
}

.lightbox-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.lightbox-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-renac-navy);
}

.lightbox-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.lightbox-close-btn:hover {
  color: var(--text-primary);
}

.lightbox-body {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  max-height: 60vh;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
}

.lightbox-footer p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Pantalla de Resumen Final de Resultados
   ========================================================================== */
.results-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.results-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.results-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.results-hero {
  background: linear-gradient(135deg, #1b365d, #0369a1);
  color: #ffffff;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
}

.results-badge-score {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.results-hero h2 {
  font-size: 24px;
  font-weight: 800;
}

.results-hero p {
  font-size: 15px;
  color: #e0f2fe;
  max-width: 600px;
}

.results-actions-top {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-restart {
  background: #ffffff;
  color: var(--color-renac-navy);
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-restart:hover {
  background: #f1f5f9;
}

.results-list-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

.result-card-item {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 650px) {
  .result-card-item {
    grid-template-columns: 40px 1fr;
    gap: 12px;
  }
  .result-atlas-link {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.result-letter-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-letter-circle.correct { background: var(--status-correct); }
.result-letter-circle.wrong { background: var(--status-wrong); }
.result-letter-circle.passed { background: var(--status-passed); }

.result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-term-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-user-answer {
  font-size: 13px;
  color: var(--text-secondary);
}

.result-user-answer strong {
  color: var(--text-primary);
}

.result-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
}

.result-atlas-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-renac-light);
  color: var(--color-renac-blue);
  border: 1px solid #bae6fd;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.result-atlas-link:hover {
  background: #bae6fd;
  color: #0369a1;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer-renac {
  background: #ffffff;
  border-top: 1px solid var(--color-border);
  padding: 16px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}
