/* pics.momoto520.com
   黑白漫画分镜的框 + 一枚红色的“章”。图是主角，界面只用黑、白、灰，
   红色只留给“选中”和那枚章。 */

@font-face {
  font-family: "Momoto Sans";
  src: url("/assets/momoto-regular.29428d5e33.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Momoto Sans";
  src: url("/assets/momoto-bold.89422f3c12.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #000000;
  --gray: #5c5c5c;
  --tile: #eeeeee;
  --stamp: #e03a2f;
  --hero: #da6642;
  --rule: 3px;
  --gutter: clamp(12px, 3.2vw, 28px);
  --max: 1120px;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Momoto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; }
img { display: block; max-width: 100%; }
p { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 8px 12px;
}
.skip:focus { top: 8px; }

/* ---------- 顶栏 ---------- */
.site-head {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.site-name { font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: 0.02em; }
.site-bili { font-size: 15px; }

/* ---------- 首屏：整张图 + 一句台词 ---------- */
.hero { margin: 0; background: var(--hero); border-block: var(--rule) solid var(--ink); }
.hero-frame { position: relative; max-width: 980px; margin: 0 auto; }
.hero-frame img { width: 100%; height: auto; }
.hero-quote {
  position: absolute;
  right: 4%;
  bottom: 6%;
  font-weight: 700;
  font-size: clamp(34px, 10vw, 96px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--paper);
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  transform: rotate(-4deg);
  transform-origin: right bottom;
}
.hero-source {
  max-width: 980px;
  margin: 0 auto;
  padding: 4px var(--gutter) 10px;
  text-align: right;
  font-size: 14px;
  color: var(--ink);
}

/* ---------- 说明 ---------- */
.intro {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--gutter) 6px;
  display: grid;
  gap: 14px;
}
.intro-lead { font-size: 18px; max-width: 34em; }
.rules {
  display: flex; align-items: center; gap: 14px;
  border: var(--rule) solid var(--ink);
  padding: 12px 14px;
  max-width: 40em;
}
.rules p { font-size: 15px; }
.stamp {
  flex: none;
  display: inline-grid; place-items: center;
  width: 4.4em; height: 4.4em;
  border: 3px solid var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  padding: 0.5em;
  transform: rotate(-12deg);
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--stamp);
}
.howto { font-size: 15px; color: var(--gray); }
.inapp {
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; font-size: 15px;
}

/* ---------- 目录 ---------- */
.toc {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--gutter) 4px;
}
.toc ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 15px;
}
.toc a { text-decoration: none; border-bottom: 2px solid currentColor; }

/* ---------- 每支视频一格分镜 ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter) 40px; }
.video {
  border: var(--rule) solid var(--ink);
  margin-top: 26px;
  padding: 16px clamp(10px, 2.4vw, 22px) 18px;
  scroll-margin-top: 12px;
}
.video-title {
  margin: 0;
  font-size: clamp(21px, 4.6vw, 30px);
  line-height: 1.3;
  font-weight: 700;
}
.video-meta {
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-size: 14px; color: var(--gray);
}
.video-meta a { color: var(--ink); }
.video-notes { margin-top: 8px; font-size: 14px; color: var(--gray); max-width: 46em; }
.video-notes summary { cursor: pointer; color: var(--ink); width: fit-content; }
.video-notes ul { margin: 6px 0 0; padding-left: 1.3em; }
.video-notes p { margin-top: 6px; }
.video-notes code { font-family: inherit; background: var(--tile); padding: 0 4px; }

.grid {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.tile { position: relative; aspect-ratio: 1; background: var(--tile); }
.tile-open { position: absolute; inset: 0; display: block; }
.tile-open img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.tile-badge {
  position: absolute; left: 4px; bottom: 4px;
  background: var(--ink); color: var(--paper);
  font-size: 12px; line-height: 1; padding: 4px 6px;
}
.tile-check {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px;
  border: 0; padding: 0; background: none; cursor: pointer;
}
.tile-check::before {
  content: "";
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--ink);
}
.tile.is-picked { outline: var(--rule) solid var(--stamp); outline-offset: -3px; }
.tile.is-picked .tile-check::before {
  background: var(--stamp);
  border-color: var(--stamp);
}
.tile.is-picked .tile-check::after {
  content: "";
  position: absolute; top: 12px; right: 14px;
  width: 6px; height: 11px;
  border: solid var(--paper);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.video-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: var(--rule) solid var(--ink);
  border-radius: 0;
  font-size: 15px; font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--paper); color: var(--ink); }
.btn-paper { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-paper:hover { color: var(--stamp); }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--paper); }
.btn-ghost:hover { color: var(--paper); background: rgba(255, 255, 255, 0.14); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ---------- 底部选中栏 ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--ink); color: var(--paper);
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
}
.bar-count { flex: 1; font-size: 15px; min-width: 0; }
body.has-bar main { padding-bottom: 96px; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  background: var(--paper); color: var(--ink);
  border: var(--rule) solid var(--ink);
  padding: 10px 14px; font-size: 15px;
}

/* ---------- 看大图 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 30;
  background: #000;
  color: var(--paper);
  display: grid;
  grid-template-rows: 1fr auto;
}
.lb-close {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; z-index: 2;
  min-height: 44px; padding: 0 14px;
  background: rgba(0, 0, 0, 0.6); border: 2px solid var(--paper); color: var(--paper);
  font-size: 15px; cursor: pointer;
}
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; touch-action: pan-y pinch-zoom; }
.lb-img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #1c1c1c 0% 50%) 50% / 24px 24px;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 72px;
  border: 0; background: rgba(0, 0, 0, 0.45); color: var(--paper);
  font-size: 40px; line-height: 1; cursor: pointer;
}
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-bar {
  padding: 10px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 2px solid #333;
  display: grid; gap: 6px;
}
.lb-info { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 15px; }
.lb-size { color: #bdbdbd; }
.lb-hint { font-size: 13px; color: #bdbdbd; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-pick[aria-pressed="true"] { background: var(--stamp); border-color: var(--stamp); }
body.lb-open { overflow: hidden; }

/* ---------- 页脚、说明页 ---------- */
.site-foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 40px;
  font-size: 13px; color: var(--gray);
  display: grid; gap: 4px;
}
.doc { max-width: 40em; margin: 0 auto; padding: 8px var(--gutter) 60px; }
.doc h1 { font-size: 30px; margin: 10px 0 16px; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc hr { border: 0; border-top: var(--rule) solid var(--ink); margin: 24px 0; }
