/* ============================================================
   BASE — Reset, tipografía global y elementos base
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- TIPOGRAFÍA ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg { display: block; }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-sans);
  font-size: var(--text-base);
}

ul, ol { list-style: none; }

/* ---- SELECCIÓN ---- */
::selection {
  background: rgba(108, 62, 184, 0.3);
  color: var(--text-primary);
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ---- FOCUS ACCESIBLE ---- */
:focus-visible {
  outline: 2px solid var(--role-rector);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- CLASES UTILITARIAS BÁSICAS ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }

.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-base{ font-size: var(--text-base); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }

.fw-medium   { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold     { font-weight: var(--fw-bold); }

.font-display { font-family: var(--font-display); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   TUTOR CO-PILOTO FLOTANTE
   ============================================================ */
.tutor-copilot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: var(--font-sans);
  pointer-events: none;
}

.tutor-copilot-container * {
  pointer-events: auto;
}

.tutor-avatar-wrapper {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.tutor-avatar-wrapper:hover {
  transform: scale(1.08);
}

.tutor-avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-surface-2), var(--bg-surface));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  position: relative;
  z-index: 2;
}

.tutor-avatar-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.35;
  animation: tutorPulse 2.5s infinite;
  z-index: 1;
}

@keyframes tutorPulse {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.tutor-mini-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-base);
  z-index: 3;
}

.tutor-bubble {
  width: 340px;
  max-width: calc(100vw - 48px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tutorBubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
}

@keyframes tutorBubbleIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tutor-bubble-header {
  padding: 12px 14px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tutor-bubble-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tutor-badge-tag {
  font-size: 10px;
  font-weight: var(--fw-bold);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tutor-bubble-heading {
  font-size: 13px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.tutor-bubble-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tutor-ctrl-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tutor-ctrl-btn:hover {
  background: var(--bg-surface-4);
  color: var(--text-primary);
}

.tutor-ctrl-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3B82F6;
}

.tutor-bubble-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutor-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  margin: 0;
}

.tutor-tip-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tutor-tip-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tutor-tip-text {
  font-size: 12px;
  color: #FCD34D;
  line-height: 1.35;
}

.tutor-hint-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

.tutor-bubble-footer {
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tutor-action-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.tutor-hint-trigger-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #60A5FA;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

/* ============================================================
   MODAL DE RUTA DE ESTUDIO
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.study-route-modal-box {
  width: 680px;
  max-width: 100%;
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

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

.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn {
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

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

.route-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  overflow-x: auto;
}

.route-tab-btn {
  flex: 1;
  min-width: 160px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  text-align: center;
  transition: all 0.2s ease;
}

.route-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-3);
}

.route-tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--color-primary);
  background: var(--bg-surface);
}

.route-modal-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.route-progress-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.stations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.station-card {
  display: flex;
  gap: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: border-color 0.2s ease;
}

.station-card.completed {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.04);
}

.station-icon-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
}

.station-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.station-circle.done {
  background: #10B981;
  color: #FFFFFF;
  font-weight: bold;
}

.station-line {
  flex: 1;
  width: 2px;
  background: var(--border-subtle);
  margin-top: 6px;
}

.station-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.station-title {
  font-size: 14px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0;
}

.station-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 6px 0;
}

.station-status-badge {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-done {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.badge-pending {
  background: var(--bg-surface-3);
  color: var(--text-secondary);
}

.cycle-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.cycle-step-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cycle-step-badge {
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--color-primary-light);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.cycle-step-icon {
  font-size: 24px;
}

.cycle-step-card h4 {
  font-size: 14px;
  margin: 0;
}

.cycle-step-card p {
  font-size: 12px;
  margin: 0;
  line-height: 1.4;
}

.technique-rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.technique-item {
  display: flex;
  gap: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.technique-letter {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.modal-footer {
  padding: 14px 20px;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   GIMNASIO DE CONCEPTOS & SIGLAS
   ============================================================ */
.active-chip {
  background: var(--color-primary) !important;
  color: #FFFFFF !important;
  border-color: var(--color-primary) !important;
  font-weight: var(--fw-bold) !important;
}

.trivia-option-btn:hover {
  background: var(--bg-surface-3) !important;
  border-color: var(--color-primary-light) !important;
  transform: translateY(-2px);
}

.match-tile:hover:not(:disabled) {
  background: var(--bg-surface-3) !important;
  transform: translateY(-2px);
}

.match-tile.selected {
  background: rgba(139, 92, 246, 0.15) !important;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

.match-tile.matched {
  background: rgba(16, 185, 129, 0.15) !important;
}

.speed-option-btn:hover {
  transform: scale(1.03);
}


