:root {
  color-scheme: light;
  --bg: oklch(96.8% 0.008 245);
  --panel: oklch(99% 0.006 245);
  --panel-muted: oklch(94.3% 0.012 245);
  --text: oklch(22% 0.025 250);
  --muted: oklch(48% 0.025 250);
  --border: oklch(86% 0.018 245);
  --accent: oklch(54% 0.15 172);
  --accent-soft: oklch(91% 0.052 172);
  --warn: oklch(72% 0.14 78);
  --danger: oklch(58% 0.18 28);
  --shadow: 0 18px 45px oklch(35% 0.04 245 / 14%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
video {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.library,
.viewer {
  min-width: 0;
}

.library {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library__header {
  display: grid;
  gap: 6px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.6rem;
  line-height: 1.15;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.lesson-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.lesson {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease-out, background 180ms ease-out, transform 180ms ease-out;
}

.lesson:hover {
  border-color: oklch(75% 0.035 245);
  background: oklch(97.6% 0.01 245);
}

.lesson:focus-visible {
  outline: 3px solid oklch(78% 0.12 172 / 70%);
  outline-offset: 2px;
}

.lesson[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lesson__inner {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.lesson__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lesson__title {
  font-weight: 700;
  line-height: 1.3;
}

.lesson__duration {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.83rem;
}

.lesson__description {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.progress__track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-muted);
}

.progress__bar {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.progress__label {
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 42px;
  text-align: right;
}

.viewer {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto;
  gap: 16px;
}

.player {
  display: grid;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: oklch(18% 0.016 250);
  box-shadow: var(--shadow);
}

video {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: oklch(16% 0.018 250);
}

.details {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.status {
  flex: 0 0 auto;
  max-width: 38ch;
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}

.status--error {
  background: oklch(93% 0.045 28);
  color: var(--danger);
}

.status--warn {
  background: oklch(93% 0.052 78);
  color: oklch(42% 0.09 70);
}

.skeleton {
  height: 86px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    oklch(93% 0.01 245),
    oklch(97% 0.01 245),
    oklch(93% 0.01 245)
  );
  background-size: 200% 100%;
  animation: shimmer 1.1s ease-out infinite;
}

.skeleton--short {
  height: 66px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

@media (max-width: 880px) {
  .shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .library {
    order: 2;
    padding: 18px;
  }

  .viewer {
    order: 1;
    grid-template-rows: auto auto;
  }

  video {
    min-height: 220px;
    aspect-ratio: 16 / 9;
  }

  .details {
    display: grid;
  }

  .status {
    width: fit-content;
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .shell {
    padding: 0;
  }

  .library,
  .player,
  .details {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.15rem;
  }
}
