@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=LXGW+WenKai+TC&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* 貓咪時光 palette — 蜜桃橘 × 奶茶米 × 奶油
   (variable names kept from upstream so every component recolors at once) */
:root {
  --pink: #ff8a5c;
  --pink-light: #ffc4a3;
  --pink-pale: #fff3ea;
  --orange: #ffb347;
  --red: #ff7b6b;
  --blue: #7cc5e8;
  --green: #b8e6c8;
  --purple: #d4b8e8;
  --bg: #fdf6ee;
  --surface: #ffffff;
  --card-1: #fff3ea;
  --card-2: #eef7fd;
  --card-3: #f0faf2;
  --card-4: #f9f2fd;
  --card-5: #fdf8ec;
  --text: #6b5344;
  --text-muted: #bfa48e;
  --shadow: rgba(255, 138, 92, .16);
  --topbar-bg: #fffaf3;
  --topbar-border: #f2ddc9;
  --photo-frame: #fffdf7;
  --photo-shadow: rgba(122, 82, 52, .14);
  --font-cute: 'LXGW WenKai TC', 'Nunito', system-ui, sans-serif;
}

/* Hide the native page scrollbar (app-like). On an infinite feed a full-height
   scrollbar is meaningless and, with classic scrollbars, its appearing/
   disappearing shifts the fixed tab bar. Scroll still works via wheel / touch /
   the year-month rail. */
html, body { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

/* Sticky header wrapper */
#sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  /* 手帳紙感：細點點網格（取代原版的彩色光暈） */
  background-image:
    radial-gradient(rgba(196, 156, 116, .12) 1.2px, transparent 1.3px),
    radial-gradient(rgba(196, 156, 116, .08) 1.2px, transparent 1.3px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  color: var(--text);
  min-height: 100vh;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(rgba(255, 214, 170, .06) 1.2px, transparent 1.3px),
    radial-gradient(rgba(255, 214, 170, .04) 1.2px, transparent 1.3px);
}

/* Top bar */
#topbar {
  position: relative; z-index: 100;
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1rem;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: 0 1px 10px rgba(150, 110, 70, .08);
  flex-wrap: wrap;
}
.logo-icon {
  width: 34px; height: 34px; border-radius: 50%;
  flex-shrink: 0;
}
#topbar h1 {
  font-size: 1.35rem; font-weight: 800; white-space: nowrap;
  font-family: var(--font-cute);
  background: linear-gradient(135deg, #e8964c, var(--pink), #ff7b6b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex; align-items: center; gap: .4rem;
}

/* Cat count pill */
.cat-count {
  font-size: .65rem; font-weight: 700;
  background: rgba(255, 138, 92, .15);
  -webkit-text-fill-color: var(--pink);
  padding: .15rem .5rem; border-radius: 20px;
  white-space: nowrap;
}
.cat-count:empty { display: none; }

.filters {
  display: flex; gap: .5rem; flex: 1; justify-content: flex-end;
  align-items: center; flex-wrap: wrap; min-width: 0;
}
/* keep controls readable: don't shrink to the arrow, cap long-option selects */
.filters select, .filters .search-input,
.filters .date-picker, .filters .date-picker-btn {
  flex-shrink: 0;
}
.filters select { max-width: 12rem; }

.filter-toggle {
  color: var(--pink); flex-shrink: 0; background: none; border: none;
  padding: 0; cursor: pointer; position: relative;
  display: none; align-items: center; /* funnel: mobile only */
}
.sheet-head, .sheet-backdrop { display: none; } /* sheet chrome: mobile only */
.filter-toggle.has-active::after {
  content: ""; position: absolute; top: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pink); border: 1.5px solid var(--topbar-bg);
}

/* Header action icon buttons (random / social / comment / theme) */
.topbar-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
/* Install-to-home-screen button (shown only when beforeinstallprompt fires) */
.install-btn {
  display: inline-flex; align-items: center; gap: .25rem; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff;
  border: none; border-radius: 20px; padding: .35rem .7rem;
  font-family: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
  transition: transform .2s;
}
.install-btn[hidden] { display: none; }
.install-btn:hover { transform: scale(1.05); }
.random-cat-button, .social-fab, .act-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; border: none;
  background: transparent; color: var(--pink); cursor: pointer; font-size: 0;
  font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
}
.random-cat-button:hover, .social-fab:hover, .act-btn:hover { background: var(--pink-pale); }
.random-cat-button svg, .social-fab svg, .act-btn svg { width: 22px; height: 22px; }
[data-theme="dark"] .random-cat-button:hover,
[data-theme="dark"] .social-fab:hover,
[data-theme="dark"] .act-btn:hover { background: rgba(255,138,92,.15); }
.social-pop {
  position: fixed; top: 58px; right: 1rem; z-index: 120;
  display: flex; gap: 16px; padding: .55rem .85rem;
  background: var(--topbar-bg); border: 2px solid var(--pink-light);
  border-radius: 26px; box-shadow: 0 8px 30px var(--shadow);
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.social-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.social-pop a { margin: 0; }

/* Search input */
.search-input {
  padding: .45rem .8rem; border-radius: 20px;
  border: 2px solid var(--pink-light);
  background: #fff; color: var(--text); font-size: .85rem;
  font-family: inherit; min-width: 0; max-width: 180px;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,138,92,.2);
}
.search-input:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}
.random-cat-button:focus-visible,
.social-fab:focus-visible,
.act-btn:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}
.random-cat-button.bounce {
  animation: random-bounce .4s ease;
}
@keyframes random-bounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(.9); }
  60% { transform: scale(1.15); }
}

.search-input::placeholder { color: var(--text-muted); }

.filters select {
  appearance: none; -webkit-appearance: none;
  padding: .45rem 1.9rem .45rem .8rem; border-radius: 20px;
  border: 2px solid var(--pink-light);
  /* custom chevron so the pill corner doesn't clip the native arrow */
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff8a5c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center;
  background-size: .7rem;
  color: var(--text); font-size: .85rem;
  font-family: inherit; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.filters select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,138,92,.2);
}
.filters select:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

/* Inline SVG icon alignment */
button svg, .date-picker-btn svg { vertical-align: -0.15em; }

/* Custom date picker */
.date-picker { position: relative; }
.date-picker-btn {
  padding: .45rem .8rem; border-radius: 20px;
  border: 2px solid var(--pink-light);
  background: #fff; color: var(--text); font-size: .85rem;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: border-color .2s, box-shadow .2s;
}
.date-picker-btn:hover { border-color: var(--pink); }
.date-picker-btn.active {
  border-color: var(--pink); background: var(--pink-pale);
}
.date-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 190;
  background: #fff; border-radius: 16px; padding: .8rem;
  border: 2px solid var(--pink-light);
  box-shadow: 0 8px 30px var(--shadow);
  width: 260px;
}
.dd-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.dd-header span {
  font-weight: 800; font-size: .9rem;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dd-nav {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--pink-pale); color: var(--pink);
  font-size: 1.1rem; font-weight: 800; cursor: pointer;
  transition: background .2s;
}
.dd-nav:hover { background: var(--pink-light); color: #fff; }
.dd-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: .7rem; font-weight: 700;
  color: var(--text-muted); margin-bottom: .3rem;
}
.dd-days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.dd-days button {
  aspect-ratio: 1; border: none; border-radius: 50%;
  background: transparent; color: var(--text); font-size: .78rem;
  font-family: inherit; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.dd-days button:hover { background: var(--pink-pale); }
.dd-days button.today { border: 2px solid var(--pink-light); }
.dd-days button.selected {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
}
.dd-days button.has-cat::after {
  content: ""; display: block; width: 4px; height: 4px;
  background: var(--pink); border-radius: 50%;
  margin: -2px auto 0;
}
.dd-days button.selected.has-cat::after { background: #fff; }
.dd-days button.other-month { color: var(--text-muted); opacity: .4; }
.dd-clear {
  display: block; width: 100%; margin-top: .5rem; padding: .4rem;
  border: none; border-radius: 20px;
  background: var(--pink-pale); color: var(--pink);
  font-family: inherit; font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: background .2s;
}
.dd-clear:hover { background: var(--pink-light); color: #fff; }

/* Theme toggle */
.theme-toggle {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--pink-light);
  background: var(--pink-pale); color: var(--text);
  font-size: 1rem; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s, transform .2s;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--pink); transform: scale(1.1); }
.theme-toggle:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

/* GitHub link */
.github-link {
  color: var(--pink); flex-shrink: 0;
  transition: color .2s, transform .2s;
  display: flex; align-items: center;
}
.github-link:hover { color: var(--purple); transform: scale(1.15) rotate(-8deg); }

.tg-link, .fb-link, .bmc-link {
  flex-shrink: 0;
  transition: color .2s, transform .2s;
  display: flex; align-items: center;
}
.tg-link { color: #229ED9; }
.fb-link { color: #1877F2; }
.bmc-link { color: #d8a200; }
.tg-link:hover, .fb-link:hover, .bmc-link:hover { transform: scale(1.15) rotate(8deg); }

/* Timeline sidebar */
#timeline {
  position: fixed; top: var(--header-offset, 56px); right: 0; bottom: 0; width: 130px; z-index: 90;
  background: linear-gradient(180deg, #fff 0%, var(--pink-pale) 100%);
  border-left: 2px solid var(--pink-light);
  overflow-y: auto; padding: .8rem 0;
  transition: transform .3s ease;
}
#timeline::-webkit-scrollbar { width: 4px; }
#timeline::-webkit-scrollbar-thumb { background: var(--pink-light); border-radius: 4px; }

#timeline-toggle {
  display: none; position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 91;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,138,92,.35);
  transition: transform .2s;
}
#timeline-toggle:hover { transform: scale(1.1); }

#timeline-list a {
  display: block; padding: .3rem .8rem; color: var(--text-muted);
  text-decoration: none; font-size: .8rem; font-weight: 600;
  border-right: 3px solid transparent;
  transition: all .2s;
}
#timeline-list a:hover {
  color: var(--pink); background: rgba(255,138,92,.08);
  border-right-color: var(--pink);
}
#timeline-list .year {
  font-weight: 800; color: var(--purple); margin-top: .6rem;
  padding: .2rem .8rem; font-size: .85rem;
}

/* Back to top button */
.back-to-top {
  position: fixed; bottom: 9.4rem; right: 1.2rem; z-index: 91;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; font-size: 1.3rem; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,138,92,.35);
  opacity: 0; transform: translateY(20px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover { transform: scale(1.1); }

/* Gallery masonry */
.masonry {
  margin-top: 0; margin-right: 130px; padding: 1.2rem;
  /* Row-major waterfall: CSS grid with per-card row-span set in app.js
     (sizeCard). column-count gave column-major order — new items filled
     left/right instead of flowing down. grid-auto-rows is the span unit. */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 1.2rem;
  grid-auto-rows: 4px;
  align-items: start;
}

/* 拍立得手帳卡片：白框相紙 + 和紙膠帶 + 微微歪斜 */
.card {
  border-radius: 5px;
  overflow: visible;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
  background: var(--photo-frame);
  padding: 10px 10px 6px;
  border: 1px solid rgba(130, 95, 60, .08);
  box-shadow: 0 4px 14px var(--photo-shadow);
  position: relative;
}
.card:nth-child(4n+1) { transform: rotate(-1.1deg); }
.card:nth-child(4n+2) { transform: rotate(1deg); }
.card:nth-child(4n+3) { transform: rotate(-.5deg); }
.card:nth-child(4n)   { transform: rotate(1.3deg); }
/* 和紙膠帶（顏色三色輪替） */
.card::before {
  content: "";
  position: absolute; top: -9px; left: 50%;
  width: 84px; height: 20px;
  transform: translateX(-50%) rotate(-2deg);
  background: rgba(255, 168, 118, .5);
  border-left: 1px dashed rgba(255, 255, 255, .75);
  border-right: 1px dashed rgba(255, 255, 255, .75);
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}
.card:nth-child(3n+2)::before { background: rgba(139, 199, 226, .45); transform: translateX(-50%) rotate(2.4deg); }
.card:nth-child(3n)::before   { background: rgba(168, 214, 168, .45); transform: translateX(-50%) rotate(-1.2deg); }

.card:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.02);
  box-shadow: 0 14px 32px var(--photo-shadow);
  z-index: 3;
}
/* Card image wrapper for badge overlay */
.card-img-wrap { position: relative; }
.card-img-wrap img { width: 100%; display: block; border-radius: 2px; }

/* Image error placeholder */
.img-error {
  width: 100%; aspect-ratio: 1; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--pink-pale), #e8d5f5);
  font-size: 3rem; border-radius: 14px 14px 0 0;
}
.lb-img-error {
  display: flex; align-items: center; justify-content: center;
  width: 300px; height: 300px;
  background: linear-gradient(135deg, rgba(255,138,92,.3), rgba(201,177,255,.3));
  font-size: 4rem; border-radius: 16px;
}

.like-badge {
  position: absolute; top: .5rem; right: .5rem;
  display: inline-flex; align-items: center; gap: .2rem;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  color: var(--pink-light); padding: .2rem .55rem;
  border-radius: 20px; font-size: .7rem; font-weight: 700;
  pointer-events: none;
}
.like-badge svg { width: 12px; height: 12px; fill: var(--pink-light); stroke: var(--pink-light); }
/* 拍立得下緣：手寫感標註 */
.card-info { padding: .55rem .15rem .25rem; font-size: .78rem; text-align: center; }
.card-info .time {
  color: var(--text); font-weight: 600;
  font-family: var(--font-cute); font-size: .84rem;
}
.card-info .model {
  display: inline-flex; align-items: center; vertical-align: middle;
  margin-top: .35rem; margin-right: .3rem; padding: .12rem .5rem;
  border-radius: 6px; font-size: .62rem; font-weight: 700;
  color: #8a6a45; background: rgba(196, 156, 116, .18);
}

/* Month separator */
/* 月份分隔：和紙緞帶標籤 */
.month-sep {
  grid-column: 1 / -1;
  justify-self: start;
  font-family: var(--font-cute);
  font-size: 1rem; font-weight: 800; letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #ffb27e);
  padding: .3rem 1.3rem .3rem 1rem;
  border-radius: 4px 18px 18px 4px;
  transform: rotate(-1.4deg);
  box-shadow: 0 3px 10px var(--shadow);
  margin: .5rem 0 .9rem;
}
.month-sep::before { content: "🐾 "; }

/* End / scroll sentinel */
#end-msg {
  text-align: center; padding: 2.5rem; font-size: 1rem;
  color: var(--text-muted); font-weight: 700;
  margin-right: 130px;
}
#end-msg.loading { visibility: hidden; height: 1px; padding: 0; }
.hidden { display: none !important; }

/* Lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(90, 74, 90, .8);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem 0;
}
#lb-close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: none; color: #fff; font-size: 2.2rem; cursor: pointer;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
  transition: transform .2s; z-index: 1;
}
#lb-close:hover { transform: scale(1.2) rotate(90deg); }
#lb-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Lightbox nav arrows */
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.4); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 2.5rem; line-height: 1;
  width: 50px; height: 70px; border-radius: 12px;
  cursor: pointer; z-index: 1;
  transition: background .2s, opacity .2s;
  display: flex; align-items: center; justify-content: center;
}
.lb-nav:hover { background: rgba(0,0,0,.7); }
.lb-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.lb-nav.disabled { opacity: .2; pointer-events: none; }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }

/* Nav hint (fades out) */
.lb-nav-hint {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  color: rgba(255,255,255,.7); font-size: .75rem; font-weight: 600;
  padding: .3rem .8rem; border-radius: 20px;
  z-index: 1; pointer-events: none;
  opacity: 1; transition: opacity .5s;
  white-space: nowrap;
}
.lb-nav-hint.fade-out { opacity: 0; }

/* Info line above image */
#lb-info {
  color: rgba(255,255,255,.8); font-size: .8rem;
  font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.3);
  text-align: center; margin-bottom: .4rem;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .3rem;
}
#lb-info .lb-title { font-size: .85rem; width: 100%; }
#lb-info .lb-time { font-size: .75rem; opacity: .8; }
#lb-info .lb-model-tag {
  display: inline-block; padding: .12rem .5rem;
  border-radius: 6px; font-size: .62rem; font-weight: 700;
  color: #d8c4a8; background: rgba(255, 255, 255, .12); border: 1px dashed rgba(255,255,255,.3);
}
/* 貼紙感標籤（粉彩底 + 深色字，取代原版的漸層藥丸） */
.inspiration-tag {
  display: inline-block; padding: .12rem .5rem;
  border-radius: 6px; font-size: .62rem; font-weight: 700;
  white-space: nowrap; text-decoration: none;
}
.inspiration-tag.news {
  background: #dcedf8; color: #3a7ca5; border: 1px dashed #a8cfe6;
}
a.inspiration-tag.news:hover { background: #cfe6f5; text-decoration: underline; }
.inspiration-tag.original {
  background: #efe4f8; color: #8a63b8; border: 1px dashed #d3bce8;
}
/* Character tag */
.character-tag {
  display: inline-flex; align-items: center; vertical-align: middle;
  padding: .12rem .5rem;
  border-radius: 6px; font-size: .62rem; font-weight: 700;
  white-space: nowrap; text-decoration: none;
  background: #ffe8d2; color: #b06a2a; border: 1px dashed #f2c9a0;
}
a.character-tag { cursor: pointer; transition: transform .15s, filter .15s; }
a.character-tag:hover { transform: translateY(-1px); filter: brightness(1.03); }
.character-tag.seasonal {
  background: #ddf3e6; color: #3f9268; border-color: #b0dfc4;
}
/* Character avatar in tags */
.char-tag-avatar {
  width: 16px; height: 16px; border-radius: 50%;
  vertical-align: -3px; margin-right: 3px;
  object-fit: cover;
}
.card-info .character-tag { margin-top: .3rem; margin-right: .3rem; }
.card-info .inspiration-tag { margin-top: .3rem; margin-right: .3rem; vertical-align: middle; }

/* Image wrapper - contains overlay elements */
#lb-img-wrap {
  position: relative; max-width: 90vw;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  flex-shrink: 0;
}
#lb-img {
  display: block; max-width: 90vw; max-height: 75vh;
}

/* Action buttons on image bottom-right */
#lb-img-actions {
  position: absolute;
  bottom: .5rem; right: .5rem;
  display: flex; gap: .35rem;
}
#lb-like-btn, #lb-download-btn, #lb-copy-btn {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: .3rem .7rem;
  border-radius: 20px; font-family: inherit;
  font-size: .72rem; font-weight: 600;
  cursor: pointer; transition: background .2s, color .2s;
  white-space: nowrap;
}
#lb-like-btn:hover, #lb-download-btn:hover, #lb-copy-btn:hover {
  background: rgba(0,0,0,.85);
}
#lb-like-btn:focus-visible, #lb-download-btn:focus-visible, #lb-copy-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#lb-like-btn { color: var(--pink-light); }
#lb-like-btn svg { fill: var(--pink-light); stroke: var(--pink-light); }
#lb-like-btn:hover { color: var(--pink); }
#lb-like-btn:hover svg { fill: var(--pink); stroke: var(--pink); }

/* Details area below image - scrollable */
#lb-details {
  max-width: 600px; width: 90vw;
  max-height: 20vh;
  overflow-y: auto;
  margin-top: .5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.3) transparent;
}
#lb-details::-webkit-scrollbar { width: 4px; }
#lb-details::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 4px; }

/* Prompt text always hidden (copy button reads from it) */
#lb-prompt-text { display: none !important; }

/* Tab bar */
#lb-tab-bar {
  display: flex; gap: .3rem;
  justify-content: center;
  margin-bottom: .4rem;
}
#lb-tab-bar button {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  color: rgba(255, 255, 255, .6);
  padding: .25rem .7rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}
#lb-tab-bar button:hover {
  background: rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .9);
}
#lb-tab-bar button.active {
  background: rgba(255, 255, 255, .25);
  color: #fff;
  border-color: rgba(255, 255, 255, .4);
}

/* Tab panels */
.lb-panel {
  border-radius: 12px;
  padding: .5rem .8rem;
  border: 1px solid rgba(255, 255, 255, .2);
}

/* Story panel */
#lb-story {
  background: linear-gradient(135deg, rgba(201, 177, 255, .4), rgba(255, 138, 92, .3));
}
#lb-story-text {
  color: #fff; font-size: .85rem; line-height: 1.5;
  text-align: center; margin: 0;
}

/* Idea panel */
#lb-idea {
  background: linear-gradient(135deg, rgba(72, 187, 176, .4), rgba(116, 185, 255, .3));
}
#lb-idea-text {
  color: #fff; font-size: .8rem; font-style: italic;
  line-height: 1.5; text-align: center; margin: 0;
}

/* News panel */
#lb-news {
  background: linear-gradient(135deg, rgba(71, 150, 255, .3), rgba(100, 180, 255, .2));
}
#lb-news-list {
  display: flex; flex-wrap: wrap; gap: .3rem;
}
.news-tag {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 20px; color: #fff;
  font-size: .68rem; font-weight: 600;
  background: linear-gradient(135deg, rgba(71, 179, 255, .7), rgba(71, 130, 255, .6));
  text-decoration: none;
}
a.news-tag { cursor: pointer; transition: transform .15s, box-shadow .15s; }
a.news-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(71, 130, 255, .4);
  text-decoration: underline;
}
a.news-tag::after { content: " ↗"; opacity: .85; }
.lb-inspiration-link {
  color: var(--blue); font-weight: 700; text-decoration: underline;
  text-underline-offset: 2px; word-break: break-all;
}
.lb-inspiration-link:hover { color: var(--pink); }

/* Constraints panel */
#lb-avoid {
  background: linear-gradient(135deg, rgba(255, 179, 71, .3), rgba(255, 140, 60, .2));
}
#lb-avoid-list {
  display: flex; flex-wrap: wrap; gap: .3rem;
}
.avoid-tag {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 20px; color: #fff;
  font-size: .68rem; font-weight: 600;
  background: linear-gradient(135deg, rgba(255, 179, 71, .7), rgba(255, 107, 71, .6));
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1024px) {
  .masonry { grid-template-columns: repeat(2, 1fr); margin-right: 0; }
  #end-msg { margin-right: 0; }
  #timeline { transform: translateX(100%); }
  #timeline.open { transform: translateX(0); }
  #timeline-toggle { display: block; }
  .back-to-top { bottom: 9rem; }
}
@media (max-width: 600px) {
  .masonry { grid-template-columns: 1fr; padding: .8rem; margin-top: 0; }
  #topbar { gap: .4rem; padding: .5rem .6rem; }
  #topbar h1 { font-size: 1.1rem; }
  .logo-icon { width: 28px; height: 28px; }
  .filters { flex: 1 1 100%; order: 1; justify-content: flex-start; gap: .4rem; flex-wrap: wrap; overflow-x: visible; }
  .filters select { font-size: .78rem; padding: .35rem .5rem; }
  .search-input { font-size: .78rem; padding: .35rem .5rem; max-width: 140px; }
  .date-picker-btn { font-size: .78rem; padding: .35rem .5rem; }
  .date-dropdown { width: calc(100vw - 1.2rem); max-width: 280px; right: auto; left: 0; }
  .github-link { margin-left: auto; }
  .back-to-top { bottom: 9rem; right: 1rem; width: 40px; height: 40px; font-size: 1.1rem; }
  /* Lightbox mobile */
  .lb-nav { display: none; }
  #lightbox { justify-content: safe center; padding: 2.5rem 0 1rem; overflow-y: auto; }
  #lb-img-wrap { border-radius: 0; overflow: visible; box-shadow: none; }
  #lb-img { max-height: 45vh; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
  #lb-img-actions { position: static; justify-content: center; margin-top: .5rem; }
  #lb-details { max-height: none; }
}

/* Skeleton loader */
.skeleton-card {
  break-inside: avoid; margin-bottom: 1.2rem;
  border-radius: 5px; overflow: hidden;
  background: var(--photo-frame);
  padding: 10px 10px 6px;
  border: 1px solid rgba(130, 95, 60, .08);
  box-shadow: 0 4px 14px var(--photo-shadow);
}
.skeleton-img {
  width: 100%; aspect-ratio: 1;
  background: linear-gradient(90deg, var(--pink-pale) 25%, #ffe0ec 50%, var(--pink-pale) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-line {
  height: .75rem; margin: .6rem .8rem;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pink-pale) 25%, #ffe0ec 50%, var(--pink-pale) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w50 { width: 50%; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
[data-theme="dark"] .skeleton-img,
[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg, #2a2030 25%, #3a2a40 50%, #2a2030 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Dark mode - class-based for manual toggle */
[data-theme="dark"] {
  --bg: #221a13;
  --surface: #2f241b;
  --card-1: #2f2419;
  --card-2: #20272e;
  --card-3: #212b22;
  --card-4: #2b2230;
  --card-5: #2e2818;
  --text: #eddcc7;
  --text-muted: #9a8672;
  --shadow: rgba(0, 0, 0, .3);
  --topbar-bg: #2a211a;
  --topbar-border: #453526;
  --photo-frame: #382d22;
  --photo-shadow: rgba(0, 0, 0, .45);
}
[data-theme="dark"] .filters select,
[data-theme="dark"] .date-picker-btn,
[data-theme="dark"] .search-input {
  background: #2a2030;
  border-color: rgba(255, 138, 92, .3);
  color: var(--text);
}
[data-theme="dark"] .filters select {
  background: #2a2030 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffa5c8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center;
  background-size: .7rem;
}
[data-theme="dark"] .date-dropdown { background: #2a2030; border-color: rgba(255, 138, 92, .3); }
[data-theme="dark"] .dd-nav { background: rgba(255, 138, 92, .15); }
[data-theme="dark"] #timeline {
  background: linear-gradient(180deg, #2a2030 0%, #1a1520 100%);
  border-left-color: rgba(255, 138, 92, .2);
}
[data-theme="dark"] .card { border-color: rgba(255, 138, 92, .1); }
[data-theme="dark"] .dd-days button { color: var(--text); }
[data-theme="dark"] .dd-clear { background: rgba(255, 138, 92, .15); }
[data-theme="dark"] .img-error { background: linear-gradient(135deg, #2a1f2a, #1f2530); }
[data-theme="dark"] .cat-count { background: rgba(255, 138, 92, .25); }
[data-theme="dark"] .theme-toggle { background: rgba(255, 138, 92, .15); }
[data-theme="dark"] body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,138,92,.03) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(116,185,255,.03) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(201,177,255,.02) 0%, transparent 50%);
}

/* RSS link */
.rss-link {
  color: #FF6600; flex-shrink: 0;
  transition: color .2s, transform .2s;
  display: flex; align-items: center;
}
.rss-link svg { fill: currentColor; }
.rss-link:hover { color: #FF6600; transform: scale(1.15) rotate(8deg); }

/* Floating Giscus button */
.giscus-toggle {
  bottom: 1.2rem; right: 1.2rem; z-index: 96;
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}

/* Giscus slide-in panel */
.giscus-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 180;
  width: 420px; max-width: 100vw;
  background: var(--surface); color: var(--text);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.giscus-panel.open { transform: translateX(0); }

.giscus-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem;
  border-bottom: 2px solid var(--pink-light);
  font-weight: 800; font-size: 1.1rem; color: var(--text);
}
.giscus-panel-header h2 { margin: 0; font-size: 1.1rem; }
.giscus-panel-header button {
  background: none; border: none; font-size: 1.5rem;
  color: var(--text-muted); cursor: pointer;
  transition: color .2s, transform .2s;
  line-height: 1;
}
.giscus-panel-header button:hover { color: var(--pink); transform: scale(1.2); }

.giscus-panel-body {
  flex: 1; overflow-y: auto;
}
#giscus-section {
  padding: 1rem;
}

/* Dark mode for panel */
[data-theme="dark"] .giscus-panel {
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0,0,0,.4);
}
[data-theme="dark"] .giscus-panel-header {
  border-bottom-color: rgba(255,138,92,.3);
}
@media (max-width: 600px) {
  .giscus-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .giscus-panel.open { transform: translateY(0); }
  .giscus-toggle { bottom: 1rem; right: 1rem; }
}

/* === Character bar (index page) === */
/* character avatars: hidden until opened (角色 button / tab); shown as a
   top-right popover on desktop, a strip above the tab bar on mobile */
.character-bar {
  display: none; gap: .8rem; justify-content: center; align-items: center;
  padding: .5rem 1rem;
  background: var(--surface);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap; white-space: nowrap;
  box-shadow: 0 8px 30px var(--shadow);
}
.character-bar.char-open { display: flex; }

/* character page: restore the always-visible switch bar (the shared base is
   now display:none for the home-page popover). Same look as before. */
.character-bar--page {
  display: flex; position: relative; z-index: 99;
  border-bottom: 2px solid var(--pink-light);
  box-shadow: 0 2px 8px var(--shadow);
}
@media (max-width: 600px) { .character-bar--page { display: none; } }
@media (min-width: 601px) {
  .character-bar.char-open {
    position: fixed; top: 58px; right: 1rem; z-index: 120;
    border: 2px solid var(--pink-light); border-radius: 16px;
    max-width: 92vw;
  }
}
.character-bar a {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--text); font-size: .72rem; font-weight: 700;
  padding: .3rem .5rem; border-radius: 12px;
  transition: background .2s, transform .2s;
}
.character-bar a:hover { background: var(--pink-pale); transform: scale(1.08); }
.character-bar a.active { background: var(--pink-pale); border: 2px solid var(--pink); }
[data-theme="dark"] .character-bar a.active { background: rgba(255,138,92,.2); border-color: var(--pink); }
.character-bar .char-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .2rem;
  border: 2px solid var(--pink-light);
  overflow: hidden;
}
.character-bar .char-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
[data-theme="dark"] .character-bar { background: var(--surface); border-color: rgba(255,138,92,.2); }
[data-theme="dark"] .character-bar a:hover { background: rgba(255,138,92,.12); }
[data-theme="dark"] .char-avatar { background: linear-gradient(135deg, #2a1f2a, #1f2530); border-color: rgba(255,138,92,.3); }

/* === Back link (character page) === */
.back-link {
  display: flex; align-items: center; gap: .3rem;
  text-decoration: none; color: var(--text); font-size: .85rem; font-weight: 600;
  padding: .3rem .6rem; border-radius: 10px;
  transition: background .2s;
}
.back-link:hover { background: var(--pink-pale); }
[data-theme="dark"] .back-link:hover { background: rgba(255,138,92,.12); }

/* === Character profile page === */
.character-page {
  max-width: 900px; margin: 1rem auto 2rem; padding: 0 1rem;
}
.character-card {
  background: var(--surface); border-radius: 20px; padding: 1.5rem;
  border: 2px solid var(--pink-light); box-shadow: 0 4px 20px var(--shadow);
}
.character-card h2 {
  text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
/* #char-name keeps the centered gradient title, with the avatar to its left.
   The gradient must live on the text span (background-clip:text needs the text). */
#char-name { display: flex; align-items: center; justify-content: center; gap: .7rem; }
#char-name span {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.char-name-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--pink-light); flex-shrink: 0;
}
.char-section { margin-bottom: 1rem; }
.char-section h4 { font-size: .95rem; font-weight: 800; color: var(--pink); margin-bottom: .4rem; }
.char-section p, .char-section ul { font-size: .88rem; line-height: 1.6; }
.char-section ul { padding-left: 1.2rem; }
.char-quirks { color: var(--text-muted); font-style: italic; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.char-tag {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .78rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
}
.season-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.season-item {
  padding: .5rem .7rem; border-radius: 12px; font-size: .82rem;
  background: var(--pink-pale); border: 1px solid var(--pink-light);
}
.season-item strong { display: block; margin-bottom: .2rem; }
[data-theme="dark"] .character-card { background: var(--surface); border-color: rgba(255,138,92,.2); }
[data-theme="dark"] .season-item { background: rgba(255,138,92,.08); border-color: rgba(255,138,92,.15); }

/* Gallery heading */
.gallery-heading { text-align: center; margin: 1.5rem 0 1rem; font-size: 1.2rem; color: var(--text); }

/* === Character grid (gallery) === */
.character-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; padding-bottom: 2rem;
}
.gallery-item {
  border-radius: 14px; overflow: hidden; background: var(--surface);
  border: 2px solid var(--pink-light); transition: transform .2s, box-shadow .2s;
}
.gallery-item:hover { transform: translateY(-3px); box-shadow: 0 6px 20px var(--shadow); }
.gallery-item img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.gallery-item-info { padding: .4rem .6rem; font-size: .76rem; }
.gallery-number { font-weight: 800; color: var(--pink); }
.gallery-title { color: var(--text-muted); }
[data-theme="dark"] .gallery-item { background: var(--surface); border-color: rgba(255,138,92,.15); }

@media (max-width: 600px) {
  .character-page { margin-top: .5rem; }
  .character-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
  .character-bar { gap: .5rem; padding: .4rem .6rem; }
  .character-bar a { font-size: .65rem; padding: .2rem .4rem; }
  .character-bar .char-avatar { width: 32px; height: 32px; font-size: 1rem; }
}

/* ── Mobile filter bottom-sheet (≤600px). Overrides the earlier .filters
      mobile rule above because it comes later in source order. ── */
@media (max-width: 600px) {
  /* funnel becomes a bottom-left FAB (above the random dice); header keeps
     only the theme toggle. All four corner FABs share size 40px. */
  .filter-toggle {
    display: flex; margin-left: 0;
    position: fixed; left: 1rem; bottom: 5rem; z-index: 96;
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(255,138,92,.35);
  }
  .filter-toggle svg { width: 20px; height: 20px; }
  #theme-toggle { margin-left: auto; } /* keep theme toggle pinned right */
  .random-cat-button { left: 1rem; bottom: 1rem; width: 40px; height: 40px; }
  .social-fab { right: 1rem; bottom: 5rem; width: 40px; height: 40px; }

  .filters {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 201;
    flex-direction: column; align-items: stretch; gap: .7rem;
    flex-wrap: nowrap; overflow-x: hidden; overflow-y: auto;
    max-height: 82vh; min-width: 0;
    background: var(--topbar-bg);
    padding: .8rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.28);
    transform: translateY(110%);
    transition: transform .25s ease;
  }
  .filters.open { transform: translateY(0); }

  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-title { font-size: 1.05rem; font-weight: 800; color: var(--pink); }
  .sheet-close {
    background: none; border: none; font-size: 1.3rem; line-height: 1;
    color: var(--text-muted); cursor: pointer; padding: .2rem .5rem;
  }

  /* full-width stacked controls in the sheet */
  .filters .search-input,
  .filters select,
  .filters .date-picker,
  .filters .date-picker-btn {
    width: 100%; max-width: none; box-sizing: border-box;
  }

  .sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.42); opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .sheet-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* ── Mobile bottom tab bar (≤600px) ── */
.tabbar { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-family: inherit; font-size: .62rem; font-weight: 700;
  padding: 7px 0 5px; position: relative;
}
.tab.active { color: var(--pink); }
.tab.has-active::after {
  content: ""; position: absolute; top: 6px; left: 50%; margin-left: 6px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--pink);
}

@media (max-width: 600px) {
  /* date calendar: the trigger sits at the bottom of the sheet, so an absolute
     "drop below" dropdown lands off-screen. Center it as a modal instead. */
  .date-dropdown {
    position: fixed; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -50%);
    width: min(320px, 92vw); max-height: 80vh; overflow-y: auto; z-index: 210;
    /* spotlight dim around the modal (tap the dim to close) */
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5), 0 12px 40px rgba(0, 0, 0, .4);
  }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    background: var(--topbar-bg); border-top: 2px solid var(--pink-light);
    box-shadow: 0 -2px 16px var(--shadow);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  /* actions live in the tab bar — hide header action icons + funnel; search
     moves into the sheet (JS), so its topbar wrapper is hidden */
  .filter-toggle, .random-cat-button, .social-fab, .act-btn, .giscus-toggle { display: none !important; }
  /* search lives in the header (left of the theme toggle), not in the sheet */
  .search-wrap {
    flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
  }
  .search-wrap .search-ic { position: absolute; left: .65rem; color: var(--text-muted); pointer-events: none; }
  .search-wrap .search-input {
    width: 100%; max-width: none; padding: .4rem .6rem .4rem 1.9rem; border-radius: 18px; font-size: .8rem;
  }
  #topbar h1 { font-size: 1rem; } /* trim brand so search has room */
  .cat-count { display: none; }

  /* character bar: hidden on home, opens as a strip flush above the bar */
  #character-bar { display: none; }
  #character-bar.char-open {
    display: flex; position: fixed; left: 0; right: 0;
    bottom: var(--tabbar-h, 56px); z-index: 151;
    border-top: 2px solid var(--pink-light);
  }

  /* --tabbar-h (set in JS from the bar's real height incl. safe-area) keeps
     these flush with the bar — no dead gap */
  .masonry { padding-bottom: calc(var(--tabbar-h, 56px) + 16px); }
  .social-pop { top: auto; bottom: calc(var(--tabbar-h, 56px) + 8px); right: 1rem; }
  .back-to-top { bottom: calc(var(--tabbar-h, 56px) + 8px); right: 1rem; }
  .filters { bottom: var(--tabbar-h, 56px); }
}

/* ===== Desktop chrome redesign (brand | search | actions  +  filter row) ===== */
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; flex-shrink: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#topbar .github-link, #topbar .tg-link, #topbar .fb-link, #topbar .bmc-link, #topbar .rss-link { display: none; } /* moved into #social-pop by JS */
#giscus-toggle { display: none !important; } /* comment lives in the header / tab bar now */

/* segmented chips (inspiration) — works in both filter row and mobile sheet */
.chip-group { display: inline-flex; background: var(--pink-pale); border-radius: 22px; padding: 3px; gap: 2px; }
.chip {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: .8rem; font-weight: 700; color: var(--text-muted);
  padding: .3rem .8rem; border-radius: 18px; transition: background .15s, color .15s;
  display: inline-flex; align-items: center; gap: .3rem;
}
.chip-avatar {
  width: 18px; height: 18px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--pink-light);
}
.chip.active { background: #fff; color: var(--pink); box-shadow: 0 1px 4px var(--shadow); }
[data-theme="dark"] .chip-group { background: rgba(255,138,92,.1); }
[data-theme="dark"] .chip.active { background: var(--surface); }

/* responsive masonry: columns track viewport width */
.masonry { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

@media (min-width: 601px) {
  #topbar { flex-wrap: nowrap; }
  .search-wrap {
    flex: 1; max-width: 520px; margin: 0 auto; position: relative;
    display: flex; align-items: center;
  }
  .search-wrap .search-ic { position: absolute; left: .9rem; color: var(--text-muted); pointer-events: none; }
  .search-wrap .search-input {
    width: 100%; max-width: none; padding: .55rem 1rem .55rem 2.5rem; border-radius: 24px;
  }

  /* filter row: standalone bar under the top bar */
  .filters {
    display: flex; position: static; flex: none; width: auto;
    justify-content: flex-start; align-items: center; gap: .6rem;
    flex-wrap: wrap; padding: .5rem 1rem;
    background: var(--topbar-bg); border-bottom: 2px solid var(--topbar-border);
    box-shadow: none; transform: none; max-height: none; border-radius: 0;
  }
  .filters .sheet-head { display: none; }
}

/* ── Mobile month-jump pill (Google-Photos style) ── */
.month-pill { display: none; }
@media (max-width: 600px) {
  .month-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    position: fixed; top: calc(var(--header-offset, 56px) + 8px);
    left: 50%; transform: translateX(-50%); z-index: 95;
    background: rgba(20, 12, 26, .82); color: #fff;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    border: none; border-radius: 20px; padding: .32rem .85rem;
    font-family: inherit; font-size: .8rem; font-weight: 800; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .month-pill.show { opacity: 1; pointer-events: auto; }
  /* timeline drawer above the tab bar; clear its content from the bar */
  #timeline { z-index: 160; }
  #timeline-list { padding-bottom: calc(var(--tabbar-h, 56px) + 12px); }
}

@media (max-width: 600px) { #timeline-toggle { display: none; } }

/* "最新" band — cats added since your last visit */
.newest-band {
  margin: 0 130px 0 0; padding: .85rem 1.2rem;
  border-bottom: 2px dashed var(--pink-light);
}
.newest-head {
  font-size: .9rem; font-weight: 800; color: var(--pink);
  margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem;
}
.newest-head .spark { font-size: 1rem; }
.newest-row {
  display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .3rem;
  -webkit-overflow-scrolling: touch;
}
.newest-item {
  flex: 0 0 auto; width: 96px; height: 96px; padding: 0;
  border: 2px solid var(--pink); border-radius: 14px; overflow: hidden;
  cursor: pointer; background: var(--surface); transition: transform .15s;
}
.newest-item:hover { transform: translateY(-3px) scale(1.03); }
.newest-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 600px) {
  .newest-band { margin-right: 0; padding: .7rem 1rem; }
  .newest-item { width: 84px; height: 84px; }
}

/* ── Site footer: credits + socials (貓咪時光) ── */
.site-footer {
  margin: 2rem 130px 5rem 0;
  padding: 1.4rem 1rem 0;
  border-top: 2px dashed var(--pink-light);
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  font-family: var(--font-cute);
}
.site-footer .footer-links {
  display: flex; justify-content: center; align-items: center;
  gap: 1.1rem; flex-wrap: wrap; margin-bottom: .7rem;
}
.site-footer .footer-links a {
  color: var(--pink); text-decoration: none; font-weight: 700;
  display: inline-flex; align-items: center; gap: .3rem;
  transition: transform .15s;
}
.site-footer .footer-links a:hover { transform: scale(1.08); text-decoration: underline; }
.site-footer .footer-credit { line-height: 1.7; }
.site-footer .footer-credit a { color: var(--pink); font-weight: 700; text-decoration: none; }
.site-footer .footer-credit a:hover { text-decoration: underline; }
@media (max-width: 1024px) { .site-footer { margin-right: 0; } }

/* ── Hero：手帳封面式標題區（貓咪時光識別） ── */
.hero {
  margin: 1.6rem 130px .4rem 0;
  text-align: center;
  font-family: var(--font-cute);
}
.hero-logo {
  width: 76px; height: 76px; border-radius: 22px;
  box-shadow: 0 6px 18px var(--shadow);
  transform: rotate(-3deg);
  border: 3px solid #fff;
}
.hero-title {
  margin: .55rem 0 .15rem;
  font-size: 2rem; font-weight: 800; letter-spacing: .06em;
  background: linear-gradient(135deg, #e8964c, var(--pink), #ff7b6b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { color: var(--text-muted); font-size: .95rem; margin: 0; }
.hero-divider {
  color: var(--pink-light); letter-spacing: .8em; font-size: .8rem;
  margin: .7rem 0 0; user-select: none;
}
[data-theme="dark"] .hero-logo { border-color: #453526; }
@media (max-width: 1024px) { .hero { margin-right: 0; } }
@media (max-width: 600px) {
  .hero { margin-top: 1.1rem; }
  .hero-logo { width: 60px; height: 60px; }
  .hero-title { font-size: 1.6rem; }
  .hero-sub { font-size: .85rem; padding: 0 1.2rem; }
}

/* 拍立得深色模式微調 */
[data-theme="dark"] .card { border-color: rgba(255, 255, 255, .06); }
[data-theme="dark"] .card-info .model { color: #d8c4a8; background: rgba(255, 224, 190, .1); }
[data-theme="dark"] .inspiration-tag.news { background: #223543; color: #8fc3e8; border-color: #35566e; }
[data-theme="dark"] .inspiration-tag.original { background: #322740; color: #c2a3e8; border-color: #4d3b66; }
[data-theme="dark"] .character-tag { background: #40301f; color: #f2b478; border-color: #66492c; }
[data-theme="dark"] .character-tag.seasonal { background: #23392c; color: #8fd4ab; border-color: #38594a; }
[data-theme="dark"] .card::before { opacity: .55; }

/* 頁尾也用手寫感 */
#end-msg { font-family: var(--font-cute); }

/* ── 姊妹站切換鈕（貓咪時光 ⇄ 狗狗時光） ── */
.site-switch {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .28rem .65rem; border-radius: 20px;
  background: var(--pink-pale); border: 1.5px dashed var(--pink-light);
  color: var(--pink); font-size: .78rem; font-weight: 700;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-cute);
  transition: transform .15s, background .15s;
}
.site-switch:hover { transform: scale(1.06); background: var(--surface); }
[data-theme="dark"] .site-switch { background: rgba(255,255,255,.06); }
@media (max-width: 600px) {
  .site-switch-label { display: none; }
  .site-switch { padding: .28rem .5rem; font-size: .9rem; }
}

/* ── Hero 功能按鈕列 ── */
.hero-links { display: flex; justify-content: center; gap: .55rem; flex-wrap: wrap; margin-top: .8rem; }
.hero-links a {
  font-family: var(--font-cute); font-weight: 700; font-size: .88rem;
  color: var(--pink); text-decoration: none;
  background: var(--surface); border: 1.5px dashed var(--pink-light);
  border-radius: 999px; padding: .32rem .85rem;
  transition: transform .12s ease, background .12s ease;
}
.hero-links a:hover { transform: translateY(-2px) rotate(-1deg); background: var(--pink-pale); }
[data-theme="dark"] .hero-links a { background: rgba(255,255,255,.05); }

/* ── 今日頭條 ── */
.headline {
  position: relative;
  margin: 1.2rem 130px 1.4rem 0; padding: 1rem;
  background: var(--photo-frame);
  border: 1px solid rgba(130, 95, 60, .1); border-radius: 8px;
  box-shadow: 0 6px 20px var(--photo-shadow);
}
.hl-ribbon {
  position: absolute; top: -12px; left: 14px;
  font-family: var(--font-cute); font-weight: 800; font-size: .85rem;
  color: #fff; background: linear-gradient(135deg, var(--pink), #ffb27e);
  padding: .22rem 1rem; border-radius: 4px 14px 14px 4px;
  transform: rotate(-1.5deg); box-shadow: 0 3px 8px var(--shadow);
}
.hl-inner { display: flex; gap: 1rem; align-items: flex-start; margin-top: .4rem; }
.hl-img { flex: 0 0 42%; max-width: 460px; display: block; cursor: zoom-in; }
.hl-img img { width: 100%; border-radius: 4px; display: block; }
.hl-body { flex: 1; min-width: 0; }
.hl-title { font-family: var(--font-cute); font-weight: 800; font-size: 1.25rem; margin-bottom: .15rem; }
.hl-meta { color: var(--text-muted); font-size: .8rem; margin-bottom: .55rem; }
.hl-story { color: var(--text); font-size: .92rem; line-height: 1.85; margin: 0 0 .6rem; }
.hl-src { color: var(--text-muted); font-size: .82rem; line-height: 1.7; margin: 0; }
.hl-src a { color: var(--blue); font-weight: 700; }
@media (max-width: 1024px) { .headline { margin-right: 0; } }
@media (max-width: 700px) {
  .hl-inner { flex-direction: column; }
  .hl-img { flex: none; max-width: none; }
}

/* ── 今日時光牆 ── */
.clock-wrap { margin: 0 130px 1.6rem 0; }
.cw-title { font-family: var(--font-cute); font-weight: 800; font-size: 1.1rem; margin-bottom: .6rem; }
.cw-sub { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.clock-wall {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: .45rem;
}
.cw-cell {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--pink-pale); border: 1.5px dashed var(--pink-light);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.cw-cell.filled { border-style: solid; cursor: zoom-in; }
.cw-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .18s ease; }
.cw-cell.filled:hover img { transform: scale(1.1); }
.cw-cell .cw-h {
  position: absolute; top: 3px; left: 5px; z-index: 2;
  font-family: var(--font-cute); font-weight: 800; font-size: .68rem;
  color: var(--text-muted);
}
.cw-cell.filled .cw-h { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.cw-cell.now { border: 2px solid var(--pink); animation: cw-pulse 1.6s ease-in-out infinite; }
.cw-zzz { font-size: .95rem; opacity: .6; }
@keyframes cw-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,138,92,.35); } 50% { box-shadow: 0 0 0 6px rgba(255,138,92,0); } }
[data-theme="dark"] .cw-cell { background: rgba(255,255,255,.04); }
@media (max-width: 1024px) { .clock-wrap { margin-right: 0; } }
@media (max-width: 700px) { .clock-wall { grid-template-columns: repeat(6, 1fr); } }

/* ── 今日同題（貓狗聯動） ── */
.crossover {
  margin: 0 130px 1.6rem 0; padding: 1rem;
  background: linear-gradient(135deg, var(--pink-pale), #eef5fc);
  border: 1.5px dashed var(--pink-light); border-radius: 16px;
}
[data-theme="dark"] .crossover { background: rgba(255,255,255,.04); }
.xo-head { font-family: var(--font-cute); font-weight: 800; font-size: 1.1rem; margin-bottom: .3rem; }
.xo-sub { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.xo-news { color: var(--text); font-size: .88rem; line-height: 1.7; margin: .2rem 0 .8rem; }
.xo-news a { color: var(--blue); font-weight: 700; }
.xo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.xo-half {
  display: block; border-radius: 10px; overflow: hidden; position: relative;
  background: var(--photo-frame); box-shadow: 0 4px 14px var(--photo-shadow);
  text-decoration: none; color: inherit; cursor: pointer;
}
.xo-half img { width: 100%; display: block; }
.xo-cap {
  font-family: var(--font-cute); font-weight: 700; font-size: .85rem;
  text-align: center; padding: .45rem .3rem;
}
.xo-wait {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 180px; color: var(--text-muted); font-family: var(--font-cute);
}
.xo-wait span { font-size: 2rem; margin-bottom: .3rem; }
@media (max-width: 1024px) { .crossover { margin-right: 0; } }
@media (max-width: 600px) { .xo-pair { grid-template-columns: 1fr; } }

/* ── 角色統計卡 ── */
.char-stats { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.char-stat-chip {
  font-family: var(--font-cute); font-weight: 700; font-size: .82rem;
  color: var(--pink); background: var(--pink-pale);
  border: 1.5px dashed var(--pink-light); border-radius: 999px;
  padding: .28rem .8rem;
}
[data-theme="dark"] .char-stat-chip { background: rgba(255,255,255,.05); }

/* ── 時光牆回顧填充格 ── */
.cw-cell.past img { filter: saturate(.4) brightness(.72); }
.cw-cell.past:hover img { filter: saturate(.9) brightness(.95); }
.cw-past {
  position: absolute; right: 3px; bottom: 3px; z-index: 2;
  font-family: var(--font-cute); font-weight: 700; font-size: .58rem;
  color: #fff; background: rgba(60, 45, 30, .72);
  border-radius: 999px; padding: .08rem .4rem;
  pointer-events: none;
}
