* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #555;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.toc-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: #16a085;
  cursor: pointer;
}

.hero-title {
  margin: 0;
  display: flex;
  align-items: center;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: bold;
  line-height: 1.1;
  text-shadow: 1px 1px #fff, -1px 1px #fff, 1px -1px #fff, -1px -1px #fff, 1px 1px 5px #555;
}

.hero-subtitle {
  margin: 12px 0 0;
  color: #7c7c7c;
  font-size: 16px;
  line-height: 1.5;
  max-width: 760px;
}

#tocWindow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
}

#tocWindow.active {
  opacity: 1;
  visibility: visible;
}

.toc-content {
  position: relative;
  width: 90%;
  height: 90%;
  background: white;
  border-radius: 12px;
  padding: 20px;
  overflow: auto;
  box-sizing: border-box;
  transform: translateY(30px);
  transition: transform 0.3s ease;
}

#tocWindow.active .toc-content {
  transform: translateY(0);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 22px;
}

summary {
  list-style: none;
  cursor: pointer;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 22px;
  line-height: 1;
  margin-left: auto;
}

details[open] summary::after {
  content: "−";
}

details {
  margin-bottom: 5px;
  background: #16a085;
  color: #fff;
  border-radius: 8px;
  overflow: hidden;
}

details li::marker {
  color: #777;
}

details:last-child {
  margin-bottom: 0;
}

details>div {
  background: white;
  padding: 15px;
  color: #777;
  box-sizing: border-box;
}

details ol {
  margin: 0;
  padding-left: 1.5rem;
}

details ol li {
  margin-bottom: 0.5rem;
}

details ol li:last-child {
  margin-bottom: 0;
}

details ol a {
  text-decoration: none;
  border-bottom: 1px solid #999;
  padding-bottom: 1px;
  color: inherit;
  transition: color 0.2s, border-color 0.2s;
}

details ol a:hover {
  color: #222;
  border-bottom-color: #222;
}

.catalog {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 24px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 18px;
}

.sidebar-title {
  margin: 0 0 14px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title svg {
  width: 1em;
  height: 1em;
  color: #16a085;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tab {
  transform: rotate(-3deg);
  position: relative;
  width: 100%;
  padding: 16px 20px;
  border: 1px solid #16a085;
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  transition: .25s ease;
}

.tab:nth-child(odd) {
  transform: rotate(-2deg);
  box-shadow: -5px 5px 0 0 #16a085;
}

.tab:nth-child(even) {
  transform: rotate(2deg);
  box-shadow: 5px 5px 0 0 #16a085;
}

.tab.active {
  transform: rotate(0);
  background: #16a085;
  color: #fff;
  box-shadow: 5px 5px 0 0 #0e6f5f;
}

.tab:active {
  transform: translateY(5px) scale(0.97);
  box-shadow: 0 3px 0 #148f77;
}

.content {
  background: #fff;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 18px;

  display: flex;
  flex-direction: column;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 280px;
  align-self: flex-end;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  border: 1px solid #16a085;
  border-radius: 8px;
  background-color: #ffffff;
  color: #7c7c7c;
  outline: none;
  box-shadow: rgb(22, 160, 133) 5px 5px 0px 0px;
  transition: all 0.2s ease;
}

.search-box input::placeholder {
  color: #7c7c7c;
  opacity: 0.7;
}

.search-box input:focus {
  border-color: #16a085;
  box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.2);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #7c7c7c;
  pointer-events: none;
}

#clearSearch {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #7c7c7c;
  cursor: pointer;
  display: none;
}

#clearSearch:hover {
  color: #000;
}

.course {
  animation: fadeIn .25s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.course-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.course-title {
  margin: 0;
  font-size: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.course-title svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: #16a085;
}

.course-desc {
  margin: 10px 0 0;
  color: #7c7c7c;
  line-height: 1.5;
  max-width: 760px;
}

.load-more {
  display: block;
  text-decoration: none;
  text-align: center;
  position: relative;
  width: fit-content;
  margin: 24px auto 0;
  padding: 14px 28px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: white;
  background: #16a085;
  border-radius: 18px;
  box-shadow: 0 8px 0 #0e6b5c;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.load-more[hidden] {
  display: none;
}

.load-more:hover {
  color: white;
  filter: brightness(1.05);
}

.load-more:active {
  transform: translateY(5px) scale(0.97);
  box-shadow: 0 3px 0 #148f77;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.lesson {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #16a085;
  border-radius: 18px;
  padding: 18px;
  min-height: 170px;
  background: #fff;
  box-shadow: 10px 10px 0 0 #16a085;
  transition: transform .25s ease, box-shadow .25s ease;
}

.lesson:hover {
  transform: translate(-4px, -4px);
  box-shadow: 14px 14px 0 0 #16a085;
}

.lesson-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.lesson-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.lesson-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #16a085;
  color: white;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.lesson-desc {
  margin: 0;
  color: #7c7c7c;
  line-height: 1.45;
  flex: 1;
}

.lesson-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #7c7c7c;
  font-size: 14px;
  margin-top: 4px;
}

.lesson-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #16a085;
  font-weight: bold;
}

.lesson-open svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.footer {
  margin-top: 40px;
  padding: 16px 0;
  text-align: center;
  color: #777;
  font-size: 14px;
  border-top: 1px solid #eee;
}

.footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #999;
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}

.footer a:hover {
  color: #222;
  border-bottom-color: #222;
}

code {
  color: #c52600;
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: Consolas, monospace;
}

@media (max-width: 980px) {
  .catalog {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .tab {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 8px;
  }

  .lesson-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 14px;
  }

  .hero,
  .content,
  .sidebar {
    border-radius: 18px;
  }

  .hero {
    padding: 20px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .search-box {
    max-width: none;
  }

  .course-title {
    font-size: 24px;
  }

  .lesson {
    min-height: auto;
  }
}