:root {
  color-scheme: dark;
  --navy-950: #06121c;
  --navy-900: #0a1a29;
  --navy-800: #10283b;
  --gold: #f4c542;
  --gold-hover: #ffd45e;
  --text: #f7f9fb;
  --muted: #aebcca;
  --danger: #ff9e9e;
  --border: rgba(255, 255, 255, 0.12);
  --focus: #8bc7ff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--navy-950);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.academy-shell { min-height: 100vh; }
.status-view {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}
.spinner, .button-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
}
.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(40px, 7vw, 104px);
  background: var(--navy-800);
  border-right: 1px solid var(--border);
}
.brand-panel h1 { max-width: 620px; margin: 12px 0 18px; font-size: clamp(42px, 5vw, 72px); line-height: 1.05; }
.brand-panel > p:last-child { max-width: 450px; color: var(--muted); font-size: 18px; }
.brand-kicker, .eyebrow { color: var(--gold); font-size: 13px; font-weight: 800; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(100%, 430px); }
.brand { display: inline-flex; margin-bottom: 44px; }
.brand img { width: 150px; height: 72px; object-fit: contain; object-position: left center; }
.login-heading h2 { margin: 8px 0; font-size: 36px; }
.login-heading > p:last-child { margin: 0 0 32px; color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field label { font-size: 14px; font-weight: 700; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--navy-900);
  color: var(--text);
}
.field input:focus { border-color: var(--focus); }
.form-message { min-height: 24px; margin: 4px 0 12px; color: var(--danger); font-size: 14px; line-height: 1.5; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 6px; font-weight: 800; }
.primary-button { width: 100%; border: 0; background: var(--gold); color: #15202a; }
.primary-button:hover:not(:disabled) { background: var(--gold-hover); }
.button-spinner { display: none; width: 20px; height: 20px; margin: auto; border-color: rgba(0, 0, 0, 0.25); border-top-color: #15202a; }
.primary-button.is-loading .button-label { display: none; }
.primary-button.is-loading .button-spinner { display: block; }
.academy-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--border);
  background: var(--navy-900);
}
.header-brand { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; font-weight: 800; }
.header-brand img { width: 70px; height: 46px; object-fit: contain; }
.secondary-button { padding: 0 18px; border: 1px solid var(--border); background: transparent; color: var(--text); }
.secondary-button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.welcome-content { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0; }
.welcome-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.welcome-heading h1 { margin: 8px 0; font-size: clamp(34px, 5vw, 56px); }
.welcome-heading p, .account-email { margin: 0; color: var(--muted); }
.account-email { padding-bottom: 8px; }
.dashboard-status {
  min-height: 220px;
  margin-top: 48px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.dashboard-status h2 { margin: 0 0 8px; font-size: 22px; }
.dashboard-status p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.6; }
.dashboard-status.error h2 { color: var(--danger); }
.dashboard-status.warning h2 { color: var(--gold); }
.courses-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; margin-top: 48px; }
.course-card { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--navy-900); }
.course-visual { aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; background: var(--navy-800); }
.course-visual img { width: 100%; height: 100%; object-fit: cover; }
.course-visual.has-thumbnail {
  aspect-ratio: auto;
  overflow: visible;
}
.course-visual.has-thumbnail img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
.course-visual img[src="/logo.png"] { width: 42%; height: 58%; object-fit: contain; }
.course-card-body { padding: 24px; }
.course-card h2 { min-height: 58px; margin: 0 0 10px; font-size: 22px; line-height: 1.3; }
.course-card-body > p { min-height: 48px; margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.progress-label strong { color: var(--text); }
.progress-track { height: 7px; overflow: hidden; border-radius: 4px; background: var(--navy-800); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.course-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  padding: 0 18px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}
.course-action:hover { background: var(--gold); color: #15202a; }
.course-view { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.course-sidebar { max-height: calc(100vh - 76px); overflow-y: auto; padding: 28px 20px; border-right: 1px solid var(--border); background: var(--navy-900); }
.back-button, .toggle-sidebar { border: 0; background: transparent; color: var(--gold); font-weight: 800; }
.course-sidebar-heading { padding: 28px 8px 20px; }
.course-sidebar-heading h1 { margin: 8px 0 0; font-size: 22px; line-height: 1.3; }
.modules-list { display: grid; gap: 24px; }
.module-group h2 { margin: 0 8px 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.lesson-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.lesson-item:hover, .lesson-item.is-active { border-left-color: var(--gold); background: rgba(255, 255, 255, 0.06); }
.lesson-marker { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--gold); font-size: 11px; }
.lesson-item small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.lesson-content { min-width: 0; padding: clamp(20px, 4vw, 56px); }
.toggle-sidebar { display: none; margin-bottom: 16px; }
.lesson-viewer { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.lesson-viewer iframe { width: 100%; height: 100%; border: 0; }
.lesson-viewer video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.lesson-viewer.is-image {
  min-height: 0;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: visible;
  background: #050b10;
}
.lesson-viewer.is-image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  display: block;
  object-fit: contain;
}
.viewer-error { height: 100%; display: grid; place-content: center; padding: 24px; color: var(--muted); text-align: center; }
.lesson-details { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-top: 28px; }
.lesson-details h2 { margin: 8px 0 0; font-size: 26px; }
.lesson-navigation { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.complete-button { width: auto; padding: 0 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 800px) {
  .login-view { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 20px; }
  .brand { margin-bottom: 28px; }
  .login-heading h2 { font-size: 32px; }
  .header-brand span { display: none; }
  .welcome-content { padding-top: 48px; }
  .welcome-heading { align-items: start; flex-direction: column; gap: 8px; }
  .account-email { padding-bottom: 0; }
  .course-view { display: block; }
  .course-sidebar { position: fixed; z-index: 10; inset: 76px 0 0 0; max-height: none; transform: translateX(-100%); transition: transform 0.2s ease; }
  .course-sidebar.is-open { transform: translateX(0); }
  .toggle-sidebar { display: inline-flex; }
  .lesson-content { padding: 20px; }
  .lesson-details { align-items: stretch; flex-direction: column; }
  .lesson-navigation { justify-content: stretch; }
  .lesson-navigation button { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .button-spinner { animation-duration: 1.6s; }
}
