:root {
  --ink: #171719;
  --muted: #6f7177;
  --line: #e4e4e7;
  --paper: #ffffff;
  --canvas: #f5f5f3;
  --black: #101012;
  --black-2: #1a1a1d;
  --red: #e23228;
  --red-dark: #b71f18;
  --gold: #e2ad50;
  --green: #2b9a62;
  --shadow: 0 12px 35px rgba(15, 15, 20, .11);
  --radius: 8px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 64px);
  color: white;
  background: rgba(16, 16, 18, .97);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 0;
  color: white;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
.brand strong { display: block; font-size: 16px; letter-spacing: .14em; line-height: 1; }
.brand small { display: block; margin-top: 6px; color: #aaaab0; font-size: 8px; letter-spacing: .21em; }
.brand-mark {
  display: block; width: 29px; height: 43px;
  background-color: var(--red);
  -webkit-mask-image: url('/brand/explorer.png'); mask-image: url('/brand/explorer.png');
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}

.topnav { display: flex; align-items: stretch; align-self: stretch; gap: 6px; }
.account-name { align-self: center; color: #aaaab0; font-size: 12px; padding-left: 8px; }
@media (max-width: 700px) { .account-name { display: none; } #logout-button { padding-inline: 7px; } }
.nav-link, .icon-button {
  position: relative;
  padding: 0 17px;
  border: 0;
  color: #c9c9cd;
  background: transparent;
  cursor: pointer;
}
.nav-link:hover, .icon-button:hover { color: white; }
.nav-link.active::after {
  content: "";
  position: absolute;
  inset: auto 17px 0;
  height: 3px;
  background: var(--red);
}
.icon-button { width: 48px; padding: 0 13px; }
.icon-button svg, .search-box svg { fill: none; stroke: currentColor; stroke-width: 2; }

.search-panel {
  position: fixed;
  z-index: 80;
  inset: 76px 0 auto;
  padding: 30px max(20px, calc((100vw - 1120px) / 2));
  color: white;
  background: rgba(22,22,25,.985);
  box-shadow: 0 20px 55px rgba(0,0,0,.28);
}
.search-panel > label { display: block; margin-bottom: 12px; color: #aaaab0; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.search-box { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 12px; padding: 0 16px; background: #2a2a2e; border: 1px solid #444448; border-radius: 7px; }
.search-box svg { width: 21px; }
.search-box input { height: 50px; min-width: 0; border: 0; outline: 0; color: white; background: transparent; font-size: 17px; }
kbd { padding: 4px 7px; border: 1px solid #55555b; border-radius: 4px; color: #aaaab0; background: #1c1c1f; font-size: 11px; }
.search-results { display: grid; gap: 5px; max-height: 55vh; margin-top: 14px; overflow: auto; }
.search-hit { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 13px 16px; border: 0; border-radius: 5px; color: white; background: transparent; cursor: pointer; text-align: left; }
.search-hit:hover { background: #303034; }
.search-hit small { color: #aaaab0; }

.loading-state { min-height: calc(100vh - 76px); display: grid; place-content: center; justify-items: center; color: var(--muted); }
.pick-loader { width: 36px; height: 42px; background: var(--red); clip-path: polygon(50% 0, 100% 22%, 86% 75%, 50% 100%, 14% 75%, 0 22%); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(.78) rotate(10deg); opacity: .55; } }

.library-hero {
  position: relative;
  overflow: hidden;
  min-height: 274px;
  display: grid;
  align-items: end;
  color: white;
  background: radial-gradient(circle at 77% 22%, rgba(226,50,40,.23), transparent 31%), linear-gradient(125deg, #111114 0%, #242428 58%, #101011 100%);
}
.library-hero::after { content: ""; position: absolute; width: 460px; height: 460px; right: 7%; top: -240px; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; box-shadow: 0 0 0 65px rgba(255,255,255,.018), 0 0 0 130px rgba(255,255,255,.018); }
.hero-inner, .library-body, .course-inner { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.hero-inner { position: relative; z-index: 1; padding: 56px 0 44px; }
.eyebrow { margin: 0 0 10px; color: #d5a148; font-size: 12px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.hero-inner h1 { max-width: 760px; margin: 0; font-size: clamp(38px, 6vw, 66px); line-height: .98; letter-spacing: -.045em; }
.hero-inner p { margin: 18px 0 0; color: #c4c4c8; font-size: 16px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 29px; }
.hero-stat { display: flex; align-items: baseline; gap: 7px; }
.hero-stat b { font-size: 22px; }
.hero-stat span { color: #a5a5aa; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.library-body { padding-block: 42px 70px; }
.library-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.library-toolbar h2 { margin: 0; font-size: 24px; }
.library-toolbar p { margin: 7px 0 0; color: var(--muted); }
.filter-row { display: flex; gap: 8px; }
.filter-button { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; font-size: 13px; font-weight: 650; }
.filter-button.active { border-color: var(--ink); color: white; background: var(--ink); }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 28px; }
.course-card { overflow: hidden; display: flex; flex-direction: column; min-width: 0; border: 1px solid #dfdfe1; border-radius: var(--radius); background: var(--paper); box-shadow: 0 2px 0 rgba(20,20,25,.02); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.course-cover { position: relative; aspect-ratio: 16/9; overflow: hidden; color: white; background: linear-gradient(135deg, var(--cover-a,#242428), var(--cover-b,#b5251e)); }
.course-cover img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.course-card:hover .course-cover img { transform: scale(1.035); }
.course-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 25%, rgba(7,7,8,.76)); }
.cover-fallback { position: absolute; inset: 0; display: grid; place-content: center; font-size: 52px; font-weight: 900; letter-spacing: -.06em; opacity: .85; }
.course-chip { position: absolute; z-index: 2; top: 14px; left: 14px; padding: 6px 9px; border-radius: 3px; color: white; background: rgba(12,12,14,.78); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.course-number { position: absolute; z-index: 2; right: 15px; bottom: 13px; color: white; font-size: 12px; font-weight: 700; }
.course-copy { display: flex; flex: 1; flex-direction: column; padding: 20px 20px 18px; }
.course-copy h3 { margin: 0; font-size: 17px; line-height: 1.34; }
.course-meta { display: flex; gap: 12px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.progress-track { height: 4px; margin-top: auto; transform: translateY(18px); background: #ededee; }
.progress-fill { height: 100%; background: var(--red); }
.progress-label { margin-top: 28px; color: var(--muted); font-size: 11px; }

.course-hero { color: white; background: linear-gradient(115deg,#111114,#2b2525 68%,#671d18); }
.course-inner { display: grid; grid-template-columns: minmax(0,1fr) 430px; gap: 60px; align-items: center; padding-block: 58px; }
.crumb { display: inline-flex; gap: 7px; align-items: center; border: 0; padding: 0; color: #d7d7da; background: none; cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.crumb:hover { color: white; }
.course-hero h1 { margin: 24px 0 16px; max-width: 720px; font-size: clamp(34px,4vw,55px); line-height: 1.04; letter-spacing: -.035em; }
.course-hero p { max-width: 650px; color: #c7c7ca; line-height: 1.65; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; margin-top: 20px; padding: 0 20px; border: 0; border-radius: 4px; color: white; background: var(--red); cursor: pointer; font-weight: 750; }
.primary-button:hover { background: var(--red-dark); }
.course-poster { position: relative; overflow: hidden; aspect-ratio: 16/9; border-radius: 7px; background: #252529; box-shadow: 0 26px 70px rgba(0,0,0,.38); }
.course-poster img { width: 100%; height: 100%; object-fit: cover; }
.course-poster::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.13); border-radius: inherit; }
.play-glyph { position: absolute; inset: 50% auto auto 50%; z-index: 2; width: 58px; height: 58px; transform: translate(-50%,-50%); border-radius: 50%; background: rgba(226,50,40,.95); box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.play-glyph::after { content: ""; position: absolute; left: 23px; top: 18px; border-left: 17px solid white; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }

.curriculum-wrap { width: min(950px, calc(100% - 40px)); margin: 44px auto 80px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; padding: 22px 2px 13px; border-bottom: 2px solid var(--ink); }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 12px; }
.lesson-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 13px; min-height: 66px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: white; cursor: pointer; }
.lesson-row:hover { background: #faf9f7; }
.lesson-index { color: #929399; font-size: 12px; font-variant-numeric: tabular-nums; }
.lesson-row h3 { margin: 0; font-size: 14px; font-weight: 650; }
.lesson-row small { display: block; margin-top: 5px; color: var(--muted); }
.lesson-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: #85858b; }
.lesson-icon svg { width: 13px; fill: currentColor; }
.lesson-row.completed .lesson-icon { border-color: #bfe0cf; color: white; background: var(--green); }
.lesson-row.unavailable { opacity: .62; }

.lesson-shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 340px minmax(0,1fr); background: #efefed; }
.lesson-sidebar { position: sticky; top: 76px; height: calc(100vh - 76px); overflow: auto; color: #efeff1; background: #1b1b1e; border-right: 1px solid #343438; }
.sidebar-head { position: sticky; top: 0; z-index: 2; padding: 22px 20px 17px; background: #18181b; border-bottom: 1px solid #333337; }
.sidebar-head button { padding: 0; border: 0; color: #b9b9be; background: none; cursor: pointer; font-size: 12px; }
.sidebar-head h2 { margin: 13px 0 0; font-size: 15px; line-height: 1.35; }
.side-section h3 { margin: 0; padding: 17px 18px 11px; color: #8f8f95; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.side-lesson { width: 100%; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 10px; align-items: start; padding: 11px 17px; border: 0; color: #cacacf; background: none; cursor: pointer; text-align: left; }
.side-lesson:hover { color: white; background: #242428; }
.side-lesson.active { color: white; background: #303034; box-shadow: inset 3px 0 var(--red); }
.side-lesson .dot { width: 18px; height: 18px; display: grid; place-items: center; margin-top: 1px; border: 1px solid #5c5c62; border-radius: 50%; font-size: 9px; }
.side-lesson.done .dot { border-color: var(--green); background: var(--green); }
.side-lesson span:last-child { font-size: 12px; line-height: 1.45; }

.lesson-main { min-width: 0; }
.player-stage { padding: 34px clamp(20px,4vw,60px); background: #101012; }
.player-frame { max-width: 1120px; margin-inline: auto; }
.video-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.video-tab { padding: 7px 11px; border: 1px solid #36363a; border-radius: 4px 4px 0 0; color: #bdbdc2; background: #1a1a1d; cursor: pointer; font-size: 11px; }
.video-tab.active { color: white; border-color: var(--red); background: var(--red); }
.video-wrap { position: relative; aspect-ratio: 16/9; display: grid; place-items: center; overflow: hidden; background: black; box-shadow: 0 20px 65px rgba(0,0,0,.33); }
.video-wrap video { width: 100%; height: 100%; background: black; }
.empty-player { padding: 50px; color: #a7a7ac; text-align: center; }
.empty-player strong { display: block; margin-bottom: 8px; color: white; font-size: 20px; }
.lesson-content { max-width: 1120px; margin-inline: auto; padding: 35px clamp(20px,4vw,60px) 90px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 33px; }
.quiet-button { min-height: 40px; padding: 0 15px; border: 1px solid #d4d4d7; border-radius: 4px; background: white; cursor: pointer; font-size: 12px; font-weight: 700; }
.quiet-button:hover { border-color: #99999e; }
.quiet-button:disabled { opacity: .4; cursor: default; }
.lesson-title-row { display: flex; justify-content: space-between; gap: 30px; align-items: start; }
.lesson-title-row h1 { margin: 0; font-size: clamp(27px,4vw,42px); line-height: 1.08; letter-spacing: -.03em; }
.lesson-kicker { margin: 0 0 9px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.complete-button { white-space: nowrap; min-height: 42px; padding: 0 16px; border: 1px solid #cfd0d3; border-radius: 4px; background: white; cursor: pointer; font-size: 12px; font-weight: 700; }
.complete-button.done { border-color: #b4dcca; color: #177a4c; background: #ebf8f1; }
.lesson-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.fact { padding: 6px 9px; border-radius: 3px; color: #5d5e64; background: #e6e6e4; font-size: 11px; }
.pdf-section { margin-top: 40px; }
.pdf-section h2 { margin: 0 0 15px; font-size: 18px; }
.pdf-stack { display: grid; gap: 18px; }
.pdf-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 2px 0 rgba(20,20,25,.02); }
.pdf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #faf9f7; }
.pdf-card-head span { display: flex; min-width: 0; align-items: baseline; gap: 9px; }
.pdf-card-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.pdf-card-head small { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.pdf-card-head a { flex-shrink: 0; color: var(--red); font-size: 12px; font-weight: 700; text-decoration: none; }
.pdf-card-head a:hover { text-decoration: underline; }
.pdf-frame { display: block; width: 100%; height: clamp(480px, 80vh, 900px); border: 0; background: #525659; }
.attachments { margin-top: 40px; }
.attachments h2 { margin: 0 0 15px; font-size: 18px; }
.attachment-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.attachment-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 13px; align-items: center; min-height: 74px; padding: 11px 13px; border: 1px solid #dcdcdf; border-radius: 6px; background: white; text-decoration: none; }
.attachment-card:hover { border-color: #b5b5ba; box-shadow: 0 5px 17px rgba(20,20,25,.06); }
.file-icon { width: 42px; height: 48px; display: grid; place-items: center; border-radius: 4px; color: white; background: #48484e; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.file-icon.pdf { background: #d83c32; }
.file-icon.audio { background: #397abf; }
.file-icon.archive { background: #8d5ab7; }
.attachment-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.attachment-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.download-arrow { color: #87878d; font-size: 20px; }
.audio-stack { margin-top: 22px; display: grid; gap: 10px; }
.audio-player { display: grid; grid-template-columns: minmax(140px,1fr) minmax(240px,2fr); gap: 15px; align-items: center; padding: 14px; border-radius: 6px; background: white; border: 1px solid var(--line); }
.audio-player strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-player audio { width: 100%; height: 36px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 5px; color: white; background: #202024; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.empty-state { padding: 70px 20px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .course-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .course-inner { grid-template-columns: 1fr; }
  .course-poster { max-width: 620px; }
  .lesson-shell { grid-template-columns: 280px minmax(0,1fr); }
}
@media (max-width: 720px) {
  .topbar { height: 64px; padding-inline: 15px; }
  .brand small { display: none; }
  .brand strong { font-size: 13px; }
  .brand-mark { width: 24px; height: 35px; }
  .topnav .nav-link { display: none; }
  .search-panel { top: 64px; }
  .course-grid { grid-template-columns: 1fr; }
  .library-toolbar { align-items: start; flex-direction: column; }
  .course-inner { padding-block: 36px; }
  .lesson-shell { display: block; }
  .lesson-sidebar { position: static; height: auto; max-height: 42vh; }
  .player-stage { padding: 16px 0 0; }
  .video-tabs { padding-inline: 14px; }
  .lesson-content { padding-top: 25px; }
  .lesson-title-row { flex-direction: column; }
  .attachment-grid { grid-template-columns: 1fr; }
  .audio-player { grid-template-columns: 1fr; }
  .pdf-frame { height: 70vh; }
}
