/* De'Kayra Digital class Home Hub — brand-aligned with dekayraschools.sc.tz */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap");

:root {
  /* Brand core (matches public school site) */
  --blue: #1d4ed8;
  --red: #dc2626;
  --yellow: #f59e0b;
  --blue-light: #dbeafe;
  --red-light: #fee2e2;
  --yellow-light: #fef3c7;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 20px 50px rgb(15 23 42 / 0.12);
  --radius: 10px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --hub-bg: #ffffff;
  --hub-bg-mid: #f8fafc;
  --hub-panel: #ffffff;
  --hub-panel-2: #f8fafc;
  --hub-line: rgba(29, 78, 216, 0.18);
  --hub-text: #0f172a;
  --hub-muted: #64748b;
  --hub-cyan: #1d4ed8;
  --hub-cyan-deep: #1e40af;
  --hub-cyan-soft: rgba(29, 78, 216, 0.12);
  --hub-accent: #1d4ed8;
  --hub-yellow: #f59e0b;
  --hub-yellow-deep: #d97706;
  --hub-yellow-soft: #fef3c7;
  --hub-font: "Inter", "Segoe UI", sans-serif;
  --hub-display: "Poppins", "Inter", sans-serif;

  --hub-red: #dc2626;
  --hub-red-soft: rgba(220, 38, 38, 0.1);
  --hub-red-line: rgba(220, 38, 38, 0.3);
  --hub-blue: #1d4ed8;
  --hub-blue-soft: rgba(29, 78, 216, 0.12);
  --hub-blue-line: rgba(29, 78, 216, 0.28);

  --lib-maroon: #991b1b;
  --lib-teal: #0f766e;
  --lib-blue: #1d4ed8;
  --lib-sky: #3b82f6;
  --lib-navy: #1e3a8a;
  --lib-green: #15803d;
  --lib-olive: #65a30d;
  --lib-brown: #92400e;
  --lib-purple: #6d28d9;

  --org-body: #b91c1c;
  --org-heart: #dc2626;
  --org-bone: #c4b39a;
  --org-muscle: #a63d3d;
  --org-brain: #c9a0a8;
  --org-diaphragm: #c98b8b;
  --org-digestive: #c97a5a;
  --org-urinary: #c9a06b;
  --org-eye: #1d4ed8;
  --org-flower: #15803d;
  --org-insect: #6b5a3a;
  --lib-orange: #ea580c;
}

.hub-body {
  margin: 0;
  min-height: 100vh;
  color: var(--hub-text);
  background:
    radial-gradient(900px 420px at 10% -10%, rgb(29 78 216 / 0.14), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgb(220 38 38 / 0.08), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 45%, #fef3c7 100%) !important;
  background-size: 120% 120%, 120% 120%, 100% 100% !important;
  animation: hub-bg-drift 22s ease-in-out infinite alternate;
  font-family: var(--hub-font) !important;
  transition: background 0.25s ease, color 0.25s ease;
}

.hub-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid var(--hub-line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  transition: box-shadow 280ms ease, background 280ms ease;
}

.hub-body.is-scrolled .hub-topbar {
  box-shadow: 0 8px 24px rgba(18, 37, 51, 0.08);
  background: rgba(255, 255, 255, 0.96);
}

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

.hub-return-school {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(29, 78, 216, 0.28);
  background: #fff;
  color: #1e40af;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.hub-return-school:hover {
  background: #dbeafe;
  border-color: rgba(29, 78, 216, 0.5);
  transform: translateY(-1px);
}

.hub-return-school[hidden] {
  display: none !important;
}

.hub-brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 14px rgba(28, 170, 217, 0.2);
}

.hub-brand-mark img,
.hub-brand-mark svg,
.hub-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hub-brand strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hub-text);
  line-height: 1.15;
}

.hub-tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--hub-line);
  box-shadow: 0 8px 24px rgba(12, 61, 82, 0.06);
}

.hub-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: var(--hub-muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.hub-tab.active,
.hub-tab:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1e40af);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.28);
}

.hub-tab:active {
  transform: scale(0.97);
}

.hub-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.hub-login-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(29, 78, 216, 0.35);
  background: #fff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.hub-login-link:hover {
  background: #dbeafe;
  color: #0d2a3d;
  transform: translateY(-1px);
}

.staff-login {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid rgba(29, 78, 216, 0.2);
  border-radius: var(--radius, 10px);
  background: linear-gradient(160deg, #fff 0%, var(--red-light) 42%, var(--yellow-light) 100%);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.staff-login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.staff-login-card {
  display: block;
  padding: 18px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--hub-line);
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, border-color 0.2s ease;
}

.staff-login-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(29, 78, 216, 0.35);
}

.staff-login-card .tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.staff-login-card h3 {
  margin: 0 0 8px;
  font-family: var(--hub-display);
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.staff-login-card p {
  margin: 0;
  color: var(--hub-muted);
  line-height: 1.45;
  font-size: 14px;
}

.staff-login-go {
  display: inline-block;
  margin-top: 14px;
  color: var(--blue);
  font-weight: 800;
}

.staff-login-grid--single {
  grid-template-columns: 1fr;
  max-width: 520px;
}

.staff-login-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: none;
}

@media (max-width: 980px) {
  .staff-login-grid--three {
    grid-template-columns: 1fr;
  }
}

.staff-login-card.staff-teacher {
  border-color: rgba(29, 78, 216, 0.28);
  background: linear-gradient(180deg, var(--blue-light), #ffffff);
}

.staff-login-card.staff-teacher .tag {
  background: var(--blue-light);
  color: var(--blue);
}

.staff-login-card.staff-admin {
  border-color: rgba(220, 38, 38, 0.28);
  background: linear-gradient(180deg, var(--red-light), #ffffff);
}

.staff-login-card.staff-admin .tag {
  background: var(--red-light);
  color: var(--red);
}

.staff-login-card.staff-admin .staff-login-go {
  color: var(--red);
}

.staff-login-card.staff-grading {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, var(--yellow-light), #ffffff);
  box-shadow: 0 10px 28px rgb(245 158 11 / 0.18);
}

.staff-login-card.staff-grading .tag {
  background: var(--yellow-light);
  color: #b45309;
}

.staff-login-card.staff-grading .staff-login-go {
  color: #b45309;
}

.hub-user-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.hub-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.1);
  color: #166534;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.hub-online-badge:hover {
  background: rgba(22, 163, 74, 0.16);
}

.hub-online-badge[hidden] {
  display: none !important;
}

.hub-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
  animation: hub-online-pulse 1.6s infinite;
}

@keyframes hub-online-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hub-online-dot { animation: none; }
}

.hub-search {
  position: relative;
  min-width: min(220px, 34vw);
}
.hub-search input {
  width: 100%;
  border: 1px solid var(--hub-line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.hub-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid var(--hub-line);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(12, 61, 82, 0.14);
  z-index: 50;
  max-height: 280px;
  overflow: auto;
}
.hub-search-results a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--hub-text);
  border-bottom: 1px solid var(--hub-line);
}
.hub-search-results a:last-child { border-bottom: 0; }
.hub-search-results strong { display: block; font-size: 14px; }
.hub-search-results span { color: var(--hub-muted); font-size: 12px; }

.hub-onboard {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 30, 42, 0.45);
}
.hub-onboard-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--hub-line);
  box-shadow: 0 18px 40px rgba(8, 30, 42, 0.22);
}
.hub-onboard-card h3 { margin: 0 0 10px; font-family: var(--hub-display), Georgia, serif; }
.hub-onboard-card ol { margin: 0 0 16px; padding-left: 18px; color: var(--hub-muted); line-height: 1.5; }

.hub-logout-btn {
  cursor: pointer;
  font: inherit;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 30, 42, 0.45);
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal-card {
  position: relative;
  width: min(440px, 100%);
  padding: 22px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(28, 170, 217, 0.28);
  box-shadow: 0 18px 40px rgba(8, 30, 42, 0.22);
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #4a6d82;
}

.auth-modal-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-modal-sub {
  margin: 0 0 14px;
  color: #4a6d82;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tab {
  flex: 1;
  border: 1px solid rgba(28, 170, 217, 0.3);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  font-weight: 800;
  cursor: pointer;
  color: #0d2a3d;
}

.auth-tab.is-active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}

.auth-form label {
  display: block;
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(28, 170, 217, 0.3);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

.auth-form .button {
  width: 100%;
  margin-top: 14px;
}

.auth-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fce8e6;
  color: #8b1d1b;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .staff-login-grid {
    grid-template-columns: 1fr;
  }

  .hub-top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

.hub-wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 80px;
}

.hub-panel { display: none; }
.hub-panel.active {
  display: block;
  animation: hub-tab-in 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

#panel-home.active {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.home-fg {
  position: relative;
  z-index: 1;
  overflow: visible;
}

.home-top {
  display: block;
  margin-bottom: 28px;
}

.hub-hero {
  position: relative;
  z-index: 1;
  text-align: left;
  max-width: 40rem;
  padding-top: 4px;
}

.hub-hero::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 10px;
  width: 4px;
  height: calc(100% - 16px);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--hub-red), var(--hub-yellow), var(--hub-cyan));
  transform-origin: top;
  animation: hub-accent-grow 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-packages {
  position: relative;
  z-index: 2;
  padding-top: 8px;
  border-top: 1px solid rgba(28, 170, 217, 0.14);
  margin-top: 8px;
}

.hub-home-strip {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid rgba(29, 78, 216, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.08), rgba(255, 255, 255, 0.95));
  box-shadow: 0 10px 24px rgba(12, 61, 82, 0.06);
  animation: hub-rise 680ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hub-home-strip[hidden] { display: none !important; }

.hub-home-strip-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 16px 20px;
  align-items: end;
}

.hub-strip-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hub-muted);
  margin-bottom: 4px;
}

.hub-strip-progress strong {
  display: block;
  font-size: 16px;
  color: var(--hub-text);
  margin-bottom: 8px;
}

.hub-strip-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.12);
  overflow: hidden;
}

.hub-strip-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d4ed8, #1caad9);
  transition: width 420ms ease;
}

.hub-strip-attendance label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hub-muted);
  margin-bottom: 6px;
}

.hub-strip-attendance-row {
  display: flex;
  gap: 8px;
}

.hub-strip-attendance input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--hub-line);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hub-strip-attendance button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--hub-cyan);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.hub-strip-msg {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--hub-muted);
}

.hub-strip-msg.is-ok { color: #157347; font-weight: 700; }
.hub-strip-msg.is-err { color: #b42318; font-weight: 700; }

.hub-strip-portal {
  align-self: center;
  font-weight: 800;
  color: var(--hub-cyan-deep);
  text-decoration: none;
  white-space: nowrap;
}

.hub-strip-portal:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .hub-home-strip-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .hub-strip-portal { justify-self: start; }
}

@media (max-width: 820px) {
  .home-top {
    margin-bottom: 20px;
  }

  .hub-hero {
    max-width: none;
  }
}

@keyframes hub-fade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes hub-rise {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes hub-bg-drift {
  from { background-position: 0% 0%, 100% 0%, 0 0; }
  to { background-position: 8% 6%, 92% 4%, 0 0; }
}

@keyframes hub-accent-grow {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes hub-tab-in {
  from { opacity: 0; transform: translateY(16px); filter: blur(2px); }
  to { opacity: 1; transform: none; filter: none; }
}

.hub-hero h1 {
  margin: 0 0 10px;
  font-family: var(--hub-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--hub-text);
  animation: hub-rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hub-hero p {
  margin: 0;
  max-width: 42ch;
  color: var(--hub-muted);
  font-size: 18px;
  line-height: 1.5;
  animation: hub-rise 780ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

.hub-section-title {
  margin: 0 0 6px;
  font-family: var(--hub-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.hub-section-sub {
  margin: 0 0 18px;
  color: var(--hub-muted);
  font-size: 16px;
}

.package-grid,
.category-grid,
.library-grid {
  display: grid;
  gap: 16px;
}

.package-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 40px;
}

@media (max-width: 1100px) {
  .package-grid { grid-template-columns: 1fr 1fr; }
}

.package-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--hub-line);
  border-radius: 16px;
  background: var(--hub-panel);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(12, 61, 82, 0.06);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), border-color 220ms ease, box-shadow 280ms ease;
  animation: hub-rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.package-card:nth-child(1) { animation-delay: 120ms; }
.package-card:nth-child(2) { animation-delay: 200ms; }
.package-card:nth-child(3) { animation-delay: 280ms; }

.package-card:nth-child(1) { border-left: 3px solid var(--hub-yellow); }
.package-card:nth-child(2) { border-left: 3px solid var(--hub-cyan); }
.package-card:nth-child(3) { border-left: 3px solid var(--hub-red); }

.package-card:hover {
  transform: translateY(-6px);
  border-color: rgba(29, 78, 216, 0.45);
  box-shadow: 0 18px 40px rgba(12, 61, 82, 0.14);
}

.package-card .tag {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--hub-cyan-soft);
  color: var(--hub-cyan-deep);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: inset 0 0 0 1px rgba(28, 170, 217, 0.28);
}

.package-card:nth-child(1) .tag {
  background: rgba(245, 197, 24, 0.18);
  color: #8a6d12;
  box-shadow: inset 0 0 0 1px rgba(245, 197, 24, 0.35);
}

.package-card h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.package-card p {
  margin: 0;
  color: var(--hub-muted);
  font-size: 15px;
  line-height: 1.45;
}

.package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #5a7d92;
  font-size: 13px;
  font-weight: 600;
}

.home-subscriptions {
  position: relative;
  z-index: 2;
  margin: 8px 0 36px;
  padding-top: 28px;
  border-top: 1px solid rgba(28, 170, 217, 0.14);
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0 16px;
}

@media (max-width: 820px) {
  .subscription-grid { grid-template-columns: 1fr; }
}

.subscription-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--hub-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f3fafc 100%);
  box-shadow: 0 12px 30px rgba(12, 61, 82, 0.07);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 280ms ease;
  animation: hub-rise 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.subscription-card:nth-child(1) { animation-delay: 180ms; }
.subscription-card:nth-child(2) { animation-delay: 260ms; }

.subscription-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(12, 61, 82, 0.12);
}

.subscription-card.is-free { border-left: 4px solid #2e9b57; }
.subscription-card.is-paid { border-left: 4px solid #d4a017; }

.subscription-card .tag {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.subscription-card.is-free .tag {
  background: rgba(46, 155, 87, 0.14);
  color: #157347;
}

.subscription-card.is-paid .tag {
  background: rgba(212, 160, 23, 0.18);
  color: #8a6d12;
}

.subscription-card h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.sub-audience {
  margin: 0;
  color: #5a7d92;
  font-size: 14px;
  font-weight: 600;
}

.sub-price {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--hub-cyan-deep, #1d4ed8);
  letter-spacing: -0.02em;
}

.sub-price span {
  font-size: 14px;
  font-weight: 600;
  color: var(--hub-muted);
}

.subscription-card > p:not(.sub-audience):not(.sub-price) {
  margin: 0;
  color: var(--hub-muted);
  font-size: 15px;
  line-height: 1.45;
}

.subscription-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #3d5f72;
  font-size: 14px;
  line-height: 1.45;
}

.sub-cta {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1d4ed8;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.sub-cta:hover { background: #0b5a74; }

.sub-contact {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(29, 78, 216, 0.08);
  color: #0d2a3d;
  font-size: 15px;
}

.sub-contact a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

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

.category-card {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 24px;
  border: 1px solid var(--hub-line);
  border-radius: 18px;
  color: var(--hub-text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 12px 28px rgba(28, 120, 170, 0.12);
  background: linear-gradient(145deg, #dff3fb, #ffffff);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(28, 170, 217, 0.12));
  pointer-events: none;
}

.category-card.engineering {
  background:
    radial-gradient(ellipse 70% 80% at 0% 0%, rgba(28, 170, 217, 0.2), transparent 55%),
    linear-gradient(155deg, #cceef9 0%, #eaf6fc 48%, #ffffff 100%);
}

.category-card.engineering:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(28, 120, 170, 0.18);
  border-color: rgba(28, 170, 217, 0.45);
}

.category-card.science {
  background:
    radial-gradient(ellipse 70% 80% at 100% 0%, rgba(28, 170, 217, 0.22), transparent 55%),
    linear-gradient(155deg, #dff4fb 0%, #f3faff 48%, #ffffff 100%);
}

.category-card.science:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(28, 120, 170, 0.18);
  border-color: rgba(28, 170, 217, 0.45);
}

.category-card.explore-tow {
  background: linear-gradient(135deg, #d0eff9 0%, #f3faff 52%, #ffffff 100%);
  text-decoration: none;
  display: block;
}

.category-card.explore-youtype {
  background: linear-gradient(135deg, #1a1d21 0%, #0e1114 55%, #12161a 100%);
  color: #e8eaed;
  text-decoration: none;
  display: block;
  border-color: rgba(74, 222, 128, 0.28);
}
.category-card.explore-youtype h3,
.category-card.explore-youtype p {
  color: #e8eaed;
}
.category-card.explore-youtype p { opacity: 0.82; }
.category-card.explore-youtype .arrow { color: #4ade80; }

.explore-grid {
  grid-template-columns: repeat(2, minmax(0, 420px));
  gap: 18px;
}

@media (max-width: 820px) {
  .explore-grid { grid-template-columns: 1fr; }
}

.category-card h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.category-card p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 28ch;
  color: var(--hub-muted);
  font-size: 15px;
  line-height: 1.45;
}

.category-card .arrow {
  position: absolute;
  right: 20px;
  bottom: 18px;
  z-index: 1;
  font-size: 28px;
  color: var(--hub-cyan);
  opacity: 0.9;
}

.library-screen { display: none; }
.library-screen.open { display: block; }

.library-header {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
  padding: 28px 12px 8px;
}

.library-header::before {
  content: "";
  position: absolute;
  inset: -10px 0 0;
  background: radial-gradient(circle at 50% 18%, rgba(28, 170, 217, 0.22), transparent 48%);
  pointer-events: none;
}

.library-header > * { position: relative; }

.library-back {
  position: absolute;
  left: 0;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--hub-line);
  border-radius: 8px;
  color: var(--hub-text);
  background: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.library-back:hover {
  border-color: rgba(28, 170, 217, 0.5);
  background: #dbeafe;
  color: var(--hub-cyan-deep);
}

.library-header h2 {
  margin: 0 0 8px;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--hub-text);
}

.library-header .request {
  color: var(--hub-cyan-deep);
  font-size: 16px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.library-header .request:hover { color: #0d2a3d; }

.library-groups {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.library-group-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hub-muted);
}

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

.lib-card {
  position: relative;
  overflow: hidden;
  display: block;
  min-height: 148px;
  padding: 16px 14px;
  border: 1px solid rgba(28, 170, 217, 0.2);
  border-radius: 12px;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(28, 120, 170, 0.14);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.lib-card:hover {
  transform: translateY(-4px) scale(1.01);
  filter: brightness(1.05);
  box-shadow: 0 16px 34px rgba(28, 120, 170, 0.22);
}

.lib-card h3 {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 62%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  background: rgba(8, 30, 48, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  color: #ffffff;
}

.lib-card.c-bone h3,
.lib-card.c-brain h3,
.lib-card.c-diaphragm h3,
.lib-card.c-urinary h3 {
  background: rgba(8, 30, 48, 0.62);
  color: #ffffff;
}

.lib-card .thumb {
  position: absolute;
  right: -6%;
  bottom: -8%;
  width: 58%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.18));
  opacity: 0.92;
}

.lib-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.08) 42%, transparent 68%);
}

.lib-card.c-bone::after,
.lib-card.c-brain::after,
.lib-card.c-diaphragm::after,
.lib-card.c-urinary::after {
  background: linear-gradient(90deg, rgba(0,0,0,0.22) 0%, rgba(0,0,0,0.06) 42%, transparent 68%);
}

.lib-card .icon {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 14px;
}

.lib-card.c-maroon { background: linear-gradient(145deg, #9a3d4c, var(--lib-maroon)); }
.lib-card.c-teal { background: linear-gradient(145deg, #2a9aa8, var(--lib-teal)); }
.lib-card.c-blue { background: linear-gradient(145deg, #3f78d0, var(--lib-blue)); }
.lib-card.c-sky { background: linear-gradient(145deg, #4aa6e0, var(--lib-sky)); }
.lib-card.c-navy { background: linear-gradient(145deg, #2a5588, var(--lib-navy)); }
.lib-card.c-green { background: linear-gradient(145deg, #3a8a60, var(--lib-green)); }
.lib-card.c-olive { background: linear-gradient(145deg, #86b040, var(--lib-olive)); }
.lib-card.c-brown { background: linear-gradient(145deg, #96704c, var(--lib-brown)); }
.lib-card.c-purple { background: linear-gradient(145deg, #6e5aa0, var(--lib-purple)); }
.lib-card.c-body { background: linear-gradient(145deg, #a83a4a, var(--org-body)); }
.lib-card.c-heart { background: linear-gradient(145deg, #d42a3c, var(--org-heart)); color: #fff; }
.lib-card.c-bone { background: linear-gradient(145deg, #d6c8b0, var(--org-bone)); color: #3a3228; }
.lib-card.c-bone .icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.lib-card.c-muscle { background: linear-gradient(145deg, #c04a4a, var(--org-muscle)); }
.lib-card.c-brain { background: linear-gradient(145deg, #d8b4bc, var(--org-brain)); color: #3a2a30; }
.lib-card.c-brain .icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.lib-card.c-diaphragm { background: linear-gradient(145deg, #d8a0a0, var(--org-diaphragm)); color: #3a2828; }
.lib-card.c-diaphragm .icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.lib-card.c-digestive { background: linear-gradient(145deg, #d8926e, var(--org-digestive)); }
.lib-card.c-urinary { background: linear-gradient(145deg, #d8b47a, var(--org-urinary)); color: #3a3220; }
.lib-card.c-urinary .icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.lib-card.c-eye { background: linear-gradient(145deg, #5a8ec4, var(--org-eye)); }
.lib-card.c-flower { background: linear-gradient(145deg, #7ab05a, var(--org-flower)); }
.lib-card.c-insect { background: linear-gradient(145deg, #8a7350, var(--org-insect)); }
.lib-card.c-orange { background: linear-gradient(145deg, #e07830, var(--lib-orange)); }
.lib-card.c-eagle { background: linear-gradient(145deg, #3a5a78, #1a3348); }
.lib-card.c-horse { background: linear-gradient(145deg, #8a6a48, #5a4030); }
.lib-card.c-hyena { background: linear-gradient(145deg, #a89060, #6a5538); }
.lib-card.c-bear { background: linear-gradient(145deg, #5a4638, #2e241c); }
.lib-card.c-wildebeest { background: linear-gradient(145deg, #7a6a58, #4a4034); }
.lib-card.c-warthog { background: linear-gradient(145deg, #9a7a58, #5a4430); }
.lib-card.c-guineafowl { background: linear-gradient(145deg, #5a6a78, #2e3844); }
.lib-card.c-lioness { background: linear-gradient(145deg, #c4a050, #8a6830); }
.lib-card.c-wolf { background: linear-gradient(145deg, #6a7078, #3a4048); }
.lib-card.c-alligator { background: linear-gradient(145deg, #4a7a48, #2a4828); }
.lib-card.c-buffalo { background: linear-gradient(145deg, #6a5040, #3a2c24); }
.lib-card.c-fox { background: linear-gradient(145deg, #d07838, #8a4820); }
.lib-card.c-raven { background: linear-gradient(145deg, #3a3a44, #1a1a22); }
.lib-card.c-lion { background: linear-gradient(145deg, #d0a040, #8a6820); }
.lib-card.c-goose { background: linear-gradient(145deg, #6a8a78, #3a5448); }
.lib-card.c-boar { background: linear-gradient(145deg, #7a5a48, #422e24); }

/* —— Library screens: shared category bands + blended model cards —— */
#library-science .library-header,
#library-engineering .library-header {
  margin-bottom: 36px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(28, 170, 217, 0.16);
}

#science-grid,
#engineering-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.sci-group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(28, 170, 217, 0.18);
}

.sci-group-head h3 {
  margin: 0 0 4px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--hub-text);
  text-transform: none;
}

.sci-group-head p {
  margin: 0;
  max-width: 42ch;
  color: var(--hub-muted);
  font-size: 15px;
  line-height: 1.4;
}

.sci-count {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid rgba(28, 170, 217, 0.22);
  border-radius: 999px;
  background: transparent;
  color: var(--hub-cyan-deep);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sci-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 18px;
}

.sci-card {
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--hub-text);
  text-decoration: none;
  box-shadow: none;
  transition: transform 200ms ease;
}

.sci-card:hover {
  transform: translateY(-4px);
}

.sci-card:hover .sci-card-go {
  color: var(--hub-cyan-deep);
  transform: translateX(3px);
}

.sci-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: visible;
  background: transparent;
}

.sci-heavy-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(20, 40, 56, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sci-heavy-badge.is-warn {
  background: rgba(180, 110, 20, 0.92);
}

.sci-heavy-badge.is-lite {
  background: rgba(20, 120, 90, 0.92);
}

.sci-card.is-heavy-locked {
  opacity: 0.72;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.sci-card.is-heavy-locked .sci-card-go {
  color: #9a6b2f;
}

.library-bw-tip {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(28, 170, 217, 0.22);
  border-radius: 12px;
  background: rgba(232, 246, 252, 0.9);
  color: var(--hub-muted);
  font-size: 14px;
  line-height: 1.45;
}

.library-bw-tip .tip-lite {
  color: #0f7a5c;
  font-weight: 700;
}

.library-quality {
  margin: 14px auto 0;
  max-width: 520px;
  text-align: center;
}

.library-quality--gate {
  margin: 0 auto 22px;
}

.library-quality-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hub-muted);
}

.library-quality-switch {
  display: inline-flex;
  border: 1px solid rgba(28, 170, 217, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.library-quality-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 10px 16px;
  min-width: 132px;
  background: transparent;
  color: var(--hub-text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.library-quality-btn + .library-quality-btn {
  border-left: 1px solid rgba(28, 170, 217, 0.28);
}

.library-quality-btn.is-active {
  background: #1d4ed8;
  color: #fff;
}

.library-quality-hint {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--hub-muted);
}

.sci-heavy-badge.is-teacher {
  background: rgba(120, 55, 20, 0.92);
}

.sci-group.is-teacher-group {
  padding: 14px;
  border: 1px dashed rgba(154, 107, 47, 0.45);
  border-radius: 14px;
  background: rgba(255, 248, 235, 0.65);
}

.sci-card.is-teacher-demo {
  outline: 1px solid rgba(154, 107, 47, 0.35);
}

@media (max-width: 640px) {
  .library-quality-btn {
    min-width: 0;
    flex: 1;
    padding: 10px 12px;
  }

  .library-quality-switch {
    display: flex;
    width: 100%;
  }
}

.sci-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  filter: drop-shadow(0 10px 22px rgba(28, 120, 170, 0.14));
  transition: transform 280ms ease;
  background: #eef7fb;
  border-radius: 12px;
}

.sci-card-media img.is-fallback {
  object-fit: contain;
  padding: 18%;
  opacity: 0.85;
  filter: none;
}

.sci-card:hover .sci-card-media img {
  transform: scale(1.04);
}

.sci-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 6px 4px;
  border-top: 0;
  background: transparent;
}

.sci-card-cat {
  color: var(--hub-cyan-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sci-card-body h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--hub-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.sci-card-go {
  margin-top: 2px;
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 700;
  transition: color 180ms ease, transform 180ms ease;
}

.lessons-panel {
  color: var(--hub-text);
  background: #ffffff;
  border: 1px solid var(--hub-line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(28, 120, 170, 0.1);
}

.lessons-panel .hub-section-title,
.lessons-panel .hub-section-sub { color: inherit; }
.lessons-panel .hub-section-sub { color: var(--hub-muted); }

.lessons-panel .name-box input,
.lessons-panel input[type="text"] {
  background: #f3faff;
  border: 1px solid var(--hub-line);
  color: var(--hub-text);
}

.lessons-panel #welcome-line {
  color: var(--hub-muted) !important;
}

.auth-once-tip {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(28, 170, 217, 0.25);
  background: rgba(232, 246, 252, 0.95);
  color: var(--hub-muted);
  font-size: 14px;
  line-height: 1.45;
}

#library-gate .auth-once-tip {
  margin: 12px auto 0;
  max-width: 640px;
  text-align: left;
}

.teacher-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(154, 107, 47, 0.4);
  background: rgba(255, 248, 235, 0.7);
}

.teacher-tools-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9a6b2f;
}

.teacher-reset-btn {
  font-size: 13px !important;
  padding: 8px 12px !important;
}

.path-exercise-tag {
  display: inline-block;
  margin: 6px 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 122, 92, 0.12);
  border: 1px solid rgba(15, 122, 92, 0.28);
  color: #0f7a5c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.path-heading .teacher-reset-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.subject-grid {
  margin-top: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#academic-view .subject-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 820px) {
  #academic-view .subject-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  #academic-view .subject-grid { grid-template-columns: 1fr; }
}

.subject-card {
  min-height: 168px;
  width: 100%;
}

.subject-card .subject-tag {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hub-cyan);
}

.path-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.path-heading-title {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--hub-text);
}

.path-heading-sub {
  margin: 0;
  color: var(--hub-muted);
  font-size: 15px;
}

.subject-mechanics {
  background:
    radial-gradient(ellipse 70% 80% at 0% 0%, rgba(28, 170, 217, 0.2), transparent 55%),
    linear-gradient(155deg, #cceef9 0%, #eaf6fc 48%, #ffffff 100%);
}

.subject-it {
  background:
    radial-gradient(ellipse 70% 80% at 100% 0%, rgba(40, 150, 120, 0.18), transparent 55%),
    linear-gradient(155deg, #dff7f1 0%, #f3faff 48%, #ffffff 100%);
}

.subject-programming {
  background:
    radial-gradient(ellipse 70% 80% at 0% 100%, rgba(28, 120, 200, 0.16), transparent 55%),
    linear-gradient(155deg, #d9eefc 0%, #f5faff 48%, #ffffff 100%);
}

.subject-electricity {
  background:
    radial-gradient(ellipse 70% 80% at 100% 100%, rgba(220, 170, 40, 0.18), transparent 55%),
    linear-gradient(155deg, #fff4d8 0%, #fffaf0 48%, #ffffff 100%);
}

.subject-science {
  background:
    radial-gradient(ellipse 70% 80% at 100% 0%, rgba(28, 170, 217, 0.22), transparent 55%),
    linear-gradient(155deg, #dff4fb 0%, #f3faff 48%, #ffffff 100%);
}

@media (max-width: 820px) {
  .subject-grid { grid-template-columns: 1fr 1fr; }
  .path-heading { flex-direction: column; }
  .academic-chips { gap: 8px; }
  .academic-chip { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 560px) {
  .subject-grid { grid-template-columns: 1fr; }
  .academic-actions { flex-direction: column; align-items: stretch; }
  .academic-actions .button { width: 100%; text-align: center; }
}

.academic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 18px;
}

.academic-chip {
  border: 1px solid var(--hub-line);
  background: #f3faff;
  color: var(--hub-text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  min-height: 44px;
}

.grade-card {
  min-height: 140px;
  padding: 18px;
}

.grade-card h3 {
  font-size: 22px;
}

#academic-view .path-heading {
  flex-wrap: wrap;
}

#academic-view .academic-actions .button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.academic-chip:hover {
  border-color: rgba(28, 170, 217, 0.45);
}

.academic-chip.is-on {
  background: rgba(28, 170, 217, 0.14);
  border-color: rgba(28, 170, 217, 0.55);
  color: #0d5f7c;
}

.academic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.academic-hint {
  margin: 0 0 14px;
  color: var(--hub-muted);
  font-size: 15px;
}

.academic-selected-meta {
  margin: 0 0 14px;
  color: var(--hub-muted);
  font-size: 14px;
}

.grade-card .subject-tag {
  text-transform: none;
  letter-spacing: 0.02em;
}

@media (max-width: 1100px) {
  .library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sci-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .hub-topbar { flex-wrap: wrap; padding: 12px 14px; }
  .hub-return-school { order: -1; width: 100%; justify-content: center; margin: 0 0 6px; }
  .hub-tabs { order: 3; width: 100%; justify-content: center; margin-left: 0; }
  .package-grid,
  .category-grid,
  .library-grid,
  .sci-grid { grid-template-columns: 1fr 1fr; }
  .library-back { position: static; margin-bottom: 12px; }
  .sci-group-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .lib-card h3 { max-width: 70%; font-size: 17px; }
}

@media (max-width: 560px) {
  .package-grid,
  .category-grid,
  .library-grid,
  .sci-grid { grid-template-columns: 1fr; }
}

/* Tanza motion system */
.hub-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hub-reveal.is-in {
  opacity: 1;
  transform: none;
}

.staff-login-card:hover,
.category-card:hover,
.explore-tow:hover,
.explore-youtype:hover {
  transform: translateY(-5px);
}

.category-card,
.explore-tow,
.explore-youtype {
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 280ms ease, border-color 220ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .hub-body,
  .hub-hero h1,
  .hub-hero p,
  .hub-hero::before,
  .hub-panel.active,
  .package-card,
  .subscription-card,
  .hub-reveal {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .hub-body {
    background-size: auto;
  }
}

/* Mobile readability pass — keep hub cards single-column at phone widths. */
@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .hub-body {
    font-size: 15px;
    line-height: 1.5;
  }

  .hub-hero h1 {
    font-size: clamp(1.5rem, 7vw, 2.15rem);
  }

  .hub-hero p,
  .hub-panel p,
  .lib-card p {
    font-size: 14px;
  }

  button,
  .btn,
  .hub-tabs a,
  .hub-return-school {
    font-size: 15px;
    min-height: 42px;
  }

  .lib-card h3,
  .category-card h3 {
    font-size: 1.1rem;
  }
}
