/* =========================================================================
   入口页 · 小程序合集
   视觉按票「定下入口页第一屏的视觉与版式（含 8 视口预算）」定稿：
   天空 / 云 / 草丘 + Baloo2 + 三张竖排卡通大卡。
   视口预算：360×640 / 375×667 / 390×844 / 414×896 / 768×1024 / 834×1112 /
   1024×768 / 1440×900 / 844×390（手机横屏），全部无横向滚动、卡片不被裁。
   ========================================================================= */

@font-face {
  font-family: 'Baloo2';
  src: url('./fonts/baloo2-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #20304f;
  --ink-soft: #42557f;
  --sky-1: #7ed2ff;
  --sky-2: #d9f4ff;
  --sky-3: #eafbff;
  --grass-1: #a8eab0;
  --grass-2: #7ddb92;
  --cream: #fffcee;
  --cream-2: #fff2cd;
  --yellow: #ffd84d;
  --pink: #ff77a9;
  --teal: #3fd6c2;
  --radius: 30px;
  --bw: 4px;
  --hard: 0 9px 0 var(--ink);
  --font: 'Baloo2', 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei',
    'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 46%, var(--sky-3) 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

/* 键盘用户先看到的跳转链，鼠标用户看不到 */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 14px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-weight: 800;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- 背景装饰 ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.sun {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff6b8 0 42%, #ffe66d 43% 62%, rgba(255, 230, 109, 0) 63%);
}
.cloud {
  position: absolute;
  width: 150px;
  height: 62px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 34px -18px 0 -6px #fff, -30px -10px 0 -12px #fff;
}
.cloud--1 { top: 84px; left: -46px; }
.cloud--2 { top: 190px; right: -54px; transform: scale(.82); }
.hill {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  border-radius: 50% 50% 0 0;
}
.hill--back { height: 150px; background: var(--grass-1); opacity: .75; }
.hill--front { height: 96px; background: var(--grass-2); }

/* ---------- 页面骨架 ---------- */
.wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 18px);
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  padding:
    calc(18px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 28px)
    calc(22px + env(safe-area-inset-bottom, 0px));
}

.brandline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(22px, 4.6vw, 30px);
  font-weight: 800;
  letter-spacing: .5px;
}
.brandline .em { font-size: 1.15em; }

.footline {
  margin: 0;
  text-align: center;
  font-size: clamp(11px, 1.7vw, 13px);
  color: var(--ink-soft);
  opacity: .85;
}

/* ---------- 卡片列表 ---------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 18px);
  flex: 1 1 auto;
  min-height: 0;
}

.loading {
  margin: 0;
  align-self: center;
  margin-top: auto;
  margin-bottom: auto;
  font-size: clamp(13px, 2.2vmin, 16px);
  color: var(--ink-soft);
}

.card {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 20px);
  flex: 1 1 0;
  min-height: 84px;
  padding: clamp(12px, 2.2vh, 20px) clamp(14px, 3vw, 22px);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  background: var(--cream);
  box-shadow: var(--hard);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 11px 0 var(--ink); }
.card:active { transform: translateY(6px); box-shadow: 0 3px 0 var(--ink); }

.card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(56px, 11vmin, 84px);
  height: clamp(56px, 11vmin, 84px);
  border: var(--bw) solid var(--ink);
  border-radius: 22px;
  background: var(--yellow);
  font-size: clamp(28px, 5.4vmin, 40px);
  box-shadow: inset 0 -6px 0 rgba(32, 48, 79, .08);
}
.card--teal .card__icon { background: var(--teal); }
.card--pink .card__icon { background: var(--pink); }

.card__body { min-width: 0; flex: 1 1 auto; }
.card__name {
  display: block;
  font-size: clamp(19px, 3.4vmin, 25px);
  font-weight: 800;
  line-height: 1.15;
}
.card__blurb {
  display: block;
  margin-top: 4px;
  font-size: clamp(12px, 1.9vmin, 15px);
  color: var(--ink-soft);
  line-height: 1.35;
}
.card__go {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream-2);
  font-size: 16px;
  font-weight: 800;
}

/* ---------- 降级：错误卡（清单拿不到 / 一条 live 都没有） ---------- */
.card--error {
  flex: 0 0 auto;
  margin-top: auto;
  margin-bottom: auto;
  cursor: default;
}
.card--error:hover,
.card--error:active { transform: none; box-shadow: var(--hard); }
.card--error .card__icon { background: #ffd3e2; }

.retry {
  flex: 0 0 auto;
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--ink);
}
.retry:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.noscript {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  background: var(--cream);
  border-top: 3px solid var(--ink);
}

/* ---------- 矮屏（手机横屏等，高度 ≤ 460px）：压扁一切，保证一屏放下 ---------- */
@media (max-height: 460px) {
  .wrap {
    gap: 8px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .brandline { font-size: 17px; }
  .cards { gap: 8px; }
  .card {
    min-height: 0;
    padding: 6px 12px;
    border-width: 3px;
    border-radius: 20px;
    box-shadow: 0 5px 0 var(--ink);
  }
  .card__icon {
    width: 42px;
    height: 42px;
    border-width: 3px;
    border-radius: 13px;
    font-size: 22px;
  }
  .card__name { font-size: 16px; }
  .card__blurb { display: none; }
  .card__go { width: 26px; height: 26px; border-width: 2px; font-size: 11px; }
  .footline { display: none; }
}

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