/* =========================================================
   DESKTOP MENU (line + dropdown)
========================================================= */

.menu {
  position: relative;
}

#desktopMenu {
  height: 100vh;
}

#mobileMain {
  display: none;
}

/* Горизонтальная линия */
#desktopMenu .menu-bar {
  position: absolute;
  top: 35%;
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
}

/* Зоны */
#desktopMenu .menu-item {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

/* Текст над линией */
#desktopMenu .menu-item > span,
#desktopMenu .menu-item > a {
  position: relative;
  top: -18px;
  max-width: 150px;
  width: 100%;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
  color: #ffffff;
  text-decoration: none;
}

/* Dropdown */
#desktopMenu .dropdown {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

#desktopMenu .menu-item:hover .dropdown {
  display: flex;
}

/* Lessons (общие) */
.lesson {
  border-radius: 6px;
  font-size: 14px;
}

#desktopMenu .lesson {
  padding: 8px 10px;
}

.lesson.free {
  color: #ffffff;
  text-decoration: none;
}

.lesson.free:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lesson.paid {
  color: #aaaaaa;
  cursor: help;
  position: relative;
}

/* Tooltip */
.lesson.paid::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.lesson.paid:hover::after {
  opacity: 1;
}

/* Hover линия */
#desktopMenu .menu-item::before {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 6px;
  background-color: #ffffff;
  transition: width 0.25s ease;
}

#desktopMenu .menu-item:hover::before {
  width: 100%;
}

/* =========================================================
   TABLET (769px – 1024px)
========================================================= */

@media (min-width: 769px) and (max-width: 1024px) {
  .menu {
    height: 100vh;
  }

  #desktopMenu .menu-bar {
    top: 40%;
    height: 8px;
  }

  #desktopMenu .menu-item > span,
  #desktopMenu .menu-item > a {
    top: -22px;
    max-width: 180px;
    font-size: 20px;
  }

  #desktopMenu .dropdown {
    top: 32px;
    min-width: 220px;
    padding: 12px;
  }

  #desktopMenu .lesson.free,
  #desktopMenu .lesson.paid {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  #desktopMenu .lesson.free:hover,
  #desktopMenu .lesson.free:active {
    background: rgba(255, 255, 255, 0.2);
  }

  #desktopMenu .lesson.paid:hover,
  #desktopMenu .lesson.paid:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .lesson {
    font-size: 16px;
    padding: 10px 12px;
  }

  .lesson.paid::after {
    font-size: 13px;
  }
}

@media (min-width: 769px) {
  #mobileMain {
    display: none;
  }
}

/* =========================================================
   MOBILE MAIN (index.html)
========================================================= */

@media (max-width: 768px) {
  #desktopMenu {
    display: none;
  }

  #mobileMain {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(12px, 4vh, 24px);
    padding: 96px 16px 32px;
    min-height: calc(100vh - 120px);
  }

  #mobileMain .mobile-subject {
    width: 100%;
    max-width: 420px;
    padding: clamp(14px, 3vh, 20px);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    text-align: center;
    font-size: clamp(18px, 4vw, 22px);
    text-decoration: none;
    transition: transform 0.12s ease;
  }

  #mobileMain .mobile-subject:active {
    transform: scale(0.98);
  }

  /* =========================================================
     MOBILE SUBJECT PAGE (mobile-subject.html)
  ========================================================= */

  main.mobile-subject {
    position: relative;
    min-height: 100vh;
    padding-top: calc(var(--header-height) + 24px);
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 40px;
  }

  .mobile-back {
    top: 8px;
    left: 16px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(16px, 4.2vw, 20px);
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
  }

  .mobile-title {
    text-align: center;
    color: #fff;
    margin: clamp(18px, 4vh, 40px) 0 clamp(14px, 3vh, 24px);
    font-size: clamp(20px, 5vw, 28px);
  }

  .mobile-lessons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(10px, 2.5vh, 16px);
  }

  .mobile-lessons .lesson {
    width: min(520px, 92vw);
    font-size: clamp(14px, 3.6vw, 16px);
    padding: clamp(10px, 2.5vh, 14px) clamp(12px, 3vw, 16px);
  }

  .lesson.paid.disabled {
    opacity: 0.55;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* =========================================================
   MOBILE HELP PAGE LAYOUT (mobile-help.html)
   Держим СНАРУЖИ media, чтобы стиль не терялся
========================================================= */

.mobile-subject-page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 88px 16px 40px;
  box-sizing: border-box;
}

.mobile-subject-page h1 {
  margin: 0 0 20px;
  text-align: center;
  font-size: 28px;
  color: #ffffff;
}

.mobile-help-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.mobile-help-list .lesson {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #1f1f1f !important;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, color 0.15s ease;
}

.mobile-help-list .lesson:link,
.mobile-help-list .lesson:visited,
.mobile-help-list .lesson:hover,
.mobile-help-list .lesson:active {
  color: #1f1f1f !important;
  text-decoration: none;
}

.mobile-help-list .lesson:active {
  transform: scale(0.97);
}

body[data-theme="dark"] .mobile-help-list .lesson {
  background: rgba(42, 42, 42, 0.96);
  color: #f5f5f5 !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .mobile-help-list .lesson:link,
body[data-theme="dark"] .mobile-help-list .lesson:visited,
body[data-theme="dark"] .mobile-help-list .lesson:hover,
body[data-theme="dark"] .mobile-help-list .lesson:active {
  color: #f5f5f5 !important;
}