/* ============================================
   PURE MATH PRO — v1.5 (Dark Blue Theme)
   Dark blue background · Blue accents · 3 cards
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  /* ---- Dark blue background ---- */
  --bg:         #070b14;
  --bg-panel:   #0d1424;
  --bg-elev:    #121b30;
  --bg-soft:    #1a2440;

  /* ---- Sidebar / topbar ---- */
  --side-bg-1:  #0f1a33;
  --side-bg-2:  #0a1226;
  --top-bg:     rgba(7, 11, 20, 0.9);

  /* ---- Lines ---- */
  --line:       rgba(59, 130, 246, 0.15);
  --line-hi:    rgba(59, 130, 246, 0.35);

  /* ---- Primary accents ---- */
  --blue:       #3b82f6;
  --blue-d:     #60a5fa;
  --cyan:       #22d3ee;
  --indigo:     #818cf8;

  /* ---- Text ---- */
  --tx-0: #dbeafe;
  --tx-1: #a9b8d4;
  --tx-2: #6b7a99;
  --tx-3: #45516b;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);

  --sidebar-w: 250px;
  --right-w: 250px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--tx-1);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;

  background-image:
    radial-gradient(ellipse 50% 40% at 0% 0%,   rgba(59, 130, 246, 0.10), transparent 60%),
    radial-gradient(ellipse 45% 40% at 100% 10%, rgba(34, 211, 238, 0.08), transparent 60%);
  background-attachment: fixed;
}

code, pre { font-family: 'JetBrains Mono', monospace !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.25); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59, 130, 246, 0.45); }
* { scrollbar-width: thin; scrollbar-color: rgba(59,130,246,0.3) transparent; }

/* ============================================
   LEFT SIDEBAR
   ============================================ */
aside.left-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--side-bg-1) 0%, var(--side-bg-2) 100%);
  border-right: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.15rem;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 2;
  position: relative;
}

aside.left-sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: -1px;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(59, 130, 246, 0.25), transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--tx-0);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #16233f, #0f1a33);
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--blue-d);
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(59, 130, 246, 0.15);
}

.info-section { margin-bottom: 1.6rem; }

.info-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--blue-d);
  margin-bottom: 0.85rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.info-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.78rem; }

.info-list li {
  background: rgba(26, 36, 64, 0.8);
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.12);
  line-height: 1.45;
  color: var(--tx-1);
  transition: all 0.25s var(--ease);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.5);
}

.info-list li:hover {
  background: var(--bg-elev);
  transform: translateX(3px);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.info-list li strong {
  color: var(--tx-0);
  display: block;
  margin-bottom: 0.15rem;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

header.topbar {
  min-height: 68px;
  background: var(--top-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  gap: 1rem;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(59, 130, 246, 0.06) inset;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  flex-shrink: 0;
}

.search-wrapper { position: relative; width: 100%; max-width: 420px; }

.search-input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--tx-0);
  outline: none;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.25s var(--ease);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.search-input::placeholder { color: var(--tx-3); font-style: italic; }

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.search-input:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-soft); }

.search-icon {
  position: absolute;
  left: 0.95rem; top: 50%;
  transform: translateY(-50%);
  color: var(--tx-3);
  font-weight: 700;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.portal-tag {
  background: var(--bg-elev);
  color: var(--tx-1);
  padding: 0.42rem 0.9rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.72rem;
  border: 1px solid var(--line);
  white-space: nowrap;
  transition: all 0.25s var(--ease);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.portal-tag:hover {
  border-color: var(--blue);
  color: var(--blue-d);
  transform: translateY(-1px);
}

.brand-tag {
  background: linear-gradient(135deg, #0f1a33, #0a1226);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--blue-d);
  font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(59, 130, 246, 0.35);
}

.content-wrapper { flex: 1; display: flex; overflow: hidden; }

main.main-content {
  flex: 1;
  padding: 2rem 2rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.9rem;
  font-weight: 800;
  color: var(--tx-0);
  letter-spacing: -0.045em;
  line-height: 1;
}

.accent {
  background: linear-gradient(120deg, #22d3ee 0%, #3b82f6 40%, #818cf8 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradShift 7s ease-in-out infinite;
}

@keyframes gradShift {
  0%,100% { background-position: 0% 50%; }
  50%     { background-position: 100% 50%; }
}

.page-subtitle {
  color: var(--tx-2);
  font-size: 0.875rem;
  margin-top: 0.6rem;
  max-width: 640px;
  line-height: 1.55;
}

.btn-reset {
  display: none;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tx-1);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  font-family: inherit;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.btn-reset:hover {
  background: var(--bg-soft);
  color: var(--blue-d);
  border-color: var(--blue);
}

/* ============================================
   LOAD CONTAINER
   ============================================ */
.load-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 25% 15%, rgba(59, 130, 246, 0.10), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(34, 211, 238, 0.08), transparent 55%),
    var(--bg-panel);
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-radius: 24px;
  padding: 3rem 2rem;
  width: 100%;
  position: relative;
  overflow: hidden;
  min-height: 320px;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.9);
}

.load-container::before,
.load-container::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--blue);
  border-style: solid;
  border-width: 0;
  opacity: 0.6;
}

.load-container::before {
  top: 14px; left: 14px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.load-container::after {
  bottom: 14px; right: 14px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.load-container > * { position: relative; z-index: 1; }

/* ============================================
   SELECTION GRID — 3 columns
   ============================================ */
.btn-group-sub {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 158px;
  gap: 1.1rem;
  width: 100%;
  max-width: 980px;
  margin: 0 auto 1.5rem;
}

/* ============================================
   SELECTION BUTTONS — vivid pastel with subtle image
   ============================================ */
.btn-sub {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 1.6rem !important;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #0a0f1c;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 12px 30px -10px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.45s var(--ease-spring),
    box-shadow 0.45s var(--ease),
    filter 0.4s var(--ease);
}

/* Index number (01, 02, 03) */
.btn-sub::before {
  content: attr(data-index);
  position: absolute;
  top: 1.3rem;
  right: 1.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(10, 15, 28, 0.55);
  letter-spacing: 0.12em;
  z-index: 3;
  transition: color 0.3s var(--ease);
}

/* Subtle image layer on the right side, faded via mask */
.btn-sub::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60%;
  height: 100%;
  background-position: center right;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.85;
  -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,0.6) 40%, transparent 90%);
  mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,0.6) 40%, transparent 90%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s var(--ease);
}

.btn-sub:hover:not(:disabled)::after { opacity: 0.55; }

.btn-sub:hover:not(:disabled) {
  transform: translateY(-6px) scale(1.02);
  filter: saturate(1.2) brightness(1.05);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 28px 55px -14px rgba(0, 0, 0, 0.85),
    0 0 0 2.5px rgba(255, 255, 255, 0.3);
}

.btn-sub:hover:not(:disabled)::before { color: rgba(10, 15, 28, 0.9); }

.btn-sub:active:not(:disabled) { transform: translateY(-2px) scale(0.995); }

.btn-sub:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.6);
}

.btn-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  position: relative;
  z-index: 2;
  color: #0a0f1c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-sub .hint {
  font-size: 0.72rem;
  color: rgba(10, 15, 28, 0.78);
  letter-spacing: 0.01em;
  font-weight: 700;
  position: relative;
  z-index: 2;
  margin-top: 0.35rem;
}

.btn-sub .arrow {
  position: absolute;
  bottom: 1.3rem;
  right: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(10, 15, 28, 0.7);
  z-index: 3;
  transition: transform 0.5s var(--ease-spring), color 0.3s var(--ease);
}

.btn-sub:hover .arrow {
  transform: translateX(6px);
  color: #0a0f1c;
}

/* ---------- Variant colors — vivid pastel ---------- */
.btn-new {
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 55%, #10b981 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 12px 30px -10px rgba(16, 185, 129, 0.55),
    0 0 0 1px rgba(16, 185, 129, 0.3);
}
.btn-new::after {
  background-image: url('https://pure-math.pro/unitsr/burger-race.webp');
}
.btn-new:hover:not(:disabled) {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 28px 55px -14px rgba(16, 185, 129, 0.7),
    0 0 0 2.5px rgba(110, 231, 183, 0.4);
}

.btn-pop {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 55%, #f59e0b 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 12px 30px -10px rgba(245, 158, 11, 0.55),
    0 0 0 1px rgba(245, 158, 11, 0.3);
}
.btn-pop::after {
  background-image: url('https://pure-math.pro/unitsr/backflip-it-around-the-world.webp');
}
.btn-pop:hover:not(:disabled) {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 28px 55px -14px rgba(245, 158, 11, 0.7),
    0 0 0 2.5px rgba(252, 211, 77, 0.4);
}

.btn-premium {
  background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 55%, #8b5cf6 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 12px 30px -10px rgba(139, 92, 246, 0.55),
    0 0 0 1px rgba(139, 92, 246, 0.3);
}
.btn-premium::after {
  background-image: url('https://pure-math.pro/unitsr/big-punch-man.webp');
}
.btn-premium:hover:not(:disabled) {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 28px 55px -14px rgba(139, 92, 246, 0.7),
    0 0 0 2.5px rgba(196, 181, 253, 0.4);
}

/* ============================================
   PRIMARY LOAD BUTTON
   ============================================ */
.btn-load {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 1.75rem 2.2rem !important;
  border-radius: 22px;
  background: linear-gradient(120deg, #2563eb 0%, #1d4ed8 40%, #4338ca 100%);
  background-size: 200% 100%;
  animation: shiftGradient 6s ease infinite;
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #ffffff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.5s var(--ease-spring), box-shadow 0.5s var(--ease), filter 0.4s var(--ease);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 22px 55px -16px rgba(37, 99, 235, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-load::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: linear-gradient(120deg, #60a5fa, #818cf8, #22d3ee, #60a5fa);
  background-size: 300% 300%;
  animation: shiftGradient 5s ease infinite;
  filter: blur(14px);
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
}

.btn-load::after {
  content: '⏎';
  position: absolute;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.4s var(--ease-spring);
}

.btn-load:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.01);
  filter: saturate(1.15) brightness(1.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 30px 70px -16px rgba(37, 99, 235, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-load:hover:not(:disabled)::after {
  right: 1.5rem;
  color: #ffffff;
}

.btn-load:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.4);
}

.btn-load .btn-label {
  color: #ffffff;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
}

@keyframes shiftGradient {
  0%,100% { background-position: 0% 50%; }
  50%     { background-position: 100% 50%; }
}

/* ============================================
   LOADER
   ============================================ */
.circle-loader {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   COURSES GRID
   ============================================ */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 1rem;
  padding-bottom: 1rem;
}

.course-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--bg-elev);
  border: 2px solid rgba(59, 130, 246, 0.2);
  transition: all 0.3s var(--ease);
  cursor: pointer;
  animation: cardIn 0.45s var(--ease) backwards;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.7);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.course-card:hover {
  transform: translateY(-6px);
  border-color: var(--blue);
  box-shadow:
    0 18px 40px -12px rgba(59, 130, 246, 0.4),
    0 0 24px rgba(59, 130, 246, 0.2);
}

.thumbnail-link { display: block; width: 100%; height: 100%; }

.thumbnail-box {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-soft);
}

.thumbnail-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.course-card:hover .thumbnail-img { transform: scale(1.08); }

.scroll-sentinel {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem;
  color: var(--tx-3);
  font-size: 0.75rem;
  display: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   RIGHT PANEL
   ============================================ */
aside.right-panel {
  width: var(--right-w);
  background: rgba(13, 20, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-box {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  transition: all 0.3s var(--ease);
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.7);
}

.panel-box:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(59, 130, 246, 0.35);
}

.panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  color: var(--blue-d);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.fact-box { font-size: 0.8rem; color: var(--tx-2); line-height: 1.55; }
.fact-box strong { color: var(--tx-0); font-weight: 600; }

.formula-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--tx-2);
}

.formula-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.formula-list code {
  background: var(--bg-soft);
  padding: 0.24rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-d);
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
}

/* ============================================
   DETAIL PAGE
   ============================================ */
.lesson-container {
  width: 100%;
  min-height: auto;
  background: transparent;
  border-radius: 0;
  border: none;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: visible;
  padding: 0;
}

.b9 {
  width: 100%;
  max-width: 970px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tx-3);
  margin: 0 auto 1rem;
  padding: 4px;
  background: transparent;
  overflow: visible;
}

/* ============================================
   LESSON VIEWER
   ============================================ */
#lessonView {
  width: 100%;
  height: 0;
  overflow: hidden;
  background: #000;
  border-radius: 12px;
  position: relative;
  transition: height 0.35s ease;
}

#lessonView.active {
  height: calc(100vh - 68px);
  margin-top: 1rem;
}

#lessonCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.btn-fullscreen {
  position: absolute;
  bottom: 16px; right: 16px;
  z-index: 50;
  background: var(--bg-elev);
  color: var(--tx-0);
  border: 1px solid var(--line);
  padding: 0.6rem 1rem;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 0.4rem;
  backdrop-filter: blur(12px);
  transition: all 0.25s var(--ease);
  font-family: inherit;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8);
}

.btn-fullscreen:hover {
  background: var(--bg-soft);
  color: var(--blue-d);
  border-color: var(--blue);
  transform: translateY(-2px);
}

.btn-start-lesson {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 2rem;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  background: linear-gradient(120deg, #25eb28 0%, #1dd842 55%, #38ca4e 100%);
  background-size: 200% 200%;
  animation: gradShift 6s ease infinite;
  border: none;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease), filter 0.35s var(--ease);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 14px 34px -12px rgb(37 235 58 / 70%);
  position: relative;
}

.btn-start-lesson .btn-play {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  font-size: 0.72rem;
  line-height: 1;
  padding-left: 2px;
}

.btn-start-lesson:hover:not(:disabled) {
  transform: translateY(-3px);
  filter: saturate(1.15) brightness(1.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 22px 50px -14px rgb(38 235 37 / 90%);
}

.btn-start-lesson:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.4);
}

.btn-back {
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tx-1);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: all 0.25s var(--ease);
  font-family: inherit;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.btn-back:hover {
  background: var(--bg-soft);
  color: var(--blue-d);
  border-color: var(--blue);
}

.class_r {
  max-width: 100%;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.class_r.spr3 {
  width: 100%;
}

.class_r.spr2 {
  width: 100%;
}

/* ============================================
   LESSON HERO
   ============================================ */
.detail-page {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.detail-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tx-0);
  margin: 0;
}

.pre-lesson {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 1rem;
  width: 100%;
  min-height: auto;
  gap: 1rem;
}

.lesson-hero {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  background: var(--bg-panel);
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.9);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.lesson-thumb {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
  transition: transform 0.35s var(--ease-spring);
}

.lesson-thumb:hover { transform: scale(1.02) rotate(-1deg); }

.lesson-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.lesson-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-d);
  margin-bottom: 0.4rem;
}

.lesson-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--tx-0);
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.lesson-desc {
  font-size: 0.82rem;
  color: var(--tx-2);
  line-height: 1.5;
  margin-bottom: 1.15rem;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
}

.small-links {
  display: inline-flex;
  gap: 0.55rem;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tx-1);
  background: var(--bg-soft);
  border: 1.5px solid rgba(59, 130, 246, 0.25);
  text-decoration: none;
  transition: all 0.25s var(--ease);
  font-family: inherit;
}

.btn-small:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-d);
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(59, 130, 246, 0.5);
}

/* ============================================
   SIMILAR LESSONS
   ============================================ */
.similar-section {
  margin: 0;
  padding: 2rem 0 2rem;
  border-top: 1px solid rgba(59, 130, 246, 0.15);
  background: transparent;
}

.similar-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.similar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--tx-0);
  letter-spacing: -0.03em;
}

.similar-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-d);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================
   EMPTY THUMBNAIL
   ============================================ */
.lesson-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16233f 0%, #0f1a33 100%);
  color: var(--blue-d);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  user-select: none;
}

.thumbnail-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16233f 0%, #0f1a33 100%);
  color: var(--blue-d);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  user-select: none;
}

/* ============================================
   RESPONSIVE — MOBILE (hidden panels)
   ============================================ */

@media (max-width: 1200px) {
  .btn-group-sub { grid-auto-rows: 148px; }
}

@media (max-width: 992px) {
  body {
    display: block;
    height: auto;
    overflow-y: auto;
  }

  aside.left-sidebar,
  aside.right-panel {
    display: none !important;
  }

  .app-body { width: 100%; min-width: 0; }
  .content-wrapper { flex-direction: column; overflow: visible; }
  main.main-content { width: 100%; overflow: visible; padding: 1.25rem; }

  .courses-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .btn-group-sub { grid-template-columns: 1fr; grid-auto-rows: 138px; }

  .lesson-hero {
    flex-direction: column;
    text-align: center;
    padding: 1.75rem;
    gap: 1.5rem;
  }
  .lesson-info { align-items: center; }
  .lesson-actions { align-items: center; }
  .lesson-thumb { width: 220px; height: 220px; }
  .lesson-name { font-size: 1.5rem; }

  #lessonView.active { height: 70vh; }

  .similar-section { padding: 1.5rem 0; }
}

@media (max-width: 600px) {
  header.topbar {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 0.9rem;
    gap: 0.6rem;
  }

  .search-wrapper { max-width: 100%; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-title { font-size: 2rem; }
  .btn-reset { width: 100%; margin-top: 0.5rem; }

  .courses-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 0.7rem;
  }

  .btn-group-sub { grid-template-columns: 1fr; grid-auto-rows: 118px; }
  .btn-sub { padding: 1.15rem 1.25rem !important; }
  .btn-label { font-size: 1.25rem; }
  .btn-sub .arrow { bottom: 1.1rem; right: 1.2rem; }
  .btn-load { padding: 1.4rem 1.5rem !important; font-size: 1.15rem; }
  .btn-load::after { right: 1.2rem; }

  .load-container { padding: 1.75rem 1rem; min-height: 400px; }

  .lesson-thumb { width: 180px; height: 180px; }
  .lesson-name { font-size: 1.35rem; }
  .lesson-hero { padding: 1.35rem; }
  .lesson-desc { font-size: 0.78rem; }

  .btn-start-lesson { width: 100%; justify-content: center; padding: 1rem 1.5rem; }

  .small-links { width: 100%; justify-content: center; flex-wrap: wrap; }

  #lessonView.active { height: 60vh; }

  .similar-section { padding: 1.25rem 0; }
  .similar-title { font-size: 1.15rem; }
}