:root {
  --bg: #fff1d6;
  --text: #3a2f24;
  --panel: #fffdf8;
  --brand: #ef7d2f;
  --brand-deep: #d96518;
  --brand2: #5fba6d;
  --brand3: #5aa0e3;
  --shadow: rgba(92, 78, 59, 0.14);
  --ink-soft: #6e6154;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  touch-action: manipulation;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, #ffe7a8 0%, transparent 32%),
    radial-gradient(circle at 92% 6%, #d4f0dc 0%, transparent 28%),
    radial-gradient(circle at 50% 100%, #ffdcc8 0%, transparent 36%),
    linear-gradient(180deg, #fff6e4 0%, var(--bg) 42%, #ffe8c8 100%);
  background-attachment: fixed;
}

.home-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 14px 40px;
  display: grid;
  gap: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 196, 120, 0.45) 0%, transparent 34%),
    radial-gradient(circle at 12% 88%, rgba(122, 201, 140, 0.28) 0%, transparent 36%),
    linear-gradient(145deg, #fff9ef 0%, #fff3df 55%, #ffe8c8 100%);
  border-radius: 28px;
  box-shadow: 0 14px 28px var(--shadow);
  border: 2px solid rgba(255, 210, 150, 0.55);
  padding: 22px 20px 18px;
  display: grid;
  gap: 18px;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.55;
}

.hero::before {
  width: 120px;
  height: 120px;
  right: -24px;
  top: -28px;
  background: radial-gradient(circle, #ffd27a 0%, transparent 70%);
  animation: glowPulse 4.2s ease-in-out infinite;
}

.hero::after {
  width: 90px;
  height: 90px;
  left: -18px;
  bottom: -24px;
  background: radial-gradient(circle, #9ad6a4 0%, transparent 70%);
  animation: glowPulse 4.2s ease-in-out infinite 0.8s;
}

.hero-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-mark {
  flex: 0 0 auto;
  width: clamp(72px, 12vw, 96px);
  height: clamp(72px, 12vw, 96px);
  border-radius: 24px;
  box-shadow: 0 10px 0 rgba(90, 62, 36, 0.16);
  animation: markBob 3.4s ease-in-out infinite;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(32px, 5.2vw, 48px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
}

.hero-copy p {
  margin: 8px 0 0;
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--ink-soft);
  max-width: 28em;
}

.group-nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-nav a {
  text-decoration: none;
  color: #6a4d2d;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(240, 139, 62, 0.22);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 15px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.group-nav a:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 139, 62, 0.45);
}

.group-nav a.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #f3a65a);
  border-color: transparent;
  box-shadow: 0 6px 0 rgba(170, 90, 30, 0.22);
}

.group-sections {
  display: grid;
  gap: 16px;
}

.age-group {
  background: var(--panel);
  border-radius: 26px;
  box-shadow: 0 10px 22px var(--shadow);
  border: 2px solid rgba(255, 222, 170, 0.5);
  padding: 18px 16px 16px;
}

.group-head h2 {
  margin: 0;
  color: var(--brand-deep);
  font-size: clamp(22px, 3.2vw, 30px);
}

.group-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

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

.game-card {
  --card-i: 0;
  position: relative;
  border-radius: 24px;
  padding: 18px 16px 16px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  min-height: 168px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: start;
  gap: 10px;
  touch-action: manipulation;
  border: 2px solid rgba(255, 255, 255, 0.48);
  background: linear-gradient(150deg, #66a2df, #69bf7a);
  box-shadow: 0 9px 0 rgba(62, 43, 28, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: cardIn 0.48s ease both;
  animation-delay: calc(var(--card-i) * 35ms);
  overflow: hidden;
}

.game-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.card-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 30px;
  line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.06);
}

.game-card strong {
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.card-blurb {
  font-weight: 500;
  opacity: 0.95;
  font-size: 14px;
  line-height: 1.35;
  max-width: 16em;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 0 rgba(62, 43, 28, 0.18);
}

.game-card:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 rgba(62, 43, 28, 0.18);
}

.menu-error {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #f7d9d4;
  color: #6f2f24;
  grid-column: 1 / -1;
}

.game-card.memory { background: linear-gradient(150deg, #f08b3e, #f6af52); }
.game-card.car { background: linear-gradient(150deg, #ff9e66, #ffc16b); }
.game-card.animal { background: linear-gradient(150deg, #79bf70, #8bd286); }
.game-card.colortap { background: linear-gradient(150deg, #6e90ff, #8db8ff); }
.game-card.balloon { background: linear-gradient(150deg, #ff8f74, #f5b1c8); }
.game-card.shape { background: linear-gradient(150deg, #ffad76, #9db0ff); }
.game-card.math { background: linear-gradient(150deg, #66a2df, #69bf7a); }
.game-card.maze { background: linear-gradient(150deg, #5a95d6, #77c980); }
.game-card.doodle { background: linear-gradient(150deg, #7f8fff, #62c0a8); }
.game-card.spell { background: linear-gradient(150deg, #5e9edc, #f0a44f); }
.game-card.farm { background: linear-gradient(150deg, #6ea65a, #d7a84d); }
.game-card.rhythm { background: linear-gradient(150deg, #df6b65, #7d7cf1); }
.game-card.runner { background: linear-gradient(150deg, #67a0e9, #57c6c4); }
.game-card.sort { background: linear-gradient(150deg, #df8250, #8f7de0); }
.game-card.whac { background: linear-gradient(150deg, #69b86f, #8ad479); }
.game-card.bubble { background: linear-gradient(150deg, #62a9ea, #69d2c5); }
.game-card.chef { background: linear-gradient(150deg, #ec9964, #f0c06b); }
.game-card.choir { background: linear-gradient(150deg, #6e8ff0, #68c9a5); }
.game-card.lighthouse { background: linear-gradient(150deg, #4f95de, #63c7b7); }
.game-card.postman { background: linear-gradient(150deg, #e0805e, #8f7de0); }
.game-card.fruit { background: linear-gradient(150deg, #e28b4d, #6fba78); }
.game-card.ocean { background: linear-gradient(150deg, #5da6e0, #5eb7b0); }
.game-card.pet { background: linear-gradient(150deg, #df7da3, #8ca6ea); }
.game-card.forest { background: linear-gradient(150deg, #7ca863, #5fa47d); }
.game-card.star { background: linear-gradient(150deg, #7586df, #78b1d8); }
.game-card.numbertap { background: linear-gradient(150deg, #5b9be8, #82c4f5); }
.game-card.fruitcount { background: linear-gradient(150deg, #e87c38, #f0b06a); }
.game-card.market { background: linear-gradient(150deg, #4aaa60, #62c478); }

@keyframes markBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-mark,
  .hero::before,
  .hero::after,
  .game-card {
    animation: none;
  }
}

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

  .game-card {
    min-height: 156px;
  }
}

@media (max-width: 560px) {
  .hero-brand {
    align-items: flex-start;
  }

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

  .group-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .group-nav a {
    text-align: center;
  }
}
