: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: auto minmax(260px, 1fr) auto;
  gap: 16px;
}

.market-warning {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  overflow: hidden;
  border: 1px solid oklch(70% 0.17 47);
  border-radius: 8px;
  padding: 18px;
  background:
    radial-gradient(circle at 0 0, oklch(88% 0.16 58 / 46%), transparent 34%),
    linear-gradient(135deg, oklch(99% 0.035 78), oklch(93% 0.075 55));
  color: oklch(24% 0.07 48);
  box-shadow:
    0 18px 45px oklch(42% 0.08 48 / 18%),
    inset 0 1px 0 oklch(100% 0.01 80 / 70%);
}

.market-warning::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  box-shadow: inset 0 0 0 1px oklch(100% 0.02 80 / 52%);
}

.market-warning__mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid oklch(59% 0.2 42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, oklch(82% 0.18 58), oklch(70% 0.19 45));
  box-shadow:
    0 8px 18px oklch(42% 0.1 44 / 22%),
    inset 0 1px 0 oklch(100% 0.02 75 / 64%);
  font-size: 1.42rem;
  line-height: 1;
}

.market-warning__body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.market-warning__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-warning__label,
.market-warning__title,
.market-warning__text {
  margin: 0;
}

.market-warning__label {
  color: oklch(34% 0.1 46);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.market-warning__badge {
  flex: 0 0 auto;
  border: 1px solid oklch(66% 0.16 42);
  border-radius: 999px;
  padding: 5px 9px;
  background: oklch(32% 0.11 42);
  color: oklch(98% 0.03 78);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.market-warning__title {
  max-width: 38rem;
  color: oklch(19% 0.07 44);
  font-size: 1.22rem;
  line-height: 1.22;
}

.market-warning__text {
  max-width: 70ch;
  color: oklch(30% 0.055 47);
  font-size: 0.98rem;
  line-height: 1.58;
}

.market-warning__risks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.market-warning__risks li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  border: 1px solid oklch(77% 0.11 56);
  border-radius: 8px;
  padding: 9px 10px;
  background: oklch(99% 0.024 78 / 76%);
  color: oklch(28% 0.06 46);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.32;
}

.market-warning__risks span {
  flex: 0 0 auto;
  line-height: 1.2;
}

.market-warning__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  gap: 8px;
  min-height: 38px;
  border: 1px solid oklch(58% 0.18 42);
  border-radius: 999px;
  padding: 8px 13px;
  background: oklch(26% 0.105 42);
  color: oklch(98% 0.025 78);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.1;
  box-shadow:
    0 10px 22px oklch(42% 0.1 42 / 18%),
    inset 0 1px 0 oklch(100% 0.02 78 / 36%);
  transition: transform 180ms ease-out, background 180ms ease-out, box-shadow 180ms ease-out;
}

.market-warning__button:hover {
  background: oklch(31% 0.12 42);
  transform: translateY(-1px);
}

.market-warning__button:focus-visible {
  outline: 3px solid oklch(72% 0.16 58 / 72%);
  outline-offset: 2px;
}

.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);
}

.feedback-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: min(880px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid oklch(77% 0.03 245);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 90px oklch(20% 0.05 245 / 36%);
}

.feedback-modal::backdrop {
  background: oklch(17% 0.025 250 / 64%);
}

.feedback-modal__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: inherit;
}

.feedback-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  background: oklch(98% 0.008 245);
}

.feedback-modal__label,
.feedback-modal__header h2 {
  margin: 0;
}

.feedback-modal__label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.feedback-modal__header h2 {
  margin-top: 6px;
  font-size: 1.18rem;
  line-height: 1.2;
}

.feedback-modal__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  transition: border-color 180ms ease-out, color 180ms ease-out, background 180ms ease-out;
}

.feedback-modal__close:hover {
  border-color: oklch(74% 0.035 245);
  background: var(--panel-muted);
  color: var(--text);
}

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

.feedback-modal__image-wrap {
  overflow: auto;
  padding: 16px;
  background: oklch(94.8% 0.01 245);
}

.feedback-modal__image-wrap img {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px oklch(35% 0.04 245 / 14%);
}

.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 auto;
  }

  .market-warning__risks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .market-warning__risks li {
    flex: 1 1 210px;
    padding: 7px 9px;
    font-size: 0.76rem;
  }

  .market-warning__button {
    width: 100%;
  }

  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,
  .market-warning,
  .player,
  .details {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .market-warning {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .market-warning__mark {
    width: 38px;
    height: 38px;
    font-size: 1.08rem;
  }

  .market-warning__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .market-warning__body {
    gap: 7px;
  }

  .market-warning__label,
  .market-warning__badge {
    font-size: 0.66rem;
  }

  .market-warning__title {
    font-size: 1rem;
    line-height: 1.22;
  }

  .market-warning__text {
    font-size: 0.88rem;
    line-height: 1.46;
  }

  .market-warning__risks {
    margin-top: 3px;
  }

  .market-warning__risks li {
    flex-basis: 100%;
  }

  .feedback-modal {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .feedback-modal__header {
    padding: 14px;
  }

  .feedback-modal__header h2 {
    font-size: 1rem;
  }

  .feedback-modal__image-wrap {
    padding: 10px;
  }
}
