:root {
  --ink: #122033;
  --muted: #596a80;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --space: #071326;
  --space-2: #0c2440;
  --cyan: #0f9fc5;
  --cyan-soft: #dff7fc;
  --gold: #f6c94d;
  --gold-soft: #fff3c4;
  --coral: #e56f51;
  --green: #1b9c6d;
  --line: #d9e2ee;
  --shadow: 0 18px 50px rgba(18, 32, 51, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -12%, rgba(15, 159, 197, 0.17), transparent 30rem),
    linear-gradient(180deg, #f7fbff 0%, var(--paper) 28rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--space);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 12px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(217, 226, 238, 0.82);
  background: rgba(255, 255, 255, 0.91);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background:
    radial-gradient(circle at 65% 32%, var(--gold) 0 8%, transparent 9%),
    radial-gradient(circle at 45% 52%, #55d3ff 0 22%, #1875b7 23% 43%, transparent 44%),
    #09192d;
  box-shadow: 0 6px 18px rgba(15, 159, 197, 0.26);
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  color: var(--space);
  font-size: 16px;
  line-height: 1;
}

.brand-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-pills {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faff;
}

.nav-pills a {
  min-height: 38px;
  min-width: 88px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #31445b;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pills a.is-active,
.nav-pills a:hover,
.nav-pills a:focus-visible {
  color: #ffffff;
  background: var(--space);
  outline: none;
}

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

.top-status {
  display: grid;
  justify-items: end;
  gap: 0;
  min-width: 88px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 82px;
  padding: 9px 13px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--space);
  font-size: 13px;
  font-weight: 950;
  text-decoration: none;
}

.top-status span:first-child {
  color: var(--space);
  font-size: 22px;
  line-height: 1;
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.page:not(.page-dashboard) {
  padding-top: 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: stretch;
}

.hero-card {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--space);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.hero-image,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-image {
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-overlay {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(7, 19, 38, 0.95) 0%, rgba(7, 19, 38, 0.78) 43%, rgba(7, 19, 38, 0.18) 100%),
    linear-gradient(180deg, rgba(7, 19, 38, 0.28), rgba(7, 19, 38, 0.88));
}

.hero-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 560px;
  max-width: 720px;
  padding: 56px;
  color: #ffffff;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 14px;
  padding: 7px 11px;
  border: 1px solid rgba(15, 159, 197, 0.5);
  border-radius: 999px;
  color: #063348;
  background: var(--cyan-soft);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.small {
  margin-bottom: 10px;
  font-size: 11px;
}

.hero-card .eyebrow,
.mission-card .eyebrow {
  color: #dffbff;
  background: rgba(4, 35, 60, 0.68);
}

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

h1 {
  max-width: 880px;
  margin-bottom: 14px;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.18;
}

p {
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.hero-card p,
.mission-card p,
.mission-card li {
  color: #d8e7f5;
}

.hero-card p {
  max-width: 650px;
  font-size: 20px;
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 132px;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button.primary {
  color: #152033;
  background: linear-gradient(135deg, var(--gold), #fff0ac);
  box-shadow: 0 12px 28px rgba(246, 201, 77, 0.26);
}

.button.secondary {
  border-color: rgba(18, 32, 51, 0.2);
  color: var(--space);
  background: #ffffff;
}

.button.danger {
  color: #ffffff;
  background: var(--coral);
}

.button.success {
  color: #ffffff;
  background: var(--green);
}

.button.compact {
  min-height: 40px;
  min-width: 118px;
  padding: 9px 14px;
  font-size: 14px;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: 3px solid rgba(15, 159, 197, 0.26);
  outline-offset: 2px;
}

.mission-card,
.panel,
.unit-panel,
.lesson-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mission-card {
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 560px;
  padding: 28px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(7, 19, 38, 0.68), rgba(7, 19, 38, 0.96)),
    radial-gradient(circle at 70% 8%, rgba(246, 201, 77, 0.4), transparent 15rem),
    var(--space);
}

.mission-card ol {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
  padding-left: 22px;
}

.mission-meter,
.mini-meter,
.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.mission-meter span,
.mini-meter span,
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.meter-copy {
  margin: 12px 0 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #ffffff, #fff8d8);
}

.auth-gate.is-authenticated {
  background: linear-gradient(135deg, #ffffff, #ecfff7);
}

.auth-gate h2,
.auth-gate p {
  margin-bottom: 4px;
}

.badge-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--space);
  background: var(--gold-soft);
  font-size: 13px;
  font-weight: 950;
}

.badge.locked {
  color: var(--muted);
  background: #edf2f8;
}

.summary-grid article {
  display: grid;
  gap: 4px;
  min-height: 110px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(18, 32, 51, 0.08);
}

.stat-value {
  color: var(--space);
  font-size: 34px;
  font-weight: 950;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-weight: 850;
}

.panel {
  padding: 24px;
}

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

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.compact-heading {
  display: block;
  margin-bottom: 16px;
}

.unit-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.unit-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.unit-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--space);
  background: var(--gold-soft);
  font-weight: 950;
}

.unit-chip h3 {
  margin-top: 3px;
}

.unit-chip p {
  min-height: 52px;
  margin-bottom: 14px;
}

.unit-chip a {
  display: inline-flex;
  margin-top: 12px;
  color: var(--cyan);
  font-weight: 900;
  text-decoration: none;
}

.page-heading {
  max-width: 860px;
  margin: 10px 0 24px;
}

.page-heading h1 {
  color: var(--space);
  font-size: clamp(36px, 4.5vw, 64px);
}

.page-heading p {
  max-width: 760px;
  font-size: 18px;
}

.unit-list {
  display: grid;
  gap: 18px;
}

.unit-panel {
  padding: 22px;
}

.unit-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.unit-head > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: var(--space);
  background: var(--cyan-soft);
  font-weight: 950;
}

.unit-head h2 {
  margin-bottom: 6px;
  color: var(--space);
}

.unit-head p {
  margin-bottom: 0;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lesson-tile {
  display: grid;
  align-content: space-between;
  min-height: 215px;
  padding: 18px;
  box-shadow: none;
}

.lesson-tile.is-complete {
  border-color: rgba(27, 156, 109, 0.5);
  background: #f0fbf6;
}

.lesson-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.lesson-tile p {
  margin-bottom: 16px;
}

.back-link {
  display: inline-flex;
  margin: 4px 0 14px;
  color: var(--cyan);
  font-weight: 950;
  text-decoration: none;
}

.lesson-detail {
  display: grid;
  gap: 18px;
}

.lesson-detail-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 30px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(115deg, rgba(7, 19, 38, 0.96), rgba(12, 36, 64, 0.78)),
    url("assets/grade4-space-hero.webp") center / cover;
  box-shadow: var(--shadow);
}

.lesson-detail-head h1 {
  color: #ffffff;
}

.lesson-detail-head p {
  max-width: 680px;
  margin-bottom: 0;
  color: #d8e7f5;
  font-size: 18px;
}

.lesson-columns,
.progress-layout,
.profile-layout,
.qa-layout,
.auth-layout,
.community-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
}

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

.community-grid {
  margin-bottom: 18px;
}

.bottom-columns {
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1fr);
}

.activity-card {
  background: linear-gradient(180deg, #ffffff, #f0fbff);
}

.diagram-orbit {
  position: relative;
  height: 220px;
  margin-top: 18px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(246, 201, 77, 0.22), transparent 54px),
    linear-gradient(180deg, #071326, #123a5f);
}

.sun-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 34px rgba(246, 201, 77, 0.85);
}

.orbit {
  position: absolute;
  inset: 50%;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit-one {
  width: 92px;
  height: 54px;
}

.orbit-two {
  width: 148px;
  height: 86px;
}

.orbit-three {
  width: 205px;
  height: 126px;
}

.vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.vocab-list span {
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--space);
  background: var(--gold-soft);
  font-weight: 850;
}

.check-list,
.faq-list {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--space);
  font-weight: 900;
}

details p {
  margin: 0;
  padding: 0 16px 16px;
}

.progress-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #ffffff, #ecfaff);
}

.progress-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 126px;
  height: 126px;
  border: 14px solid var(--cyan-soft);
  border-top-color: var(--gold);
  border-right-color: var(--cyan);
  border-radius: 50%;
  color: var(--space);
  font-size: 28px;
  font-weight: 950;
}

.progress-bars {
  display: grid;
  gap: 16px;
}

.bar-row {
  display: grid;
  gap: 9px;
}

.bar-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--space);
}

.bar {
  background: #e8eef6;
}

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

.score-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.score-table th,
.score-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.score-table th {
  color: var(--space);
  background: #f7faff;
  font-size: 13px;
  text-transform: uppercase;
}

.profile-form,
.question-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--space);
  font-weight: 900;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #f9fbff;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #f9fbff;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(15, 159, 197, 0.22);
  border-color: var(--cyan);
}

.form-message,
.result-box {
  min-height: 24px;
  margin: 0;
  font-weight: 850;
}

.inline-form,
.task-form,
.chat-form {
  display: grid;
  gap: 12px;
}

.profile-card {
  align-self: start;
  text-align: center;
  background:
    radial-gradient(circle at 80% 0%, rgba(246, 201, 77, 0.26), transparent 13rem),
    #ffffff;
}

.avatar {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, var(--space), var(--cyan));
  font-size: 28px;
  font-weight: 950;
}

.profile-card dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 20px 0 0;
}

.friend-code {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7faff;
  font-weight: 850;
}

.gate-card.is-locked {
  position: relative;
}

.gate-card.is-locked::after {
  content: "Login required";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(7, 19, 38, 0.84);
  font-size: 22px;
  font-weight: 950;
}

.friend-list,
.request-list,
.task-list {
  display: grid;
  gap: 12px;
}

.friend-card,
.request-card,
.task-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.friend-card header,
.request-card header,
.task-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.friend-card h3,
.request-card h3,
.task-card h3 {
  margin-bottom: 2px;
}

.friend-card p,
.request-card p,
.task-card p {
  margin-bottom: 0;
}

.task-comments {
  display: grid;
  gap: 8px;
}

.task-comments p {
  margin: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: #ffffff;
}

.chat-widget {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
}

.chat-toggle {
  min-width: 92px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--space), var(--cyan));
  box-shadow: 0 16px 40px rgba(18, 32, 51, 0.24);
  cursor: pointer;
  font-weight: 950;
}

.chat-panel {
  width: min(380px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 36px));
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(18, 32, 51, 0.24);
}

.chat-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-panel h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 220px;
  max-height: 280px;
  margin: 12px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f7faff;
}

.chat-bubble {
  max-width: 84%;
  padding: 9px 11px;
  border-radius: 8px;
  background: #ffffff;
}

.chat-bubble.mine {
  justify-self: end;
  color: #ffffff;
  background: var(--space);
}

.chat-bubble small {
  display: block;
  margin-top: 4px;
  opacity: 0.74;
}

.chat-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-card dl div {
  padding: 12px;
  border-radius: 8px;
  background: #f7faff;
}

.profile-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-card dd {
  margin: 6px 0 0;
  color: var(--space);
  font-size: 18px;
  font-weight: 950;
}

.saved-questions {
  display: grid;
  gap: 12px;
}

.saved-questions article {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.saved-questions h3 {
  margin-bottom: 6px;
}

.saved-questions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
  font-weight: 950;
}

.empty-copy {
  margin: 0;
}

.exam-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.tab-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--space);
  background: #ffffff;
  cursor: pointer;
  font-weight: 900;
}

.tab-button.is-active {
  color: #ffffff;
  background: var(--space);
}

.exam-form {
  display: grid;
  gap: 20px;
}

.question-list {
  display: grid;
  gap: 16px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  max-width: 100%;
  padding: 0 6px;
  color: var(--space);
  font-weight: 950;
  line-height: 1.4;
}

.choice {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f9fbff;
  font-weight: 780;
}

.choice input {
  width: auto;
}

.exam-result {
  margin-top: 16px;
  border-color: rgba(27, 156, 109, 0.42);
  background: #f0fbf6;
}

.mobile-nav {
  display: none;
}

@media (max-width: 1040px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .nav-pills {
    order: 3;
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .account-status {
    justify-self: end;
  }

  .hero-grid,
  .lesson-columns,
  .progress-layout,
  .profile-layout,
  .qa-layout,
  .auth-layout,
  .community-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .hero-content,
  .mission-card {
    min-height: 470px;
  }

  .mission-card {
    min-height: auto;
  }

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

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

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

@media (max-width: 720px) {
  body {
    padding-bottom: 72px;
  }

  .topbar {
    min-height: 66px;
    padding: 10px 14px;
  }

  .brand-copy small,
  .top-status {
    display: none;
  }

  .account-link {
    min-width: 72px;
  }

  .nav-pills {
    display: none;
  }

  main {
    width: min(100% - 24px, 1180px);
    padding-top: 14px;
  }

  .hero-card,
  .hero-content {
    min-height: 560px;
  }

  .hero-image {
    object-position: 62% center;
  }

  .hero-overlay {
    background:
      linear-gradient(90deg, rgba(7, 19, 38, 0.96), rgba(7, 19, 38, 0.72)),
      linear-gradient(180deg, rgba(7, 19, 38, 0.22), rgba(7, 19, 38, 0.94));
  }

  .hero-content {
    justify-content: end;
    width: 100%;
    max-width: 100%;
    padding: 28px 22px;
  }

  h1 {
    font-size: clamp(34px, 11vw, 48px);
  }

  .page-heading h1 {
    font-size: clamp(34px, 12vw, 50px);
  }

  .hero-card p,
  .page-heading p {
    font-size: 16px;
  }

  .hero-card p {
    max-width: 29ch;
  }

  .mission-card ol,
  .mission-card p {
    max-width: 30ch;
  }

  .hero-actions,
  .form-actions,
  .exam-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions {
    width: min(100%, 322px);
  }

  .button,
  .tab-button {
    width: 100%;
  }

  .mission-card,
  .panel,
  .unit-panel {
    padding: 18px;
  }

  .auth-gate {
    display: grid;
  }

  .summary-grid,
  .unit-track,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid article {
    min-height: 86px;
  }

  .unit-chip {
    min-height: auto;
  }

  .unit-head {
    display: grid;
  }

  .lesson-detail-head {
    display: grid;
    padding: 22px;
  }

  .progress-hero {
    display: grid;
    justify-items: start;
  }

  .profile-card dl {
    grid-template-columns: 1fr;
  }

  .score-table-wrap {
    overflow-x: visible;
  }

  .score-table {
    min-width: 0;
  }

  .score-table thead {
    display: none;
  }

  .score-table,
  .score-table tbody,
  .score-table tr,
  .score-table td {
    display: block;
    width: 100%;
  }

  .score-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .score-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .score-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
  }

  .saved-questions article {
    align-items: flex-start;
  }

  .mobile-nav {
    position: fixed;
    z-index: 30;
    left: 10px;
    right: auto;
    bottom: 10px;
    width: calc(100vw - 20px);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: calc(100vw - 20px);
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(217, 226, 238, 0.9);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 34px rgba(18, 32, 51, 0.22);
    backdrop-filter: blur(14px);
  }

  .mobile-nav a {
    display: grid;
    place-items: center;
    min-height: 42px;
    border-radius: 999px;
    color: var(--space);
    font-size: 11px;
    font-weight: 950;
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
  }

  .chat-widget {
    right: 10px;
    bottom: 76px;
  }

  .chat-panel {
    width: calc(100vw - 20px);
  }

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

  .mobile-nav a.is-active {
    color: #ffffff;
    background: var(--space);
  }
}

@media (max-width: 420px) {
  main {
    width: calc(100% - 20px);
  }

  .hero-content {
    padding: 24px 18px;
  }

  .hero-card,
  .hero-content {
    min-height: 540px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .panel,
  .unit-panel,
  .mission-card {
    padding: 16px;
  }

  .lesson-tile {
    min-height: 190px;
  }

  .mobile-nav {
    left: 6px;
    right: auto;
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
  }

  .mobile-nav a {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-image {
    animation: slow-space-drift 24s ease-in-out infinite alternate;
  }

  .sun-dot {
    animation: solar-pulse 2.8s ease-in-out infinite;
  }

  .orbit-one {
    animation: orbit-spin 18s linear infinite;
  }

  .orbit-two {
    animation: orbit-spin 24s linear infinite reverse;
  }

  .orbit-three {
    animation: orbit-spin 32s linear infinite;
  }

  .badge:not(.locked) {
    animation: badge-glow 3.8s ease-in-out infinite;
  }
}

@keyframes slow-space-drift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }

  to {
    transform: scale(1.08) translate3d(-1.5%, 1%, 0);
  }
}

@keyframes solar-pulse {
  0%,
  100% {
    box-shadow: 0 0 30px rgba(246, 201, 77, 0.72);
  }

  50% {
    box-shadow: 0 0 48px rgba(246, 201, 77, 0.95);
  }
}

@keyframes orbit-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes badge-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(246, 201, 77, 0);
  }

  50% {
    box-shadow: 0 8px 22px rgba(246, 201, 77, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button,
  .hero-image,
  .sun-dot,
  .orbit,
  .badge {
    transition: none;
    animation: none;
  }

  .button:hover,
  .button:focus-visible {
    transform: none;
  }
}
