@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:           #f0ede8;
  --surface:      #ffffff;
  --surface2:     #f7f5f2;
  --surface3:     #eeebe6;
  --border:       #e0dbd3;
  --text:         #18171b;
  --muted:        #65625c;
  --subtle:       #9e9890;

  --nav-bg:       #0d1b36;
  --nav-bg2:      #0a1428;
  --nav-text:     #a8bcda;
  --nav-active:   #ffffff;
  --nav-hover:    #162444;
  --nav-border:   #1a2e4a;

  --primary:      #1a3560;
  --primary-lt:   #e4edf8;
  --accent:       #2460b0;
  --accent2:      #3b82f6;

  --green:        #15803d;
  --green-lt:     #d1fae5;
  --green-bright: #22c55e;
  --amber:        #b45309;
  --amber-lt:     #fef3c7;
  --amber-bright: #f59e0b;
  --red:          #b91c1c;
  --red-lt:       #fee2e2;
  --red-bright:   #ef4444;
  --purple:       #7c3aed;
  --purple-lt:    #ede9fe;

  --shadow-sm:    0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:    0 12px 36px rgba(0,0,0,.13), 0 4px 12px rgba(0,0,0,.07);
  --shadow-glow:  0 0 24px rgba(36,96,176,.25);
  --radius:       12px;
  --radius-lg:    16px;
  --radius-xl:    22px;

  --serif: 'Lora', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --grad-hero:    linear-gradient(135deg, #0d1b36 0%, #1a3560 50%, #0f3460 100%);
  --grad-accent:  linear-gradient(135deg, #2460b0, #3b82f6);
  --grad-green:   linear-gradient(135deg, #15803d, #22c55e);
  --grad-amber:   linear-gradient(135deg, #b45309, #f59e0b);
  --grad-red:     linear-gradient(135deg, #b91c1c, #ef4444);
  --grad-purple:  linear-gradient(135deg, #7c3aed, #a78bfa);
  --grad-card:    linear-gradient(145deg, #fff 0%, #f7f5f2 100%);
}

.dark {
  --bg:        #0c0c0a;
  --surface:   #141412;
  --surface2:  #1c1c19;
  --surface3:  #222220;
  --border:    #2e2e2a;
  --text:      #f0eeeb;
  --muted:     #82807a;
  --subtle:    #4e4c47;

  --nav-bg:    #070c18;
  --nav-bg2:   #050910;
  --nav-text:  #7a9ac4;
  --nav-hover: #0e1e35;
  --nav-border:#101e30;

  --primary-lt:#0a1a30;
  --green-lt:  #072014;
  --amber-lt:  #1e1200;
  --red-lt:    #1e0808;
  --purple-lt: #160e2e;

  --shadow-glow: 0 0 28px rgba(59,130,246,.2);
  --grad-card:    linear-gradient(145deg, #1c1c19 0%, #141412 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

a  { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

#ce-root {
  display: flex;
  min-height: 100vh;
  height: 100%;
}

.page-enter {
  animation: pageIn .32s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fade-in { animation: fadeIn .28s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#sidebar {
  width: 265px;
  flex-shrink: 0;
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--nav-border);
}

#sidebar-brand {
  padding: 28px 22px 24px;
  border-bottom: 1px solid var(--nav-border);
  background: linear-gradient(160deg, var(--nav-bg2) 0%, var(--nav-bg) 100%);
  position: relative;
  overflow: hidden;
}
#sidebar-brand::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.18) 0%, transparent 70%);
  pointer-events: none;
}
#sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,.3), transparent);
  pointer-events: none;
}

.brand-emblem {
  font-size: 28px;
  margin-bottom: 12px;
  line-height: 1;
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 0 10px rgba(59,130,246,.5));
}

#sidebar-brand .app-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .01em;
  line-height: 1.2;
  position: relative;
}
#sidebar-brand .app-title-sub {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: rgba(168,188,218,.9);
  line-height: 1.2;
  position: relative;
  margin-bottom: 8px;
}
#sidebar-brand .app-sub {
  font-size: 9.5px;
  color: rgba(168,188,218,.55);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  position: relative;
  border-top: 1px solid rgba(168,188,218,.1);
  padding-top: 8px;
  margin-top: 2px;
}

#nav-links {
  flex: 1;
  padding: 20px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: rgba(168,188,218,.35);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 500;
  color: var(--nav-text);
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
  letter-spacing: .005em;
  position: relative;
  user-select: none;
}
.nav-item:hover  { background: var(--nav-hover); color: #fff; transform: translateX(3px); }
.nav-item.active {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(36,96,176,.45), inset 0 1px 0 rgba(255,255,255,.12);
}
.nav-item.active .nav-icon { color: rgba(255,255,255,.9); }

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(168,188,218,.7);
  transition: color .15s;
}
.nav-item:hover .nav-icon { color: rgba(255,255,255,.85); }

.nav-label {
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

#sidebar-footer {
  padding: 10px 12px 20px;
  border-top: 1px solid var(--nav-border);
}
.theme-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--nav-text);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.theme-btn:hover { background: var(--nav-hover); color: #fff; }
.theme-btn .nav-icon { color: rgba(168,188,218,.6); }
.theme-btn:hover .nav-icon { color: rgba(255,255,255,.85); }

#mobile-nav {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--nav-bg);
  padding: 0 16px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--nav-border);
}
#mobile-brand {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.mob-btn {
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
#mobile-menu {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: var(--nav-bg);
  z-index: 29;
  padding: 10px;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}
#mobile-menu.open { display: flex; }

#app    { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
#main   { flex: 1; overflow-y: auto; }

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 18px;
  color: var(--muted);
}
.spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page      { max-width: 880px; margin: 0 auto; padding: 40px 30px 70px; }
.page-wide { max-width: 1080px; margin: 0 auto; padding: 40px 30px 70px; }

.card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.section-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.section-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 30px;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .18s;
  letter-spacing: .01em;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 100%);
  pointer-events: none;
}
.btn-primary  { background: var(--grad-accent); color: #fff; box-shadow: 0 4px 14px rgba(36,96,176,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(36,96,176,.45); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost   { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--muted); }
.btn-ghost::after { display: none; }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none !important; }

.status-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sbtn {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  letter-spacing: .02em;
  transition: all .15s;
  text-transform: uppercase;
  font-family: var(--sans);
}
.sbtn.dom  { background: var(--green-lt);  color: var(--green); }
.sbtn.proc { background: var(--amber-lt);  color: var(--amber); }
.sbtn.dif  { background: var(--red-lt);    color: var(--red); }
.sbtn.clr  { background: var(--surface2);  color: var(--muted); border-color: var(--border); }
.sbtn.dom.on,  .sbtn.dom:hover  { border-color: var(--green);  box-shadow: 0 0 0 3px rgba(21,128,61,.18); background: var(--green); color: #fff; }
.sbtn.proc.on, .sbtn.proc:hover { border-color: var(--amber);  box-shadow: 0 0 0 3px rgba(180,83,9,.18);  background: var(--amber); color: #fff; }
.sbtn.dif.on,  .sbtn.dif:hover  { border-color: var(--red);    box-shadow: 0 0 0 3px rgba(185,28,28,.18);  background: var(--red);   color: #fff; }
.sbtn.clr:hover { border-color: var(--subtle); }

.hero {
  margin-bottom: 36px;
  background: var(--grad-hero);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.2) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36,96,176,.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 12px;
  color: #fff;
  position: relative;
}
.hero p { font-size: 15px; color: rgba(200,212,232,.85); max-width: 460px; line-height: 1.7; position: relative; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.15);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 16px;
  position: relative;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 0;
}
.stat-cell {
  background: var(--surface);
  padding: 20px 22px;
  transition: background .15s;
}
.stat-cell:hover { background: var(--surface2); }
.stat-cell label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--subtle); font-weight: 700; display: block; margin-bottom: 7px; }
.stat-cell .val {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  transition: transform .2s;
}
.stat-cell:hover .val { transform: scale(1.05); }
.stat-cell.ms .val { background: var(--grad-green);  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-cell.pr .val { background: var(--grad-amber);  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-cell.hd .val { background: var(--grad-red);    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.progress-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 9px; letter-spacing: .01em; }
.bar-track { height: 10px; background: var(--surface3); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill  {
  height: 100%;
  background: var(--grad-green);
  border-radius: 99px;
  transition: width 1s cubic-bezier(.22,.68,0,1.2);
  position: relative;
}
.bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}

.modes-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 36px; }
.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s, transform .2s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  opacity: 0;
  transition: opacity .2s;
}
.mode-card:nth-child(1)::before { background: var(--grad-accent); }
.mode-card:nth-child(2)::before { background: var(--grad-green); }
.mode-card:nth-child(3)::before { background: var(--grad-purple); }
.mode-card:hover { box-shadow: var(--shadow-lg); border-color: transparent; transform: translateY(-3px); }
.mode-card:hover::before { opacity: 1; }
.mode-num {
  font-family: var(--sans);
  font-size: 36px;
  font-weight: 800;
  color: var(--border);
  margin-bottom: 16px;
  line-height: 1;
  transition: color .2s;
}
.mode-card:nth-child(1):hover .mode-num { color: var(--accent2); }
.mode-card:nth-child(2):hover .mode-num { color: var(--green-bright); }
.mode-card:nth-child(3):hover .mode-num { color: var(--purple); }
.mode-card h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 8px; }
.mode-card p  { font-size: 13px; color: var(--muted); line-height: 1.6; flex: 1; margin-bottom: 20px; }
.mode-card .go { font-size: 12px; font-weight: 800; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; transition: letter-spacing .2s; }
.mode-card:hover .go { letter-spacing: .12em; }

#lec-layout { display: flex; height: 100vh; overflow: hidden; }

#lec-idx {
  width: 290px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}
#lec-idx-hdr {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface2);
}
#lec-idx-hdr strong { font-size: 11.5px; font-weight: 800; flex: 1; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.jform  { display: flex; gap: 5px; }
.jin    { width: 70px; padding: 5px 8px; font-size: 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); outline: none; transition: border-color .15s; }
.jin:focus { border-color: var(--accent2); }
.jbtn   { padding: 5px 11px; border-radius: 8px; background: var(--grad-accent); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; border: none; }

#idx-tree { flex: 1; overflow-y: auto; padding: 12px 10px; font-size: 12.5px; }
.idx-libro { margin-bottom: 22px; }
.idx-libro-hd { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--subtle); padding: 0 4px; margin-bottom: 8px; }
.idx-tit { margin-bottom: 12px; padding-left: 10px; border-left: 2.5px solid var(--border); }
.idx-tit-hd { font-size: 11.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; line-height: 1.4; }
.idx-cap { margin-bottom: 8px; }
.idx-cap-hd { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--subtle); margin-bottom: 5px; }
.idx-arts { display: flex; flex-wrap: wrap; gap: 3px; }
.idx-art {
  width: 38px; height: 30px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface2);
  color: var(--muted);
  border: 1.5px solid transparent;
  transition: all .12s;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans);
}
.idx-art:hover { background: var(--primary-lt); color: var(--primary); border-color: var(--accent2); transform: scale(1.08); }
.idx-art.cur   { background: var(--grad-accent); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(36,96,176,.35); }
.idx-art.der   { opacity: .28; text-decoration: line-through; }

#lec-view { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

#lec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  gap: 12px;
}
#lec-mob-btn { display: none; padding: 7px 10px; border-radius: 9px; background: var(--surface2); border: 1.5px solid var(--border); cursor: pointer; font-size: 14px; }
#nav-ctrl  { display: flex; align-items: center; gap: 6px; }
.nav-prev, .nav-next {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 15px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
.nav-prev:hover:not([disabled]) { background: var(--surface2); color: var(--text); border-color: var(--muted); }
.nav-next { color: var(--accent2); }
.nav-next:hover:not([disabled]) { background: var(--primary-lt); border-color: var(--accent2); }
.nav-prev[disabled], .nav-next[disabled] { opacity: .3; cursor: not-allowed; }
#art-counter {
  padding: 7px 16px; border-radius: 9px;
  background: var(--surface2); border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 700; min-width: 124px; text-align: center;
  font-family: var(--sans);
}
#lec-jump { display: flex; gap: 6px; }
.ljin { width: 114px; padding: 6px 12px; font-size: 13px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--surface2); color: var(--text); outline: none; transition: border-color .15s; }
.ljin:focus { border-color: var(--accent2); }

#art-content { flex: 1; overflow-y: auto; padding: 44px 48px 68px; }

.breadcrumb { font-size: 11.5px; color: var(--muted); margin-bottom: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bc-primary { color: var(--accent2); font-weight: 700; }
.bc-sep { color: var(--border); }

.art-header { margin-bottom: 26px; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }

.art-num {
  font-family: var(--sans);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.badge-der { background: var(--red-lt); color: var(--red); font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 6px; letter-spacing: .06em; text-transform: uppercase; }

.art-body {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 2;
  color: var(--text);
  max-width: 680px;
}
.art-body p { margin-bottom: 20px; }
.art-derogado { font-style: italic; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; font-size: 15px; max-width: 560px; font-family: var(--serif); border-left: 4px solid var(--border); }

.status-panel { margin-top: 36px; padding: 22px 24px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); display: inline-block; box-shadow: var(--shadow-sm); }
.status-panel > p { font-size: 11px; color: var(--muted); margin-bottom: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }

#lec-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; backdrop-filter: blur(2px); }
#lec-idx.mob-open { position: fixed; top: 0; left: 0; bottom: 0; z-index: 51; width: 300px; box-shadow: var(--shadow-lg); }

.art-sel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.art-sel-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.art-sel { max-width: 200px; }

/* Selector de artículo compacto (input numérico) */
.art-input-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.art-num-input {
  width: 76px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.art-num-input::-webkit-outer-spin-button,
.art-num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.art-num-input:focus { border-color: var(--accent2); }
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 9px;
}
.btn-ghost.active-random {
  background: var(--primary-lt);
  color: var(--accent2);
  border-color: var(--accent2);
}

.quiz-art-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(36,96,176,.3);
  font-family: var(--sans);
}

.quiz-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 2.2;
  color: var(--text);
  max-width: 680px;
}
.quiz-body p {
  margin-bottom: 22px;
}

.qbw { display: inline-block; position: relative; margin: 0 3px; vertical-align: baseline; }
.qb {
  width: 112px;
  padding: 3px 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  border: none;
  border-bottom: 2.5px solid var(--accent2);
  background: var(--primary-lt);
  color: var(--accent2);
  outline: none;
  border-radius: 6px 6px 0 0;
  transition: all .18s;
}
.qb:focus { background: #dbeafe; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.qb.ok  { border-color: var(--green-bright); background: var(--green-lt); color: var(--green); animation: popIn .3s ease; }
.qb.ko  { border-color: var(--red-bright); background: var(--red-lt); color: var(--red); text-decoration: line-through; animation: shake .35s ease; }
.qhint {
  position: absolute;
  bottom: -24px;
  left: 50%; transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1.5px solid var(--green-lt);
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  font-family: var(--sans);
}

@keyframes popIn {
  0%   { transform: scale(.8); }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}

.quiz-footer { margin-top: 44px; padding-top: 24px; border-top: 1.5px solid var(--border); }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.quiz-result  { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.quiz-score-num { font-family: var(--sans); font-size: 22px; font-weight: 800; }
.quiz-score-num.perfect { background: var(--grad-green); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.quiz-score-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.quiz-score-ring {
  display: flex;
  align-items: center;
  gap: 14px;
  animation: scoreReveal .5s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes scoreReveal {
  from { opacity:0; transform: scale(.7) translateY(10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.score-ring-svg { flex-shrink: 0; }
.score-ring-track { fill: none; stroke: var(--border); stroke-width: 5; }
.score-ring-fill  { fill: none; stroke-width: 5; stroke-linecap: round; transform-origin: 50% 50%; transform: rotate(-90deg); transition: stroke-dashoffset 1s cubic-bezier(.22,.68,0,1.2); }
.score-ring-text  { font-family: var(--sans); font-size: 13px; font-weight: 800; fill: var(--text); dominant-baseline: middle; text-anchor: middle; }

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.flash-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 32px; }
.flash-counter {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 600;
}
.flash-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flash-sel {
  padding: 8px 13px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.flash-sel:focus { border-color: var(--accent2); }

.flash-progress-bar {
  width: 100%;
  max-width: 580px;
  margin: 0 auto 22px;
  height: 4px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}
.flash-progress-fill {
  height: 100%;
  background: var(--grad-accent);
  border-radius: 99px;
  transition: width .6s cubic-bezier(.22,.68,0,1.2);
}

.flash-scene {
  width: 100%;
  max-width: 580px;
  margin: 0 auto 28px;
  aspect-ratio: 3 / 2;
  perspective: 1400px;
}

.flash-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
}
.flash-inner.flipped { transform: rotateY(180deg); }

.flash-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 28px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.06);
  transition: box-shadow .3s;
}
.flash-inner:hover .flash-face { box-shadow: 0 14px 38px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08); }

.flash-face.back {
  transform: rotateY(180deg);
  border-color: var(--accent2);
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(36,96,176,.18), 0 2px 8px rgba(36,96,176,.1);
}

mark {
  background: transparent;
  font-style: normal;
}

mark.hl-v {
  color: var(--accent2);
  font-weight: 700;
}

mark.hl-k {
  background: rgba(124,58,237,.09);
  color: var(--purple);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
  border-bottom: 1.5px solid rgba(124,58,237,.25);
  text-decoration: none;
}

mark.hl-n {
  color: var(--amber);
  font-weight: 700;
}

mark.hl-c {
  background: rgba(5,150,105,.08);
  color: #047857;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
  border-bottom: 1.5px solid rgba(5,150,105,.28);
  font-style: italic;
  text-decoration: none;
}
.dark mark.hl-k { background: rgba(167,139,250,.13); border-bottom-color: rgba(167,139,250,.35); }
.dark mark.hl-c { background: rgba(16,185,129,.1); color: #34d399; border-bottom-color: rgba(16,185,129,.35); }

.art-body mark.hl-v,
.art-body mark.hl-k,
.art-body mark.hl-n,
.art-body mark.hl-c { font-size: inherit; }

.flash-front {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  text-align: center;
  background: radial-gradient(ellipse at center, var(--primary-lt) 0%, var(--surface) 70%);
}
.flash-front-num {
  font-family: var(--sans);
  font-size: 72px;
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 8px rgba(36,96,176,.2));
}
.flash-front-sub { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.flash-front-text {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.68;
  color: var(--text);
  max-height: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  text-align: left;
}
.flash-hint {
  font-size: 11px;
  color: var(--subtle);
  letter-spacing: .04em;
  text-align: center;
  padding: 11px 36px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
  font-weight: 600;
  text-transform: uppercase;
}

.flash-back {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #eff6ff 0%, var(--surface) 60%);
}
.dark .flash-back {
  background: linear-gradient(160deg, #0a1a30 0%, var(--surface) 60%);
}
.flash-back-header {
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.flash-back-art-num {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  color: var(--accent2);
  letter-spacing: .01em;
}
.flash-hl-legend {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.hl-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.hl-dot.hl-v { background: var(--accent2); }
.hl-dot.hl-k { background: var(--purple); }
.hl-dot.hl-n { background: var(--amber); }
.hl-dot.hl-c { background: #047857; }
.flash-back-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 26px 22px;
}
.flash-back-text {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text);
}
.flash-back-text p { margin-bottom: 13px; }

.flash-back-num-only {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.flash-back-num-only-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.flash-back-num-only-val {
  font-family: var(--sans);
  font-size: 72px;
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.flash-actions {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 580px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  animation: slideUp .3s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: translateY(0); }
}
.flash-actions-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }

.mode-start-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 520px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.mode-start-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
}
.mode-start-card.quiz-start::before { background: var(--grad-green); }
.mode-start-card.flash-start::before { background: var(--grad-purple); }
.mode-start-icon {
  font-size: 42px;
  margin-bottom: 16px;
  display: block;
}
.mode-start-card h2 { font-family: var(--serif); font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.mode-start-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }

.prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 32px; }

.prog-big {
  font-family: var(--sans);
  font-size: 56px;
  font-weight: 800;
  background: var(--grad-green);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 5px;
}
.prog-sub { font-size: 13.5px; color: var(--muted); }

.stacked-bar { height: 14px; border-radius: 99px; overflow: hidden; display: flex; margin: 22px 0 8px; background: var(--surface3); border: 1px solid var(--border); }
.seg { height: 100%; transition: width .8s cubic-bezier(.22,.68,0,1.2); }
.stacked-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--subtle); font-weight: 600; }

.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.srl { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.srv { font-family: var(--sans); font-size: 22px; font-weight: 800; }

.repaso-section h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 14px;
  margin-top: 32px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--red-lt);
}
.repaso-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 12px; }
.repaso-card {
  background: var(--red-lt);
  border: 1.5px solid rgba(185,28,28,.12);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .15s;
  border-left: 4px solid var(--red);
}
.repaso-card:hover { opacity: .82; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.repaso-num { font-weight: 800; color: var(--red); font-size: 13px; margin-bottom: 5px; font-family: var(--sans); }
.repaso-txt { font-size: 11.5px; color: var(--text); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

@media (max-width: 820px) {
  #sidebar { display: none; }
  #mobile-nav { display: flex; }
  #lec-layout { height: calc(100vh - 56px); }
  #lec-idx { display: none; width: 290px; }
  #lec-idx.mob-open { display: flex; }
  #lec-mob-btn { display: block; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .modes-grid { grid-template-columns: 1fr; }
  .prog-grid  { grid-template-columns: 1fr; }
  #lec-bar { padding: 8px 12px; }
  #art-content { padding: 26px 20px 52px; }
  #lec-jump { display: none; }
  .nav-prev span, .nav-next span { display: none; }
  #art-counter { min-width: 90px; font-size: 12px; }
  .art-num { font-size: 28px; }
  .art-body { font-size: 15.5px; }
  .quiz-body { font-size: 15px; line-height: 2.1; }
  .qb { width: 90px; font-size: 13px; }
  .flash-scene { aspect-ratio: 4 / 3; }
  .flash-front-num, .flash-back-num-only-val { font-size: 50px; }
  .hero { padding: 30px 24px; border-radius: var(--radius-lg); }
  .hero h1 { font-size: 28px; }
  .art-sel { max-width: 150px; }
  .mode-start-card { padding: 26px 22px; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--subtle); }

.counting { transition: transform .1s; transform: scale(1.08); }
