/* amemori.win 共用樣式：晴天、紙張、積木玩具感。所有頁面都載入這一份。 */
:root {
  --paper: #fff8ec;
  --paper-2: #fff1d9;
  --white: #ffffff;
  --ink: #22304a;
  --ink-soft: #55607a;
  --sun: #ffc93c;
  --sun-pale: #fff0c2;
  --sky: #8ed1f5;
  --sky-pale: #dff3ff;
  --kids: #5dbb63;
  --kids-pale: #e2f5df;
  --games: #5b8def;
  --games-pale: #e3ecff;
  --tools: #ff9f43;
  --tools-pale: #ffe9d3;
  --coral: #ff7a59;
  --line: 2.5px solid var(--ink);
  --pop: 4px 4px 0 var(--ink);
  --pop-lg: 6px 6px 0 var(--ink);
  --radius: 18px;
  --font-display: "Huninn", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-body: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; line-height: 1.3; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ── 頁首 ───────────────────────────── */
.site-header { padding: 16px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-size: 1.5rem; }
.brand-mark { width: 40px; height: 40px; }
.site-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; font-weight: 700; font-size: .95rem;
  padding: 6px 14px; border: var(--line); border-radius: 999px; background: var(--white);
  transition: transform .12s ease, box-shadow .12s ease;
}
.site-nav a:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.site-nav a[aria-current="page"][data-section="kids"]  { background: var(--kids-pale); }
.site-nav a[aria-current="page"][data-section="games"] { background: var(--games-pale); }
.site-nav a[aria-current="page"][data-section="tools"] { background: var(--tools-pale); }

/* ── 按鈕 ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-family: var(--font-display); font-size: 1.1rem; text-decoration: none; cursor: pointer;
  padding: 10px 22px; border: var(--line); border-radius: 14px;
  background: var(--sun); color: var(--ink); box-shadow: var(--pop);
  transition: transform .12s ease, box-shadow .12s ease;
  touch-action: manipulation;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--pop-lg); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible, .card:focus-visible, .door:focus-visible { outline: 3px dashed var(--coral); outline-offset: 4px; }
.btn.white { background: var(--white); }
.btn.green { background: var(--kids); color: #fff; }
.btn.blue  { background: var(--games); color: #fff; }

/* ── 首頁主視覺：晴天 ─────────────────── */
.hero {
  position: relative; overflow: hidden;
  margin-top: 8px;
  background: var(--sky-pale);
  border: var(--line); border-radius: 28px; box-shadow: var(--pop-lg);
  display: grid; grid-template-columns: 1.1fr .9fr; align-items: center;
  min-height: 360px;
}
.hero-text { position: relative; z-index: 1; padding: 40px clamp(20px, 5vw, 56px); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin: 0 0 14px; }
.hero h1 mark { background: linear-gradient(transparent 58%, var(--sun) 58%, var(--sun) 92%, transparent 92%); color: inherit; padding: 0 .1em; }
.hero p { margin: 0 0 24px; font-size: 1.08rem; color: var(--ink-soft); max-width: 30em; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art { align-self: stretch; position: relative; min-height: 260px; }
.hero-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sun-rays { transform-origin: 300px 120px; animation: spin 40s linear infinite; }
.cloud-a { animation: drift 9s ease-in-out infinite alternate; }
.cloud-b { animation: drift 12s ease-in-out infinite alternate-reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(-10px); } to { transform: translateX(14px); } }

/* 分區頁的小型主視覺 */
.page-hero {
  margin-top: 8px; padding: 32px clamp(20px, 5vw, 48px);
  border: var(--line); border-radius: 24px; box-shadow: var(--pop);
  background: var(--hero-bg, var(--sun-pale));
  display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap;
}
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 6px; }
.page-hero p { margin: 0; color: var(--ink-soft); max-width: 36em; }
.page-hero .badge { flex: none; }
.page-hero[data-section="kids"]  { --hero-bg: var(--kids-pale); }
.page-hero[data-section="games"] { --hero-bg: var(--games-pale); }
.page-hero[data-section="tools"] { --hero-bg: var(--tools-pale); }

.badge {
  display: inline-block; font-weight: 700; font-size: .9rem;
  padding: 4px 14px; border: var(--line); border-radius: 999px; background: var(--white);
  transform: rotate(-3deg);
}

/* ── 三扇門：分區入口 ─────────────────── */
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 40px 0 8px; }
.door {
  display: grid; grid-template-columns: 72px 1fr; gap: 4px 16px; align-items: center;
  padding: 18px 20px; text-decoration: none;
  background: var(--door-bg); border: var(--line); border-radius: var(--radius); box-shadow: var(--pop);
  transition: transform .12s ease, box-shadow .12s ease;
}
.door:hover { transform: translate(-2px, -2px) rotate(-.6deg); box-shadow: var(--pop-lg); }
.door svg { grid-row: span 2; width: 72px; height: 72px; }
.door strong { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }
.door span { color: var(--ink-soft); font-size: .92rem; line-height: 1.5; }
.door[data-section="kids"]  { --door-bg: var(--kids-pale); }
.door[data-section="games"] { --door-bg: var(--games-pale); }
.door[data-section="tools"] { --door-bg: var(--tools-pale); }

/* ── 分區標題 ───────────────────────── */
.section { padding: 36px 0 8px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 1.7rem; position: relative; }
.section-head h2::after {
  content: ""; display: block; height: 8px; margin-top: 2px; border-radius: 8px;
  background: var(--underline, var(--sun)); width: 70%;
}
.section[data-section="kids"]  { --underline: var(--kids); }
.section[data-section="games"] { --underline: var(--games); }
.section[data-section="tools"] { --underline: var(--tools); }
.more { font-weight: 700; text-decoration: none; white-space: nowrap; border-bottom: 2.5px solid var(--ink); }
.more:hover { color: var(--coral); border-color: var(--coral); }

/* ── 卡片 ───────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; list-style: none; padding: 0; margin: 0; }
.card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; text-decoration: none;
  background: var(--white); border: var(--line); border-radius: var(--radius); box-shadow: var(--pop);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translate(-2px, -2px); box-shadow: var(--pop-lg); }
.cards li:nth-child(3n+1) .card:hover { transform: translate(-2px, -2px) rotate(-.8deg); }
.cards li:nth-child(3n+2) .card:hover { transform: translate(-2px, -2px) rotate(.8deg); }
.card-thumb {
  aspect-ratio: 16 / 10; display: grid; place-items: center;
  background: var(--thumb, var(--sun-pale)); border-bottom: var(--line);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb .card-emoji { font-size: 3.4rem; line-height: 1; }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.card-title { font-family: var(--font-display); font-size: 1.2rem; }
.card-desc { color: var(--ink-soft); font-size: .92rem; line-height: 1.6; flex: 1; }
.card-tag { align-self: flex-start; margin-top: 8px; font-size: .8rem; font-weight: 700; padding: 1px 10px; border-radius: 999px; background: var(--tag, var(--sun-pale)); }
.card[data-section="kids"]  { --thumb: var(--kids-pale);  --tag: var(--kids-pale); }
.card[data-section="games"] { --thumb: var(--games-pale); --tag: var(--games-pale); }
.card[data-section="tools"] { --thumb: var(--tools-pale); --tag: var(--tools-pale); }
.empty { color: var(--ink-soft); }

/* ── 給家長的小紙條 ───────────────────── */
.note {
  position: relative; margin: 48px auto 8px; max-width: 760px;
  padding: 22px 26px 22px 80px;
  background: var(--sun-pale); border: var(--line); border-radius: 6px 22px 6px 22px; box-shadow: var(--pop);
  transform: rotate(-.6deg);
}
.note svg { position: absolute; left: 20px; top: 22px; width: 42px; height: 42px; }
.note h2 { margin: 0 0 4px; font-size: 1.25rem; }
.note p { margin: 0; color: var(--ink-soft); }

/* ── 內文頁 ─────────────────────────── */
.prose { max-width: 760px; padding: 32px 0 48px; }
.prose h1 { font-size: 2.2rem; margin-bottom: .4em; }
.prose h2 { font-size: 1.35rem; margin: 1.8em 0 .4em; }
.prose a { color: var(--games); font-weight: 700; }

/* ── 右側廣告欄 ─────────────────────────
   全站唯一的廣告位。沒有廣告時整欄隱藏、內容自動佔滿寬度；
   寬螢幕固定在右側（捲動時跟著走），手機上移到頁面最下方，遠離遊戲按鈕。 */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; align-items: start; }
.ad-rail { display: none; }
.ad-rail:has(.ad-filled) { display: block; }
@media (min-width: 1000px) {
  .with-rail:has(.ad-filled) { grid-template-columns: minmax(0, 1fr) 300px; }
  .ad-rail .ad-box { position: sticky; top: 20px; margin-top: 36px; }
}
.ad-box {
  padding: 10px 10px 12px;
  background: var(--white); border: 2px dashed #c9bfae; border-radius: var(--radius);
}
.ad-label { display: block; font-size: .78rem; color: var(--ink-soft); margin: 0 4px 6px; letter-spacing: .1em; }
.ad-slot { min-height: 250px; }
.ad-preview {
  height: 600px; max-height: 70vh; display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(45deg, var(--paper), var(--paper) 12px, var(--paper-2) 12px, var(--paper-2) 24px);
  border-radius: 12px; color: var(--ink-soft); font-weight: 700;
}
@media (max-width: 999px) {
  .ad-rail { width: 100%; max-width: 360px; margin: 24px auto 0; }
  .ad-preview { height: 250px; }
}

/* ── 頁尾：山坡 ─────────────────────── */
.site-footer { margin-top: 72px; }
.footer-hills { width: 100%; height: 60px; display: block; }
.footer-inner { background: var(--kids); color: #fff; padding: 8px 0 36px; }
.site-footer .wrap { display: flex; gap: 12px 24px; flex-wrap: wrap; justify-content: space-between; font-weight: 500; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; border-bottom: 2px solid rgba(255,255,255,.6); }
.site-footer a:hover { border-color: #fff; }

/* ── 手機 ───────────────────────────── */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 200px; order: -1; border-bottom: var(--line); }
  .doors { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 560px) {
  .hero-text { padding: 24px 20px 28px; }
  .note { padding: 70px 20px 20px; }
  .note svg { top: 16px; }
  .section-head h2 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
