:root {
  --sky: #4aa3ff;
  --sky-deep: #2f7ff0;
  --grape: #7c6cff;
  --sun: #ffb020;
  --coral: #ff7a66;
  --mint: #29d3a6;
  --pink: #ff8fc7;
  --ink: #23314f;
  --ink-soft: #5a6b8c;
  --muted: #8b98b4;
  --line: #eef1f9;
  --bg: #f2f6ff;
  --card: #ffffff;
  --shadow-sm: 0 8px 22px rgba(52, 90, 175, 0.08);
  --shadow-md: 0 16px 40px rgba(52, 90, 175, 0.14);
  --shadow-lg: 0 24px 60px rgba(47, 127, 240, 0.24);
  --radius: 24px;
  --radius-lg: 30px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Nunito", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 12% -6%, #dcecff 0%, rgba(220, 236, 255, 0) 60%),
    radial-gradient(900px 420px at 108% 4%, #ffe6d6 0%, rgba(255, 230, 214, 0) 55%),
    var(--bg);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.view {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 16px 30px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 22px 26px;
  color: #fff;
  border-radius: 32px;
  background: linear-gradient(150deg, #5aa8ff 0%, #6f7bff 52%, #9a6bff 100%);
  box-shadow: var(--shadow-lg);
}

.hero .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
}

.hero .blob.b1 {
  top: -40px;
  right: -30px;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.35);
}

.hero .blob.b2 {
  bottom: -60px;
  left: -30px;
  width: 140px;
  height: 140px;
  background: rgba(255, 176, 32, 0.55);
}

.hero .blob.b3 {
  top: 40px;
  right: 40px;
  width: 60px;
  height: 60px;
  background: rgba(41, 211, 166, 0.6);
}

.hero-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  font-size: 24px;
}

.hero-logo img {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
}

.hero-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hero-brand small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  opacity: 0.85;
}

.hero h1 {
  position: relative;
  z-index: 2;
  margin: 20px 0 8px;
  font-size: 27px;
  line-height: 1.25;
}

.hero h1 em {
  font-style: normal;
  color: #fff2c4;
}

.hero p {
  position: relative;
  z-index: 2;
  max-width: 280px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.hero-tags span {
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.hero-main {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-text {
  flex: 1 1 auto;
  min-width: 0;
}

.hero-mascot {
  flex: 0 0 auto;
  width: 118px;
  margin-right: -6px;
  animation: float 4.5s ease-in-out infinite;
}

.hero-mascot .mascot-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 16px rgba(20, 30, 70, 0.28));
}

.hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.hero-emoji {
  position: absolute;
  z-index: 1;
  font-size: 30px;
  opacity: 0.9;
  animation: float 4s ease-in-out infinite;
}

.hero-emoji.e2 { top: 58px; right: 14px; font-size: 20px; opacity: .9; animation-delay: .6s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-9px) rotate(4deg); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--sky-deep);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn.light {
  color: var(--sky-deep);
  background: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.btn.sun {
  background: linear-gradient(135deg, #ffc93c, #ff9f1c);
  color: #6a3b00;
}

.btn.ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn.full {
  width: 100%;
}

/* ---------- Age groups ---------- */
.age-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.age-card {
  position: relative;
  overflow: hidden;
  padding: 14px 10px 16px;
  border-radius: 22px;
  color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.age-card:active {
  transform: translateY(2px) scale(0.98);
}

.age-card .emoji {
  font-size: 30px;
}

.age-card .age {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
}

.age-card .tag {
  margin-top: 2px;
  font-size: 11.5px;
  opacity: 0.92;
}

.age-card.a1 { background: linear-gradient(150deg, #ff9a8b, #ff6a88); }
.age-card.a2 { background: linear-gradient(150deg, #43cea2, #1c9dea); }
.age-card.a3 { background: linear-gradient(150deg, #7f7fff, #b06bff); }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
}

.stat-card {
  padding: 13px 6px;
  text-align: center;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.stat-card strong {
  display: block;
  font-size: 20px;
  background: linear-gradient(120deg, var(--sky-deep), var(--grape));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Sections ---------- */
.section {
  margin-top: 26px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.section-title .dot {
  width: 10px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--sun), var(--coral));
}

.section-link {
  color: var(--sky-deep);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Course cards ---------- */
.course-grid {
  display: grid;
  gap: 14px;
}

.course-card {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.course-card:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: var(--shadow-md);
}

.course-cover {
  position: relative;
  height: 158px;
  background: linear-gradient(135deg, #dcecff, #eef4ff);
}

.course-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-cover .cover-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 48px;
}

.course-cover .badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 12px;
  color: #fff;
  border-radius: 999px;
  background: rgba(47, 127, 240, 0.92);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(47, 127, 240, 0.3);
}

.badge.sun {
  background: linear-gradient(135deg, #ffc93c, #ff9f1c);
  color: #6a3b00;
  box-shadow: 0 6px 14px rgba(255, 159, 28, 0.35);
}

.course-body {
  padding: 15px 15px 16px;
}

.course-title {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
}

.course-desc,
.article-desc,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--sky-deep);
  font-weight: 700;
}

.pill.mint { background: #e4fbf4; color: #12a37c; }
.pill.pink { background: #ffeef6; color: #e65fa0; }
.pill.sun { background: #fff4de; color: #cc7a00; }

/* ---------- Article / lesson / profile / login ---------- */
.article-list {
  display: grid;
  gap: 12px;
}

.article-card,
.lesson-card,
.profile-card,
.login-card,
.empty-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.article-card {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 12px;
  align-items: center;
  transition: transform 0.15s ease;
}

.article-card:active {
  transform: scale(0.99);
}

.article-thumb {
  width: 86px;
  height: 86px;
  border-radius: 18px;
  object-fit: cover;
  background: #eaf1ff;
}

.article-thumb.cover-fallback {
  display: grid;
  place-items: center;
  font-size: 30px;
}

.article-title,
.lesson-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
}

/* ---------- Outcomes ---------- */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.outcome-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.outcome-ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  font-size: 24px;
  flex: 0 0 auto;
}

.outcome-ico.i1 { background: #fff1de; }
.outcome-ico.i2 { background: #e3f7ef; }
.outcome-ico.i3 { background: #eaeeff; }
.outcome-ico.i4 { background: #ffe9f2; }
.outcome-ico.i5 { background: #e6f7ff; }

.outcome-card b {
  display: block;
  font-size: 14.5px;
}

.outcome-card span {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Public program intro / locked course ---------- */
.program-card,
.locked-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(180px 120px at 100% 0%, rgba(255, 176, 32, 0.18), transparent 70%),
    radial-gradient(180px 120px at 0% 100%, rgba(74, 163, 255, 0.16), transparent 70%),
    #fff;
  box-shadow: var(--shadow-md);
}

.program-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--sky-deep);
  background: #eaf4ff;
  font-size: 12px;
  font-weight: 800;
}

.program-card h3,
.locked-card h2 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.35;
}

.program-card p,
.locked-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.program-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.program-steps span {
  padding: 8px 10px;
  border-radius: 14px;
  color: #405174;
  background: #f3f7ff;
  font-size: 12px;
  font-weight: 700;
}

.locked-card {
  margin-top: 22px;
  text-align: center;
}

.lock-ico {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 26px;
  background: linear-gradient(150deg, #eaf4ff, #f2eaff);
  font-size: 34px;
}

.locked-card .btn {
  margin-top: 18px;
}

/* ---------- School chips ---------- */
.school-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.school-chips::-webkit-scrollbar {
  display: none;
}

.school-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  color: #45557a;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- Page head / detail ---------- */
.page-head {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -14px -16px 16px;
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, rgba(242, 246, 255, 0.96), rgba(242, 246, 255, 0.75));
  backdrop-filter: blur(10px);
}

.back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-cover {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: #e6eeff;
}

.detail-cover.cover-fallback {
  display: grid;
  place-items: center;
  height: 190px;
  font-size: 60px;
}

.detail-card {
  margin-top: 14px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.detail-card .page-title {
  white-space: normal;
}

.rich-text {
  overflow: hidden;
  margin-top: 12px;
  color: #35456a;
  font-size: 15px;
  line-height: 1.9;
}

.rich-text img,
.rich-text video {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 16px;
  margin: 6px 0;
}

video {
  width: 100%;
  border-radius: 18px;
  background: #000;
  margin-top: 8px;
}

.lesson-card {
  display: block;
  transition: transform 0.15s ease;
}

.lesson-card:active {
  transform: scale(0.99);
}

.lesson-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--sky), var(--grape));
  font-size: 13px;
  font-weight: 800;
}

/* ---------- Search ---------- */
.search-box {
  position: sticky;
  top: 62px;
  z-index: 6;
  padding: 4px 0 12px;
}

.search-box input,
.login-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input:focus,
.login-card input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(74, 163, 255, 0.15);
}

/* ---------- Login ---------- */
.login-hero {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 22px 0 10px;
  text-align: center;
}

.login-hero .mascot {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 32px;
  background: linear-gradient(150deg, #cfe4ff, #e7dbff);
  box-shadow: var(--shadow-md);
  animation: float 4.5s ease-in-out infinite;
}

.login-hero .mascot .mascot-svg {
  width: 78px;
  height: auto;
}

.login-hero h1 {
  margin: 6px 0 0;
  font-size: 23px;
}

.login-card {
  margin-top: 12px;
}

.login-card label {
  display: block;
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  margin-top: 7px;
}

/* ---------- Profile ---------- */
.profile-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  color: #fff;
  background: linear-gradient(150deg, #4aa3ff, #7c6cff);
  box-shadow: var(--shadow-md);
}

.profile-card .avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 4px auto 12px;
  border-radius: 26px;
  color: var(--sky-deep);
  background: #fff;
  font-size: 30px;
  font-weight: 800;
}

.profile-card .page-title {
  color: #fff;
}

.profile-card .muted {
  color: rgba(255, 255, 255, 0.85);
}

.profile-card .pill {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.profile-menu {
  margin-top: 14px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.profile-menu a:last-child {
  border-bottom: 0;
}

.profile-menu .mi {
  font-size: 20px;
}

.profile-menu .arrow {
  margin-left: auto;
  color: var(--muted);
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 -8px 30px rgba(52, 90, 175, 0.08);
}

.tabbar-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 54px;
  color: #9aa6c4;
  border-radius: 18px;
  font-size: 11.5px;
  font-weight: 700;
  transition: color 0.15s ease, background 0.15s ease;
}

.tabbar-item.active {
  color: var(--sky-deep);
}

.tabbar-item.active .tabbar-icon {
  transform: translateY(-2px) scale(1.06);
  background: linear-gradient(135deg, #eaf3ff, #efeaff);
}

.tabbar-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  border-radius: 14px;
  font-size: 19px;
  transition: transform 0.18s ease, background 0.18s ease;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  z-index: 60;
  max-width: 80vw;
  transform: translateX(-50%) translateY(16px);
  padding: 11px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(35, 49, 79, 0.94);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Empty ---------- */
.empty-card {
  text-align: center;
  padding: 34px 20px;
}

.empty-card .emoji {
  font-size: 44px;
}

.empty-card h3 {
  margin: 10px 0 6px;
  font-size: 17px;
}

/* ---------- Skeleton ---------- */
.skeleton {
  display: grid;
  gap: 14px;
}

.skeleton-hero,
.skeleton-card {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #e6edfb, #f6f9ff, #e6edfb);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite;
}

.skeleton-hero {
  height: 210px;
}

.skeleton-card {
  height: 120px;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.fade-in {
  animation: fadeIn 0.32s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 360px) {
  .view {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero {
    padding: 20px 18px 24px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero-mascot {
    width: 96px;
    margin-right: -10px;
  }

  .hero-tags span {
    font-size: 10px;
    padding: 5px 8px;
  }
}

@media (min-width: 520px) {
  body {
    padding: 12px 0;
  }

  .view {
    border-radius: 30px;
    box-shadow: var(--shadow-md);
  }
}
