:root {
  --bg: #FBF8F3; --card: #FFFFFF; --ink: #2A1204; --soft: #6B6259; --line: #ECE8E0;
  --orange: #E8590C; --orange-soft: #FDE6D8; --done: #2F7D4F;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: 'Outfit', -apple-system, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; line-height: 1.45; }
button, select, textarea, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.login { max-width: 340px; margin: 18vh auto 0; padding: 0 16px; display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 34px; }
.login p { margin: 0; color: var(--soft); }
.login input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 11px 14px; }
.err { color: #B3261E; min-height: 22px; font-size: 14px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 59px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 20px; white-space: nowrap; }
.tabs { display: flex; gap: 8px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 16px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.tab.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; }

.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.side { border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; height: calc(100vh - 59px); position: sticky; top: 59px; background: var(--bg); }
.progress-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.by { font-weight: 600; margin-bottom: 6px; }
.progress-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--soft); margin-bottom: 8px; }
.progress-line span:last-child { color: var(--ink); font-weight: 600; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--orange); border-radius: 99px; transition: width .25s; }

.sec-title { font-size: 13px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; margin: 18px 6px 6px; display: flex; justify-content: space-between; gap: 8px; }
.sec-title span:last-child { white-space: nowrap; }
.lesson { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 9px 8px; cursor: pointer; }
.lesson:hover { background: var(--line); }
.lesson.on { background: var(--orange-soft); }
.tick { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #C9C5BC; margin-top: 1px; display: grid; place-items: center; font-size: 12px; line-height: 1; color: #fff; }
.lesson.done .tick { background: var(--done); border-color: var(--done); }
.lesson.done .tick::after { content: '✓'; }
.l-text { min-width: 0; flex: 1; }
.l-title { font-weight: 500; overflow-wrap: anywhere; }
.l-meta { font-size: 13px; color: var(--soft); }

.main { padding: 20px 28px 60px; max-width: 1100px; width: 100%; min-width: 0; }
.player-wrap { background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; }
video { width: 100%; height: 100%; display: block; background: #000; }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.lh-text { min-width: 0; }
.crumb { font-size: 14px; color: var(--soft); }
.main h1 { font-size: 26px; line-height: 1.2; margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.speed { font-size: 14px; color: var(--soft); display: flex; align-items: center; gap: 6px; }
.speed select { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 8px; color: var(--ink); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: #C9C5BC; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { margin-top: 22px; font-size: 14px; padding: 6px 12px; color: var(--soft); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary.is-done { background: var(--card); color: var(--done); border-color: var(--done); }
.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }

.notes, .resources { margin-top: 26px; }
.notes-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.saved { font-size: 13px; color: var(--soft); }
textarea { width: 100%; min-height: 180px; resize: vertical; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; line-height: 1.5; }
textarea:focus, select:focus, input:focus, .btn:focus-visible, .lesson:focus-visible, .tab:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.res { display: block; margin-top: 8px; padding: 10px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.res:hover { border-color: var(--orange); }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: block; }
  .brand { display: none; }
  .top { padding: 0 16px; gap: 10px; }
  .tabs { margin-left: 0; }
  .side { display: none; position: fixed; inset: 59px 0 0 0; height: auto; z-index: 15; border-right: 0; }
  .side.open { display: block; }
  .main { padding: 14px 16px 50px; }
  .player-wrap { border-radius: 12px; }
  .main h1 { font-size: 21px; }
}
