@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300..800&family=Noto+Nastaliq+Urdu:wght@400;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* ===========================================================
   Learning Adventures — "Heal Space Explorer" theme
   Deep-space palette + Bricolage Grotesque, matching the game.
   =========================================================== */

:root {
  --void: #04070e;
  --void-2: #071320;
  --panel: #0a1524;
  --panel-2: #0d1b2c;
  --panel-soft: rgba(10, 21, 36, 0.6);
  --ink: #eaf6f4;
  --ink-dim: #9fb6c6;
  --ink-faint: #6e8698;
  --teal: #19b8a6;
  --mint: #9fe2d0;
  --coral: #e86a5e;
  --blue: #1b9cd8;
  --gold: #ffc857;
  --danger: #ff5a5a;
  --line: rgba(25, 184, 166, 0.30);
  --hair: rgba(159, 226, 208, 0.14);
  --font-d: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-u: 'Noto Nastaliq Urdu', serif;
  --font-m: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-d);
  color: var(--ink);
  background: var(--void);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Subtle starfield + nebula glow behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(27, 156, 216, 0.16), transparent 60%),
    radial-gradient(900px 600px at 8% 108%, rgba(25, 184, 166, 0.14), transparent 60%),
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.7) 50%, transparent),
    radial-gradient(1px 1px at 65% 15%, rgba(255, 255, 255, 0.6) 50%, transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255, 255, 255, 0.5) 50%, transparent),
    radial-gradient(1px 1px at 85% 55%, rgba(255, 255, 255, 0.6) 50%, transparent),
    radial-gradient(1.5px 1.5px at 12% 82%, rgba(159, 226, 208, 0.7) 50%, transparent),
    radial-gradient(1px 1px at 92% 88%, rgba(255, 255, 255, 0.5) 50%, transparent),
    linear-gradient(180deg, var(--void), var(--void-2));
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(5, 11, 20, 0.72);
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo,
a.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(47, 168, 216, 0.4));
}

.logo-word {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(96deg, var(--mint) 10%, var(--teal) 50%, var(--blue) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-ur {
  font-family: var(--font-u);
  font-size: 0.95rem;
  color: var(--ink-faint);
  margin-top: 0.2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  color: var(--mint);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}

.nav-links a:hover {
  color: var(--ink);
}

/* ---------- Main hero ---------- */
.hero {
  flex: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
  width: 100%;
}

.hero-wide {
  max-width: 980px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
  text-wrap: balance;
  background: linear-gradient(96deg, #eaf6f4 8%, var(--mint) 36%, var(--blue) 66%, var(--coral) 98%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink-dim);
  margin-bottom: 2.5rem;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-large {
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(95deg, var(--mint), var(--teal) 46%, var(--blue));
  color: #04121c;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(25, 184, 166, 0.3);
}

.btn-secondary {
  background: var(--panel);
  color: var(--mint);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--teal);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 0.5rem 1.1rem;
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--teal);
}

/* ---------- Landing CTA + features ---------- */
.cta-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.feature-card,
.status-card,
.auth-card,
.panel,
.stat-tile,
.concept-card,
.child-card,
.activity-card {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}

.feature-card {
  padding: 1.75rem 1.5rem;
  text-align: center;
}

.feature-icon {
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  color: var(--mint);
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.5;
}

/* ---------- Connection status (status.html) ---------- */
.status-card {
  padding: 2rem;
  text-align: left;
  max-width: 460px;
  margin: 0 auto;
}

.status-card h2 {
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 1.25rem;
  text-align: center;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.status-label {
  font-size: 1.05rem;
  color: var(--ink-dim);
}

.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #33465a;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.status-dot.ok {
  background: var(--teal);
  box-shadow: 0 0 10px rgba(25, 184, 166, 0.7);
}

.status-dot.fail {
  background: var(--danger);
}

.status-message {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.98rem;
  line-height: 1.5;
  text-align: center;
  color: var(--ink-dim);
}

.status-message.ok {
  background: rgba(25, 184, 166, 0.14);
  color: var(--mint);
}

.status-message.fail {
  background: rgba(255, 90, 90, 0.12);
  color: #ffb3b3;
}

/* ---------- Auth forms ---------- */
.auth-card {
  padding: 2.5rem 2rem;
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.auth-title {
  font-size: 1.7rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 0.4rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--ink-dim);
  margin-bottom: 1.75rem;
}

form label {
  display: block;
  font-weight: 700;
  color: var(--mint);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

form input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input::placeholder {
  color: var(--ink-faint);
}

form input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 184, 166, 0.18);
}

form .btn-primary {
  width: 100%;
  margin-top: 1.5rem;
}

.form-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
  display: none;
}

.form-message.ok,
.form-message.fail {
  display: block;
}

.form-message.ok {
  background: rgba(25, 184, 166, 0.14);
  color: var(--mint);
  border: 1px solid var(--line);
}

.form-message.fail {
  background: rgba(255, 90, 90, 0.12);
  color: #ffb3b3;
  border: 1px solid rgba(255, 90, 90, 0.4);
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.auth-switch a,
.forgot-link a {
  color: var(--mint);
  font-weight: 700;
}

.forgot-link {
  text-align: center;
  margin-top: 0.85rem;
  font-size: 0.9rem;
}

/* "or" divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--ink-faint);
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hair);
}

.divider span {
  padding: 0 0.75rem;
}

/* Google button — kept light for brand recognition */
.btn-google {
  width: 100%;
  background: #ffffff;
  color: #3c4043;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 700;
}

.btn-google:hover {
  background: #f1f3f4;
}

.btn-google svg {
  flex-shrink: 0;
}

/* ---------- Dashboard ---------- */
.loading-text {
  text-align: center;
  color: var(--ink-dim);
  font-size: 1.1rem;
  padding: 2rem 0;
}

.panel {
  padding: 1.75rem;
  text-align: left;
  max-width: 680px;
  margin: 1.5rem auto 0;
}

.panel h2 {
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.panel p {
  color: var(--ink-dim);
  line-height: 1.55;
}

.panel-empty {
  color: var(--ink-faint);
  font-style: italic;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.panel-head h2 {
  margin-bottom: 0;
}

.panel-sub {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* Add-child form */
.child-form {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: 1.25rem;
  margin: 1rem 0;
}

.child-form label:first-child {
  margin-top: 0;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.form-actions .btn {
  width: auto;
  margin-top: 0;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.emoji-option {
  font-size: 1.5rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.emoji-option:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.emoji-option.selected {
  border-color: var(--gold);
  background: rgba(255, 200, 87, 0.15);
}

/* Child cards */
.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.child-card {
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.child-avatar {
  font-size: 2.6rem;
  line-height: 1;
}

.child-name {
  font-weight: 800;
  color: var(--ink);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.child-age {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.child-map-link {
  display: inline-block;
  margin-top: 0.7rem;
  text-decoration: none;
  width: 100%;
}

.child-remove {
  margin-top: 0.7rem;
  background: transparent;
  border: none;
  color: var(--coral);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
}

.child-remove:hover {
  color: var(--danger);
}

/* ---------- Learning map ---------- */
.child-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.child-header-avatar {
  font-size: 3rem;
  line-height: 1;
}

.child-header h1 {
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.child-sub {
  color: var(--ink-dim);
  margin-top: 0.25rem;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-track {
  flex: 1;
  max-width: 340px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width 0.35s ease;
}

.progress-count {
  font-size: 0.9rem;
  color: var(--ink-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Subject filter buttons */
.subject-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.subject-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mint);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subject-btn:hover {
  border-color: var(--teal);
  color: var(--ink);
}

.subject-btn.active {
  background: linear-gradient(120deg, rgba(25, 184, 166, 0.25), rgba(27, 156, 216, 0.22));
  border-color: var(--teal);
  color: var(--ink);
}

.domain-heading {
  color: var(--mint);
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

/* Concept + activity cards */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.concept-card {
  padding: 1.1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.concept-card.mastered {
  border-color: var(--teal);
  background: linear-gradient(180deg, rgba(25, 184, 166, 0.1), var(--panel));
}

.concept-card.activity-featured {
  border-color: rgba(255, 200, 87, 0.6);
  background: linear-gradient(180deg, rgba(255, 200, 87, 0.1), var(--panel));
  box-shadow: 0 10px 30px rgba(255, 200, 87, 0.18);
}

.concept-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.concept-name {
  font-weight: 800;
  color: var(--ink);
  font-size: 1.02rem;
}

.concept-age {
  font-size: 0.75rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.concept-subject {
  font-size: 0.78rem;
  color: var(--mint);
  font-weight: 700;
  margin-top: 0.15rem;
}

.concept-desc {
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 0.5rem;
  flex: 1;
}

.concept-prereqs {
  margin-top: 0.65rem;
  font-size: 0.85rem;
}

.concept-prereqs summary {
  cursor: pointer;
  color: var(--mint);
  font-weight: 700;
}

.concept-prereqs ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-dim);
}

.concept-prereqs li {
  margin: 0.3rem 0;
  line-height: 1.4;
}

.concept-play {
  margin-top: 0.85rem;
  align-self: flex-start;
  text-decoration: none;
}

.concept-toggle {
  margin-top: 0.6rem;
  align-self: flex-start;
}

/* ---------- Activity / quiz player ---------- */
.for-child {
  text-align: center;
  color: var(--ink-dim);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.activity-card {
  padding: 2rem;
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.activity-subject {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mint);
}

.activity-title {
  font-size: 1.6rem;
  color: var(--ink);
  margin: 0.25rem 0;
}

.activity-title-urdu {
  font-family: var(--font-u);
  font-size: 1.4rem;
  color: var(--mint);
  margin-bottom: 0.75rem;
  line-height: 2;
}

.activity-intro {
  color: var(--ink-dim);
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
}

.quiz-progress {
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.quiz-question {
  font-size: 1.2rem;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.quiz-question-urdu {
  font-family: var(--font-u);
  font-size: 1.3rem;
  color: var(--mint);
  margin-bottom: 1rem;
  line-height: 2.1;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.quiz-option {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  font-family: inherit;
  font-size: 1.02rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--teal);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.correct {
  border-color: var(--teal);
  background: rgba(25, 184, 166, 0.22);
  font-weight: 700;
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: rgba(255, 90, 90, 0.16);
}

.quiz-feedback {
  margin-top: 1rem;
}

.quiz-verdict {
  font-weight: 800;
  font-size: 1.05rem;
}

.quiz-verdict.ok {
  color: var(--mint);
}

.quiz-verdict.no {
  color: #ffb3b3;
}

.quiz-explain {
  color: var(--ink-dim);
  line-height: 1.5;
  margin: 0.5rem 0 1rem;
}

.quiz-feedback .btn-primary {
  width: 100%;
}

.quiz-results {
  text-align: center;
}

.quiz-results h2 {
  color: var(--ink);
  font-size: 1.6rem;
}

.quiz-result-msg {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0.75rem 0 1.5rem;
}

.quiz-result-msg.ok {
  color: var(--mint);
}

.quiz-result-msg.no {
  color: #ffb3b3;
}

.quiz-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quiz-actions .btn {
  text-decoration: none;
}

/* ---------- Parent progress view ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-tile {
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  font-family: var(--font-m);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}

.stat-label {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.subject-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0;
}

.subject-row-label {
  flex: 0 0 auto;
  width: 210px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
}

.subject-bar-track {
  flex: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.subject-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--mint));
  border-radius: 999px;
}

.subject-row-count {
  flex: 0 0 auto;
  width: 2.5rem;
  text-align: right;
  font-weight: 700;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.recent-items {
  list-style: none;
}

.recent-items li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hair);
  flex-wrap: wrap;
}

.recent-items li:last-child {
  border-bottom: none;
}

.recent-name {
  font-weight: 700;
  color: var(--ink);
}

.recent-meta {
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* ---------- Embedded game ---------- */
.game-frame {
  width: 100%;
  height: 82vh;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--void);
  display: block;
}

body.game-mode .hero {
  max-width: 1180px;
}

body.game-mode .activity-card {
  max-width: 100%;
  padding: 1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
  border-top: 1px solid var(--hair);
  margin-top: 2rem;
}

.footer-small {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.footer-small a {
  color: var(--ink-dim);
}

/* ===========================================================
   SKY HERO — "From K2 to the Cosmos" (landing page)
   =========================================================== */
.skyhero {
  position: relative;
  min-height: 88vh;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.skyhero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.skyhero-panel {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 2rem 0 2rem clamp(1rem, 5vw, 4rem);
  padding: 2rem;
  background: rgba(5, 11, 20, 0.62);
  border: 1px solid var(--hair);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  text-align: left;
}

.sky-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.skyhero-panel h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(96deg, #eaf6f4 8%, var(--mint) 38%, var(--blue) 66%, var(--coral) 98%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sky-ur {
  font-family: var(--font-u);
  color: var(--mint);
  font-size: 1.1rem;
  line-height: 2;
  margin-bottom: 0.9rem;
}

.sky-lede {
  color: var(--ink-dim);
  line-height: 1.65;
  margin-bottom: 1.4rem;
}

.sky-lede strong {
  color: var(--ink);
}

.cta-left {
  justify-content: flex-start;
  margin-bottom: 0.75rem;
}

.sky-hint {
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* Hero video background (slow, dreamlike) */
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease;
  z-index: 1;
}

.hero-video.on {
  opacity: 1;
}

/* Legibility shade: corners + bottom blend into the dark theme */
.skyhero-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 85% 85% at 50% 42%, transparent 55%, rgba(4, 7, 14, 0.45) 82%, var(--void) 100%),
    linear-gradient(180deg, rgba(4, 7, 14, 0.35) 0%, transparent 22%, transparent 55%, rgba(4, 7, 14, 0.82) 100%);
}

/* Big Rihla lockup, bottom-left (per the sketch) */
.hero-lockup {
  position: absolute;
  z-index: 3;
  left: clamp(1rem, 5vw, 4rem);
  bottom: clamp(1.5rem, 6vh, 3.5rem);
  text-align: left;
  max-width: min(560px, 92vw);
}

.lk-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mint);
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.lk-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lk-mark {
  width: clamp(52px, 8vw, 84px);
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 16px rgba(47, 168, 216, 0.5));
}

.lk-word {
  font-size: clamp(3rem, 9vw, 5.2rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  background: linear-gradient(96deg, #ffffff 5%, var(--mint) 45%, var(--blue) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.7));
}

.lk-ur {
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  color: var(--mint);
  line-height: 1.9;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.lk-tag {
  color: var(--ink);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.55;
  margin: 0.9rem 0 1.1rem;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
}

/* Stat chips along the bottom (the sketch's dashes) */
.hero-stats {
  position: absolute;
  z-index: 3;
  right: clamp(1rem, 4vw, 3rem);
  bottom: clamp(1.5rem, 5vh, 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-end;
}

.stat-chip {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: rgba(5, 11, 20, 0.6);
  backdrop-filter: blur(6px);
  color: var(--ink-dim);
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .hero-stats {
    display: none;
  }
  .hero-lockup {
    bottom: 1.25rem;
  }
}

/* Subject legend (landing + child map) */
.sky-legend {
  position: absolute;
  z-index: 2;
  left: clamp(1rem, 5vw, 4rem);
  bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 620px;
  align-items: center;
}

.legend-label {
  flex-basis: 100%;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: rgba(5, 11, 20, 0.66);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.legend-chip:hover {
  border-color: var(--teal);
  color: var(--ink);
}

.legend-chip.on {
  border-color: var(--teal);
  color: var(--ink);
  background: rgba(25, 184, 166, 0.18);
}

.legend-chip.dim {
  opacity: 0.45;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-count {
  font-family: var(--font-m);
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.features-band {
  max-width: 980px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1rem;
  width: 100%;
}

@media (max-width: 720px) {
  .skyhero {
    min-height: 92vh;
    align-items: flex-start;
  }
  .skyhero-panel {
    margin: 5.5rem 1rem 9rem;
    padding: 1.5rem;
  }
  .sky-legend {
    left: 1rem;
    right: 1rem;
  }
}

/* ---------- Child sky (learning map page) ---------- */
.sky-wrap {
  max-width: 980px;
}

.sky-stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--hair);
}

.sky-stage canvas {
  width: 100%;
  height: 520px;
  display: block;
  touch-action: none;
}

.sky-count {
  font-family: var(--font-m);
  font-size: 0.85rem;
  color: var(--gold);
  white-space: nowrap;
}

.sky-key-lit {
  color: var(--mint);
  font-weight: 700;
}

.sky-key-gold {
  color: var(--gold);
  font-weight: 700;
}

.sky-legend-inline {
  position: static;
  margin-top: 0.85rem;
  max-width: none;
}

/* Floating star card */
.sky-info {
  position: absolute;
  right: 12px;
  top: 12px;
  width: min(300px, 78%);
  padding: 1rem 1.1rem;
  background: rgba(7, 15, 26, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  z-index: 3;
}

.sky-info-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-dim);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.sky-info-subject {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mint);
  padding-right: 1.6rem;
}

.sky-info-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 0.2rem;
}

.sky-info-meta {
  font-size: 0.82rem;
  color: var(--gold);
  margin-top: 0.25rem;
}

.sky-info-desc {
  font-size: 0.88rem;
  color: var(--ink-dim);
  line-height: 1.5;
  margin-top: 0.5rem;
  max-height: 7.5em;
  overflow-y: auto;
}

.sky-info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

/* Tooltip (landing hover) */
.sky-tooltip {
  position: fixed;
  z-index: 30;
  padding: 0.5rem 0.85rem;
  background: rgba(7, 15, 26, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.85rem;
  pointer-events: none;
  max-width: 320px;
  transform: translateX(-0%);
}

/* ===========================================================
   LIBRARY — Netflix-style shelves
   =========================================================== */
.library-main {
  max-width: 1100px;
}

.shelf {
  margin-top: 2rem;
  text-align: left;
}

.shelf-title {
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.shelf-rail {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 1rem;
  scroll-snap-type: x proximity;
}

.shelf-rail::-webkit-scrollbar {
  height: 8px;
}

.shelf-rail::-webkit-scrollbar-thumb {
  background: rgba(159, 226, 208, 0.2);
  border-radius: 4px;
}

.shelf-card {
  position: relative;
  flex: 0 0 200px;
  scroll-snap-align: start;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hair);
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.shelf-card:hover {
  transform: translateY(-4px) scale(1.04);
  border-color: var(--teal);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.shelf-card.soon {
  cursor: default;
  opacity: 0.65;
}

.shelf-card.soon:hover {
  transform: none;
  border-color: var(--hair);
  box-shadow: none;
}

/* Poster art — animated scenes built from gradients + glyphs */
.poster {
  position: relative;
  height: 130px;
  overflow: hidden;
  display: block;
}

.poster .pa,
.poster .pb {
  position: absolute;
  font-size: 2.3rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.poster .pa {
  left: 14%;
  top: 26%;
  animation: posterDriftA 5.5s ease-in-out infinite alternate;
}

.poster .pb {
  right: 12%;
  bottom: 12%;
  font-size: 1.7rem;
  animation: posterDriftB 4.2s ease-in-out infinite alternate;
}

@keyframes posterDriftA {
  from { transform: translate(0, 0) rotate(-4deg); }
  to   { transform: translate(10px, -8px) rotate(5deg); }
}

@keyframes posterDriftB {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-8px, -10px) scale(1.12); }
}

.poster-space       { background: radial-gradient(circle at 70% 20%, #1b3a5c, #04070e 70%); }
.poster-fractions   { background: linear-gradient(140deg, #3d2c12, #0e1524 70%); }
.poster-foodchain   { background: linear-gradient(160deg, #12331f, #071320 75%); }
.poster-adaptations { background: linear-gradient(150deg, #37281a, #0a1a2a 70%); }
.poster-idioms      { background: linear-gradient(145deg, #2c1a35, #0a1524 72%); }
.poster-plurals     { background: linear-gradient(150deg, #1a2c3b, #0a1524 75%); }
.poster-water       { background: linear-gradient(160deg, #10344a, #071320 75%); }
.poster-bazaar      { background: linear-gradient(150deg, #3b2a10, #0a1524 72%); }
.poster-stories     { background: linear-gradient(150deg, #14323a, #0a1524 72%); }
.poster-molecule    { background: radial-gradient(circle at 30% 25%, #46201d, transparent 55%), radial-gradient(circle at 75% 70%, #123a4e, #060d18 80%); }
.poster-shadow      { background: linear-gradient(150deg, #2b2410, #05080f 70%); }
.poster-magnet      { background: linear-gradient(155deg, #3a1420, #0a1524 72%); }
.poster-circuit     { background: linear-gradient(150deg, #33290c, #0a1524 75%); }
.poster-drum        { background: linear-gradient(150deg, #33201a, #0a1524 72%); }
.poster-watercycle  { background: radial-gradient(circle at 78% 22%, #2a3f14, transparent 55%), linear-gradient(160deg, #103048, #060d18 78%); }
.poster-roti        { background: radial-gradient(circle at 42% 40%, #4a3a1c, transparent 55%), linear-gradient(150deg, #33270f, #0a1524 78%); }
.poster-nets        { background: linear-gradient(150deg, #14323a, #101a2e 78%); }
.poster-generic     { background: linear-gradient(150deg, #16283c, #0a1524 75%); }

/* star dust over every poster */
.poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1px 1px at 18% 22%, rgba(255,255,255,0.8) 50%, transparent),
    radial-gradient(1px 1px at 72% 38%, rgba(255,255,255,0.6) 50%, transparent),
    radial-gradient(1px 1px at 45% 72%, rgba(255,255,255,0.5) 50%, transparent),
    radial-gradient(1.5px 1.5px at 88% 14%, rgba(159,226,208,0.7) 50%, transparent);
}

.card-base {
  padding: 0.7rem 0.85rem 0.85rem;
}

.card-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.3;
}

.card-badge {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-weight: 700;
}

/* Hover peek overlay (desktop) */
.card-hover {
  position: absolute;
  inset: 0;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  background: linear-gradient(180deg, rgba(4, 7, 14, 0.2), rgba(4, 7, 14, 0.92) 70%);
  opacity: 0;
  transition: opacity 0.18s ease;
  text-align: left;
}

.shelf-card:hover .card-hover {
  opacity: 1;
}

.ch-tag {
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.4;
  font-weight: 600;
}

.ch-meta {
  font-size: 0.72rem;
  color: var(--mint);
  font-weight: 700;
}

.ch-cta {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(95deg, var(--mint), var(--teal) 46%, var(--blue));
  color: #04121c;
  font-size: 0.8rem;
  font-weight: 800;
}

/* Preview modal */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 6, 12, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Without this, the flex display above overrides the [hidden] attribute, so
   the modal shows empty on load and refuses to close. This keeps it hidden
   until library.js sets hidden=false. */
.preview-modal[hidden] {
  display: none;
}

.preview-card {
  position: relative;
  width: min(460px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow-x: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  text-align: left;
}

.preview-card .sky-info-close {
  z-index: 2;
}

.poster-large {
  height: 190px;
  border-radius: 0;
}

.poster-large .pa {
  font-size: 3.4rem;
}

.poster-large .pb {
  font-size: 2.4rem;
}

.preview-body {
  padding: 1.25rem 1.4rem 1.5rem;
}

.preview-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mint);
}

.preview-body h2 {
  font-size: 1.45rem;
  color: var(--ink);
  margin-top: 0.3rem;
}

.preview-urdu {
  font-family: var(--font-u);
  color: var(--mint);
  font-size: 1.15rem;
  line-height: 2;
  margin-top: 0.15rem;
}

.preview-tagline {
  color: var(--ink-dim);
  line-height: 1.55;
  margin-top: 0.6rem;
}

.preview-sample {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(25, 184, 166, 0.06);
}

.preview-sample-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}

.preview-sample-q {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  min-height: 3em;
}

.preview-actions {
  margin-top: 1.25rem;
}

.preview-actions .btn {
  width: 100%;
  text-align: center;
}

/* ---------- Legal pages ---------- */
.legal-page {
  max-width: 720px;
  text-align: left;
}

.legal-page h1 {
  text-align: center;
}

.legal-page .subtitle {
  text-align: center;
}

.legal-page .panel {
  margin-top: 1.25rem;
}

.legal-page .panel h2 {
  font-size: 1.1rem;
  color: var(--mint);
}

.legal-page .panel a {
  color: var(--mint);
}

/* ---------- Responsive + motion ---------- */
@media (max-width: 520px) {
  .subject-row-label {
    width: 130px;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
