/* Fallderz Moments — 圖書館氛圍 × 像素風狗狗鼠鼠
   配色參考 Lazy Days 粉彩色票 */
:root {
  --teal: #97B3AE;
  --mint: #D2E0D3;
  --blush: #F0DDD6;
  --coral: #F2C3B9;
  --sand: #D6CBBF;
  --ivory: #F0EEEA;

  --teal-deep: #557570;
  --teal-ink: #3B524E;
  --coral-deep: #C9776A;
  --wood: #B5A797;
  --wood-deep: #8F7F6E;
  --gold: #D9B44F;
  --ink: #3E4A48;
  --ink-soft: #6F7B78;
  --paper: #F7F4EF;
  --card: #FFFDF9;
  --line: #E4DED6;
  --white: #FFFFFF;

  --radius: 14px;
  --shadow: 0 6px 18px rgba(85, 117, 112, .14);
  --shadow-lift: 0 14px 30px rgba(85, 117, 112, .22);

  /* 英文與數字用 Nunito / Libre Baskerville / Pixelify Sans，中文落到粉圓體 */
  --cjk: 'Huninn', 'jf-openhuninn', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --font: 'Nunito', var(--cjk);
  --font-title: 'Libre Baskerville', Georgia, var(--cjk);
  --font-pixel: 'Pixelify Sans', var(--cjk);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 170px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  /* 溫暖的檯燈光暈 */
  background-image:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(247, 222, 178, .45), transparent 70%),
    radial-gradient(ellipse 40% 30% at 100% 100%, rgba(242, 195, 185, .18), transparent 70%),
    url("bookshelf-faint.svg");  /* 手繪書櫃背景 */
  background-size: auto, auto, 520px 300px;
  line-height: 1.75;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { max-width: 100%; display: block; }

a { color: var(--teal-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { image-rendering: pixelated; height: auto; }

/* ---------- 共用元件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1.5px solid var(--teal); background: var(--white); color: var(--teal-ink);
  border-radius: 999px; padding: .45em 1.1em; cursor: pointer; text-decoration: none;
  transition: background .2s, color .2s, transform .15s;
}
.btn:hover { background: var(--mint); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--white); }
.btn.primary:hover { background: var(--teal-ink); }
.btn.danger { border-color: var(--coral-deep); color: #9C4E42; }
.btn.danger:hover { background: var(--blush); }
.btn.small { padding: .25em .8em; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (min-width: 641px) {  /* 電腦版：分類標籤自動換行，全部一眼看完（手機維持左右滑動） */
  #tag-filter { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}
.segmented { display: inline-flex; background: var(--ivory); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: .3em 1em; border-radius: 999px; cursor: pointer; color: var(--ink-soft);
}
.segmented button[aria-pressed="true"] { background: var(--white); color: var(--teal-ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.tag {
  display: inline-block; padding: 0 .65em; border-radius: 4px; font-size: .8rem;
  background: var(--mint); color: var(--teal-ink); white-space: nowrap; border: 1px solid rgba(85,117,112,.18);
}
.field {
  width: 100%; border: 1.5px solid var(--line); background: var(--white); border-radius: 10px; padding: .5em .85em;
  outline: none; transition: border-color .2s;
}
.field:focus { border-color: var(--teal); }

/* ---------- 頁首：圖書館招牌 + 書架 ---------- */
.site-header { position: relative; padding: 34px 16px 0; text-align: center; isolation: isolate; }
.site-header::before { /* 頁首後方較清楚的書櫃，往下漸漸淡出 */
  content: ''; position: absolute; inset: 0 0 -20px; z-index: -1; pointer-events: none;
  background: url("bookshelf-bg.svg") repeat-x 50% 4px / 520px 300px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(#000 20%, transparent 95%);
  mask-image: linear-gradient(#000 20%, transparent 95%);
}
.brand h1, .tagline { text-shadow: 0 0 12px var(--paper), 0 0 4px var(--paper); }
.plaque {
  display: inline-block; margin: 0; font-family: var(--font-pixel); font-size: .78rem; letter-spacing: .25em;
  color: var(--teal-ink); background: var(--mint); padding: .1em 1em; border-radius: 3px;
  box-shadow: 0 2px 0 var(--teal);
}
.brand { text-decoration: none; color: var(--teal-ink); }
.brand h1 {
  margin: .25em 0 0; font-family: var(--font-title); font-weight: 700; font-size: clamp(2.1rem, 6.5vw, 3.6rem);
  letter-spacing: .02em; line-height: 1.15;
}
.brand h1 em { color: var(--coral-deep); font-weight: 400; }
.tagline { margin: .5em 0 0; color: var(--ink-soft); font-size: 1.05rem; letter-spacing: .12em; }

.shelf {
  position: relative; max-width: 760px; margin: 18px auto 0; height: 92px;
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  border-bottom: 12px solid var(--wood);
  box-shadow: 0 6px 0 var(--wood-deep);
  padding: 0 16px;
}
.shelf .sprite { flex: 0 0 auto; width: auto; height: 76px; }
.shelf .sprite.books { height: 40px; }
.shelf .sprite.flip { transform: scaleX(-1); }
.shelf .dog { margin-right: auto; }
.shelf .chipmunk { margin-left: auto; height: 70px; }
.today-stamp {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; margin-bottom: 8px;
  border: 2px solid var(--coral-deep); color: var(--coral-deep); border-radius: 6px; padding: 4px 10px;
  font-family: var(--font-pixel); transform: rotate(-4deg); background: rgba(255,255,255,.6);
}
.today-stamp small { font-size: .65rem; letter-spacing: .2em; }

/* ---------- 網站導覽（書櫃下方的索引標籤） ---------- */
.site-nav { display: flex; justify-content: center; gap: 6px; margin: 16px auto 0; flex-wrap: wrap; }
.site-nav a {
  position: relative; text-decoration: none; color: var(--teal-ink); background: var(--card);
  border: 1.5px solid var(--sand); border-bottom-width: 3px; border-radius: 8px 8px 4px 4px;
  padding: .25em 1.1em; font-size: .95rem; transition: transform .15s, background .15s;
}
.site-nav a:hover { transform: translateY(-2px); background: var(--white); }
.site-nav a[aria-current="page"] { background: var(--mint); border-color: var(--teal); color: var(--teal-ink); }
/* 書籤：完整直播（珊瑚紅）、系列（金黃），像夾在書頁上方的緞帶書籤 */
.site-nav a.bookmark {
  border-radius: 3px 3px 0 0; padding: .25em 1em .4em; border-bottom-width: 1.5px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 7px), 0 100%); padding-bottom: .65em;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
}
.site-nav a.bookmark.live { background: #F6D3CA; border-color: #E3A99C; color: #84463B; }
.site-nav a.bookmark.series { background: #F8E3A8; border-color: #DDBB5F; color: #6b4f24; }
.site-nav a.bookmark:hover { transform: translateY(2px); }
.site-nav a.bookmark.live[aria-current="page"] { background: var(--coral-deep); border-color: var(--coral-deep); color: var(--white); }
.site-nav a.bookmark.series[aria-current="page"] { background: #D9B44F; border-color: #C49E3A; color: #3d2c11; }
/* 書籤頁不顯示分類列與年月時間軸 */
.site-nav a.bookmark .count { font-size: .72rem; margin-left: .35em; background: rgba(255, 255, 255, .6); border-radius: 999px; padding: 0 .45em; }
.site-nav a.bookmark[aria-current="page"] .count { background: rgba(255, 255, 255, .25); }
/* 完整直播頁：軟木塞留言板，兩欄釘上代表截圖 */
.corkboard {
  margin: 8px 0 32px; padding: 26px 24px 30px; border: 12px solid #D9C4A0; border-radius: 6px;
  box-shadow: var(--shadow-lift), inset 0 0 16px rgba(80, 50, 20, .3);
  background-color: #C79A6B;
  background-image:
    radial-gradient(rgba(110, 70, 35, .45) 1px, transparent 1.6px),
    radial-gradient(rgba(255, 235, 200, .35) 1px, transparent 1.6px),
    radial-gradient(rgba(90, 55, 25, .3) 1.5px, transparent 2px);
  background-size: 9px 9px, 13px 13px, 23px 23px; background-position: 0 0, 5px 7px, 11px 3px;
}
.cork-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 30px; }
.pin-card {
  position: relative; border: 0; padding: 10px 10px 12px; background: var(--card); cursor: pointer; font: inherit; color: var(--ink);
  transform: rotate(var(--tilt, 0deg)); box-shadow: 0 6px 14px rgba(55, 35, 15, .35); transition: transform .2s, box-shadow .2s;
}
.pin-card:hover, .pin-card:focus-visible { transform: rotate(0deg) translateY(-4px) scale(1.02); box-shadow: 0 12px 24px rgba(55, 35, 15, .4); }
.pin {
  position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 35%, #F6B7A8, var(--coral-deep) 60%, #8E4A3F); box-shadow: 0 3px 3px rgba(0, 0, 0, .35);
}
.pin-photo { position: relative; display: block; aspect-ratio: 16 / 10; background: #3d3a37; }
.pin-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin-empty { display: grid; place-items: center; height: 100%; font-size: 2.4rem; }
.pin-title {  /* 標題便條釘在照片右上角，不擋住人物 */
  position: absolute; right: -6px; top: -6px; transform: rotate(3deg); max-width: 72%;
  background: rgba(255, 251, 240, .94); padding: .45em .9em .5em; border-radius: 2px; box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  font-weight: 700; font-size: 1.02rem; line-height: 1.4; text-align: center; color: var(--ink);
}
.year-notes { display: flex; flex-wrap: wrap; gap: 10px; margin: -6px 0 22px; }
.year-note {
  font-family: var(--font-title); font-weight: 700; text-decoration: none; color: var(--ink); background: #FBEFA8;
  padding: .3em .8em .35em; box-shadow: 0 3px 6px rgba(55, 35, 15, .3); transform: rotate(-2deg); transition: transform .15s;
}
.year-note:nth-child(even) { background: #F6D3CA; transform: rotate(2deg); }
.year-note:hover { transform: rotate(0) translateY(-2px); }
.pin-title small { display: block; font-family: var(--font-pixel); font-weight: 400; font-size: .72rem; color: var(--coral-deep); letter-spacing: .06em; }
.nav-break { display: none; }
body.shelf-live .catalog-row, body.shelf-series .catalog-row { display: none; }
body.shelf-live .segmented[aria-label="瀏覽方式"] { display: none; }  /* 完整直播頁固定為軟木板 */
.back-link { color: var(--teal-deep); text-decoration: none; font-weight: 600; }
/* 系列目錄：書卡 */
.series-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 6px 0 24px; }
.series-card {
  display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px;
  background: #FFFBF0; border: 1.5px solid #EBDDB8; border-left: 6px solid #D9B44F; border-radius: 6px 12px 12px 6px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s;
}
.series-card:hover { transform: translateY(-3px); }
.series-cover { width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--ivory); display: grid; place-items: center; font-size: 1.8rem; }
.series-cover img { width: 100%; height: 100%; object-fit: cover; }
.series-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.series-meta b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4a3517; }
.series-meta small { color: var(--ink-soft); font-size: .8rem; }
.copy-link.done { background: var(--mint); }

/* ---------- 支持網站 ---------- */
.support-link {
  display: inline-flex; align-items: center; gap: .3em; margin: 4px 0 10px; padding: .35em 1.2em;
  background: #FBEFD9; color: #7A5A2B; border: 1.5px solid #E6C98F; border-radius: 999px;
  text-decoration: none; font-size: .92rem; box-shadow: 0 2px 0 #E6C98F; transition: transform .15s;
}
.site-footer .support-link { color: #7A5A2B; }
.support-link:hover { transform: translateY(-2px); }

/* ---------- 內頁（關於、協作者名單） ---------- */
.subpage { max-width: 820px; margin: 0 auto; padding: 26px 16px 50px; }
.paper {
  position: relative; background: var(--card); border: 1.5px solid var(--sand); border-left: 8px solid var(--teal);
  border-radius: 12px; padding: 24px 28px; margin: 0 0 22px; box-shadow: 0 3px 0 var(--sand);
}
.paper h2 { margin: 0 0 8px; font-weight: 600; color: var(--teal-ink); font-size: 1.35rem; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.paper h2 .chapter { font-family: var(--font-pixel); font-size: .78rem; letter-spacing: .15em; color: var(--ink-soft); }
.paper p, .paper li { line-height: 2; }
.paper .corner-sticker { position: absolute; right: 14px; top: -26px; height: 70px; }
/* 關於頁：安俞真（左）／金秋天（右）圓形頭像，滑過換第二張 */
.duo { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 18px 0 10px; }
.duo-face { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.duo-face figcaption { font-size: .9rem; color: var(--ink-soft); }
.duo-heart { height: 30px; width: auto; margin-bottom: 26px; animation: bob 1.6s ease-in-out infinite; }
.swap { position: relative; display: block; width: 132px; height: 132px; border-radius: 50%; overflow: hidden; outline: none;
  background: var(--mint); border: 4px solid var(--card); box-shadow: 0 0 0 2px var(--sand), var(--shadow); }
.swap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 14px; image-rendering: pixelated; transition: opacity .35s; }
.duo-face.photo .swap img { object-fit: cover; padding: 0; image-rendering: auto; }
.swap img + img { opacity: 0; }
.swap:hover img + img, .swap:focus-visible img + img { opacity: 1; }
.swap:hover img:first-child, .swap:focus-visible img:first-child { opacity: 0; }
@media (max-width: 640px) {
  .swap { width: 96px; height: 96px; }
  .duo { gap: 16px; }
  .duo-heart { height: 22px; }
}
.name-card {
  position: relative; margin: 18px 0 4px; padding: 16px 18px 12px; background: var(--paper);
  border: 1.5px solid var(--sand); border-radius: 8px;
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(242, 195, 185, .45) 27px 28px);
}
.name-card::before { content: ''; position: absolute; left: 0; right: 0; top: 34px; border-top: 2px solid var(--coral); }
.name-card-label { display: block; font-family: var(--font-pixel); font-size: .78rem; letter-spacing: .15em; color: var(--coral-deep); margin-bottom: 10px; }
.name-formula { margin: 0; font-family: var(--font-title); font-size: 1.08rem; color: var(--teal-ink); line-height: 2; overflow-wrap: anywhere; }
.mailbox { border-left-color: var(--coral-deep); }
.form-embed {
  margin-top: 10px; border-radius: 12px; overflow: hidden; background: var(--white); border: 1.5px solid var(--line);
}
.form-embed iframe { display: block; width: 100%; height: 1023px; border: 0; }
.form-fallback { margin: 8px 0 0; font-size: .85rem; color: var(--ink-soft); }
.disclaimer { font-size: .85rem; color: var(--ink-soft); background: var(--ivory); border-radius: 10px; padding: 10px 14px; line-height: 1.8; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.team-card {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.team-card .avatar { height: 76px; justify-self: center; }
.team-card .avatar.photo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--sand), var(--shadow); }
.team-card .name { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.team-card .role { display: inline-block; font-family: var(--font-pixel); font-size: .72rem; letter-spacing: .1em; background: var(--mint); color: var(--teal-ink); padding: 0 .6em; border-radius: 4px; margin-left: 6px; }
.team-card .role.chief { background: var(--coral); color: #6d3a32; }
.team-card .desc { margin: 2px 0 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.7; }
.x-link {
  display: inline-flex; align-items: center; gap: .35em; text-decoration: none; white-space: nowrap;
  background: var(--ink); color: var(--white); border-radius: 999px; padding: .3em .9em; font-size: .88rem;
}
.x-link:hover { background: var(--teal-ink); }
.x-link .threads-icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.x-link { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .paper { padding: 18px 16px; }
  .paper .corner-sticker { height: 52px; top: -20px; }
  .paper:has(.corner-sticker) h2 { padding-right: 48px; }
  .form-embed iframe { width: 1px; min-width: 100%; height: 1150px; }
  .team-card { grid-template-columns: 64px minmax(0, 1fr); }
  .team-card .avatar { height: 60px; }
  .team-card .avatar.photo { width: 60px; height: 60px; }
  .team-card .x-link { grid-column: 2; justify-self: start; }
}

/* ---------- 工具列：目錄櫃 ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20; margin-top: 18px;
  background: rgba(247, 244, 239, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px 6px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { flex: 1 1 220px; max-width: 340px; }
.toolbar-spacer { flex: 1; }
.catalog-row { max-width: 1200px; margin: 0 auto; padding: 4px 16px; display: flex; gap: 10px; align-items: flex-start; }
.row-label {
  flex: 0 0 auto; font-size: .78rem; color: var(--ink-soft); padding-top: .25em; letter-spacing: .15em;
  border-right: 1.5px solid var(--sand); padding-right: 10px; min-width: 46px;
}
.tag-filter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tag-filter::-webkit-scrollbar { display: none; }
.tag-filter button {
  border: 1.5px solid var(--line); background: var(--white); border-radius: 4px; padding: .05em .75em; cursor: pointer; white-space: nowrap;
  color: var(--ink); font-size: .9rem;
}
.tag-filter button.empty { color: var(--ink-soft); opacity: .6; }
.tag-filter button[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: var(--ink); opacity: 1; }
.scroll-row { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.scroll-row.more-right { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.scroll-row.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%); mask-image: linear-gradient(90deg, transparent, #000 15%); }
.scroll-row.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.series-filter button { border-style: dashed; border-color: #D9B97A; background: #FFFDF6; color: #6b4f24; }
.series-filter button[aria-pressed="true"] { background: #F5D77E; border-color: #D9B44F; border-style: solid; color: #4a3517; }
.tag-filter .count { font-size: .72rem; opacity: .7; margin-left: .35em; }

.timeline-nav { padding-bottom: 10px; }
.timeline-body { min-width: 0; flex: 1; }
.years { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.years::-webkit-scrollbar { display: none; }
.years button {
  flex: 0 0 auto; white-space: nowrap; border: 0; background: transparent; padding: 0 .7em; border-radius: 6px; cursor: pointer;
  color: var(--ink-soft); font-size: 1rem; font-family: var(--font-title);
}
.years button small { font-family: var(--font); }
.years button[aria-pressed="true"] { background: var(--teal); color: var(--white); }
.months { display: flex; gap: 4px; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.months::-webkit-scrollbar { display: none; }
.months button {
  flex: 0 0 auto; min-width: 48px; border: 1.5px solid var(--line); background: var(--card); border-radius: 6px;
  padding: .1em .4em; cursor: pointer; font-size: .85rem; line-height: 1.3; color: var(--ink);
}
.months button small { display: block; font-size: .7rem; color: var(--ink-soft); }
.months button.has { border-color: var(--teal); }
.months button.bday { border-color: var(--coral-deep); background: var(--blush); }
.months button[aria-pressed="true"] { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--white); }
.months button[aria-pressed="true"] small { color: rgba(255,255,255,.85); }
.months button:not(.has):not([aria-pressed="true"]) { color: var(--ink-soft); opacity: .6; }
.years button[aria-pressed="true"]:not(.whole) { background: var(--mint); color: var(--teal-ink); }
.period-caption { margin: -8px 0 18px; color: var(--ink-soft); font-size: .9rem; letter-spacing: .05em; }
.status .btn { margin-top: 4px; }

/* ---------- 主內容 ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 28px 16px 60px; min-height: 50vh; }
.status { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--ink-soft); padding: 60px 0; }
.status .sprite { height: 72px; }

.month-section { margin-bottom: 40px; }
/* 目錄抽屜標籤 */
.month-heading {
  display: flex; align-items: center; gap: 14px; margin: 0 0 20px; font-weight: 400;
}
.drawer-label {
  position: relative; display: inline-flex; align-items: baseline; gap: .4em;
  background: var(--card); border: 2px solid var(--wood); border-radius: 6px; padding: .15em 1.1em .2em;
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px var(--sand);
  color: var(--teal-ink);
}
.drawer-label b { font-family: var(--font-title); font-size: 1.35rem; font-weight: 700; }
.drawer-label span { font-size: 1.1rem; }
.drawer-label::after { /* 抽屜把手 */
  content: ''; position: absolute; left: 50%; bottom: -9px; width: 34px; height: 7px; transform: translateX(-50%);
  border: 2px solid var(--wood); border-top: 0; border-radius: 0 0 10px 10px; background: var(--sand);
}
.month-heading small { font-size: .85rem; color: var(--ink-soft); }
.month-heading::after { content: ''; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--sand) 0 8px, transparent 8px 14px); }

/* ---------- 便利貼 ---------- */
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 30px 22px; }
.note {
  --tilt: 0deg; --tint: var(--mint);
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--tint); border: 0; border-radius: 3px 3px 3px 20px; padding: 22px 14px 12px; text-align: left; cursor: pointer;
  box-shadow: var(--shadow); transform: rotate(var(--tilt)); transition: transform .25s, box-shadow .25s;
}
.note:hover, .note:focus-visible { transform: rotate(0) translateY(-4px); box-shadow: var(--shadow-lift); outline: none; z-index: 2; }
.note:focus-visible { box-shadow: var(--shadow-lift), 0 0 0 3px var(--teal-deep); }
.note::before { /* 紙膠帶 */
  content: ''; position: absolute; top: -10px; left: 50%; width: 78px; height: 22px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, .62); box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.note[data-tint="mint"]  { --tint: var(--mint); }
.note[data-tint="blush"] { --tint: var(--blush); }
.note[data-tint="coral"] { --tint: #F6D6CE; }
.note[data-tint="sand"]  { --tint: #E4DBD1; }
.note[data-tint="ivory"] { --tint: var(--ivory); }
.note[data-tint="teal"]  { --tint: #C3D5D1; }
.note-date { display: flex; justify-content: space-between; align-items: baseline; color: var(--teal-ink); }
.note-date strong { font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; }
.note-date span { font-size: .8rem; color: var(--ink-soft); }
.note-thumb {
  display: block; position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.55);
}
.note-thumb img, .note-thumb video { width: 100%; height: 100%; object-fit: cover; }
.note-thumb .placeholder span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-thumb .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 12px; text-align: center;
  color: var(--teal-deep); font-size: .95rem; line-height: 28px; overflow: hidden;
  background: repeating-linear-gradient(0deg, transparent 0 27px, rgba(151, 179, 174, .35) 27px 28px);
}
.badge {
  position: absolute; right: 8px; bottom: 8px; background: rgba(62, 74, 72, .75); color: var(--white);
  font-size: .72rem; padding: .05em .55em; border-radius: 999px;
}
.badge.play { right: auto; bottom: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: .95rem; padding: .25em .75em; }
.note-thumb video { pointer-events: none; background: var(--ivory); }
.note-title { display: block; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.note-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.note-tags .tag { background: rgba(255, 255, 255, .72); font-size: .72rem; }
.call-number {
  display: block; margin-top: 2px; padding-top: 6px; border-top: 1px dashed rgba(62,74,72,.25);
  font-family: var(--font-pixel); font-size: .72rem; color: var(--ink-soft); letter-spacing: .08em;
}

/* 系列 */
.series-chip {
  display: inline-block; align-self: flex-start; max-width: 100%; font-size: .74rem; line-height: 1.6; padding: 0 .6em; border-radius: 4px;
  background: rgba(255, 253, 249, .85); color: #7A5A2B; border: 1px dashed #D9B97A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ledger-title .series-chip { margin: 2px 0; }
.series-box {
  margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: #FBF6E9; border: 1.5px dashed #D9B97A;
}
.series-box h3 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 600; color: #6b4f24; }
.series-box h3 small { font-weight: 400; color: var(--ink-soft); font-size: .8rem; margin-left: 6px; }
.series-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.series-nav {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 12px; border-radius: 10px;
  border: 1.5px solid #E6D3A8; background: var(--card); cursor: pointer; min-width: 0;
}
.series-nav.next { text-align: right; align-items: flex-end; }
.series-nav small { font-family: var(--font-pixel); font-size: .72rem; letter-spacing: .08em; color: #8a6a35; }
.series-nav span { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.series-nav:hover { border-color: #C9A35A; background: var(--white); }
.series-nav.empty { cursor: default; opacity: .55; }
.series-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid #E6D3A8; }
.series-list li { position: relative; padding-left: 14px; }
.series-list li::before { content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid #D9B97A; }
.series-list li[aria-current="true"]::before { background: var(--coral-deep); border-color: var(--coral-deep); }
.series-item {
  display: flex; gap: 10px; align-items: baseline; width: 100%; padding: 5px 6px; border: 0; background: transparent;
  text-align: left; border-radius: 6px; cursor: pointer; color: var(--ink);
}
button.series-item:hover { background: rgba(255, 255, 255, .8); }
.series-item .d { font-family: var(--font-title); font-size: .85rem; color: var(--teal-ink); flex: 0 0 auto; }
.series-item .t { min-width: 0; overflow-wrap: anywhere; }
.series-item .here { margin-left: auto; flex: 0 0 auto; font-size: .72rem; background: var(--coral-deep); color: var(--white); padding: 0 .6em; border-radius: 999px; }
li[aria-current="true"] .series-item { cursor: default; font-weight: 600; }
@media (max-width: 640px) {
  .series-pager { grid-template-columns: 1fr; }
  /* 手機版影片：iOS Safari 的 iframe 會依內容撐開寬度，強制貼齊容器 */
  dialog.detail { overflow-x: hidden; }
  .media-grid, .media-grid figure { min-width: 0; max-width: 100%; }
  .embed { max-width: 100%; }
  .media-grid .vbox video { max-height: 70vh; }
  .embed iframe { width: 1px; min-width: 100%; max-width: 100%; }
  .embed[style] { aspect-ratio: var(--ar); }
  .embed.portrait { width: min(100%, calc(72vh * var(--arw))); margin: 0 auto; }
  .media-grid video { max-height: 72vh; object-fit: contain; }
  .series-nav.next { text-align: left; align-items: flex-start; }
}

/* 狗狗鼠鼠貼圖 */
.sticker { display: block; width: auto; image-rendering: auto; pointer-events: none; user-select: none; }
.note-sticker {  /* 統一放在便利貼內側右下角，不超出邊界，避免蓋到相鄰的便利貼 */
  position: absolute; right: 8px; bottom: 6px; height: 46px; max-width: 64px; object-fit: contain; z-index: 3;
  filter: drop-shadow(0 2px 1px rgba(62, 74, 72, .18)); transition: transform .25s;
}
.note:hover .note-sticker, .note:focus-visible .note-sticker { transform: translateY(-6px) rotate(-4deg); }
.note .call-number { padding-right: 66px; }
.heading-sticker { height: 40px; margin-left: -4px; }
.ledger-media { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ledger-sticker { height: 34px; }
.status-sticker { height: 84px; }
.detail-body { position: relative; }
.detail-sticker { position: absolute; right: 18px; top: 10px; height: 76px; }
.detail-body .call-no, .detail-body h2 { padding-right: 90px; }
.footer-shelf .sticker { height: 52px; }

/* 生日便利貼 */
.note.birthday {
  --tint: #FBE3DC;
  background:
    radial-gradient(circle at 12% 18%, var(--gold) 0 2.5px, transparent 3px),
    radial-gradient(circle at 82% 10%, var(--teal) 0 2.5px, transparent 3px),
    radial-gradient(circle at 90% 62%, var(--coral-deep) 0 2.5px, transparent 3px),
    radial-gradient(circle at 8% 70%, var(--teal) 0 2px, transparent 2.5px),
    radial-gradient(circle at 50% 95%, var(--gold) 0 2px, transparent 2.5px),
    linear-gradient(160deg, #FDEDE7, #F6CFC5);
  outline: 2px dashed var(--coral-deep); outline-offset: -7px; padding-top: 40px;
  box-shadow: 0 0 0 4px rgba(242, 195, 185, .55), var(--shadow-lift);
}
.note.birthday::before { background: repeating-linear-gradient(45deg, rgba(255,255,255,.75) 0 6px, rgba(245,215,126,.75) 6px 12px); }
.bday-ribbon {
  position: absolute; top: 8px; left: -8px; z-index: 1; background: var(--coral-deep); color: var(--white);
  font-family: var(--font-pixel); font-size: .72rem; letter-spacing: .08em; padding: .05em .7em .05em .6em;
  box-shadow: 2px 2px 0 rgba(62,74,72,.2);
}
.bday-ribbon::after {
  content: ''; position: absolute; left: 0; bottom: -6px; border: 3px solid transparent; border-top-color: #8f4e43; border-right-color: #8f4e43;
}
.note.birthday .note-date strong { color: var(--coral-deep); }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- 列表：借閱登記卡 ---------- */
.ledger {
  background: var(--card); border: 1.5px solid var(--sand); border-radius: 10px; overflow: hidden;
  box-shadow: 0 3px 0 var(--sand);
}
.ledger-head, .ledger-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(120px, 220px) 130px; gap: 14px; align-items: center;
  padding: 10px 16px;
}
.ledger-head {
  background: var(--mint); color: var(--teal-ink); font-family: var(--font-pixel); font-size: .78rem; letter-spacing: .15em;
  border-bottom: 2px solid var(--teal);
}
.ledger ol { list-style: none; margin: 0; padding: 0; }
.ledger-row {
  width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer;
  border-bottom: 1px solid #ECE4DA; transition: background .15s;
}
.ledger li:last-child .ledger-row { border-bottom: 0; }
.ledger-row:hover, .ledger-row:focus-visible { background: #F3F7F3; outline: none; }
.ledger-date { line-height: 1.25; color: var(--teal-ink); }
.ledger-date strong { display: block; font-family: var(--font-title); font-size: 1.02rem; }
.ledger-date span { font-size: .78rem; color: var(--ink-soft); }
.ledger-title { min-width: 0; }
.ledger-title b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.ledger-title span { display: block; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ledger-media { font-size: .8rem; color: var(--ink-soft); text-align: right; white-space: nowrap; }
.ledger-row.birthday { background: linear-gradient(90deg, #FBE3DC, transparent 70%); }
.ledger-row.birthday .ledger-date strong { color: var(--coral-deep); }
.ledger-row .bday-mark { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-pixel); font-size: .72rem; color: var(--coral-deep); }
.ledger-row .bday-mark img { height: 18px; }

/* ---------- 詳細內容：書頁 ---------- */
dialog.detail {
  width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 14px;
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.25);
  border-left: 10px solid var(--teal);
}
dialog.detail.birthday { border-left-color: var(--coral-deep); }
dialog.detail::backdrop { background: rgba(62, 74, 72, .45); backdrop-filter: blur(3px); }
.detail-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--mint); border-bottom: 1px solid var(--line);
}
dialog.detail.birthday .detail-head { background: var(--blush); }
.detail-head .date { flex: 1; color: var(--teal-ink); font-family: var(--font-title); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.75); cursor: pointer; font-size: 1.1rem;
  display: inline-grid; place-items: center; color: var(--teal-ink); flex: 0 0 auto;
}
.icon-btn:hover { background: var(--white); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.detail-body {
  padding: 20px 28px 28px;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(151, 179, 174, .16) 31px 32px);
}
.call-no { margin: 0; font-family: var(--font-pixel); font-size: .8rem; color: var(--ink-soft); letter-spacing: .1em; }
.detail-body h2 { margin: 0 0 8px; font-weight: 600; font-size: 1.55rem; line-height: 1.45; overflow-wrap: anywhere; }
.detail-body .note-tags { margin-bottom: 14px; }
.detail-text { font-size: 1.05rem; line-height: 2; overflow-wrap: anywhere; margin-bottom: 18px; }
.birthday-banner {
  display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 0 0 14px; padding: 12px;
  background: linear-gradient(160deg, #FDEDE7, #F6CFC5); border-radius: 12px; border: 2px dashed var(--coral-deep);
  font-family: var(--font-pixel); font-size: 1.3rem; color: var(--coral-deep); letter-spacing: .1em;
}
.birthday-banner .sprite { height: 56px; }
.birthday-banner span { align-self: center; }

.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.media-grid figure { margin: 0; min-width: 0; }
.media-grid figure.wide { grid-column: 1 / -1; }
.media-grid figure.single { grid-column: 1 / -1; }
.media-grid .photo {
  display: block; width: 100%; padding: 0; border: 0; background: var(--ivory); border-radius: 10px; overflow: hidden; cursor: zoom-in;
}
.media-grid .photo img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.media-grid figure.single .photo img { aspect-ratio: auto; max-height: 70vh; object-fit: contain; margin: 0 auto; }
.media-grid video { width: 100%; border-radius: 10px; background: #000; }
/* 雲端硬碟影片：原生播放器，依影片比例完整顯示（直式影片以高度為限、置中） */
.vbox { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.media-grid .vbox video { display: block; width: auto; height: auto; max-width: 100%; max-height: 78vh; min-width: 160px; border-radius: 10px; background: #000; }
.video-open { align-self: flex-end; font-size: .78rem; color: var(--ink-soft); }
.media-grid figcaption { font-size: .82rem; color: var(--ink-soft); text-align: center; margin-top: 4px; }
.embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--ivory); }
.embed.tall { aspect-ratio: 4 / 5; max-width: 480px; margin: 0 auto; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tweet-box { display: flex; justify-content: center; min-height: 120px; }
.link-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--white); border-radius: 10px;
  border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); overflow-wrap: anywhere;
}
.link-card:hover { border-color: var(--teal); }
.link-card .ico { font-size: 1.4rem; }
.source {
  margin: 0; padding-top: 12px; border-top: 1px dashed var(--sand); font-size: .9rem; color: var(--ink-soft); overflow-wrap: anywhere;
}

dialog.lightbox {
  border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
}
dialog.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
dialog.lightbox::backdrop { background: rgba(30, 36, 35, .88); }
dialog.lightbox img { max-width: calc(100vw - 32px); max-height: calc(100vh - 90px); object-fit: contain; border-radius: 6px; }
dialog.lightbox a { color: var(--white); font-size: .9rem; }
dialog.lightbox .icon-btn { position: absolute; top: 14px; right: 14px; }

/* ---------- 頁尾 ---------- */
.site-footer { text-align: center; padding: 20px 16px 40px; color: var(--ink-soft); font-size: .85rem; }
.site-footer a { color: var(--ink-soft); }
.footer-shelf {
  display: flex; justify-content: center; align-items: flex-end; gap: 12px; max-width: 260px; margin: 0 auto 10px;
  border-bottom: 8px solid var(--wood); box-shadow: 0 4px 0 var(--wood-deep);
}
.footer-shelf .sprite { height: 44px; }
.footer-shelf .sprite.small { height: 18px; margin-bottom: 18px; }

@media (max-width: 760px) {
  .ledger-head { display: none; }
  .ledger-row { grid-template-columns: 86px minmax(0, 1fr); gap: 4px 12px; }
  .ledger-tags, .ledger-media { grid-column: 2; text-align: left; }
  .ledger-media { justify-content: flex-start; }
}
@media (max-width: 640px) {
  html { scroll-padding-top: 220px; }
  .site-header { padding-top: 14px; }  /* 手機頁首縮小，第一眼就能看到工具列與便利貼 */
  .plaque { display: none; }
  .brand h1 { font-size: 2rem; }
  .tagline { font-size: .85rem; margin-top: .2em; }
  .shelf { height: 52px; gap: 6px; margin-top: 6px; }
  .shelf .sprite { height: 42px; }
  .shelf .chipmunk { height: 40px; }
  .shelf .sprite.books { height: 22px; }
  .today-stamp { transform: scale(.85); }
  .site-nav { margin-top: 10px; gap: 4px; }
  .site-nav a { font-size: .85rem; padding: .2em .7em; }
  .site-nav a.bookmark { padding-bottom: .55em; }
  .nav-break { display: block; flex-basis: 100%; height: 0; }  /* 手機：書籤換到第二行並排 */
  .series-cards { grid-template-columns: 1fr; }
  .corkboard { padding: 18px 12px 22px; border-width: 8px; }
  .cork-grid { gap: 26px 12px; }
  .pin-card { padding: 6px 6px 8px; }
  .pin-photo { aspect-ratio: 4 / 5; }
  .pin-title { font-size: .76rem; padding: .3em .5em .35em; max-width: 86%; right: -4px; top: 14px; }  /* 避開中央圖釘 */
  .site-nav a.bookmark .count { font-size: .68rem; }
  .shelf .sprite.books.flip { display: none; }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .note { padding: 18px 10px 10px; }
  .note.birthday { padding-top: 36px; }
  .note-title { font-size: .92rem; }
  .note-sticker { height: 40px; max-width: 56px; right: 6px; bottom: 5px; }
  .note .call-number { padding-right: 58px; }
  .detail-sticker { height: 56px; right: 10px; }
  .detail-body .call-no, .detail-body h2 { padding-right: 64px; }
  .ledger-sticker { height: 28px; }
  .detail-body { padding: 16px; }
  .media-grid { gap: 8px; }
  .birthday-banner { font-size: .95rem; gap: 6px; }
  .birthday-banner .sprite { height: 40px; }
  .birthday-banner span { white-space: nowrap; font-size: .85rem; letter-spacing: .08em; }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .row-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .note { transform: none; }
}

/* 進站公告（浮動小視窗） */
.notice-pop {  /* 軟木塞留言板：外框木條＋軟木底，公告像便條紙用圖釘釘上去 */
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 340px; padding: 14px 14px 12px;
  border: 7px solid var(--wood); border-radius: 10px; box-shadow: var(--shadow-lift), inset 0 0 12px rgba(80, 50, 20, .25);
  background-color: #CFAE85;
  background-image:
    radial-gradient(rgba(120, 80, 40, .35) 1px, transparent 1.5px),
    radial-gradient(rgba(255, 240, 210, .35) 1px, transparent 1.5px);
  background-size: 9px 9px, 13px 13px; background-position: 0 0, 4px 6px;
  animation: notice-in .35s ease-out;
}
.notice-pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.notice-pop-head .sticker { height: 40px; margin: -30px 0 -4px -6px; }
.notice-pop-head b {
  flex: 1; font-family: var(--font-pixel); letter-spacing: .12em; font-size: .85rem; color: var(--white);
  text-shadow: 0 1px 0 rgba(80, 50, 20, .5);
}
.notice-pop-head .icon-btn { width: 28px; height: 28px; font-size: .85rem; background: rgba(255, 253, 249, .85); }
.notice-pop ul { list-style: none; margin: 10px 0 12px; padding: 4px 2px; display: grid; gap: 14px; max-height: 46vh; overflow-y: auto; }
.notice-pop li {
  position: relative; padding: 16px 14px 12px; background: var(--card); border-radius: 2px;
  box-shadow: 0 3px 6px rgba(62, 44, 24, .25); transform: rotate(-1deg);
  font-size: .92rem; line-height: 1.7; overflow-wrap: anywhere;
}
.notice-pop li:nth-child(even) { transform: rotate(1deg); background: #FBF3E4; }
.notice-pop li::before {  /* 圖釘 */
  content: ''; position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F6B7A8, var(--coral-deep) 60%, #8E4A3F);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .3);
}
.notice-pop li small { display: block; font-family: var(--font-pixel); color: var(--coral-deep); letter-spacing: .06em; margin-bottom: 2px; }
.notice-pop > .btn { display: block; margin-left: auto; background: var(--card); }
@keyframes notice-in { from { opacity: 0; transform: translateY(16px); } }
@media (max-width: 640px) {
  .notice-pop { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* 頁尾「狗鼠一起」貼圖（圖庫有圖時取代小愛心） */
.footer-shelf .pair-sticker { height: 72px; width: auto; }
.footer-shelf [hidden] { display: none !important; }
