/* ========================================================
   CODExTRMS - MODERN CLEAN THEME & RESPONSIVE STYLES
   ======================================================== */

/* Light Theme (Default) */
:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --card: #ffffff;
  --surface: #faf8f4;
  --surface-hover: #f1ede4;
  --bar-track: #e5e0d4;
  --line: #e4dfd4;
  --text: #191c21;
  --muted: #647082;
  --cyan: #4338ca;
  --accent: #6366f1;
  --grad: linear-gradient(135deg, #3b82f6, #6366f1);
  --chrome: rgba(246, 244, 238, 0.94);
  --chrome-solid: #ffffff;
  --chrome-border: #e4dfd4;
  --shadow: 0 4px 16px rgba(35, 30, 20, 0.05);
  --shadow-lg: 0 10px 28px rgba(35, 30, 20, 0.08);
}

/* Dark Theme - Refined, subtle, NO harsh neon glow */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --card: #131d31;
  --surface: #18263f;
  --surface-hover: #1f304e;
  --bar-track: #22324e;
  --line: #22324e;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --accent: #60a5fa;
  --grad: linear-gradient(135deg, #2563eb, #6366f1);
  --chrome: rgba(11, 17, 32, 0.92);
  --chrome-solid: #131d31;
  --chrome-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 76px 0 120px;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse at 88% 10%, rgba(222, 223, 217, 0.65) 0%, transparent 48%),
    radial-gradient(ellipse at 12% 92%, rgba(242, 234, 221, 0.75) 0%, transparent 52%),
    var(--bg);
  transition: background-color 0.2s, color 0.2s;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 10% 12%, rgba(37, 99, 235, 0.08) 0, transparent 45%),
    radial-gradient(ellipse at 90% 90%, rgba(99, 102, 241, 0.08) 0, transparent 45%),
    var(--bg);
}

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

/* ========================================================
   HEADER
   ======================================================== */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 64px;
  background: var(--chrome);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--chrome-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px;
  z-index: 50;
  transition: background 0.2s, border-color 0.2s;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--cyan);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  display: block;
}

.brand-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: -0.01em;
}

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

.header-action {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--chrome-border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.header-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-action:hover,
.header-action:focus-visible {
  background: var(--surface-hover);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.notification-wrap {
  position: relative;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 600px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  padding: 16px;
}

.notification-panel b {
  display: block;
}

.notification-panel p {
  margin: 10px 0 0;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #738096;
}

.notification-dot.unread {
  background: #fb7185;
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.25);
}

.notification-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.notification-item p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.notification-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.notification-media {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-top: 8px;
  border-radius: 8px;
  background: #000;
}

.notification-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 650;
}

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

/* ========================================================
   CONTAINER & CARDS
   ======================================================== */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--cyan) 25%, var(--line));
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.err {
  color: #f87171;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 20px;
  color: var(--cyan);
  margin-top: 2px;
}

.btn {
  display: inline-block;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--grad);
  border-radius: 999px;
  padding: 9px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 4px 12px;
  font-size: 12px;
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bar {
  height: 6px;
  background: var(--bar-track);
  border-radius: 9px;
  overflow: hidden;
  margin-top: 8px;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--grad);
}

.course-search {
  width: 100%;
  height: 48px;
  margin: 0 0 18px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.course-search::placeholder {
  color: var(--muted);
}

.course-search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 16%, transparent);
}

.catalog {
  max-width: 100%;
  padding: 22px;
}

.catalog-empty {
  grid-column: 1/-1;
  margin: 4px 0;
  padding: 8px;
}

/* ========================================================
   COURSES & ENROLLED BATCHES (RESPONSIVE GRID)
   ======================================================== */
.courses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.course {
  padding: 0;
  overflow: hidden;
  margin: 0;
  background: var(--card);
  border-radius: 14px;
}

.course:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.course img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface);
  display: block;
}

.course .b {
  padding: 14px;
}

.course h3 {
  margin: 0 0 4px;
  font-size: 15px;
  text-transform: uppercase;
  line-height: 1.35;
}

.external-course {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.external-course:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.course-actions {
  justify-content: center;
}

.course-actions.is-enrolled {
  justify-content: space-between;
}

.course-openable {
  cursor: pointer;
}

.course-openable:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* ========================================================
   PREMIUM FEATURES TILES
   ======================================================== */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.tile {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.tile:hover,
.tile:focus-visible {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--cyan) 45%, var(--line));
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tile-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--grad);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Tablet: 3 columns */
@media (min-width: 641px) and (max-width: 1024px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

/* Phone: strictly 2-2 per row */
@media (max-width: 640px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .tile {
    min-height: 98px;
    padding: 12px 8px;
    gap: 8px;
  }
  .tile-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
    border-radius: 12px;
  }
  .tile span:last-child {
    font-size: 13px;
    font-weight: 600;
  }
  .courses {
    grid-template-columns: repeat(1, 1fr);
    gap: 14px;
  }
}

/* ========================================================
   CONTINUE WATCHING
   ======================================================== */
.continue-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

/* Horizontal Scroll for Enrolled Batches and Course Tracks */
.courses-horizontal-track,
.enrolled-courses {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 18px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 6px 4px 18px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  -webkit-overflow-scrolling: touch;
}

.courses-horizontal-track::-webkit-scrollbar,
.enrolled-courses::-webkit-scrollbar {
  height: 6px;
}

.courses-horizontal-track::-webkit-scrollbar-track,
.enrolled-courses::-webkit-scrollbar-track {
  background: transparent;
}

.courses-horizontal-track::-webkit-scrollbar-thumb,
.enrolled-courses::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
}

.courses-horizontal-track::-webkit-scrollbar-thumb:hover,
.enrolled-courses::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.courses-horizontal-track .course,
.enrolled-courses .course {
  flex: 0 0 280px !important;
  min-width: 280px !important;
  max-width: 300px !important;
  margin: 0;
}

.courses-horizontal-track .course .b,
.enrolled-courses .course .b {
  padding: 14px;
}

.courses-horizontal-track .course h3,
.enrolled-courses .course h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-wrap h2 {
  margin: 0;
}

.badge-count {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--cyan);
  border: 1px solid var(--line);
}

.slider-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.slider-btn:hover {
  background: var(--surface-hover);
  border-color: var(--cyan);
  transform: scale(1.06);
}

.continue-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: background 0.18s, border-color 0.18s;
}

.continue-item:hover,
.continue-item:focus-visible {
  background: var(--surface-hover);
  border-color: var(--cyan);
}

.continue-item > span:nth-child(2) {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.continue-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-play {
  color: var(--cyan);
}

/* ========================================================
   STUDENT PROFILE & AVATAR
   ======================================================== */
.profile-avatar-wrap {
  position: relative;
  width: 86px;
  height: 86px;
  flex: none;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--cyan);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  display: block;
}

.avatar-img:hover {
  filter: brightness(0.92);
  transform: scale(1.02);
}

.avatar-edit-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--cyan);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s, background 0.15s;
}

.avatar-edit-btn:hover {
  transform: scale(1.1);
}

/* Fallback letter avatar */
.avatar {
  width: 86px;
  height: 86px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 800;
  background: var(--grad);
  color: #fff;
  border: 2.5px solid var(--cyan);
}

/* ========================================================
   VIDEO PLAYER & WATERMARK (TOP-LEFT, LOGO ONLY)
   ======================================================== */
video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px;
}

.video-player {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  color: #fff;
}

.video-player video {
  display: block;
  width: 100%;
  max-height: 72vh;
  aspect-ratio: 16/9;
  object-fit: contain;
  border-radius: 0;
}

/* Top-Left Watermark with Logo ONLY */
.player-watermark {
  position: absolute;
  top: 14px;
  left: 14px;
  right: auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  opacity: 0.78;
  transition: opacity 0.25s ease;
}

.player-watermark img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  display: block;
}

.video-player:fullscreen .player-watermark {
  top: 24px;
  left: 24px;
}

.video-player:fullscreen .player-watermark img {
  width: 44px;
  height: 44px;
}

.video-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 24px 12px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65) 45%, rgba(0, 0, 0, 0.85));
  color: #fff;
}

.seek-control {
  display: block;
  width: 100%;
  height: 4px;
  margin: 0 0 7px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.video-control-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}

.video-control-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 17px;
  cursor: pointer;
}

.video-control-btn:hover,
.video-control-btn[aria-expanded="true"],
.video-control-btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.2);
}

.video-control-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.video-control-spacer {
  flex: 1;
}

.video-navigation,
.audio-control {
  display: flex;
  align-items: center;
  gap: 2px;
}

.audio-control input {
  width: 0;
  max-width: clamp(70px, 12vw, 110px);
  height: 4px;
  accent-color: #fff;
  cursor: pointer;
  transition: width 0.18s;
}

.audio-control input:not([hidden]) {
  width: clamp(70px, 12vw, 110px);
}

.audio-control input[hidden] {
  display: none;
}

.video-time {
  flex: none;
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.settings-menu {
  position: relative;
  flex: none;
}

.video-settings-menu {
  position: absolute;
  right: 0;
  bottom: 44px;
  z-index: 5;
  display: grid;
  gap: 12px;
  min-width: 190px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #181818;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.video-settings-menu[hidden] {
  display: none;
}

.speed-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
}

.speed-control select {
  min-width: 92px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: #292929;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.video-download-option {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.video-download-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Standard fullscreen */
.video-player:fullscreen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-player:fullscreen video {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  aspect-ratio: unset;
  object-fit: cover;
}

.video-player:fullscreen .video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  flex: none;
  width: 100%;
  z-index: 10;
}

/* WebKit fullscreen (Safari, Chrome on iOS/Android) */
.video-player:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-player:-webkit-full-screen video {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  aspect-ratio: unset;
  object-fit: cover;
}

.video-player:-webkit-full-screen .video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  flex: none;
  width: 100%;
  z-index: 10;
}

/* Mozilla fullscreen */
.video-player:-moz-full-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-player:-moz-full-screen video {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  aspect-ratio: unset;
  object-fit: cover;
}

.video-player:-moz-full-screen .video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  flex: none;
  width: 100%;
  z-index: 10;
}

/* ========================================================
   CLEAN SPRING BUBBLE BOTTOM NAVIGATION (RESPONSIVE)
   ======================================================== */
.nav-bottom-container {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 16px;
}

#navbarContainer {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 64px;
  pointer-events: auto;
  overflow: visible;
}

#navbar {
  position: relative;
  width: 100%;
  height: 64px;
  background: var(--chrome-solid);
  border: 1px solid var(--chrome-border);
  box-shadow: var(--shadow-lg);
  border-radius: 32px;
  display: flex;
  align-items: center;
  z-index: 2;
}

#activeBubble {
  position: absolute;
  top: -16px;
  left: 12.5%;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--cyan);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  transition: background-color 0.2s, border-color 0.2s;
}

#activeBubbleIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--cyan);
}

#menuWrapper {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 5;
}

.menuElement {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.menuElement .nav-icon {
  font-size: 18px;
  line-height: 1;
  transition: opacity 0.2s, transform 0.2s;
}

.menuElement .nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s, transform 0.2s;
}

.menuElement.active {
  color: var(--cyan);
}

.menuElement.active .nav-icon {
  opacity: 0;
  transform: translateY(-4px);
}

.menuElement.active .nav-label {
  color: var(--cyan);
  font-weight: 700;
  transform: translateY(2px);
}

/* Mobile Phone Bottom Nav: Docked to bottom edge */
@media (max-width: 640px) {
  .nav-bottom-container {
    bottom: 0;
    padding: 0;
  }
  #navbarContainer {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
  }
  #navbar {
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}

/* ========================================================
   LESSON BROWSER & WATCH PAGE
   ======================================================== */
.play {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}

.play.lesson-layout {
  grid-template-columns: minmax(0, 1fr);
}

.lesson-browser {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.lesson-progress {
  display: grid;
  gap: 9px;
}

.lesson-progress-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.lesson-progress-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.lesson-progress-bar {
  height: 5px;
}

.lesson-progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.2s;
}

.mark-all-done,
.reset-progress {
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.mark-all-done {
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.reset-progress {
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.1);
  color: #fb7185;
}

.mark-all-done:disabled,
.reset-progress:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lesson-tab {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.lesson-tab:hover {
  background: var(--surface-hover);
}

.lesson-tab.on {
  border-color: transparent;
  background: var(--grad);
  color: #ffffff;
}

.lesson-progress-message {
  margin: 0;
}

.lesson-list {
  display: grid;
  gap: 9px;
  max-height: 62vh;
}

.lesson-row,
.resource-row {
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.lesson-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.lesson-row.on {
  border-color: var(--cyan);
  background: var(--surface-hover);
}

.lesson-row.dn .lesson-row-title b {
  text-decoration: line-through;
  text-decoration-color: rgba(52, 211, 153, 0.6);
}

.lesson-done-toggle {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: #34d399;
  font-size: 13px;
  font-weight: 800;
  line-height: 17px;
  cursor: pointer;
}

.lesson-done-toggle[aria-checked="true"] {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.lesson-row-title {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.lesson-row-title .chapter-number {
  width: max-content;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface-hover);
}

.lesson-title-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.lesson-row-title b {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.lesson-duration {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lesson-row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lesson-play-btn,
.lesson-resource-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.lesson-play-btn {
  border-color: transparent;
  background: var(--grad);
  color: #ffffff;
}

.lesson-play-btn:hover,
.lesson-resource-btn:hover {
  filter: brightness(1.08);
  border-color: var(--cyan);
}

.lesson-resource-btn {
  font-size: 12px;
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-wrap: anywhere;
}

.lesson-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.lesson-row.dn::after {
  content: none;
}

.chapter-page {
  padding-bottom: 20px;
}

.chapter-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}

.chapter-back {
  align-self: center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
  padding: 8px 14px;
}

.chapter-back:hover {
  background: var(--surface-hover);
}

.chapter-search {
  margin: 0;
  border-radius: 999px;
}

.chapter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.chapter-tab {
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chapter-tab:hover {
  background: var(--surface-hover);
}

.chapter-tab.on {
  border-color: transparent;
  background: var(--grad);
  color: #ffffff;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.chapter-grid[hidden],
.material-list[hidden],
#chapter-player[hidden] {
  display: none;
}

.chapter-card {
  position: relative;
  min-width: 0;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
}

.chapter-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cyan) 38%, var(--line));
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chapter-open {
  width: 100%;
  height: 100%;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  padding: 17px 14px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chapter-open b {
  max-width: 100%;
  padding-right: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chapter-number {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.chapter-meta {
  color: var(--muted);
  font-size: 13px;
}

.chapter-done {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
}

.chapter-open .bar {
  width: 100%;
  height: 4px;
  margin-top: 0;
}

.chapter-favorite {
  position: absolute;
  top: 8px;
  right: 9px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chapter-favorite:hover,
.chapter-favorite.saved {
  color: #fb4c99;
}

.chapter-empty {
  grid-column: 1/-1;
  margin: 8px 0;
}

.material-list .ls {
  max-height: 70vh;
}

.material-list .ls li[data-note] {
  cursor: pointer;
}

.player-back {
  margin-bottom: 16px;
}

.player-back + h2 {
  margin-bottom: 16px;
}

.ls {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 70vh;
  overflow: auto;
}

.ls li {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.ls li[data-id] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lesson-note {
  flex: none;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.lesson-note:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.ls li.on {
  background: var(--surface-hover);
  font-weight: 600;
}

.ls li.dn::after {
  content: " ✓";
  color: #34d399;
}

#watch-page[hidden] {
  display: none;
}

.wrap:has(.watch-page:not([hidden])) {
  max-width: 1600px;
}

.watch-toolbar {
  position: sticky;
  top: 64px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin: 0 -16px 14px;
  padding: 8px 16px;
  background: var(--chrome);
  color: var(--text);
  border-bottom: 1px solid var(--chrome-border);
}

.watch-toolbar h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-toolbar .chapter-back {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.attachments-toggle {
  border: 0;
  border-radius: 999px;
  background: var(--grad);
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
  padding: 8px 16px;
}

.attachments-toggle[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--cyan);
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  align-items: start;
  gap: 16px;
}

.watch-layout:not(.attachments-open) {
  grid-template-columns: minmax(0, 1fr);
}

.watch-main {
  min-width: 0;
}

.watch-main video {
  display: block;
  width: 100%;
  max-height: 72vh;
  aspect-ratio: 16/9;
  object-fit: contain;
}

.watch-video-title {
  margin: 12px 0 4px;
  line-height: 1.35;
}

.next-countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.next-countdown[hidden] {
  display: none;
}

.next-countdown span {
  flex: 1;
  min-width: 180px;
  font-weight: 650;
}

.watch-attachments {
  position: sticky;
  top: 132px;
  min-width: 0;
  max-height: calc(100vh - 150px);
  overflow: hidden;
}

.watch-attachments[hidden] {
  display: none;
}

.watch-attachments .lesson-tabs {
  margin-bottom: 12px;
}

.attachment-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.attachment-video {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.attachment-video.playing {
  border-color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 13%, var(--surface));
  box-shadow: inset 3px 0 var(--cyan);
}

.attachment-video-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.attachment-video.playing .attachment-video-title {
  color: var(--cyan);
}

.attachment-video .lesson-play-btn {
  justify-self: start;
}

/* ========================================================
   TELEGRAM MODAL (MATCHING REFERENCE SCREENSHOT)
   ======================================================== */
.telegram-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.telegram-overlay[hidden] {
  display: none;
}

.telegram-dialog {
  position: relative;
  width: min(100%, 460px);
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 38px 30px 32px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

:root[data-theme="light"] .telegram-dialog {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(25, 20, 10, 0.12);
}

.telegram-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

:root[data-theme="light"] .telegram-close {
  background: var(--surface-hover);
  color: var(--text);
}

.telegram-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.telegram-badge {
  display: inline-block;
  color: #06b6d4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.telegram-title {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.telegram-desc {
  margin: 0 auto 26px;
  max-width: 380px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.telegram-join-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s, filter 0.15s;
}

.telegram-join-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ========================================================
   DONATION MODAL
   ======================================================== */
.donate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.donate-overlay[hidden] {
  display: none;
}

.donate-dialog {
  position: relative;
  width: min(100%, 360px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.donate-dialog h2 {
  margin: 0 24px 6px;
}

.donate-dialog p {
  margin: 8px 0 14px;
}

.donate-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
}

.donate-qr {
  display: block;
  width: min(100%, 240px);
  height: auto;
  margin: 14px auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.donate-upi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  text-align: left;
}

.donate-upi small,
.donate-upi b {
  display: block;
}

.donate-upi small {
  margin-bottom: 4px;
  color: var(--muted);
}

.donate-download {
  display: block;
  margin-top: 16px;
}

.ph {
  width: 100%;
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #0e7490, #6d28d9);
}

/* ========================================================
   RESPONSIVE BREAKPOINTS (LAPTOP, TABLET, PHONE)
   ======================================================== */
@media (max-width: 900px) {
  .watch-layout,
  .watch-layout.attachments-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .watch-attachments {
    position: static;
    max-height: none;
  }
  .attachment-list {
    max-height: 48vh;
  }
}

@media (max-width: 860px) {
  .play {
    grid-template-columns: 1fr;
  }
  .grid3 {
    gap: 8px;
  }
  .chapter-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  }
  .continue-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    padding: 70px 0 92px;
  }
  .wrap {
    padding: 0 14px;
  }
  .top {
    gap: 10px;
    padding: 8px 14px;
    min-height: 58px;
  }
  .logo {
    font-size: 17px;
    gap: 8px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .header-actions {
    gap: 6px;
  }
  .header-action {
    width: 35px;
    height: 35px;
    font-size: 15px;
  }
  .catalog {
    padding: 16px;
  }
  .course-search {
    height: 44px;
  }
  .continue-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .continue-item {
    gap: 8px;
    padding: 10px;
  }
  .chapter-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .chapter-toolbar .chapter-back {
    justify-self: start;
  }
  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .chapter-card,
  .chapter-open {
    min-height: 196px;
  }
  .chapter-open {
    padding: 14px 11px;
  }
  .chapter-tabs {
    gap: 6px;
  }
  .chapter-tab {
    padding: 8px 13px;
    font-size: 13px;
  }
  .video-control-row {
    gap: 2px;
  }
  .video-control-btn {
    width: 32px;
    height: 34px;
    padding: 0;
    font-size: 15px;
  }
  #fullscreen-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 32px;
    height: 34px;
    font-size: 18px;
    align-items: center;
    justify-content: center;
  }
  .video-time {
    font-size: 11px;
  }
  .audio-control input:not([hidden]) {
    width: 70px;
  }
  .lesson-browser {
    padding: 12px;
  }
  .lesson-row {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 9px;
    padding: 11px;
  }
  .lesson-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
  .lesson-progress-count {
    width: 100%;
    margin-left: 0;
  }
  .lesson-list {
    max-height: 55vh;
  }
  .watch-toolbar {
    top: 58px;
    gap: 8px;
    margin-right: -14px;
    margin-left: -14px;
    padding: 8px 14px;
  }
  .watch-toolbar h2 {
    font-size: 14px;
  }
  .watch-toolbar .chapter-back,
  .attachments-toggle {
    padding: 7px 10px;
    font-size: 12px;
  }
  .watch-main video {
    max-height: 55vh;
  }
  .watch-attachments {
    padding: 12px;
  }
  .notification-panel {
    position: fixed;
    top: 58px;
    right: 12px;
    width: min(290px, calc(100vw - 24px));
  }
}
