:root {
  --bg: #f4f3fb;
  --surface: #ffffff;
  --surface-alt: #f8f7fd;
  --surface-dark: #211d48;
  --border: #ddd9f3;
  --text: #221f44;
  --muted: #6b6787;
  --brand: #534ab7;
  --brand-soft: #eeedfe;
  --success: #3b6d11;
  --success-bg: #eaf3de;
  --warn: #8a5a0a;
  --warn-bg: #faeeda;
  --danger: #922d2d;
  --danger-bg: #fdeaea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(42, 34, 91, 0.08);
  --font: "Segoe UI", "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(180deg, #f7f5ff 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: var(--brand);
  text-decoration: none;
}

h1, h2, h3, p {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-dark {
  background: rgba(33, 29, 72, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.topbar-dark,
.topbar-dark a,
.topbar-dark .topbar-user {
  color: #f3f1ff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  font-size: 14px;
  color: var(--muted);
}

.page-shell,
.admin-main {
  padding: 28px;
}

.page-shell.narrow {
  max-width: 720px;
  margin: 0 auto;
}

.hero-card,
.table-card,
.course-card,
.empty-card,
.auth-card,
.stat-card,
.video-panel,
.lesson-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero-card.dark {
  background: linear-gradient(135deg, #2c256a 0%, #534ab7 100%);
  color: #fff;
}

.hero-card.dark .eyebrow,
.hero-card.dark p {
  color: rgba(255, 255, 255, 0.82);
}

.hero-stat {
  text-align: right;
}

.hero-stat strong {
  display: block;
  font-size: 44px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.section-block {
  margin-top: 24px;
}

.section-header {
  margin-bottom: 16px;
}

.section-header h1,
.section-header h2 {
  margin-bottom: 6px;
}

.section-header p,
.muted,
small {
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.course-card,
.empty-card {
  padding: 20px;
}

.course-card-top,
.course-card-actions,
.table-card-header,
.table-row,
.curriculum-row,
.lesson-header,
.player-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.course-card h3,
.empty-card h3 {
  margin: 12px 0 8px;
}

.progress-bar {
  height: 8px;
  margin: 16px 0;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #7f77dd 100%);
}

.button {
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.button-secondary {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge-info {
  background: var(--brand-soft);
  color: var(--brand);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warn-bg);
  color: var(--warn);
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  border-color: #d1e8b7;
  color: var(--success);
}

.flash-error {
  background: var(--danger-bg);
  border-color: #efc3c3;
  color: var(--danger);
}

.support-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf4 0%, #fff7dd 100%);
  box-shadow: var(--shadow);
}

.support-banner p,
.support-banner strong {
  display: block;
}

.support-banner p {
  margin-top: 6px;
  color: var(--muted);
}

.support-banner-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.support-banner-compact {
  margin-top: 0;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.support-banner-inline {
  margin: 0;
}

.support-banner-footnote {
  margin-top: 16px;
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffaf0;
  box-shadow: none;
}

.support-banner-footnote strong {
  font-size: 13px;
}

.support-banner-footnote p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.support-banner-footnote .support-banner-actions .button,
.support-banner-footnote .support-banner-actions .button-secondary {
  padding: 7px 12px;
  font-size: 12px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 28px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 32px;
}

.auth-card-wide {
  width: min(560px, 100%);
}

.login-shell {
  padding: 48px 24px;
}

.login-page {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 430px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: #ffffff;
  box-shadow: 0 28px 60px rgba(33, 27, 78, 0.12);
}

.login-copy {
  display: grid;
  gap: 28px;
  padding: clamp(36px, 5vw, 64px);
  background:
    radial-gradient(circle at top left, rgba(127, 119, 221, 0.24), transparent 36%),
    linear-gradient(160deg, #2b235f 0%, #241d53 52%, #1e1948 100%);
  color: #f7f5ff;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 17px;
  letter-spacing: 0.06em;
  box-shadow: 0 16px 30px rgba(12, 10, 33, 0.25);
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.login-brand span {
  color: rgba(238, 235, 255, 0.78);
  font-size: 14px;
}

.login-copy-body {
  max-width: 620px;
}

.login-copy-body h1 {
  margin: 10px 0 14px;
  font-size: clamp(42px, 5vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.login-copy-body p {
  max-width: 56ch;
  font-size: 19px;
  line-height: 1.68;
  color: rgba(238, 235, 255, 0.84);
}

.login-step-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-step-list li {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
}

.login-step-list strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
  color: #ffffff;
}

.login-step-list p {
  margin: 0;
  color: rgba(238, 235, 255, 0.78);
  line-height: 1.6;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: clamp(28px, 4vw, 44px);
  background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
}

.login-card-header h2 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.login-card-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-migration-note {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid #ddd9f3;
  border-radius: 20px;
  background: linear-gradient(135deg, #f7f4ff 0%, #f1edff 100%);
}

.login-migration-note strong {
  font-size: 16px;
}

.login-migration-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-migration-note .button {
  justify-self: start;
}

.login-form {
  gap: 18px;
}

.login-form .field span {
  font-size: 14px;
  font-weight: 700;
}

.login-form .field input {
  padding: 16px 18px;
  border-radius: 16px;
  font-size: 17px;
}

.login-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(221, 217, 243, 0.95);
}

.login-footer-links a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.login-footer-links a:hover {
  text-decoration: underline;
}

.access-shell {
  padding: 48px 24px;
}

.access-card {
  width: min(1080px, 100%);
  padding: 0;
  overflow: hidden;
  background: #ffffff;
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin: 14px 0 8px;
}

.auth-links {
  margin-top: 18px;
}

.auth-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
}

.auth-links-row a {
  font-weight: 700;
}

.auth-callout {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-alt);
}

.auth-callout strong,
.auth-callout p {
  display: block;
}

.auth-callout p {
  margin: 6px 0 14px;
  color: var(--muted);
}

.access-header-brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.access-header-brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 17px;
  letter-spacing: 0.06em;
  box-shadow: 0 16px 30px rgba(12, 10, 33, 0.25);
}

.access-header-brand strong,
.access-header-brand span {
  display: block;
}

.access-header-brand strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.access-header-brand span,
.access-side-top span {
  color: rgba(238, 235, 255, 0.78);
  font-size: 14px;
}

.access-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 410px);
}

.access-hero {
  display: grid;
  gap: 24px;
  padding: clamp(32px, 5vw, 56px);
  background:
    radial-gradient(circle at top left, rgba(128, 119, 221, 0.28), transparent 34%),
    linear-gradient(160deg, #2b235f 0%, #241d53 55%, #1e1948 100%);
  color: #f6f4ff;
}

.access-copy {
  max-width: 640px;
}

.access-copy h1 {
  margin: 0 0 16px;
  max-width: 11ch;
  font-size: clamp(40px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.access-copy p {
  max-width: 52ch;
  font-size: 18px;
  line-height: 1.62;
  color: rgba(238, 235, 255, 0.84);
}

.access-panel-header {
  margin-bottom: 20px;
}

.access-panel-header h2 {
  margin-bottom: 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.access-panel-header p,
.access-note p,
.access-step p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 16px;
}

.access-side {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: clamp(28px, 4vw, 44px);
  background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
}

.access-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  color: var(--muted);
}

.access-side-top span {
  color: var(--muted);
}

.access-form-card {
  border: 1px solid rgba(221, 217, 243, 0.96);
  border-radius: 28px;
  padding: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
  box-shadow: 0 20px 40px rgba(42, 34, 91, 0.08);
}

.access-form {
    gap: 20px;
}

.access-form .field span {
  font-size: 14px;
  font-weight: 700;
}

.access-form .field input {
  padding: 18px 20px;
  border-radius: 16px;
  font-size: 18px;
}

.access-note {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(221, 217, 243, 0.95);
}

.button-large {
  padding: 18px 24px;
  font-size: 18px;
  letter-spacing: -0.015em;
  box-shadow: 0 12px 22px rgba(83, 74, 183, 0.16);
}

.access-value-list {
  display: grid;
  gap: 14px;
}

.access-value-item {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
}

.access-value-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
  color: #ffffff;
}

.access-value-item p {
  margin: 0;
  color: rgba(238, 235, 255, 0.78);
  line-height: 1.6;
}

.access-help {
  display: grid;
  gap: 10px;
  border-radius: 22px;
}

.access-help strong {
  font-size: 17px;
}

.access-help p {
  margin: 0;
  line-height: 1.6;
}

.access-help-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.access-help-links a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.access-help-links a:hover {
  text-decoration: underline;
}

.access-help-hero {
  padding-top: 4px;
  color: rgba(238, 235, 255, 0.84);
}

.access-help-inline {
  margin-top: 20px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #fffdf2 0%, #fff8dc 100%);
  box-shadow: none;
  border: 1px solid #efe5bf;
}

.access-help-inline .access-help-links a {
  color: var(--brand);
}

.stack {
  display: grid;
  gap: 16px;
}

.stack-sm {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field textarea,
.inline-form select,
.inline-form input,
.table-card select,
.table-card textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-card {
  padding: 18px 20px;
}

.course-card-muted {
  background: #fbf9ff;
}

.empty-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
}

.table-card + .table-card,
.stack > .table-card {
  margin-top: 16px;
}

.table-row,
.curriculum-row {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.table-row:first-of-type,
.curriculum-row:first-of-type {
  border-top: 0;
}

.curriculum-section {
  padding: 12px 0;
  font-weight: 700;
  color: var(--muted);
}

.curriculum-actions {
  display: flex;
  gap: 10px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 67px);
}

.admin-sidebar {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  padding: 20px 16px;
}

.admin-nav {
  display: block;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  color: var(--muted);
}

.admin-nav.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-grid.compact {
  margin-bottom: 0;
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  margin-bottom: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.kv-list {
  display: grid;
  gap: 10px;
}

.kv-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.align-right {
  text-align: right;
}

.empty-inline {
  padding: 10px 0;
  color: var(--muted);
}

.player-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 67px);
}

.player-sidebar {
  background: #1c1b2e;
  color: #ece8ff;
  padding-bottom: 24px;
}

.player-sidebar-header {
  padding: 18px 18px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.player-sidebar-header p {
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.player-section-label {
  padding: 14px 18px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #bdb8ef;
  text-transform: uppercase;
}

.player-lesson {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  color: #ece8ff;
  border-left: 3px solid transparent;
}

.player-lesson small {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  margin-top: 4px;
}

.player-lesson.is-current {
  background: rgba(83, 74, 183, 0.3);
  border-left-color: #8f87f1;
}

.player-stage {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-self: start;
  align-content: start;
}

.video-panel {
  overflow: hidden;
  background: #121126;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
}

.video-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  padding: 32px;
}

.lesson-panel {
  padding: 24px;
}

.warning-card {
  margin: 20px 0;
  padding: 16px;
  border-left: 4px solid #b26c09;
  border-radius: 0 12px 12px 0;
  background: var(--warn-bg);
}

.resource-block {
  margin-top: 20px;
}

.resource-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.resource-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-alt);
}

@media (max-width: 980px) {
  .admin-shell,
  .player-shell,
  .login-page {
    grid-template-columns: 1fr;
  }

  .access-grid {
    grid-template-columns: 1fr;
  }

  .access-side {
    order: -1;
  }

  .access-side-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-sidebar,
  .player-sidebar {
    border-right: 0;
  }

  .two-column,
  .inline-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .support-banner,
  .topbar,
  .course-card-actions,
  .table-card-header,
  .lesson-header,
  .player-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .login-shell {
    padding: 20px 12px;
  }

  .login-brand .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    font-size: 16px;
  }

  .login-copy,
  .login-card {
    padding: 22px;
  }

  .login-copy-body h1 {
    font-size: 42px;
  }

  .login-copy-body p {
    font-size: 17px;
  }

  .login-migration-note .button,
  .button-large {
    width: 100%;
  }

  .access-card {
    width: 100%;
  }

  .access-header-brand .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    font-size: 16px;
  }

  .access-copy h1 {
    font-size: 42px;
    max-width: none;
  }

  .access-copy p {
    font-size: 17px;
  }

  .access-hero,
  .access-side,
  .access-form-card,
  .access-help-inline {
    padding: 20px;
  }

  .button-large {
    width: 100%;
  }
}
