/* MathMelo Official Website Stylesheet — Oil-UI Enhanced & WCAG AAA Accessible */
:root {
  --bg: #fffbf5;
  --bg-2: #fcf1e4;
  --card: #ffffff;
  --ink: #2b1f48;
  --muted: #5e537d;
  --purple: #6d4aff;
  --purple-hover: #5835eb;
  --purple-soft: #ede8ff;
  --coral: #ff6060;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --teal: #059669;
  --teal-soft: #d1fae5;
  --line: rgba(43, 31, 72, 0.08);
  --line-strong: rgba(43, 31, 72, 0.14);
  --shadow: 0 16px 40px rgba(43, 31, 72, 0.09);
  --shadow-sm: 0 4px 14px rgba(43, 31, 72, 0.05);
  --round: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 48%, var(--bg) 100%);
  min-height: 100vh;
}

/* Bilingual Language Toggling */
html[lang="en"] .zh, html[lang="zh-Hans"] .en { display: none !important; }

a { color: var(--purple); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--purple-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--round); line-height: 1.25; letter-spacing: -0.015em; color: var(--ink); }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* Navigation Bar */
.bar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 251, 245, 0.92);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 3px 8px rgba(43, 31, 72, 0.15); }
.brand-name { font: 800 22px/1 var(--round); letter-spacing: -0.02em; }
.bar nav { display: flex; align-items: center; gap: 20px; }
.bar nav a {
  color: var(--muted); font: 700 15px/1 var(--round);
  transition: color 0.15s;
}
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--purple); }

/* Language Switcher Button */
.lang {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 14px/1 var(--round); color: var(--ink); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 14px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: all 0.18s ease;
}
.lang:hover {
  border-color: var(--purple); color: var(--purple); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 74, 255, 0.15);
}
.lang svg { width: 15px; height: 15px; fill: currentColor; }

/* Hero Section */
.hero {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px;
  align-items: center; padding: 64px 24px 56px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font: 800 13px/1 var(--round); letter-spacing: 0.05em; text-transform: uppercase;
  color: #92400e; background: var(--amber-soft); padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.28);
}
.hero h1 { font-size: clamp(38px, 5.8vw, 62px); font-weight: 900; margin: 20px 0 16px; }
.hero h1 .accent {
  background: linear-gradient(135deg, #6d4aff 0%, #ec4899 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.lede { font-size: 18.5px; line-height: 1.65; color: var(--muted); margin-bottom: 30px; max-width: 32em; }
.lede strong { color: var(--ink); }

.cta-group { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px;
  border-radius: 18px; font: 800 16px/1 var(--round); text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff7a60 0%, #eb4d35 100%);
  box-shadow: 0 4px 0 #be321d, 0 12px 24px rgba(235, 77, 53, 0.35);
  cursor: default;
}
.btn.ghost {
  color: var(--purple); background: var(--card);
  border: 2px solid var(--purple-soft); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--purple); }

.meta-badges {
  margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.badge-item {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, 0.75);
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-strong);
}

/* Phone Mockup Art */
.hero-art { position: relative; justify-self: center; width: min(340px, 100%); }
.phone-frame {
  border-radius: 46px; padding: 11px; background: #1c1a2e;
  box-shadow: 0 32px 72px rgba(43, 31, 72, 0.28);
}
.phone-frame img { border-radius: 36px; }

/* Floating Mascot Stickers */
.mascot-sticker {
  position: absolute; filter: drop-shadow(0 10px 18px rgba(43, 31, 72, 0.22));
  animation: float 4s ease-in-out infinite alternate;
}
.mascot-sticker.cat {
  width: 120px; left: -68px; bottom: 48px; animation-duration: 4.2s;
}
.mascot-sticker.hamster {
  width: 105px; right: -50px; top: 60px; animation-duration: 3.8s;
}
.mascot-sticker.penguin {
  width: 100px; right: -42px; bottom: 90px; animation-duration: 4.6s;
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(3deg); }
}

/* Section Common */
section { padding: 64px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(28px, 4.5vw, 42px); font-weight: 900; }
.section-head p { color: var(--muted); font-size: 17.5px; margin-top: 12px; }

/* Feature Cards Grid */
.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 32px 28px; box-shadow: var(--shadow-sm); display: flex;
  flex-direction: column; gap: 16px; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon {
  width: 54px; height: 54px; border-radius: 16px; display: flex;
  align-items: center; justify-content: center; font-size: 26px;
}
.feature-card h3 { font-size: 20px; font-weight: 800; }
.feature-card p { color: var(--muted); font-size: 15px; line-height: 1.62; }

/* Storybook Scenes Showcase */
.scenes-showcase {
  background: #fbf6ee; border: 1px solid var(--line-strong); border-radius: 32px;
  padding: 44px 36px; box-shadow: var(--shadow-sm);
}
.scenes-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-top: 28px;
}
.scene-pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; display: flex; align-items: center; gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.scene-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.scene-pill img { width: 44px; height: 44px; border-radius: 12px; }
.scene-pill strong { font-family: var(--round); font-size: 15px; display: block; color: var(--ink); }
.scene-pill span { font-size: 12.5px; color: var(--muted); }

/* Screenshots Carousel/Grid - WCAG AAA Contrast Fixed */
.shots-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.shot-card {
  background: #1c1a2e; border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px; padding: 10px 10px 14px 10px;
  box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.shot-card:hover { transform: translateY(-4px); box-shadow: 0 20px 48px rgba(43, 31, 72, 0.22); }
.shot-card img { border-radius: 20px; }
.shot-caption {
  text-align: center; margin-top: 10px; font-weight: 700;
  font-family: var(--round); font-size: 14px; color: #ffffff;
  padding: 4px 6px 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Parent Trust & Privacy Banner */
.trust-banner {
  background: linear-gradient(135deg, #ede8ff 0%, #fdf5ea 100%);
  border: 1px solid rgba(109, 74, 255, 0.18); border-radius: 32px;
  padding: 48px 40px; display: grid; grid-template-columns: 1fr 1fr;
  gap: 36px; align-items: center;
}
.trust-list { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.trust-item {
  display: flex; align-items: flex-start; gap: 12px; font-size: 15px;
  color: var(--ink); line-height: 1.55;
}
.trust-check {
  width: 22px; height: 22px; border-radius: 50%; background: var(--teal);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; flex: none; margin-top: 2px;
}

/* Footer */
footer {
  border-top: 1px solid var(--line); padding: 48px 0; background: var(--card);
}
.footer-wrap {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 20px;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--muted); font-size: 14px; font-weight: 600; }
.footer-links a:hover { color: var(--purple); }
.copyright { font-size: 14px; color: var(--muted); }

/* Document Layout (Support & Privacy & 404) */
.doc { max-width: 820px; padding: 48px 24px 80px; }
.doc h1 { font-size: 38px; margin-bottom: 12px; }
.doc .meta { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.doc h2 { font-size: 24px; margin: 36px 0 12px; }
.doc h3 { font-size: 18px; margin: 22px 0 8px; }
.doc p { margin-bottom: 16px; color: var(--ink); line-height: 1.7; }
.doc ul { margin: 0 0 18px 24px; color: var(--ink); line-height: 1.7; }
.doc li { margin-bottom: 6px; }
.doc table {
  width: 100%; border-collapse: collapse; margin: 20px 0 28px;
  font-size: 14.5px;
}
.doc th, .doc td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line);
}
.doc th { background: rgba(43, 31, 72, 0.04); font-weight: 700; font-family: var(--round); }
.summary-box {
  background: var(--amber-soft); border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 18px; padding: 20px 24px; margin-bottom: 32px;
}
.summary-box p { margin: 0; color: #92400e; font-size: 15px; }

/* 404 Page Styles */
.error-box {
  text-align: center; padding: 80px 24px; max-width: 580px; margin: 0 auto;
}
.error-box img { width: 140px; height: 140px; margin: 0 auto 24px; }
.error-box h1 { font-size: 42px; margin-bottom: 16px; }
.error-box p { font-size: 18px; color: var(--muted); margin-bottom: 32px; }

/* Responsive adjustments */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .lede { margin-left: auto; margin-right: auto; }
  .cta-group { justify-content: center; }
  .meta-badges { justify-content: center; }
  .hero-art .cat { left: -10px; bottom: -20px; }
  .hero-art .hamster { right: -10px; top: -10px; }
  .hero-art .penguin { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .shots-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-banner { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
