:root {
  color-scheme: dark;
  --bg: #08111d;
  --bg-2: #0a1424;
  --surface: #111f33;
  --surface-2: #172841;
  --surface-3: #203955;
  --stroke: rgba(152, 194, 255, 0.22);
  --stroke-strong: rgba(152, 194, 255, 0.36);
  --text: #f5f8fc;
  --muted: #a9bbcf;
  --muted-2: #7f94ac;
  --blue: #72a8ff;
  --blue-2: #1478e6;
  --sky: #6dc6e8;
  --mint: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --panel-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
  --focus: 0 0 0 3px rgba(109, 198, 232, 0.42);
  --radius: 8px;
  --shell: min(1180px, calc(100vw - 32px));
  --font: "Avenir Next", "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(20, 120, 230, 0.14), transparent 28%),
    linear-gradient(240deg, rgba(34, 197, 94, 0.09), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 80%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--amber);
  color: #1d1200;
  font-weight: 800;
}

.skip-link:focus {
  top: 16px;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(152, 194, 255, 0.16);
  background: rgba(8, 17, 29, 0.88);
  backdrop-filter: blur(16px);
}

.header-layout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding-block: 12px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-lockup small {
  max-width: 330px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.primary-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.primary-nav a {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  border-color: var(--stroke);
  background: rgba(114, 168, 255, 0.12);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface);
}

.nav-toggle span:not(.visually-hidden) {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.app-main {
  min-height: calc(100vh - 230px);
  padding: 22px 0 56px;
}

.app-status {
  min-height: 0;
}

.status-message {
  margin-bottom: 16px;
  border: 1px solid var(--stroke);
  border-left: 4px solid var(--sky);
  border-radius: var(--radius);
  background: rgba(17, 31, 51, 0.88);
  padding: 12px 14px;
  color: var(--muted);
}

.status-message strong {
  color: var(--text);
}

.status-message.warning {
  border-left-color: var(--amber);
}

.status-message.error {
  border-left-color: var(--red);
}

.status-pill,
.tag,
.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 28px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(114, 168, 255, 0.10);
  padding: 4px 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.online {
  color: #c6f6dc;
  background: rgba(34, 197, 94, 0.13);
}

.status-pill.offline {
  color: #ffd8a8;
  background: rgba(245, 158, 11, 0.14);
}

.page {
  width: var(--shell);
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(300px, 0.72fr);
  gap: 26px;
  align-items: center;
  min-height: min(760px, calc(100vh - 100px));
  padding: 18px 0 34px;
}

.hero-copy {
  max-width: 690px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--sky);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.35rem, 6vw, 5.4rem);
  max-width: 780px;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.45rem);
}

h3 {
  font-size: 1.08rem;
}

p {
  margin: 0;
}

.lead {
  margin-top: 16px;
  max-width: 700px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions,
.action-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 15px;
  font-weight: 850;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.button {
  background: linear-gradient(135deg, var(--blue-2), #315cae);
  color: white;
}

.secondary-button {
  border-color: var(--stroke-strong);
  background: var(--surface);
  color: var(--text);
}

.ghost-button {
  border-color: var(--stroke);
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 44px;
  padding: 0;
  border-color: var(--stroke);
  background: var(--surface);
  color: var(--text);
}

.button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button.compact,
.secondary-button.compact,
.ghost-button.compact {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 0.84rem;
}

.button[disabled],
.secondary-button[disabled],
.ghost-button[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.hero-media {
  position: relative;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.hero-media img {
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--panel-shadow);
}

.hero-media img:first-child {
  width: min(100%, 420px);
}

.hero-media img:last-child {
  width: min(86%, 320px);
  margin-top: -90px;
  margin-left: 80px;
}

.section {
  padding: 28px 0;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-header p {
  max-width: 650px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.card,
.panel,
.auth-panel,
.module-row,
.lesson-panel,
.profile-editor,
.quiz-panel {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(23, 40, 65, 0.92), rgba(17, 31, 51, 0.92));
  box-shadow: var(--panel-shadow);
}

.card,
.panel,
.auth-panel,
.profile-editor,
.quiz-panel {
  padding: 18px;
}

.card p,
.panel p,
.module-row p,
.lesson-panel p,
.profile-editor p,
.quiz-panel p {
  color: var(--muted);
}

.card h3,
.panel h3,
.module-row h3,
.lesson-panel h3 {
  margin-bottom: 8px;
}

.metric-card strong,
.metric-value {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  font-weight: 950;
}

.metric-card span {
  color: var(--muted);
}

.progress-bar {
  position: relative;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--mint));
}

.module-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.module-index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: rgba(114, 168, 255, 0.14);
  color: var(--sky);
  font-weight: 950;
}

.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.lesson-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.lesson-panel {
  padding: 14px;
}

.lesson-panel.complete {
  border-color: rgba(34, 197, 94, 0.5);
}

.lesson-panel ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-button {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 800;
}

.tab-button[aria-selected="true"] {
  border-color: var(--sky);
  color: var(--text);
  background: rgba(114, 168, 255, 0.16);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field label,
.checkbox-group legend {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 850;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(8, 17, 29, 0.72);
  color: var(--text);
  padding: 11px 12px;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field small {
  color: var(--muted-2);
}

.checkbox-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  margin: 0;
  padding: 12px;
}

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

.checkbox-list label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.empty-state {
  border: 1px dashed var(--stroke-strong);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--muted);
  background: rgba(17, 31, 51, 0.58);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(320px, 0.62fr);
  gap: 18px;
  align-items: start;
  padding-top: 22px;
}

.auth-panel form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 5px;
}

.segmented button {
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  font-weight: 850;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--stroke);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: var(--text);
}

.quiz-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 11px;
  color: var(--text);
  text-align: left;
}

.quiz-choice + .quiz-choice {
  margin-top: 8px;
}

.quiz-choice.correct {
  border-color: rgba(34, 197, 94, 0.65);
}

.quiz-choice.incorrect {
  border-color: rgba(239, 68, 68, 0.65);
}

.answer-key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: rgba(114, 168, 255, 0.16);
  color: var(--sky);
  font-weight: 950;
}

.site-footer {
  border-top: 1px solid var(--stroke);
  padding: 28px 0;
  background: rgba(8, 17, 29, 0.72);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 22px;
}

.footer-grid img {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}

.footer-grid p {
  max-width: 620px;
  color: var(--muted);
}

.footer-grid nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: start;
  justify-content: flex-end;
}

.footer-grid a {
  color: var(--muted);
  font-weight: 750;
}

.footer-grid a:hover {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 980px) {
  .header-layout {
    grid-template-columns: auto auto 1fr;
  }

  .nav-toggle {
    display: block;
    grid-column: 2;
  }

  .primary-nav {
    position: fixed;
    inset: 78px 16px auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: start;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 10px;
    box-shadow: var(--panel-shadow);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .header-actions {
    grid-column: 3;
  }

  .hero,
  .dashboard-grid,
  .auth-layout,
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-media {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --shell: min(100vw - 24px, 1180px);
  }

  .brand-lockup small,
  .status-pill {
    display: none;
  }

  .header-layout {
    gap: 10px;
  }

  .module-row {
    grid-template-columns: 1fr;
  }

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

  .section-header,
  .footer-grid {
    align-items: start;
    flex-direction: column;
  }

  .footer-grid nav {
    justify-content: flex-start;
  }
}
