/* PokéDive 游戏主题（SOP v3.22，02 §2.1）。加载于 /pokedive/ 首页和全部分页。
   视觉来源：原作 pokedive.com/en/ 登录画面（2026-11-05 截图，assets/pokedive/original-entry-*.webp）：
   左侧饱和红面板 + 黄色斜切分隔条，白色大圆角卡片，浅灰输入框，天蓝 "Dive" 字标，
   粗圆体斜体标题，深绿森林像素背景。长文阅读放在浅色纸面上，红/黄只用在答案面板、按钮、卡片边。
   布局骨架仍是 /assets/guide-article-layout.css；首页独有布局在 hub.css。 */
@font-face {
  font-family: "M PLUS Rounded 1c";
  src: url("/assets/fonts/mplus-rounded-800-latin.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
:root {
  --pd-red: #e8333b; --pd-red-dk: #b5202a; --pd-red-lo: #fbe3e4;
  --pd-yellow: #ffc800; --pd-yellow-dk: #d9a500;
  --pd-sky: #5fc3f2; --pd-sky-dk: #1f7fb5;
  --pd-forest: #1c2e22; --pd-forest-hi: #2b4733; --pd-leaf: #4d8a4a;
  --pd-ink: #1d2540; --pd-dim: #55607c; --pd-line: #e3dfd6; --pd-sheet: #f8f5ee; --pd-card: #fff; --pd-pale: #f2eee4;
  --pd-display: "M PLUS Rounded 1c", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --pd-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* 骨架读取的变量 */
  --paper: var(--pd-sheet); --white: var(--pd-card); --ink: var(--pd-ink); --muted: var(--pd-dim);
  --line: var(--pd-line); --pale: var(--pd-pale); --green: var(--pd-red-dk); --gold: var(--pd-yellow);
  --body: var(--pd-body);
}

/* ---------- 基础 ---------- */
body.pd-theme { margin: 0; background: var(--pd-sheet); color: var(--pd-ink); font: 17px/1.7 var(--pd-body); }
.pd-theme *, .pd-theme *::before, .pd-theme *::after { box-sizing: border-box; }
html:has(body.pd-theme) { scroll-padding-top: 1rem; background: var(--pd-forest); }
.pd-theme a { color: #a8161f; text-underline-offset: 3px; }
.pd-theme a:hover { color: var(--pd-ink); text-decoration-thickness: 2px; }
.pd-theme :focus-visible { outline: 3px solid var(--pd-sky-dk); outline-offset: 3px; }
.pd-theme img { max-width: 100%; height: auto; }
.pd-theme h1, .pd-theme h2, .pd-theme h3 { font-family: var(--pd-display); font-weight: 800; line-height: 1.15; color: var(--pd-ink); }
.pd-theme h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); margin: 0 0 .8rem; }
.pd-theme h3 { font-size: 1.15rem; }
.pd-theme p { margin: .7rem 0 1.1rem; }
.pd-theme .wrap { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.pd-theme .skip { position: absolute; top: -90px; left: 12px; background: var(--pd-yellow); color: var(--pd-ink); padding: 10px 14px; z-index: 50; border-radius: 8px; }
.pd-theme .skip:focus { top: 10px; }
.pd-theme .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pd-theme .eyebrow { margin: 0; font: 800 12px/1.4 var(--pd-display); letter-spacing: .14em; text-transform: uppercase; color: var(--pd-red-dk); }
.pd-theme .byline { font-size: 13px; color: var(--pd-dim); }
.pd-theme sup.ref a { text-decoration: none; font-weight: 700; padding: 0 1px; }

/* ---------- 页眉：森林深绿条 + 红色底边 + 黄色斜切 ---------- */
.pd-theme .top { background: var(--pd-forest); position: relative; z-index: 20; border: 0; border-bottom: 5px solid var(--pd-red); }
.pd-theme .top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; position: relative; }
.pd-theme .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font: 800 1.45rem/1 var(--pd-display); font-style: italic; white-space: nowrap; min-width: 0; }
.pd-theme .brand:hover { color: #fff; }
.pd-theme .brand span { display: block; }
.pd-theme .brand b { color: var(--pd-sky); font-weight: 800; }
.pd-theme .brand small { display: block; font: 700 10px/1.5 var(--pd-body); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: #b9cdbd; margin-top: 3px; }
.pd-theme .desktop-nav { display: flex; align-items: center; gap: 4px; }
.pd-theme .desktop-nav a, .pd-theme .mobile-links a { color: #eaf3ec; text-decoration: none; font: 700 14px/1.3 var(--pd-body); padding: 10px 12px; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.pd-theme .desktop-nav a:hover, .pd-theme .mobile-links a:hover { color: var(--pd-yellow); background: #ffffff14; }
.pd-theme .desktop-nav a[aria-current=page], .pd-theme .mobile-links a[aria-current=page] { color: var(--pd-yellow); box-shadow: inset 0 -3px 0 var(--pd-yellow); }
.pd-theme .mobile-nav { display: none; position: static; }
.pd-theme .mobile-nav summary { list-style: none; cursor: pointer; background: var(--pd-red); color: #fff; padding: 9px 16px; border-radius: 999px; font: 800 14px var(--pd-display); min-height: 44px; display: inline-flex; align-items: center; }
.pd-theme .mobile-nav summary::-webkit-details-marker { display: none; }
.pd-theme .mobile-nav:not([open]) > .mobile-links { display: none; }
.pd-theme .mobile-links { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; min-width: 210px; padding: 8px; background: var(--pd-forest-hi); border: 2px solid var(--pd-red); border-radius: 14px; }

/* ---------- 文章页头与目录 ---------- */
.pd-theme .crumbs { font-size: 13px; color: var(--pd-dim); padding: 22px 0 0; }
.pd-theme .crumbs a { color: var(--pd-dim); }
.pd-theme .crumbs a:hover { color: var(--pd-red-dk); }
.pd-guide .article-head { padding-top: 14px; }
.pd-guide .article-head h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-style: italic; letter-spacing: -.01em; margin: .25em 0 .35em; }
.pd-theme .article-head .answer { position: relative; background: var(--pd-red); color: #fff; border-radius: 22px; padding: 18px 24px 18px 30px; font-size: 1.1rem; line-height: 1.65; box-shadow: 0 5px 0 var(--pd-red-dk); overflow: hidden; }
.pd-theme .article-head .answer::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; background: var(--pd-yellow); }
.pd-theme .article-head .answer p { margin: 0; }
.pd-theme .article-head .answer strong { color: #fff3b8; }
.pd-theme .article-head .answer a { color: #fff; }
.guide-layout.pd-theme .article-layout > .toc { background: var(--pd-card); border: 2px solid var(--pd-line); border-radius: 16px; }
.pd-theme .toc strong { color: var(--pd-red-dk); font: 800 12px var(--pd-display); letter-spacing: .12em; text-transform: uppercase; }
.guide-layout.pd-theme .toc a, .guide-layout.pd-theme .article-layout > .toc a { background: var(--pd-pale); border: 1px solid var(--pd-line); color: var(--pd-ink); text-decoration: none; border-radius: 999px; padding: 5px 12px; }
.guide-layout.pd-theme .toc a:hover { border-color: var(--pd-red); color: var(--pd-red-dk); }

/* ---------- 正文 ---------- */
.pd-theme .prose { overflow-wrap: anywhere; }
.pd-theme .prose > section { border-top: 2px dashed var(--pd-line); padding-top: .3rem; scroll-margin-top: 14px; }
.pd-theme .prose h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin-top: 1.8rem; }
.pd-theme .prose h2::before { content: ""; display: inline-block; width: .62em; height: .62em; margin: 0 .55em .1em 0; vertical-align: middle; border-radius: 50%;
  background: linear-gradient(var(--pd-red) 0 40%, var(--pd-ink) 40% 58%, #fff 58%); border: 2px solid var(--pd-ink); }
.pd-theme .prose li { padding: 3px 0; }
.pd-theme .prose li::marker { color: var(--pd-red-dk); font-weight: 800; }
.pd-theme .prose ol { counter-reset: pdstep; list-style: none; padding-left: 0; }
.pd-theme .prose ol > li { counter-increment: pdstep; position: relative; padding: 8px 0 8px 46px; border-bottom: 1px dashed var(--pd-line); }
.pd-theme .prose ol > li:last-child { border-bottom: 0; }
.pd-theme .prose ol > li::before { content: counter(pdstep); position: absolute; left: 0; top: 7px; width: 32px; height: 32px; display: grid; place-items: center; font: 800 15px var(--pd-display); color: #fff; background: var(--pd-red); border-radius: 50%; box-shadow: 0 2px 0 var(--pd-red-dk); }
.pd-theme .prose .sources ol > li::before { display: none; }
.pd-theme .prose .sources ol > li { padding-left: 0; counter-increment: none; }
.pd-theme .prose .sources ol { list-style: decimal; padding-left: 22px; }
.pd-theme .notice { background: var(--pd-card); border: 2px solid var(--pd-line); border-left: 8px solid var(--pd-yellow); border-radius: 12px; padding: 13px 18px; margin: 20px 0; font-size: 15.5px; }
.pd-theme .table-wrap { overflow: auto; max-width: 100%; margin: 22px 0; border: 2px solid var(--pd-ink); border-radius: 16px; background: var(--pd-card); }
.pd-theme table { border-collapse: collapse; width: 100%; min-width: 540px; font-size: 14.5px; line-height: 1.55; }
.pd-theme th, .pd-theme td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--pd-line); }
.pd-theme th { background: var(--pd-ink); color: #fff; font: 800 13px var(--pd-display); letter-spacing: .03em; }
.pd-theme tbody tr:nth-child(even) td { background: #fbf8f1; }
.pd-theme tr:last-child td { border-bottom: 0; }
.pd-theme .prose figure img, .guide-layout.pd-theme figure.game-image img { max-height: min(70vh, 640px); object-fit: contain; }
.guide-layout.pd-theme figure.game-image { background: var(--pd-card); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--pd-ink), 0 6px 0 2px #1d254033; border-radius: 18px; }
.pd-guide [data-game-image="pd-shiny"] img { width: 40px; height: 40px; max-width: 40px; }
.pd-guide [data-game-image="pd-shiny"] > a { width: 40px; }
.pd-theme .sources { margin-top: 30px; padding-top: 10px; border-top: 2px solid var(--pd-line); font-size: 13px; color: var(--pd-dim); overflow-wrap: anywhere; }
.pd-theme .sources h2 { font-size: 1.1rem; }
.pd-theme .sources h2::before { display: none; }
.pd-theme .sources li { margin-bottom: 12px; }
.pd-theme .media-pending { padding: 18px; background: #fff6dc; border: 1px solid #9c741b; }

/* register_page.py 生成的相关任务 */
.pd-theme .related-tasks { margin: 34px 0 10px; padding: 18px 20px; background: var(--pd-card); border: 2px solid var(--pd-line); border-radius: 18px; }
.pd-theme .related-tasks h2 { font-size: 1.2rem; margin: 0 0 10px; }
.pd-theme .related-tasks h2::before { display: none; }
.pd-theme .related-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px; }
.pd-theme .related-links a { display: flex; justify-content: space-between; gap: 8px; padding: 11px 14px; min-height: 44px; border: 2px solid var(--pd-line); border-radius: 12px; background: var(--pd-sheet); text-decoration: none; font-weight: 700; color: var(--pd-ink); }
.pd-theme .related-links a:hover { border-color: var(--pd-red); color: var(--pd-red-dk); }

/* ---------- 按钮 ---------- */
.pd-theme .pd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 11px 22px; border-radius: 999px; font: 800 16px/1.2 var(--pd-display); font-style: italic; text-decoration: none; cursor: pointer;
  background: var(--pd-yellow); color: #2a1f00; border: 0; box-shadow: 0 4px 0 var(--pd-yellow-dk); }
.pd-theme .pd-btn:hover { background: #ffd83d; color: #2a1f00; transform: translateY(-1px); }
.pd-theme .pd-btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #ffffffcc; font-style: normal; }
.pd-theme .pd-btn.ghost:hover { background: #ffffff22; color: #fff; }

/* ---------- 推荐模块（共享，只改色） ---------- */
.pd-theme .play-rec-card { border-radius: 18px !important; border: 2px solid var(--pd-line) !important; }

/* ---------- 页脚（站级页脚，换成本主题配色） ---------- */
.pd-theme .footer { background: var(--pd-forest); color: #e4efe6; padding: 32px 0; border-top: 5px solid var(--pd-red); }
.pd-theme .footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.pd-theme .footer p { max-width: 54ch; font-size: .9rem; color: #c3d4c7; }
.pd-theme .footer a { color: #fff; }
.pd-theme .footer a:hover { color: var(--pd-yellow); }
.pd-theme .footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pd-theme .footer :focus-visible { outline-color: var(--pd-yellow); }

/* ---------- 手机优先断点（00 §3） ---------- */
@media (max-width: 900px) {
  .pd-theme .desktop-nav { display: none; }
  .pd-theme .mobile-nav { display: block; }
}
@media (max-width: 600px) {
  body.pd-theme { font-size: 16px; }
  .pd-theme .wrap { width: calc(100% - 28px); }
  .pd-theme .brand { font-size: 1.25rem; }
  .pd-theme .brand small { display: none; }
  .pd-theme .article-head .answer { padding: 14px 16px 14px 22px; font-size: 1rem; border-radius: 18px; }
  .pd-theme .prose ol > li { padding-left: 42px; }
  .pd-theme .footer-grid { display: grid; }
}

/* 手机：目录改单行横滑，首个 H2 保持在第一屏内（image_audit HERO） */
@media (max-width: 600px) {
  .guide-layout.pd-theme .article-layout > .toc { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 8px 10px; scrollbar-width: thin; }
  .guide-layout.pd-theme .toc strong { width: auto; flex: none; align-self: center; margin: 0 4px 0 0; }
  .guide-layout.pd-theme .toc a { flex: none; white-space: nowrap; }
  .pd-guide .article-head { padding-top: 6px; }
  .pd-guide .article-head h1 { font-size: 1.9rem; }
  .pd-theme .crumbs { padding-top: 12px; }
  .pd-theme .article-head .answer { font-size: .98rem; padding: 12px 14px 12px 20px; }
  .pd-theme .byline { margin: 8px 0; }
}

/* ---------- 路线生态卡片、店主头像与像素图渲染 ---------- */
.pd-theme .px-art { image-rendering: pixelated; }
.pd-theme .pd-biome-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 18px 0 24px; }
.pd-theme .pd-biome-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 10px; background: var(--pd-card); border: 2px solid var(--pd-line); border-radius: 16px; }
.pd-theme .pd-biome-card img { width: 96px; height: 96px; max-width: 96px; image-rendering: pixelated; border-radius: 12px; }
.pd-theme .pd-biome-card strong { font: 800 14px/1.25 var(--pd-display); color: var(--pd-ink); }
.pd-theme .pd-biome-card span { font-size: 12.5px; color: var(--pd-dim); line-height: 1.35; }
.pd-theme .pd-keeper-cell { display: flex; align-items: center; gap: 10px; }
.pd-theme .pd-keeper-cell img { width: 40px; height: 40px; max-width: 40px; flex: none; image-rendering: pixelated; border-radius: 8px; background: var(--pd-pale); }
.pd-theme .pd-quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.pd-theme .pd-quick-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px; background: #ffffff1f; color: #fff; font: 700 13.5px/1.2 var(--pd-body); text-decoration: none; border: 1px solid #ffffff55; }
.pd-theme .pd-quick-links a:hover { background: var(--pd-yellow); color: #2a1f00; border-color: var(--pd-yellow); }
@media (max-width: 600px) {
  .pd-theme .pd-biome-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pd-theme .pd-biome-card img { width: 80px; height: 80px; max-width: 80px; }
  .pd-hub .pd-hero-copy, .pd-hub .pd-hero .game-image { min-width: 0; max-width: 100%; }
  .pd-theme .pd-quick-links { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; gap: 6px; margin-top: 8px; padding-bottom: 2px; scrollbar-width: thin; }
  .pd-theme .pd-quick-links a { flex: none; white-space: nowrap; min-height: 44px; padding: 4px 12px; font-size: 13px; }
  .pd-hub .pd-hero { padding: 14px 0 16px; }
  .pd-hub .pd-hero-in { gap: 12px; }
  .pd-hub .pd-hero .game-image img { max-height: 170px; }
  .pd-hub .pd-section { padding-top: 16px; }
}
