:root {
  --bg: #fff7ec;
  --bg2: #ffeedd;
  --card: #ffffff;
  --ink: #3b2a20;
  --muted: #8a6f5e;
  --line: #f1dcc6;
  --orange: #ff7a2f;
  --coral: #ff5c7a;
  --leaf: #23a86f;
  --sun: #ffc531;
  --f-tropical: #ff7a2f;
  --f-ice: #3aa7e0;
  --f-forest: #2a9d6a;
  --t0: #ff4f8b;
  --t1: #ff9a1f;
  --t2: #3aa7e0;
  --t3: #9a8a80;
  --shadow: 0 6px 20px -10px rgba(120, 60, 20, .35);
  --r: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1511;
    --bg2: #261b15;
    --card: #2c211a;
    --ink: #fbeee2;
    --muted: #c7ac98;
    --line: #463427;
    --shadow: 0 6px 20px -10px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  font-family: "Noto Sans HK", "PingFang HK", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; }
a { color: var(--orange); }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.small { font-size: .85rem; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 8px 16px 6px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 900; color: var(--ink); text-decoration: none; font-size: 1.05rem;
}
.nav {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 4px;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 4px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 500;
}
.nav a:hover { background: var(--orange); color: #fff; border-color: var(--orange); }

main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- hero ---------- */
.hero {
  display: grid; gap: 24px; align-items: center;
  margin: 20px 0 8px; padding: 28px 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 197, 49, .55), transparent 40%),
    linear-gradient(135deg, #ff9a3d 0%, #ff6a5c 55%, #ff4f8b 100%);
  color: #fff; box-shadow: var(--shadow); overflow: hidden;
}
.kicker { margin: 0; font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 800; letter-spacing: .04em; opacity: .9; font-size: .9rem; }
.hero h1 { margin: 6px 0 10px; font-size: clamp(2.1rem, 7vw, 3.4rem); line-height: 1.1; font-weight: 900; }
.hero h1 span { color: #fff6c8; }
.lead { margin: 0 0 16px; max-width: 34em; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .45); padding: 4px 12px; border-radius: 999px; font-size: .9rem; }
.chips b { margin-right: 6px; }
.hero-art { margin: 0; justify-self: center; }
.hero-art img { width: min(260px, 70vw); height: auto; border-radius: 16px; transform: rotate(3deg); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .5); }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1.4fr 1fr; padding: 40px; }
}

/* ---------- blocks ---------- */
.block { margin: 44px 0; }
.block h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: clamp(1.4rem, 4.5vw, 1.9rem); font-weight: 900; margin: 0 0 14px;
}
.num {
  font-family: "M PLUS Rounded 1c", sans-serif; font-size: .9rem; font-weight: 800;
  background: var(--orange); color: #fff; border-radius: 10px; padding: 2px 8px;
}
.sub { margin: 26px 0 10px; font-size: 1.1rem; }
.note {
  margin-top: 16px; padding: 14px 16px; border-radius: 14px;
  background: var(--bg2); border: 1px dashed var(--line); font-size: .95rem;
}
.warn { color: var(--coral); font-weight: 500; font-size: .92rem; margin: 6px 0 0; }

.tldr, .cards, .zoom { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tl, .card, .zl {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
}
.tl { border-top: 5px solid var(--orange); }
.tl:nth-child(2) { border-top-color: var(--coral); }
.tl:nth-child(3) { border-top-color: var(--f-ice); }
.tl:nth-child(4) { border-top-color: var(--sun); }
.tl h3, .card h3, .zl h3 { margin: 0 0 6px; font-size: 1.05rem; }
.tl p, .card p, .zl p { margin: 0; font-size: .95rem; }
.zi { font-size: 1.6rem; }

/* ---------- stages ---------- */
.stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: st; }
.stages li {
  display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
}
.stages img { width: 84px; height: 84px; object-fit: contain; }
.stages h3 { margin: 0 0 4px; }
.stages h3 small { font-weight: 500; color: var(--muted); font-size: .85rem; margin-left: 6px; }
.stages p { margin: 0; font-size: .95rem; }

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.levels td:first-child { font-weight: 900; color: var(--orange); font-size: 1.1rem; }

/* ---------- chart ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  border: 2px solid var(--fc); background: var(--card); color: var(--ink);
}
.tabs button small { font-weight: 500; opacity: .75; }
.tabs button[aria-selected="true"] { background: var(--fc); color: #fff; }
.tabs img { width: 18px; height: 18px; }

.field-head {
  display: grid; gap: 14px; align-items: center;
  background: var(--card); border: 2px solid var(--fc); border-radius: var(--r); padding: 14px; margin-bottom: 14px;
}
.field-head h3 { margin: 0; font-size: 1.3rem; color: var(--fc); }
.field-head h3 small { color: var(--muted); font-weight: 500; font-size: .9rem; }
.field-head p { margin: 4px 0; font-size: .95rem; }
.unlock { font-weight: 700; }
.field-img { width: 100%; max-width: 170px; justify-self: center; }
@media (min-width: 640px) { .field-img { max-width: 220px; } }
@media (min-width: 640px) { .field-head { grid-template-columns: 220px 1fr; } }
.kidline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: .92rem; }
.kidline .tiny { width: 36px; height: 36px; object-fit: contain; }
.cell { width: 20px; height: 20px; vertical-align: -4px; }

.tree { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ycol { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.ylead { font-size: .85rem; font-weight: 700; color: var(--fc); margin-bottom: 6px; }
.mix { font-size: 1rem; }
.young {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--fc) 12%, var(--card)); border-radius: 12px; padding: 6px 8px; margin-bottom: 10px;
}
.young > img:first-child { width: 56px; height: 56px; object-fit: contain; }
.young b { display: block; }
.young span { font-size: .8rem; color: var(--muted); font-family: "M PLUS Rounded 1c", sans-serif; }
.yp { width: 32px; height: 32px; }
.adults { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.char {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.char:hover, .char:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); outline: none; border-color: var(--fc, var(--orange)); }
.char img { width: 72px; height: 72px; object-fit: contain; }
.cn { font-weight: 700; font-size: .82rem; line-height: 1.25; margin-top: 4px; word-break: break-word; }
.cj { font-size: .72rem; color: var(--muted); font-family: "M PLUS Rounded 1c", sans-serif; }
.char .tier { margin-top: 4px; }
.char .badge { position: absolute; top: 6px; right: 6px; }

.tier {
  display: inline-block; font-style: normal; font-size: .72rem; font-weight: 700;
  color: #fff; padding: 1px 8px; border-radius: 999px; background: var(--t3);
}
.tier.t0 { background: var(--t0); }
.tier.t1 { background: var(--t1); }
.tier.t2 { background: var(--t2); }
.tier.t3 { background: var(--t3); }
.tier.ts { background: linear-gradient(90deg, #8a5cff, #ff4f8b); }
.badge { display: inline-block; font-size: .66rem; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.badge.pred { background: #ffe1dc; color: #c2321c; }
.badge.prey { background: #dcf3e6; color: #1b7a4b; }

.tier-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .88rem; color: var(--muted); }
.tier-legend .tier { margin-right: 6px; }

.secret-strip {
  display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px;
  border-radius: var(--r); background: linear-gradient(90deg, rgba(138, 92, 255, .14), rgba(255, 79, 139, .14));
}
.secret-strip .char { width: 130px; flex: none; }
.secret-strip p { margin: 0; font-size: .95rem; }
.char.glow { box-shadow: 0 0 0 3px rgba(255, 79, 139, .35); }
.char.dim { opacity: .55; }

.special { display: grid; gap: 10px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.sp { display: flex; gap: 10px; align-items: center; background: var(--bg2); border-radius: 14px; padding: 10px; }
.sp > img:first-child { width: 52px; height: 52px; object-fit: contain; }
.sp .px { width: 28px; height: 28px; }
.sp p { margin: 2px 0 0; font-size: .88rem; }
.tag { font-size: .72rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }

/* ---------- food ---------- */
.ftable { margin-bottom: 18px; }
.ftable h3 { display: flex; align-items: center; gap: 8px; color: var(--fc); margin: 18px 0 10px; flex-wrap: wrap; }
.ftable h3 small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.ftable h3 img { width: 22px; height: 22px; }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.fgroup { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--fc); border-radius: var(--r); padding: 12px; }
.fhead { display: flex; align-items: center; gap: 6px; font-size: .95rem; margin-bottom: 6px; }
.fhead .yp { margin-left: auto; }
.fgroup ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fgroup li { display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: center; }
.fgroup li img { width: 36px; height: 36px; }
.fgroup li .en { font-size: .75rem; color: var(--muted); }
.fgroup li small { display: block; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.pts { margin-left: 6px; font-size: .72rem; font-weight: 700; background: var(--sun); color: #5a3a00; border-radius: 6px; padding: 0 5px; }

/* ---------- snacks ---------- */
.snacks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.snack { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.snack img { width: 36px; height: 36px; flex: none; }
.snack b { display: block; font-size: .95rem; }
.snack span { font-size: .82rem; color: var(--muted); }

/* ---------- secret ---------- */
.secret-card {
  display: grid; gap: 18px; align-items: center;
  background: linear-gradient(135deg, rgba(58, 167, 224, .14), rgba(35, 168, 111, .14));
  border: 2px solid #7fd0c6; border-radius: 24px; padding: 20px;
}
.secret-card .kicker { color: var(--f-ice); }
.secret-card h3 { margin: 4px 0 8px; font-size: 1.4rem; }
.secret-art { width: 200px; justify-self: center; filter: drop-shadow(0 10px 18px rgba(0, 80, 90, .25)); }
.steps { margin: 0 0 10px; padding-left: 1.2em; }
.steps li { margin-bottom: 6px; }
@media (min-width: 640px) { .secret-card { grid-template-columns: 220px 1fr; } }
.pxrow { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.px.big { width: 64px; height: 64px; }

/* ---------- lists / cols ---------- */
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.list { margin: 0; padding-left: 1.1em; }
.list li { margin-bottom: 6px; font-size: .95rem; }

/* ---------- dex ---------- */
.dex-progress { display: grid; gap: 8px; margin-bottom: 14px; }
.dp { display: grid; grid-template-columns: 48px 1fr 52px; align-items: center; gap: 10px; font-weight: 700; }
.dp .bar { height: 12px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.dp .bar i { display: block; height: 100%; background: var(--fc); border-radius: 999px; transition: width .2s; }
.dp b { color: var(--fc); text-align: right; }
.dex-field h3 { color: var(--fc); margin: 16px 0 8px; }
.dex-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.dex-item {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; font-size: .85rem;
}
.dex-item img { width: 32px; height: 32px; flex: none; }
.dex-item input { accent-color: var(--fc); width: 18px; height: 18px; flex: none; }
.dex-item.on { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, var(--card)); font-weight: 700; }
.ghost { margin-top: 16px; font: inherit; font-size: .85rem; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 14px; cursor: pointer; }

/* ---------- modal ---------- */
.modal {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  border: 0; border-radius: 22px; padding: 20px; background: var(--card); color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
}
.modal::backdrop { background: rgba(40, 20, 10, .55); }
.modal .close {
  position: absolute; top: 10px; right: 12px; border: 0; background: var(--bg2); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; cursor: pointer;
}
.m-top { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: center; }
.m-art { width: 130px; height: 130px; object-fit: contain; }
.m-top h3 { margin: 0; font-size: 1.3rem; color: var(--fc); padding-right: 30px; }
.m-top .cj { margin: 0; font-size: .9rem; }
.proto { margin: 4px 0; font-size: .92rem; }
.m-badges { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.blurb { background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin: 14px 0; font-size: .95rem; }
.m-stats { margin: 0; display: grid; gap: 8px; }
.m-stats div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: .92rem; }
.m-stats dt { font-weight: 700; color: var(--muted); }
.m-stats dd { margin: 0; }

/* ---------- footer ---------- */
.footer { max-width: 1080px; margin: 50px auto 0; padding: 20px 16px 40px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.footer p { margin: 4px 0; }

@media (max-width: 420px) {
  .stages li { grid-template-columns: 60px 1fr; }
  .stages img { width: 60px; height: 60px; }
  .char img { width: 60px; height: 60px; }
  .m-top { grid-template-columns: 96px 1fr; }
  .m-art { width: 96px; height: 96px; }
}
