/* ═══════════════════════════════════════════════════════════════
   TechHub Euroformac — DAW 2026 — style.css
═══════════════════════════════════════════════════════════════ */
:root {
  --primary-color: #6366f1;
  --secondary-color: #a855f7;
  --accent-color: #22d3ee;
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --radius: 12px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; }

/* ── VIEWS ──────────────────────────────────────────────────── */
#view-dashboard { position: relative; z-index: 10; }
#view-dashboard.hidden { display: none; }

.view-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-fullscreen.hidden { display: none; }

/* ── DASHBOARD LAYOUT ───────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  background: rgba(15, 23, 42, 0.98);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000; /* Increased to stay above overlay */
}

.sidebar-header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo h1 span {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.side-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.side-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.side-icon { font-size: 1.2rem; }

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-small { font-size: 0.7rem; color: var(--text-secondary); opacity: 0.6; }

/* ── MAIN CONTENT AREA ──────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top right, rgba(99,102,241,0.05), transparent 40%);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1; /* Keep content below overlay */
  min-width: 0; /* Fix for flex item overflow */
}

/* ── SIDEBAR OVERLAY ────────────────────────────────────────── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7); /* Darker solid background, no blur */
    z-index: 990; /* Just below sidebar (1000) */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 90;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        background: #0f172a; /* Solid background on mobile to avoid "turbidity" */
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
        backface-visibility: hidden; /* Sharpness fix */
        transform: translateZ(0); /* Sharpness fix */
    }
    .sidebar.open {
        left: 0;
    }
    .menu-toggle {
        display: flex;
    }
    .top-bar {
        padding: 0.75rem 1rem;
    }
    #main-container {
        padding: 1.5rem 1rem;
    }
    .hero h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .top-bar-actions .label {
        display: none;
    }
    .progress-bar-small {
        width: 100px;
    }
    .top-bar-left h2 {
        font-size: 1.1rem;
    }
}

.top-bar-title h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

#main-container {
  padding: 2rem 2.5rem;
  flex: 1;
}

.dash-section {
  animation: fadeIn 0.4s ease-out forwards;
}

.dash-section.hidden { display: none; }

/* ── EMPTY STATES ───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    animation: fadeIn 0.5s ease-out;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.1));
}

.empty-state p {
    font-size: 1.1rem;
    max-width: 400px;
    margin-bottom: 1rem;
}

/* ── HEADER (Legacy/Refined) ────────────────────────────────── */
/* Some styles from .main-header might be reused by .top-bar icons if needed */

.user-nav { display: flex; align-items: center; gap: 1.5rem; }
.progress-info { display: flex; flex-direction: column; gap: 0.25rem; }
.progress-info .label { font-size: 0.75rem; color: var(--text-secondary); }

.progress-bar-small {
  width: 150px; height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px; overflow: hidden;
}
.progress-bar-small .fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
  box-shadow: 0 0 10px var(--primary-color);
  transition: width 0.5s ease;
}

/* ── HERO ───────────────────────────────────────────────────── */
.hero { margin-bottom: 3rem; text-align: center; }
.hero h2 {
  font-size: 2.5rem; margin-bottom: 0.5rem;
  background: linear-gradient(to bottom right, #fff, #94a3b8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { color: var(--text-secondary); font-size: 1.1rem; }

/* ── GRID ───────────────────────────────────────────────────── */
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 1024px) {
  .grid-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-container { grid-template-columns: 1fr; }
}
.grid-container.syllabus-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .grid-container.syllabus-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-container.syllabus-grid { grid-template-columns: 1fr; }
}

/* ── SUBJECT CARD ───────────────────────────────────────────── */
.subject-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 1.5rem;
  border-radius: var(--radius);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subject-card:hover {
  border-color: var(--card-color, var(--primary-color));
  box-shadow: 0 0 20px color-mix(in srgb, var(--card-color, var(--primary-color)) 20%, transparent);
  transform: translateY(-2px);
}

.subject-card h3 { font-size: 1.2rem; }

.card-icon {
  position: absolute; bottom: 0; right: -10px;
  font-size: 4rem; opacity: 0.1; transition: transform 0.3s ease;
}
.subject-card:hover .card-icon { transform: scale(1.2) rotate(-10deg); opacity: 0.2; }

.card-pool-badge {
  font-size: 0.75rem; color: var(--text-secondary);
  background: var(--glass); border: 1px solid var(--glass-border);
  padding: 0.2rem 0.6rem; border-radius: 20px; width: fit-content;
}

.card-actions-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}

.btn-flashcard {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  padding: 0.4rem 0.8rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-flashcard:hover { background: rgba(168, 85, 247, 0.25); }

.btn-fallos {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 0.4rem 0.8rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-fallos:hover { background: rgba(239, 68, 68, 0.22); }

.btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.4rem 1rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-tiny {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-tiny:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.btn-theory {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.btn-theory:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}

/* ── TOPIC FRAMES (UNIT SELECTOR) ────────────────────────────── */
.unit-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.topic-frame {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.topic-frame:hover:not(.disabled) {
    border-color: color-mix(in srgb, var(--card-color) 50%, white);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.topic-frame.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.topic-header {
    background: rgba(255, 255, 255, 0.04);
    padding: 0.6rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    position: relative;
}

.topic-title {
    transition: all 0.3s ease;
}

.topic-play-icon {
    position: absolute;
    right: 12px;
    opacity: 0;
    transform: translateX(10px) scale(0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.9rem;
    pointer-events: none;
}

.topic-frame:hover:not(.disabled) .topic-header {
    background: color-mix(in srgb, var(--card-color) 30%, transparent);
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.2);
}

.topic-frame:hover:not(.disabled) .topic-title {
    transform: translateX(-10px);
}

.topic-frame:hover:not(.disabled) .topic-play-icon {
    opacity: 1;
    transform: translateX(0) scale(1.2);
}

.topic-badge {
    background: #10b981;
    color: #fff;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.topic-content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.topic-content .resource-links-container {
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 0.4rem;
}

.res-link-labeled {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    min-width: 48px;
    flex: 1;
}

.res-link-labeled span {
    font-size: 0.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.res-link-labeled:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.res-link-labeled.report { color: #5eead4; }
.res-link-labeled.infographic { color: #d8b4fe; }
.res-link-labeled.video { color: #60a5fa; }

/* ── EXAM SELECTOR LARGE ────────────────────────────────────── */
.exam-selector-large { margin-top: 0.25rem; }
.exam-selector-large button {
  width: 100%;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border: none; color: white;
  padding: 1rem; border-radius: 10px;
  font-weight: 700; cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
  font-family: inherit; font-size: 0.95rem;
}
.exam-selector-large button:hover {
  transform: translateY(-2px); filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* ── FALLOS CARD ────────────────────────────────────────────── */
.fallos-card {
  border-color: rgba(239, 68, 68, 0.2);
}
.fallos-card .exam-selector-large button {
  background: linear-gradient(to right, #ef4444, #dc2626);
  box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}

/* ── SECTION DIVIDER ────────────────────────────────────────── */
.section-divider {
  display: flex; align-items: center;
  margin: 4rem 0 2rem;
  color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em;
}
.section-divider::before, .section-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(to var(--side), var(--glass-border), transparent);
}
.section-divider::before { --side: left; margin-right: 1.5rem; }
.section-divider::after  { --side: right; margin-left: 1.5rem; }

/* ── SYLLABUS CARDS ─────────────────────────────────────────── */
.syllabus-card {
  border: 1px solid rgba(245,158,11,0.2);
  background: linear-gradient(135deg, rgba(30,41,59,0.8), rgba(15,23,42,0.9));
  padding: 1rem;
}
.syllabus-card:hover { border-color: #f59e0b; box-shadow: 0 0 20px rgba(245,158,11,0.1); }
.syllabus-card .card-icon { color: #f59e0b; opacity: 0.15; font-size: 2rem; }
.syllabus-card .exam-selector-large button {
  background: linear-gradient(to right, #f59e0b, #d97706);
  box-shadow: 0 4px 15px rgba(245,158,11,0.2);
}
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.badge-oficial {
  background: #f59e0b;
  color: white;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-attempts {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: bold;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.syllabus-group { margin-bottom: 3rem; animation: fadeIn 0.5s ease forwards; grid-column: 1 / -1; }
.syllabus-group-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.syllabus-group-header .header-icon {
  font-size: 1.5rem; background: rgba(255,255,255,0.05);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.syllabus-group-header h4 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; }

/* ── EXAM TOPBAR ────────────────────────────────────────────── */
.exam-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  z-index: 10;
}

.back-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 0.9rem;
  transition: all 0.2s ease;
}
.back-btn:hover { background: rgba(255,255,255,0.1); }

.exam-subject-label {
  font-weight: 600; font-size: 0.95rem;
  color: var(--text-secondary);
}

.timer { font-weight: 700; color: var(--accent-color); font-size: 1rem; min-width: 60px; text-align: right; }

.exam-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  /* El display:flex se ha quitado para evitar el bug de padding-bottom en contenedores flex con overflow */
}

#exam-engine-root, #flashcard-root, #stats-root {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}


/* ── QUESTION CONTAINER ─────────────────────────────────────── */
.question-container {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeIn 0.3s ease;
}

.question-meta {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.85rem; color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.unit-badge {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: #818cf8;
  padding: 0.15rem 0.5rem;
  border-radius: 6px; font-size: 0.75rem;
}

.question-text {
  font-size: 1.15rem; font-weight: 600;
  margin-bottom: 1.5rem; line-height: 1.6;
}

.options-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.option-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.2rem;
  border-radius: 12px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex; align-items: center; gap: 1rem;
  font-family: inherit; font-size: 0.95rem;
}
.option-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  transform: translateX(6px);
}
.option-btn:disabled { cursor: default; }
.option-btn.correct { background: rgba(16,185,129,0.15); border-color: #10b981; }
.option-btn.incorrect { background: rgba(239,68,68,0.15); border-color: #ef4444; }

.opt-letter {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

.feedback-area { margin-top: 1.25rem; }
.feedback-area.hidden { display: none; }

.explanation-box {
  padding: 1.2rem; border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border-left: 4px solid #ef4444;
  animation: fadeIn 0.3s ease;
}
.explanation-box.correct-box { border-left-color: #10b981; }
.explanation-box strong { display: block; margin-bottom: 0.5rem; }
.explanation-box p { font-size: 0.9rem; color: var(--text-secondary); }

.next-btn {
  background: var(--primary-color);
  color: white; border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 10px; font-weight: 700;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit; font-size: 0.95rem;
}
.next-btn:hover { filter: brightness(1.1); transform: scale(1.03); }

/* ── RESULTS ────────────────────────────────────────────────── */
.results-container {
  text-align: center; max-width: 600px; margin: 0 auto;
  animation: fadeIn 0.4s ease;
}
.results-container h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }

.score-circle {
  width: 140px; height: 140px; border-radius: 50%;
  margin: 1.5rem auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; font-weight: 800; border: 5px solid;
}
.score-circle.passed { border-color: #10b981; color: #10b981; box-shadow: 0 0 30px rgba(16,185,129,0.2); }
.score-circle.failed { border-color: #ef4444; color: #ef4444; box-shadow: 0 0 30px rgba(239,68,68,0.2); }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.75rem; margin-bottom: 1.25rem;
}
.stat-item {
  background: var(--glass); padding: 0.9rem;
  border-radius: 10px; display: flex;
  flex-direction: column; gap: 0.25rem;
}
.stat-item span { font-size: 0.8rem; color: var(--text-secondary); }
.stat-item strong { font-size: 1.3rem; }

.formula-box {
  background: rgba(234,179,8,0.07);
  border: 1px solid rgba(234,179,8,0.25);
  border-radius: 12px; padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem; text-align: left; line-height: 1.8;
}
.formula-box p { font-size: 0.9rem; color: var(--text-secondary); }
.formula-box p strong { color: #fbbf24; }
.formula-box small {
  font-size: 0.78rem; color: var(--text-secondary); opacity: 0.7;
  display: block; margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.05); padding-top: 0.5rem;
}

.feedback-final h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

/* ── PROGRESS SECTION ───────────────────────────────────────── */
.progress-section { margin-top: 4rem; animation: fadeIn 0.5s ease; }
.progress-section-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.progress-section-header h2 {
  font-size: 1.6rem;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.clear-history-btn {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; padding: 0.4rem 1rem;
  border-radius: 8px; cursor: pointer;
  font-size: 0.8rem; transition: all 0.2s ease;
  font-family: inherit;
}
.clear-history-btn:hover { background: rgba(239,68,68,0.2); }

.progress-layout {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 1.5rem; align-items: start;
}
@media (max-width: 900px) { .progress-layout { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--bg-card); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 1.5rem;
  height: 320px; position: relative;
}

.history-table-card {
  background: var(--bg-card); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 1.5rem;
  overflow-y: auto; max-height: 360px;
}
.history-table-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }

.history-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.history-table th {
  text-align: left; color: var(--text-secondary);
  font-weight: 600; padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}
.history-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}
.history-table tr:hover td { background: rgba(255,255,255,0.03); }

.badge-pass {
  background: rgba(16,185,129,0.15); color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
  padding: 0.15rem 0.5rem; border-radius: 6px;
  font-weight: 700; font-size: 0.85rem;
}
.badge-fail {
  background: rgba(239,68,68,0.12); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
  padding: 0.15rem 0.5rem; border-radius: 6px;
  font-weight: 700; font-size: 0.85rem;
}

/* ── STATS VIEW ─────────────────────────────────────────────── */
.stats-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.stats-subject-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  transition: all 0.3s ease;
}
.stats-subject-card:hover { transform: translateY(-2px); }

.stats-card-header {
  display: flex; align-items: center; gap: 1rem;
  padding-left: 0.75rem;
}
.stats-card-header h3 { font-size: 1.1rem; }

.stats-avg {
  margin-left: auto; font-size: 1.8rem; font-weight: 800;
}
.stats-avg.pass { color: #10b981; }
.stats-avg.fail { color: #ef4444; }

.stats-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.stats-bar-row {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.8rem; color: var(--text-secondary);
}
.stats-bar-row > span:first-child { width: 80px; flex-shrink: 0; }
.stats-bar-row > span:last-child { width: 40px; text-align: right; flex-shrink: 0; }
.stats-bar-track {
  flex: 1; height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px; overflow: hidden;
}
.stats-bar-fill {
  height: 100%; border-radius: 10px;
  transition: width 0.6s ease;
}

.stats-mini-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.stats-mini-item {
  background: var(--glass);
  border-radius: 8px; padding: 0.6rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.stats-mini-item span { font-size: 0.72rem; color: var(--text-secondary); }
.stats-mini-item strong { font-size: 1rem; }

/* ── FLASHCARD ──────────────────────────────────────────────── */
.fc-wrapper {
  width: 100%; max-width: 680px;
  margin-left: auto; margin-right: auto;
  display: flex; flex-direction: column; gap: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.fc-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  min-height: 280px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  perspective: 1000px;
}

.fc-card.flipped { transform: rotateY(180deg); }

.fc-front, .fc-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem; text-align: center;
  border-radius: 20px;
}

.fc-back {
  transform: rotateY(180deg);
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.fc-hint {
  font-size: 0.75rem; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.fc-question {
  font-size: 1.2rem; font-weight: 600; line-height: 1.6;
}

.fc-answer {
  font-size: 1.3rem; font-weight: 700;
  color: #10b981; margin-bottom: 0.75rem;
}

.fc-explanation {
  font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5;
}

.fc-controls {
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
}

.fc-btn {
  padding: 0.75rem 1.5rem; border-radius: 10px;
  font-weight: 700; cursor: pointer;
  font-family: inherit; font-size: 0.9rem;
  transition: all 0.2s ease; border: none;
}
.fc-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.fc-btn-fail { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.fc-btn-fail:hover:not(:disabled) { background: rgba(239,68,68,0.25); }
.fc-btn-pass { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.fc-btn-pass:hover:not(:disabled) { background: rgba(16,185,129,0.25); }
.fc-btn-skip { background: var(--glass); color: var(--text-secondary); border: 1px solid var(--glass-border); }
.fc-btn-skip:hover { background: rgba(255,255,255,0.08); }

.fc-progress { padding: 0 0.5rem; }
.fc-progress .progress-bar-small { width: 100%; }

/* ── LAB MODAL ──────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: center;
}
.modal.hidden { display: none; }

.lab-modal-content {
  background: var(--bg-dark);
  width: 95vw; height: 95vh;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden; padding: 0.5rem;
}

.close-btn {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; font-size: 1.5rem; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  z-index: 10; transition: background 0.2s;
}
.close-btn:hover { background: rgba(255,255,255,0.2); }

/* ── BACKGROUND BLURS ───────────────────────────────────────── */
.bg-blur-1 {
  position: fixed; top: 10%; left: 5%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
  filter: blur(80px); z-index: 1; pointer-events: none;
}
.bg-blur-2 {
  position: fixed; bottom: 10%; right: 10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.2) 0%, transparent 70%);
  filter: blur(100px); z-index: 1; pointer-events: none;
}

/* ── SKELETON ───────────────────────────────────────────────── */
.skeleton-card {
  height: 200px; background: var(--glass);
  border-radius: var(--radius); animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── FOOTER ─────────────────────────────────────────────────── */
footer { margin-top: 4rem; padding-bottom: 2rem; }
.footer2 {
  text-align: center; padding: 2rem 0;
  color: rgba(248,250,252,0.6); font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  letter-spacing: 0.5px;
}
.footer2 a {
  color: #00f3ff; text-decoration: none;
  font-weight: 600; transition: all 0.3s ease;
  padding: 2px 4px; border-radius: 4px;
}
.footer2 a:hover {
  color: #fff; background: rgba(0,243,255,0.1);
  text-shadow: 0 0 10px rgba(0,243,255,0.5);
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  #app { padding: 1rem 4%; }
  .hero h2 { font-size: 1.6rem; }
  .exam-body { padding: 1rem; }
  .question-text { font-size: 1rem; }
  .fc-card { min-height: 220px; }
  .fc-question { font-size: 1rem; }
  .stats-grid-full { grid-template-columns: 1fr; }
  .grid-container { grid-template-columns: 1fr; }
}

/* ── LAB CARDS ──────────────────────────────────────────────── */
.labs-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .labs-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .labs-grid { grid-template-columns: 1fr; }
}

.lab-card {
  background: var(--lab-bg, rgba(99,102,241,0.08));
  border: 1px solid var(--lab-border, rgba(99,102,241,0.3));
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.lab-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--lab-color, #6366f1);
  border-radius: var(--radius) var(--radius) 0 0;
}

.lab-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px color-mix(in srgb, var(--lab-color, #6366f1) 20%, transparent);
  border-color: var(--lab-color, #6366f1);
}

.lab-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.lab-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lab-card-subject {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lab-color, #6366f1);
}

.lab-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.lab-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lab-card-btn {
  width: 100%;
  background: var(--lab-color, #6366f1);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-align: center;
}

.lab-card-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--lab-color, #6366f1) 40%, transparent);
}

/* ── SIMULACRO TEMARIO BTN ──────────────────────────────────── */
.syllabus-group-header {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.simulacro-temario-btn {
  margin-left: auto;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #1a0800;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(245,158,11,0.3);
}

.simulacro-temario-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(245,158,11,0.4);
}

/* ── MAIN NAV ───────────────────────────────────────────────── */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--glass);
  border-color: var(--glass-border);
}

@media (max-width: 768px) {
  .main-nav { display: none; }
}

/* ── SYLLABUS GROUP ACTIONS ─────────────────────────────────── */
.syllabus-group-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.syllabus-group-header {
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── FALLOS ANALYSIS ────────────────────────────────────────── */
.fallos-total {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.fallos-worst-tema {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.worst-tema-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f87171;
}

.worst-tema-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.tema-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.tema-fail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.tema-fail-label {
  width: 65px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: 500;
}

.tema-fail-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}

.tema-fail-bar {
  height: 100%;
  background: linear-gradient(to right, #ef4444, #f97316);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.tema-fail-count {
  width: 20px;
  text-align: right;
  color: #f87171;
  font-weight: 700;
  font-size: 0.75rem;
}

.fallos-pdf-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.75rem;
}

.pdf-icon { font-size: 1.2rem; flex-shrink: 0; }

.pdf-hint-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.pdf-link {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.pdf-link:hover { color: var(--accent-color); text-decoration: underline; }

/* ── EXAMEN FINAL CARD ──────────────────────────────────────── */
.examen-final-card {
  border: 2px solid rgba(239,68,68,0.4) !important;
  background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(249,115,22,0.06)) !important;
  position: relative;
}

.examen-final-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(239,68,68,0.05), transparent);
  pointer-events: none;
}

.examen-final-card:hover {
  border-color: #ef4444 !important;
  box-shadow: 0 0 24px rgba(239,68,68,0.2) !important;
}

.badge-examen-final {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  font-size: 0.6rem;
  padding: 3px 8px;
  border-radius: 4px;
  width: fit-content;
  font-weight: 800;
  letter-spacing: 0.08em;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── EXPLANATION FEEDBACK ───────────────────────────────────── */
.expl-label {
  font-weight: 700;
  color: var(--accent-color);
  margin-right: 0.4rem;
}

.expl-why {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 0.5rem;
}

.explanation-box.correct-box .expl-label {
  color: #10b981;
}

/* ── QUICK READ ─────────────────────────────────────────────── */
.quickread-container {
  max-width: 680px; margin: 0 auto; animation: fadeIn 0.3s ease;
}
.quickread-header { margin-bottom: 1.5rem; text-align: center; }
.quickread-badge {
  display: inline-block; background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3); color: var(--primary-color);
  font-size: 0.75rem; font-weight: 700; padding: 0.3rem 0.8rem;
  border-radius: 20px; margin-bottom: 0.75rem; letter-spacing: 0.08em;
}
.quickread-header h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.quickread-header p { color: var(--text-secondary); font-size: 0.9rem; }
.quickread-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 2rem; }
.quickread-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 0.85rem 1rem;
  font-size: 0.9rem; line-height: 1.5;
  transition: all 0.2s ease;
}
.quickread-item:hover { border-color: var(--primary-color); background: rgba(99,102,241,0.06); }
.quickread-dot { color: var(--accent-color); font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }
.quickread-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── POST-EXAM SUMMARY ──────────────────────────────────────── */
.post-exam-summary {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 1.25rem; margin-top: 1.5rem; text-align: left;
}
.post-exam-summary h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-primary); }
.post-exam-summary.perfect { text-align: center; border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.05); }
.post-exam-summary.perfect h3 { color: #10b981; }
.worst-tema-summary {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px; padding: 0.6rem 0.9rem; margin-bottom: 1rem;
  font-size: 0.85rem; color: var(--text-secondary);
}
.worst-tema-summary strong { color: #f87171; }
.pdf-link-btn {
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
  color: var(--primary-color); padding: 0.3rem 0.75rem; border-radius: 6px;
  font-size: 0.78rem; font-weight: 600; text-decoration: none; transition: all 0.2s;
}
.pdf-link-btn:hover { background: rgba(99,102,241,0.25); }
.failed-concepts { display: flex; flex-direction: column; gap: 0.5rem; }
.failed-concept-item {
  background: rgba(239,68,68,0.05); border-left: 3px solid rgba(239,68,68,0.4);
  border-radius: 0 8px 8px 0; padding: 0.6rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.failed-q { font-size: 0.82rem; color: var(--text-secondary); }
.failed-correct { font-size: 0.82rem; color: #10b981; font-weight: 600; }

.btn-solo-nosé {
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.25);
  color: var(--accent-color);
  padding: 0.4rem 0.8rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-solo-nosé:hover { background: rgba(34,211,238,0.2); }

/* ═══════════════════════════════════════════════════════════════
   STUDY GUIDE BANNER — Guía Estratégica de Estudio
   ═══════════════════════════════════════════════════════════════ */

.study-guide-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease;
}

/* Countdown Block */
.study-countdown {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--urgency, #3b82f6);
  border-radius: 12px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--urgency, #3b82f6) 15%, transparent);
  flex-shrink: 0;
  min-width: 160px;
}
.countdown-num {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--urgency, #3b82f6);
  line-height: 1;
  font-family: 'Outfit', sans-serif;
}
.countdown-label {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
}
.countdown-label span { color: var(--text-secondary); font-weight: 400; }
.countdown-date {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  letter-spacing: 0.05em;
}

/* Phase Badge */
.study-phase-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid;
  border-radius: 12px;
  flex-shrink: 0;
}
.phase-icon { font-size: 1.5rem; }
.phase-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--phase-color, #3b82f6);
  margin-bottom: 0.15rem;
}
.phase-desc { font-size: 0.72rem; color: var(--text-secondary); }

/* Today's Subjects */
.study-today { flex: 1; min-width: 200px; }
.study-today-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-secondary); margin-bottom: 0.5rem;
}
.study-today-subjects { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.study-subject-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-primary);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.study-subject-chip:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  transform: scale(1.04);
}

/* Libreta Buttons */
.study-libreta-btn-wrap { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.btn-libreta {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
  padding: 0.55rem 1rem;
  border-radius: 10px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit; position: relative;
}
.btn-libreta:hover { background: rgba(124,58,237,0.22); }
.libreta-count {
  background: #ef4444; color: #fff;
  font-size: 0.65rem; font-weight: 800;
  padding: 0.1rem 0.35rem; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.btn-libreta-export {
  background: rgba(5,150,105,0.12);
  border: 1px solid rgba(5,150,105,0.3);
  color: #34d399;
  padding: 0.55rem 0.85rem;
  border-radius: 10px; font-size: 0.82rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-libreta-export:hover { background: rgba(5,150,105,0.22); }

/* Strategic Tip Bar */
.study-tip-bar {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(59,130,246,0.08);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0 0 14px 14px;
}
.tip-icon { font-size: 1.1rem; }
.tip-text { 
  font-size: 0.8rem; 
  color: var(--text-secondary); 
  line-height: 1.4;
}
.tip-text b { color: #60a5fa; }

.study-tasks-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.study-tasks-list div {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Today's card highlight */
.subject-card-today {
  border-color: rgba(59,130,246,0.5) !important;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.2), 0 0 24px rgba(59,130,246,0.1) !important;
}
.subject-card-today::after {
  content: '📅 HOY';
  position: absolute;
  top: 0.5rem; right: 0.5rem;
  background: rgba(59,130,246,0.2);
  border: 1px solid rgba(59,130,246,0.4);
  color: #60a5fa;
  font-size: 0.6rem; font-weight: 800;
  padding: 0.2rem 0.5rem; border-radius: 6px;
  letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════════════════════════
   LIBRETA DE ERRORES — Modal & Inline
   ═══════════════════════════════════════════════════════════════ */

.libreta-modal-content {
  background: var(--bg-dark);
  width: 90vw; max-width: 760px;
  max-height: 85vh;
  border-radius: 16px;
  border: 1px solid rgba(124,58,237,0.3);
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(124,58,237,0.15);
  padding: 0;
}

.libreta-modal-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.libreta-modal-header h2 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.libreta-modal-sub { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; max-width: 420px; }

.libreta-entries {
  display: flex; flex-direction: column; gap: 1rem;
}

.libreta-entry {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 1rem;
  position: relative;
  transition: border-color 0.2s;
}
.libreta-entry:hover { border-color: rgba(124,58,237,0.3); }

.libreta-entry-q {
  font-size: 0.85rem;
  color: #f87171;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}
.libreta-entry-a {
  font-size: 0.85rem;
  color: #34d399;
  margin-bottom: 0.6rem;
}

.libreta-entry-nota {
  display: flex; gap: 0.5rem;
  background: rgba(124,58,237,0.06);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: 8px; padding: 0.6rem 0.75rem;
  margin-bottom: 0.4rem;
}
.nota-icon { flex-shrink: 0; font-size: 0.9rem; }
.nota-text {
  font-size: 0.83rem; color: var(--text-primary);
  line-height: 1.5; outline: none;
  min-width: 0; flex: 1;
  cursor: text;
}
.nota-text:focus { color: #e2e8f0; }

.libreta-entry-date {
  font-size: 0.68rem; color: var(--text-secondary);
  text-align: right; margin-top: 0.25rem;
}

.libreta-del-btn {
  position: absolute; top: 0.7rem; right: 0.7rem;
  background: none; border: none;
  color: rgba(255,255,255,0.2);
  font-size: 0.85rem; cursor: pointer;
  padding: 0.2rem; border-radius: 4px;
  transition: color 0.2s;
}
.libreta-del-btn:hover { color: #ef4444; }

/* Inline libreta after wrong answer */
.btn-libreta-inline {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.75rem;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.25);
  color: #a78bfa;
  padding: 0.4rem 0.85rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.btn-libreta-inline:hover { background: rgba(124,58,237,0.2); }

.libreta-inline { margin-top: 0.75rem; }
.libreta-inline-label {
  font-size: 0.82rem; font-weight: 600;
  color: #a78bfa; margin-bottom: 0.5rem;
}
.libreta-nota-textarea {
  width: 100%; min-height: 80px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 8px; padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-family: inherit; font-size: 0.83rem;
  resize: vertical; outline: none;
  transition: border-color 0.2s;
}
.libreta-nota-textarea:focus { border-color: rgba(124,58,237,0.6); }

.btn-save-nota {
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.35);
  color: #a78bfa; padding: 0.4rem 0.85rem;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s ease;
}
.btn-save-nota:hover { background: rgba(124,58,237,0.28); }

.btn-skip-nota {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary); padding: 0.4rem 0.75rem;
  border-radius: 8px; font-size: 0.78rem;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.btn-skip-nota:hover { border-color: rgba(255,255,255,0.2); color: var(--text-primary); }

.libreta-saved-confirm {
  margin-top: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 8px;
  font-size: 0.82rem; color: #34d399;
  animation: fadeIn 0.3s ease;
}
@media (max-width: 640px) {
  .study-guide-wrap { flex-direction: column; gap: 0.75rem; }
  .study-countdown { width: 100%; justify-content: center; }
  .study-phase-badge { width: 100%; }
  .study-today { width: 100%; }
  .study-libreta-btn-wrap { width: 100%; }
  .btn-libreta { flex: 1; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   TUTOR INTERACTIVO — Java POO (Paper Aesthetic)
   ═══════════════════════════════════════════════════════════════ */

.tutor-splash {
  max-width: 1000px; margin: 0 auto; padding: 2rem 1rem;
  animation: fadeIn 0.5s ease;
}
.tutor-splash-header { text-align: center; margin-bottom: 3rem; }
.tutor-splash-icon { font-size: 4rem; margin-bottom: 1rem; }
.tutor-splash-title { font-size: 2.2rem; margin-bottom: 0.5rem; }
.tutor-splash-sub { color: var(--text-secondary); margin-bottom: 1.5rem; }
.tutor-splash-badge {
  display: inline-block; background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3); color: #f87171;
  padding: 0.5rem 1.2rem; border-radius: 30px; font-weight: 700; font-size: 0.9rem;
}

.tutor-sessions-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem; margin-bottom: 4rem;
}

.tutor-session-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  transition: all 0.3s ease; position: relative; overflow: hidden;
}
.tutor-session-card:hover { transform: translateY(-5px); border-color: var(--session-color); }
.session-card-icon {
  font-size: 2.5rem; width: 60px; height: 60px;
  background: var(--session-color-soft); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.session-card-temas { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.session-card-temas span {
  font-size: 0.65rem; background: rgba(255,255,255,0.05);
  padding: 0.2rem 0.5rem; border-radius: 4px; color: var(--text-secondary);
}
.session-card-title { font-size: 1.25rem; font-weight: 700; }
.session-card-sub { font-size: 0.85rem; color: var(--text-secondary); flex: 1; }
.session-card-meta { font-size: 0.8rem; display: flex; gap: 1rem; color: var(--text-secondary); opacity: 0.8; }
.session-card-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }

.btn-tutor-start {
  background: var(--session-color); color: white; border: none;
  padding: 0.75rem; border-radius: 10px; font-weight: 700; cursor: pointer;
}
.btn-tutor-exam-only {
  background: transparent; border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); padding: 0.6rem; border-radius: 10px; font-size: 0.85rem; cursor: pointer;
}

/* TUTOR INTERFACE */
.tutor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--glass-border);
}
.tutor-topbar.exam-mode { border-bottom: 2px solid #ef4444; background: rgba(239,68,68,0.05); }
.tutor-session-info { display: flex; align-items: center; gap: 1rem; }
.tutor-icon-badge {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.tutor-session-title { font-weight: 700; font-size: 1rem; }
.tutor-session-sub { font-size: 0.75rem; color: var(--text-secondary); }

.tutor-progress-wrap { display: flex; align-items: center; gap: 0.5rem; }
.tutor-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--text-secondary); font-weight: 700;
}
.tutor-step-dot.active { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.1); }
.tutor-step-dot.done { background: #3b82f6; border-color: #3b82f6; color: white; }
.tutor-step-line { width: 20px; height: 2px; background: rgba(255,255,255,0.1); }
.tutor-step-line.done { background: #3b82f6; }

.tutor-body {
  display: flex; height: calc(100vh - 160px); overflow: hidden;
}
.tutor-left {
  flex: 4; overflow-y: auto; padding: 2rem;
  border-right: 1px solid var(--glass-border);
}
.tutor-right { flex: 5; background: #2a2a2e; padding: 1.5rem; position: relative; }

.tutor-concept-badge {
  padding: 0.3rem 0.8rem; border: 1px solid; border-radius: 6px;
  font-size: 0.7rem; font-weight: 800; width: fit-content; margin-bottom: 1rem;
  letter-spacing: 0.05em;
}
.tutor-paso-titulo { font-size: 1.8rem; margin-bottom: 1.5rem; }
.tutor-paso-num { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.4rem; }

.tutor-bubble {
  display: flex; gap: 1rem; background: rgba(255,255,255,0.03);
  padding: 1.2rem; border-radius: 14px; margin-bottom: 2rem;
}
.tutor-bubble-avatar { font-size: 2rem; }
.tutor-bubble-name { font-weight: 700; font-size: 0.85rem; color: #3b82f6; margin-bottom: 0.4rem; }
.tutor-explanation { font-size: 0.95rem; line-height: 1.6; color: #e2e8f0; }

.tutor-code-section { margin-bottom: 2rem; }
.tutor-code-label { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.6rem; color: var(--text-secondary); opacity: 0.7; }

.tutor-consejo {
  display: flex; gap: 0.75rem; background: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.25); border-radius: 10px;
  padding: 1rem; font-size: 0.88rem; line-height: 1.5; color: #fdba74;
}
.tutor-consejo-icon { font-size: 1.2rem; }

/* PAPER SHEET EFFECT */
.paper-sheet {
  background: #fdfdfd; width: 100%; height: 100%; border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; position: relative; color: #334155;
  background-image: linear-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 100% 1.8rem;
}
.paper-margin-line {
  position: absolute; left: 40px; top: 0; bottom: 0;
  width: 2px; background: rgba(239,68,68,0.2);
}
.paper-header {
  padding: 1.5rem 2rem 1rem 60px; display: flex; justify-content: space-between;
  border-bottom: 2px solid #334155; margin-bottom: 0.5rem;
}
.paper-title { font-family: 'Outfit', sans-serif; font-weight: 900; font-size: 1.1rem; color: #1e293b; text-transform: uppercase; }
.paper-instruccion { font-size: 0.85rem; font-style: italic; color: #64748b; margin-top: 0.2rem; line-height: 1.4; }
.paper-logo { font-weight: 900; color: #e5e7eb; font-size: 2rem; letter-spacing: -0.05em; }

.paper-textarea {
  flex: 1; width: 100%; background: transparent; border: none;
  padding: 0.5rem 2rem 1rem 60px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem; line-height: 1.8rem; color: #0f172a; resize: none; outline: none;
}
.diseno-hint {
  padding: 0.5rem 2rem 0.5rem 60px; font-size: 0.8rem; color: #6366f1; font-weight: 700;
  background: rgba(99,102,241,0.05); border-bottom: 1px dashed rgba(99,102,241,0.2);
}

.paper-checks { padding: 1rem 2rem 1rem 60px; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.paper-checks-label { font-size: 0.75rem; font-weight: 900; text-transform: uppercase; color: #94a3b8; margin-bottom: 0.5rem; }
.paper-check-item { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; margin-bottom: 0.25rem; }
.check-ok { color: #059669; font-weight: 600; }
.check-fail { color: #dc2626; }

.paper-actions {
  padding: 1rem 2rem 1.5rem 60px; display: flex; align-items: center; justify-content: space-between;
  background: #f1f5f9; border-top: 1px solid #e2e8f0;
}
.btn-tutor-check {
  background: #1e293b; color: white; border: none; padding: 0.5rem 1.2rem;
  border-radius: 6px; font-weight: 700; cursor: pointer;
}
.paper-nav { display: flex; gap: 0.6rem; }
.btn-tutor-nav {
  background: white; border: 1px solid #cbd5e1; color: #475569;
  padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.btn-tutor-nav.primary { background: #3b82f6; color: white; border-color: #2563eb; }

/* EXAM MODE SPECIFIC */
.exam-layout { height: calc(100vh - 80px); }
.exam-enunciado-panel { flex: 4; padding: 2rem; overflow-y: auto; background: var(--bg-dark); }
.exam-paper-panel { flex: 6; padding: 1.5rem; background: #1e1e20; }

.exam-badge-oficial {
  background: #ef4444; color: white; padding: 0.4rem 0.8rem; border-radius: 4px;
  font-weight: 900; font-size: 0.75rem; width: fit-content; margin-bottom: 1rem;
}
.exam-instrucciones { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.exam-enunciado-text {
  font-size: 1rem; line-height: 1.7; background: rgba(255,255,255,0.03);
  padding: 1.5rem; border-radius: 12px; border: 1px solid var(--glass-border); margin-bottom: 2rem;
}
.exam-enunciado-text strong { color: #ef4444; }

.exam-criterios-panel { background: rgba(0,0,0,0.2); padding: 1.2rem; border-radius: 12px; }
.exam-criterios-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }
.exam-criterio-item { display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.85rem; margin-bottom: 0.6rem; color: var(--text-secondary); }
.crit-ok { color: #10b981; }
.crit-fail { color: #f87171; }

.exam-paper-header {
  padding: 1.5rem 2rem 1rem 60px; display: flex; gap: 1.5rem;
  border-bottom: 2px solid #000; margin-bottom: 0.2rem;
}
.exam-paper-logo { font-size: 3rem; }
.exam-paper-titulo { font-weight: 900; font-size: 1.1rem; }
.exam-paper-subtitulo { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }
.exam-paper-nota { font-weight: 900; color: #94a3b8; font-size: 0.8rem; margin-top: 0.4rem; }
.exam-redline { height: 2px; background: #ef4444; width: calc(100% - 60px); margin-left: 60px; }

.btn-exam-submit {
  background: #dc2626; color: white; border: none; padding: 0.7rem 1.5rem;
  border-radius: 6px; font-weight: 800; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 4px 0 #991b1b; transition: all 0.1s;
}
.btn-exam-submit:active { transform: translateY(2px); box-shadow: 0 2px 0 #991b1b; }

.exam-timer-badge {
    background: #000; color: #3b82f6; border: 1px solid #3b82f6;
    padding: 0.5rem 1rem; border-radius: 8px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}

/* EXAM RESULTS */
.exam-resultado {
  margin-top: 2rem; background: #f8fafc; border: 2px solid #e2e8f0;
  border-radius: 12px; padding: 2rem; animation: slideUp 0.5s ease;
}
.exam-result-score { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.result-nota { font-size: 4rem; font-weight: 900; font-family: 'Outfit', sans-serif; }
.result-label { font-size: 1.5rem; font-weight: 800; }
.pass .result-nota, .pass .result-label { color: #059669; }
.fail .result-nota, .fail .result-label { color: #dc2626; }

.exam-result-stats { display: flex; gap: 2rem; margin-bottom: 2rem; padding: 1.5rem; background: white; border-radius: 10px; border: 1px solid #e2e8f0; }
.exam-stat { display: flex; flex-direction: column; gap: 0.2rem; }
.exam-stat span { font-size: 0.75rem; color: #64748b; text-transform: uppercase; font-weight: 700; }
.exam-stat strong { font-size: 1.5rem; color: #1e293b; }

.exam-feedback-fallos { margin: 1.5rem 0; border-top: 1px solid #e2e8f0; padding-top: 1.5rem; }
.exam-feedback-fallos-title { font-weight: 900; color: #ef4444; margin-bottom: 1rem; font-size: 0.9rem; }
.exam-fallo-item { margin-bottom: 1rem; background: white; padding: 1rem; border-radius: 8px; border: 1px solid #fee2e2; }
.exam-fallo-desc { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.4rem; color: #b91c1c; }
.exam-fallo-consejo { font-size: 0.8rem; line-height: 1.5; color: #64748b; }

.exam-result-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

@media (max-width: 1024px) {
  .tutor-body { flex-direction: column; height: auto; overflow: visible; }
  .tutor-right, .exam-paper-panel { height: 600px; }
  .exam-layout { height: auto; }
}

/* ── ASSISTANT IA ───────────────────────────────────────────── */
.assistant-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 50px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 640px) {
  .assistant-fab {
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.6rem 1rem;
    gap: 0.5rem;
    font-size: 0.8rem;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  }
  .fab-icon { font-size: 1.2rem; }
  .fab-label { font-size: 0.8rem; }
}

.assistant-fab:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5);
}

.fab-icon { font-size: 1.5rem; }
.fab-label { font-size: 0.9rem; letter-spacing: 0.05em; }

.assistant-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  height: 550px;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: slideInUpChat 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.assistant-window.hidden { display: none; }

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

@media (max-width: 640px) {
  .assistant-window {
    width: 94vw;
    right: 3vw;
    bottom: 5.5rem;
    height: 75vh;
    border-radius: 16px;
  }
}

.assistant-header {
  padding: 1.25rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.assistant-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-family: 'Outfit';
  letter-spacing: 0.5px;
}

.assistant-status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: pulseAssistant 2s infinite;
}

@keyframes pulseAssistant {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.assistant-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.assistant-close:hover { color: white; }

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg {
  max-width: 85%;
  padding: 0.8rem 1rem;
  border-radius: 15px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

@media (max-width: 640px) {
  .msg {
    max-width: 92%;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
  }
}

.msg-bot {
  align-self: flex-start;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

.msg-user {
  align-self: flex-end;
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 2px;
}

.msg-system {
  align-self: stretch;
  background: rgba(168, 85, 247, 0.1);
  border: 1px dashed rgba(168, 85, 247, 0.4);
  color: #c084fc;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.5rem;
}

.highlight-momentary {
  animation: pulse-start 2s infinite;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 20px var(--primary-color);
}

@keyframes pulse-start {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 20px 10px rgba(99, 102, 241, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.assistant-input-area {
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.75rem;
}

.assistant-input-area input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
}

.assistant-input-area input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.assistant-input-area button {
  background: var(--primary-color);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}

.assistant-input-area button:hover { transform: scale(1.05); }

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.assist-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.assist-chip:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

@media (max-width: 640px) {
  /* Alread handled above */
}

/* ── VIDEO MODAL STYLES ─────────────────────────────────────── */
.video-modal-content {
    background: #000;
    width: 80vw;
    max-width: 1000px;
    height: auto;
    aspect-ratio: 16/9;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    position: relative;
    padding: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .video-modal-content {
        width: 95vw;
    }
}

.video-link-mini {
    font-size: 1.1rem;
    text-decoration: none;
    opacity: 0.6;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-block;
}

.video-link-mini:hover {
    opacity: 1;
    transform: scale(1.3);
}

/* ── ACTIVITY LOG STYLES ──────────────────────────────────── */
.activity-log-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.8rem;
}

.activity-day {
    margin-bottom: 1.5rem;
}

.activity-date-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary-color);
    letter-spacing: 0.05rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.activity-date-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--glass-border), transparent);
    margin-left: 1rem;
}

.activity-items {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(5px);
}

.activity-icon {
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-border);
    border-radius: 10px;
}

.activity-info {
    flex: 1;
}

.activity-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.activity-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

@media (max-width: 600px) {
    .activity-item {
        gap: 0.6rem;
    }
    .activity-time {
        display: none;
    }
}

/* Activity Log View More Button */
.view-more-activity {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@keyframes highlightMomentary {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(99,102,241,0); }
    50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(99,102,241,0.4); border-color: var(--primary-color); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(99,102,241,0); }
}

.highlight-momentary {
    animation: highlightMomentary 1.5s ease;
    z-index: 100;
}

/* ── TUTOR MOTIVACIONAL ─────────────────────────────────────── */
.tutor-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.tutor-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--primary-color);
}

.tutor-card.scolding::before { background: #ef4444; }
.tutor-card.encouraging::before { background: #10b981; }

.tutor-avatar {
  font-size: 3rem;
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite;
}

.tutor-content { flex: 1; }

.tutor-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.tutor-message {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.tutor-progress-mini {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.task-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: all 0.3s ease;
}

.task-dot.done {
  background: var(--primary-color);
  box-shadow: 0 0 8px var(--primary-color);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 768px) {
  .tutor-card {
    flex-direction: column;
    padding: 1.25rem;
    gap: 1rem;
    text-align: center;
  }
  .tutor-avatar { font-size: 2.5rem; }
  .tutor-title { 
    flex-direction: column; 
    gap: 0.25rem; 
    margin-bottom: 0.75rem;
  }
  .tutor-message { font-size: 0.95rem; }
  .tutor-progress-mini { justify-content: center; }
  
  .tutor-content { width: 100%; }
  .tutor-content .planner-go-btn {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* ── PLANNER ENHANCEMENTS ───────────────────────────────────── */
.planner-task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.planner-task-item:hover { color: var(--text-primary); }

.planner-task-item.done {
  color: var(--text-secondary);
  opacity: 0.7;
  text-decoration: line-through;
}

.task-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.planner-task-item.done .task-check {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

/* ── ACADEMIC PLANNER ───────────────────────────────────────── */
.planner-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease;
}

.planner-container {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.planner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.planner-header h3 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.planner-phase-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background: var(--phase-bg);
    color: var(--phase-color);
    border: 1px solid var(--phase-color);
}

.planner-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0.5rem 1.2rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.planner-grid::-webkit-scrollbar { height: 6px; }
.planner-grid::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.planner-card {
    min-width: 180px;
    flex: 0 0 calc(100% / 4 - 0.75rem);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s ease;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

.planner-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
}

.planner-card.is-today {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.planner-card.is-today::before {
    content: 'HOY';
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 0.55rem;
    font-weight: 900;
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.planner-date {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.planner-date .day-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: capitalize;
}

.planner-date .day-date {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.planner-subjects {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.planner-subject-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    color: var(--subj-color);
    border: 1px solid color-mix(in srgb, var(--subj-color) 25%, transparent);
}

.planner-subject-tag .tag-icon {
    font-size: 1rem;
}

.planner-actions {
    margin-top: 0.5rem;
}

.planner-rest-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    padding: 1rem 0;
    animation: fadeIn 0.4s ease;
}

.planner-go-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.planner-go-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

@media (max-width: 1100px) {
    .planner-card { min-width: 220px; flex: 0 0 calc(100% / 3 - 0.75rem); }
}

@media (max-width: 800px) {
    .planner-card { min-width: 240px; flex: 0 0 calc(100% / 2 - 0.75rem); }
}

@media (max-width: 500px) {
    .planner-card { min-width: 280px; flex: 0 0 90%; }
}

/* ── PLANNER METHODOLOGY ────────────────────────────────────── */
.planner-methodology {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    animation: fadeIn 0.6s ease;
}

.methodology-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 1rem;
}

.methodology-header h4 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}

.methodology-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.methodology-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .methodology-grid { grid-template-columns: 1fr; }
}

.methodology-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.methodology-card h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    opacity: 0.8;
}

.methodology-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.methodology-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.methodology-card li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.methodology-card li::before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
}


/* 📝 SUMMARY FEATURE ───────────────────────────────────────── */
.summary-link-mini {
    text-decoration: none;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(0.2);
    display: inline-block;
}

.summary-link-mini:hover {
    transform: scale(1.4) rotate(5deg);
    filter: grayscale(0);
}

.summary-modal-content {
    max-width: 700px;
    width: 90vw;
    border-radius: 28px !important;
    padding: 2.5rem !important;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 193, 7, 0.25) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 30px rgba(255, 193, 7, 0.05) !important;
    animation: modalReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.summary-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 193, 7, 0.05));
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.summary-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.summary-body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1.2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 193, 7, 0.3) transparent;
}

.summary-body::-webkit-scrollbar { width: 6px; }
.summary-body::-webkit-scrollbar-thumb { 
    background: rgba(255, 193, 7, 0.2); 
    border-radius: 10px; 
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-point {
    display: flex;
    gap: 1.2rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.7;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    animation: pointSlideIn 0.5s ease backwards;
}

.summary-point:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 193, 7, 0.3);
    transform: translateX(8px);
}

@keyframes pointSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.point-bullet {
    color: #ffc107;
    font-weight: 900;
    font-size: 1.3rem;
    flex-shrink: 0;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.4);
}

.summary-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
}

.btn-summary-close {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(255, 193, 7, 0.2);
}

.btn-summary-close:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(255, 193, 7, 0.3);
}

/* ── STUDY SESSION BAR ───────────────────────────────────────── */
.study-session-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--primary-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10000;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-active-session .main-content,
body.has-active-session .exam-body {
    padding-bottom: 120px !important;
}

body.has-active-session #exam-engine-root,
body.has-active-session #flashcard-root {
    padding-bottom: 140px;
}

body.has-active-session .results-container {
    padding-bottom: 140px;
    margin-bottom: 2rem;
}

body.has-active-session .assistant-fab {
    bottom: 120px !important;
}

.study-session-bar.hidden {
  display: none;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.session-timer {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  background: rgba(99,102,241,0.1);
  padding: 0.2rem 0.8rem;
  border-radius: 8px;
  min-width: 100px;
  text-align: center;
}

.session-subject {
  font-weight: 600;
  color: var(--text-primary);
}

.session-actions {
  display: flex;
  gap: 1rem;
}

.btn-session-complete {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-session-complete:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.btn-session-cancel {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ── RANKING BOARD ─────────────────────────────────────────── */
.ranking-section {
    margin-bottom: 50px;
    animation: fadeIn 0.8s ease-out;
}

.ranking-section-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 30px 0 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: -0.02em;
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.empty-mini {
    padding: 3rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    text-align: center;
    color: var(--text-secondary);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    font-style: italic;
}

.ranking-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.ranking-card:hover {
    transform: translateY(-5px);
    border-color: var(--card-color, var(--primary-color));
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px color-mix(in srgb, var(--card-color, var(--primary-color)) 20%, transparent);
}

.ranking-card-header {
    background: linear-gradient(135deg, color-mix(in srgb, var(--card-color, var(--primary-color)) 40%, transparent), transparent);
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ranking-card-header .subject-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.ranking-card-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.ranking-card-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 1rem;
}

.ranking-unit-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-unit-title {
    font-size: 0.85rem;
    color: var(--card-color);
    margin-bottom: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid color-mix(in srgb, var(--card-color), transparent 80%);
    padding-bottom: 6px;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.rank-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rank-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Podium Styles */
.rank-1 .rank-number { background: linear-gradient(135deg, #ffd700, #b8860b); color: #000; box-shadow: 0 0 15px rgba(255, 215, 0, 0.4); }
.rank-2 .rank-number { background: linear-gradient(135deg, #c0c0c0, #708090); color: #000; box-shadow: 0 0 15px rgba(192, 192, 192, 0.4); }
.rank-3 .rank-number { background: linear-gradient(135deg, #cd7f32, #8b4513); color: #000; box-shadow: 0 0 15px rgba(205, 127, 50, 0.4); }

.rank-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.rank-score {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent-color);
    background: rgba(34, 211, 238, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
}

.rank-1 .rank-score { color: #ffd700; background: rgba(255, 215, 0, 0.1); }

.empty-ranking {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Ranking Fairness Banner */
.ranking-info-banner {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.ranking-info-banner .info-icon {
    font-size: 1.2rem;
}

.ranking-info-banner p {
    margin: 0;
}
/* ─── ACADEMIA UNIFIED HUB ─────────────────────────────────── */
.academia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.academia-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2px; /* For the gradient border effect */
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    border: 1px solid var(--glass-border);
}

.academia-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px color-mix(in srgb, var(--card-color) 20%, transparent);
    border-color: var(--card-color);
}

.academia-card-inner {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 1.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.card-glass-bg {
    position: absolute;
    top: 0; right: 0;
    width: 150px; height: 150px;
    background: radial-gradient(circle at top right, color-mix(in srgb, var(--card-color) 15%, transparent), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.academia-card-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.academia-icon-wrapper {
    width: 60px; height: 60px;
    background: color-mix(in srgb, var(--card-color) 10%, #1e293b);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.academia-title-group h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.academia-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.academia-fallos-badge {
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline dotted;
}

/* Main Action Buttons */
.academia-main-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.academia-btn-main {
    width: 100%;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--card-color), color-mix(in srgb, var(--card-color) 70%, #000));
    border: none;
    color: white;
    box-shadow: 0 10px 20px color-mix(in srgb, var(--card-color) 30%, transparent);
}

.academia-btn-main:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

.academia-btn-main .btn-texts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.btn-main-text { font-weight: 800; font-size: 1.05rem; }
.btn-sub-text { font-size: 0.75rem; opacity: 0.8; font-weight: 400; }

.academia-secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Accordion Themes */
.academia-themes-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.academia-themes-toggle {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.academia-themes-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.academia-themes-toggle.active {
    border-bottom: 1px solid var(--glass-border);
}

.academia-themes-toggle .chevron {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.academia-themes-list {
    overflow: hidden;
    transition: max-height 0.35s ease-out;
}

.academia-themes-list.hidden {
    max-height: 0;
}

.academia-theme-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: background 0.2s;
    position: relative;
    gap: 12px;
}

.academia-theme-item:hover {
    background: rgba(255,255,255,0.03);
}

.theme-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.theme-badge {
    background: var(--card-color);
    color: white;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 8px;
    font-weight: 800;
}

/* ── THEME ACTIONS DROPDOWN ────────────────────────────────────── */
.theme-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

.theme-dropdown-trigger {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    user-select: none;
}

.theme-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: scale(1.1);
}

.theme-dropdown-trigger.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.theme-dropdown-menu {
    position: fixed;
    right: auto;
    top: auto;
    bottom: auto;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 2000;
    min-width: 210px;
    padding: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.theme-dropdown-menu.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.theme-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.theme-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(4px);
}

.theme-dropdown-item span.icon {
    font-size: 1rem;
    width: 20px;
    display: flex;
    justify-content: center;
}

.theme-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 6px 4px;
}

.theme-dropdown-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 8px 14px 4px;
    font-weight: 800;
}

.theme-dropdown-item.primary {
    color: #818cf8;
}
.theme-dropdown-item.primary:hover {
    background: rgba(99, 102, 241, 0.15);
}

.academia-card-footer {
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-text-only {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline dotted;
}

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

@media (max-width: 768px) {
    .academia-grid {
        grid-template-columns: 1fr;
    }
}


/* ── NUEVOS ESTILOS PARA TEMAS Y RESULTADOS ── */
.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.q-meta-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.q-counter {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.exam-timer {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--secondary-color);
}

.weak-themes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0 2rem;
}
.weak-tema-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}
.weak-tema-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-color);
}
.wt-info {
    display: flex;
    flex-direction: column;
}
.wt-name {
    font-weight: 700;
    color: var(--text-primary);
}
.wt-stats {
    font-size: 0.8rem;
    color: #f87171;
}
.wt-pdf-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}
.wt-pdf-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* ── HALL OF FAME (TOP 5) ────────────────────────────────── */
.hall-of-fame-section {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    animation: fadeIn 1s ease-out;
}

.hall-of-fame-section::before {
    content: "🏆";
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 10rem;
    opacity: 0.05;
    transform: rotate(15deg);
}

.hall-of-fame-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.hof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.hof-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.hof-item:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.07);
    border-color: #fbbf24;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3), 0 0 20px rgba(251, 191, 36, 0.1);
}

.hof-item.rank-1 { border-color: #fbbf24; background: linear-gradient(to bottom, rgba(251, 191, 36, 0.05), transparent); }
.hof-item.rank-2 { border-color: #94a3b8; }
.hof-item.rank-3 { border-color: #d97706; }

.hof-rank {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.hof-username {
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.hof-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hof-stats strong {
    color: var(--text-primary);
}

.hof-badge {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 900;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 10px rgba(251, 191, 36, 0.3);
}

@media (max-width: 600px) {
    .hof-grid {
        grid-template-columns: 1fr;
    }
}
