:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --panel: #111216;
  --border: rgba(255, 255, 255, 0.08);
  --text: #ededed;
  --muted: #a9abb3;
  --accent: #4c7dff;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  height: 100vh;
  padding: 24px;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  min-height: 0;
  overflow-y: auto;
  padding-top: 16px;
  padding-right: 6px;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.lesson-list {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lesson-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-group__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.lesson-card {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.lesson-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lesson-card.active {
  border-color: var(--accent);
  background: rgba(76, 125, 255, 0.12);
}

.lesson-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lesson-meta__label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.lesson-meta h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.lesson-card.active .lesson-meta h3 {
  font-weight: 600;
}

.main {
  overflow: hidden;
}

.mobile-bar {
  display: none;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.menu-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  color: var(--text);
}

.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}

.menu-btn:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.player {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.player-sticky {
  position: sticky;
  top: 24px;
}

.player__content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.video-shell {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

.video-shell__actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0b0d;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-embed.loaded iframe {
  opacity: 1;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(11, 11, 13, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-embed.fallback .video-fallback {
  opacity: 1;
  pointer-events: auto;
}

.button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.button:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.player__controls {
  display: flex;
  justify-content: space-between;
}

@media (max-width: 900px) {
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 16px;
  }

  .main {
    order: 1;
  }

  .sidebar {
    height: auto;
    overflow: visible;
    padding-top: 12px;
    padding-right: 0;
    display: none;
    order: 2;
    border-radius: 10px;
    margin-top: 12px;
  }

  body.drawer-open .sidebar {
    display: block;
  }

  .mobile-bar {
    display: flex;
  }

  .player {
    padding: 16px;
    border-radius: 10px;
  }

  .player-sticky {
    position: static;
    top: auto;
  }

  .video-shell {
    padding: 12px;
    border-radius: 10px;
  }

  .video-shell__actions {
    top: 12px;
    right: 12px;
  }

  .video-embed {
    border-radius: 10px;
  }

  .lesson-list {
    padding: 0 16px 16px;
    max-height: none;
  }

  .lesson-card {
    border-radius: 8px;
  }
}

@media (max-width: 600px) {
  .player__controls {
    flex-direction: column;
    gap: 12px;
  }
}
