/* 網站外框：低彩度羊毛氈色、霞鶩文楷、縫線邊框 */
:root {
  --cream: #fff8ea;
  --paper: #fffcf4;
  --oat: #eadcc6;
  --wood: #9c7254;
  --sage: #a9be9b;
  --mist: #aac7ce;
  --rose: #d7a3a3;
  --mustard: #d8b56c;
  --brick: #c87f68;
  --ink: #4b3a33;
  --ink-soft: #7d665b;
  --line: #eadcc6;
  --stitch: rgba(125, 102, 91, 0.3);
  --story: "LXGW WenKai TC", "Kaiti TC", "BiauKai", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); line-height: 1.85;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--cream) radial-gradient(rgba(125, 102, 91, 0.07) 1.2px, transparent 1.3px) 0 0 / 22px 22px;
}
a { color: var(--brick); }
.muted { color: var(--ink-soft); }

/* 注音：字的右邊一欄直排符號；聲調黏在最後一個符號右上方、輕聲點在最上面（台灣課本排法）。聲調用畫的，才夠清楚 */
.zy { display: inline-flex; align-items: center; vertical-align: middle; margin: 0 0.06em 0 0; line-height: 1; }
.zy-c { line-height: 1; }
.zy-r {
  display: inline-flex; align-items: center; height: 1.12em; margin-left: 0.04em;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; font-weight: 600; color: var(--ink-soft);
}
.zy-s { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.4em; line-height: 1.02; padding-right: 0.62em; }
.zy-r.n3 .zy-s { font-size: 0.35em; }
.zy-s i { position: relative; font-style: normal; display: block; }
.zy-t { position: absolute; left: 100%; top: -0.12em; width: 0.58em; height: 0.58em; margin-left: 0.04em; background: currentColor; -webkit-mask: var(--tone) center / contain no-repeat; mask: var(--tone) center / contain no-repeat; }
.zy-t.t2 { --tone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 8.5 L7.5 1.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.zy-t.t3 { --tone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.8 2 L5 8.3 L8.2 2' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.zy-t.t4 { --tone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 1.5 L7.5 8.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.zy-l { display: block; width: 0.28em; height: 0.28em; border-radius: 50%; background: currentColor; margin-bottom: 0.12em; }
.zy-x { display: inline-block; line-height: 1; vertical-align: middle; }


/* 頁首 */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; max-width: 1140px; margin: 0 auto; }
.site-logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--story); font-size: 24px; font-weight: 700; }
.logo-words { display: flex; flex-direction: column; line-height: 1.15; }
.logo-sub { font-size: 13px; font-weight: 400; color: var(--ink-soft); font-family: "PingFang TC", sans-serif; letter-spacing: 0.08em; }
.hero-brand { font-size: 16px !important; letter-spacing: 0.1em; background: rgba(255, 252, 244, 0.85); display: inline-block; padding: 2px 14px; border-radius: 999px; margin-bottom: 8px !important; color: var(--ink) !important; }
.site-mark { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--mustard); box-shadow: 0 3px 0 #b7944f; outline: 2px dashed rgba(255, 255, 255, 0.7); outline-offset: -5px; }
.site-nav { display: flex; gap: 8px; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 15px; background: var(--paper); padding: 6px 14px; border-radius: 999px; box-shadow: 0 2px 0 var(--line); }
.site-foot { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 48px 16px; }
main { max-width: 1140px; margin: 0 auto; padding: 8px 20px 0; }

/* ---------- 首頁 ---------- */
.hero { position: relative; border-radius: 32px; overflow: hidden; box-shadow: 0 0 0 8px var(--paper), 0 0 0 10px var(--line), 0 18px 40px rgba(90, 60, 30, 0.16); }
.hero-art { display: block; width: 100%; height: auto; min-height: 340px; object-fit: cover; }
.hero-text { position: absolute; left: 5%; top: 9%; max-width: 560px; }
.hero h1 br.m { display: none; }
.hero h1 { font-family: var(--story); font-size: clamp(28px, 3.8vw, 46px); line-height: 1.3; margin: 0 0 10px; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8); }
.hero p { font-family: var(--story); font-size: clamp(16px, 1.8vw, 21px); margin: 0 0 18px; color: var(--ink-soft); }
.hero-btn { display: inline-block; font-family: var(--story); font-size: 22px; color: var(--ink); text-decoration: none; background: var(--mustard); padding: 10px 26px; border-radius: 18px; box-shadow: 0 5px 0 #b7944f; outline: 2px dashed rgba(255, 255, 255, 0.7); outline-offset: -6px; }
.cloud { animation: drift 38s linear infinite alternate; }
.cloud.c2 { animation-duration: 52s; }
@keyframes drift { to { transform: translateX(90px); } }
.sway { transform-origin: 857px 370px; animation: sway 6s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(1.6deg); } }
.smoke { animation: smoke 5s ease-in-out infinite; }
@keyframes smoke { 50% { transform: translate(4px, -8px); opacity: 0.5; } }
.bird { animation: fly 22s linear infinite; }
@keyframes fly { from { transform: translate(-60px, 170px); } to { transform: translate(1260px, 120px); } }

.shelf-wrap { margin-top: 56px; }
.shelf-wrap h2, .for-adults h3 { font-family: var(--story); }
.shelf-wrap h2 { font-size: 34px; margin: 0; }
/* 木頭書架：每排底下有一條木板 */
.shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 44px 22px; margin-top: 22px; padding: 18px 18px 30px;
  background: repeating-linear-gradient(180deg, transparent 0 262px, #b98a66 262px 278px, #9c7254 278px 284px);
  border-radius: 24px; background-color: #f3e7d4; box-shadow: inset 0 0 0 10px #b98a66, inset 0 0 0 12px #9c7254;
}
.book {
  position: relative; height: 240px; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 14px 26px;
  background: var(--c); color: var(--ink); text-decoration: none; border-radius: 6px 16px 16px 6px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.12), 0 14px 22px rgba(80, 55, 35, 0.2);
  outline: 2px dashed rgba(255, 255, 255, 0.75); outline-offset: -8px; transition: transform 0.25s;
}
.book::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; background: rgba(0, 0, 0, 0.12); border-radius: 6px 0 0 6px; }
a.book:hover { transform: translateY(-8px) rotate(-1.5deg); }
.book-tag { align-self: flex-start; background: rgba(255, 252, 244, 0.92); font-size: 13px; padding: 1px 10px; border-radius: 999px; }
.book-title { font-family: var(--story); font-size: 26px; font-weight: 700; line-height: 1.35; }
.book-grade { margin-top: auto; font-size: 13px; }
.book-badge { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-size: 20px; }
.book.soon { opacity: 0.42; filter: saturate(0.6); }
.book-play { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); white-space: nowrap; background: var(--brick); color: #fff; font-size: 14px; padding: 3px 14px; border-radius: 999px; box-shadow: 0 3px 0 #a8654f; }
.book.soon .book-grade { background: rgba(255, 252, 244, 0.85); align-self: flex-start; padding: 0 10px; border-radius: 999px; }

.for-adults { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 40px; }
.for-adults > div { background: var(--paper); border-radius: 24px; padding: 22px 26px; box-shadow: 0 4px 0 var(--line); outline: 2px dashed var(--stitch); outline-offset: -10px; }
.for-adults h3 { font-size: 24px; margin: 0 0 6px; }
.for-adults p { margin: 0; }

/* ---------- 書頁下方：故事、聊聊、任務、給爸媽、給老師 ---------- */
.player-fallback { position: absolute; left: 16px; right: 16px; bottom: 16px; background: #fff; padding: 12px 16px; border-radius: 12px; }
.story { max-width: 780px; margin: 52px auto 0; }
.story-head { text-align: center; margin-bottom: 22px; }
.story-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0; }
.story-meta.left { justify-content: flex-start; margin-bottom: 10px; }
.story-meta span { background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: 0 14px; font-size: 14px; }
.story h1 { font-family: var(--story); font-size: clamp(32px, 5vw, 46px); margin: 10px 0 8px; line-height: 1.3; }
.lead { font-family: var(--story); font-size: 19px; color: var(--ink-soft); margin: 0; }
.jump { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.jump a { text-decoration: none; color: var(--ink); background: var(--paper); padding: 6px 16px; border-radius: 999px; box-shadow: 0 3px 0 var(--line); font-size: 15px; }
.story-card { background: var(--paper); border-radius: 26px; padding: 26px 30px; margin: 20px 0; box-shadow: 0 4px 0 var(--line), 0 12px 28px rgba(90, 60, 30, 0.07); outline: 2px dashed var(--stitch); outline-offset: -10px; scroll-margin-top: 16px; }
.story h2 { font-family: var(--story); font-size: 28px; margin: 0 0 12px; display: flex; align-items: center; gap: 12px; }
.ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; flex: none; }
.ico.sage { background: var(--sage); } .ico.mist { background: var(--mist); } .ico.rose { background: var(--rose); }
.ico.mustard { background: var(--mustard); } .ico.oat { background: var(--oat); } .ico.brick { background: var(--brick); }
.story h3 { font-family: var(--story); font-size: 22px; margin: 20px 0 6px; color: #6d8a8f; }
.story h4 { font-size: 16px; margin: 16px 0 4px; }
.story p, .story li { font-family: var(--story); font-size: 19px; }
.story p { margin: 0 0 6px; }
details summary { cursor: pointer; font-size: 17px; color: var(--brick); list-style: none; padding: 8px 16px; background: #fbf1e6; border-radius: 14px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; }
details[open] summary::before { content: "▾ "; }
.page-text { padding-left: 4px; }
.choices { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.choices li { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 14px; font-size: 18px; }
.talk { padding-left: 1.4em; }
.talk li { margin: 6px 0; }
.mission { background: #f5f0de; }
.mission .big { font-size: 22px; }
.parents { background: #eef3ee; }
.tip { background: #fff; border-left: 5px solid var(--mustard); padding: 12px 16px; border-radius: 10px; margin-top: 14px !important; }
.teachers { background: #f7ece8; }
.plan { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.plan ul { margin: 0; padding-left: 1.2em; }
.flow { padding-left: 0; list-style: none; counter-reset: f; }
.flow li { display: flex; gap: 10px; align-items: baseline; margin: 6px 0; }
.flow .min { flex: none; font-family: "PingFang TC", sans-serif; font-size: 13px; background: var(--brick); color: #fff; padding: 1px 10px; border-radius: 999px; }
.print-btn { display: inline-block; margin-top: 10px; text-decoration: none; color: var(--ink); background: var(--mustard); padding: 8px 20px; border-radius: 14px; box-shadow: 0 4px 0 #b7944f; font-family: "PingFang TC", sans-serif; font-size: 16px; }

/* 廣告：只在家長／老師區，和故事內容明顯分開 */
.ad-wrap { margin: 28px auto; max-width: 780px; min-height: 120px; padding: 8px 12px 12px; border-radius: 18px; background: rgba(255, 252, 244, 0.6); border: 1px solid var(--line); }
.ad-label { margin: 0 0 4px !important; text-align: center; font-family: "PingFang TC", sans-serif !important; font-size: 12px !important; color: #a8968a; }

/* ---------- 學習單（A4 列印） ---------- */
.print-page { background: #eee; }
.sheet { max-width: 800px; background: #fff; margin: 20px auto; padding: 36px 44px; font-family: var(--story); font-size: 24px; line-height: 2.1; }
.sheet h1 { font-size: 38px; margin: 0; text-align: center; }
.sheet-head p { text-align: right; font-size: 20px; }
.sheet h2 { font-size: 24px; margin: 22px 0 8px; font-weight: 700; }
.sheet-opts { padding-left: 1.4em; margin: 0; }
.sheet-feel { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.sheet-feel > span { display: inline-flex; align-items: center; gap: 6px; }
.sheet-feel > span > b { font-size: 34px; }
.draw { height: 240px; border: 3px dashed #bbb; border-radius: 18px; }
.task { background: #f6f1e6; padding: 8px 16px; border-radius: 12px; }
.no-print { font-family: "PingFang TC", sans-serif; font-size: 16px; }
.no-print button { font: inherit; padding: 6px 16px; border-radius: 10px; border: 1px solid #ccc; background: #fff; cursor: pointer; }
@media print {
  .print-page { background: #fff; }
  .no-print { display: none; }
  .sheet { margin: 0; padding: 0; max-width: none; }
  @page { size: A4; margin: 14mm; }
}

@media (max-width: 760px) {
  .hero-text { position: static; padding: 20px 20px 24px; background: var(--paper); max-width: none; }
  .hero-art { min-height: 0; }
  .for-adults { grid-template-columns: 1fr; }
  .plan { grid-template-columns: 1fr; }
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 40px 14px; padding: 14px 14px 26px; background: repeating-linear-gradient(180deg, transparent 0 228px, #b98a66 228px 244px, #9c7254 244px 250px); background-color: #f3e7d4; }
  .book { height: 210px; padding: 14px 10px 12px 22px; }
  .book-title { font-size: 21px; }
}
@media (max-width: 640px) {
  .site-head { padding: 10px 14px; }
  .site-logo { font-size: 20px; }
  .site-nav a { font-size: 13px; padding: 4px 10px; }
  main { padding: 6px 12px 0; }
  .story-card { padding: 22px 18px; }
  .sheet { padding: 20px; font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud, .sway, .smoke, .bird { animation: none; }
}

/* 書架篩選 */
.filters { margin: 16px 0 6px; display: grid; gap: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-name { font-family: var(--story); font-weight: 700; font-size: 18px; margin-right: 4px; min-width: 2.5em; }
.chip { font: inherit; font-size: 15px; cursor: pointer; padding: 5px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.chip.on { background: var(--brick); border-color: #a8654f; color: #fff; box-shadow: 0 2px 0 #a8654f; }
.filter-soon { font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.shelf .book[hidden] { display: none; }
.shelf-empty { text-align: center; margin-top: 12px; }

/* 首頁介紹 */
.intro { margin-top: 44px; background: var(--paper); border-radius: 26px; padding: 28px 30px; box-shadow: 0 4px 0 var(--line); outline: 2px dashed var(--stitch); outline-offset: -10px; }
.intro h2 { font-family: var(--story); font-size: 30px; margin: 0 0 10px; }
.intro > p { font-family: var(--story); font-size: 18px; }
.intro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 16px; }
.intro-grid h3 { font-family: var(--story); font-size: 21px; margin: 0 0 4px; }
.intro-grid p { margin: 0; font-size: 15px; }
@media (max-width: 760px) { .intro-grid { grid-template-columns: 1fr; } .filter-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .chip { flex: none; } }

/* 爸媽文章 */
.site-nav a + a { margin-left: 0; }
.crumbs { font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.crumbs a { color: var(--ink-soft); }
.post-body h2 { font-family: var(--story); font-size: 26px; margin: 30px 0 10px; }
.post-body h2:first-child { margin-top: 0; }
.post-body p, .post-body li { font-family: var(--story); font-size: 19px; line-height: 1.95; }
.post-body li { margin: 6px 0; }
.post-body blockquote { margin: 14px 0; padding: 10px 16px; background: #f5f0de; border-radius: 12px; }
.book-cta { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; background: #eef3ee; border-radius: 22px; padding: 14px; text-decoration: none; color: var(--ink); box-shadow: 0 4px 0 var(--line); margin: 20px 0; }
.book-cta img { width: 100%; height: auto; border-radius: 14px; display: block; }
.book-cta span { font-family: var(--story); font-size: 18px; }
.faq h3 { color: var(--ink); }
.related { padding-left: 1.2em; } .related li { font-size: 18px; }
.post-list { display: grid; gap: 16px; }
.post-card { display: grid; gap: 4px; background: var(--paper); border-radius: 22px; padding: 20px 24px; text-decoration: none; color: var(--ink); box-shadow: 0 4px 0 var(--line); outline: 2px dashed var(--stitch); outline-offset: -8px; transition: transform .2s; }
.post-card:hover { transform: translateY(-3px) rotate(-.3deg); }
.post-tag { justify-self: start; background: var(--mist); font-size: 13px; padding: 1px 12px; border-radius: 999px; }
.post-title { font-family: var(--story); font-size: 24px; font-weight: 700; line-height: 1.4; }
.post-desc { color: var(--ink-soft); font-size: 15px; }
.post-date { color: #a8968a; font-size: 13px; }
@media (max-width: 640px) { .book-cta { grid-template-columns: 1fr; } .site-nav a { font-size: 13px; } }
.site-nav a { white-space: nowrap; }
@media (max-width: 640px) {
  .site-head { gap: 8px; }
  .site-logo { font-size: 18px; gap: 8px; white-space: nowrap; }
  .site-mark { width: 34px; height: 34px; font-size: 18px; }
  .logo-sub { font-size: 11px; }
  .site-nav { gap: 6px; }
  .site-nav a { font-size: 12px; padding: 4px 9px; }
  .book-grade { font-size: 12px; }
}
