/* Shared tool-page theme mirrors the blog's indigo/cyan glass look so the
   standalone tool pages don't clash with the rest of the site. Link this LAST
   in each page's <head> so it overrides the page's own inline :root/body/surface
   declarations by cascade order. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2?v=5.3.0") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/* Remap every palette token these pages use (they vary in naming) to the blog. */
:root {
  --bg: #0c1222;
  --surface: rgba(20,30,50,0.55);
  --surface2: rgba(25,38,60,0.65);
  --surface-hover: rgba(25,38,60,0.72);
  --border: rgba(56,189,248,0.12);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-subtle: rgba(56,189,248,0.12);
  --accent2: rgba(56,189,248,0.12);
  --accent-rgb: 56,189,248;
  --green: #34d399; --green2: rgba(52,211,153,0.12);
  --yellow: #fbbf24; --yellow2: rgba(251,191,36,0.12);
  --red: #fb7185; --red2: rgba(251,113,133,0.12);
  --purple: #a78bfa; --purple2: rgba(167,139,250,0.12);
  --radius: 8px; --radius-sm: 8px;
  --nav-bg: rgba(12,18,34,0.78);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #e8eef5;
  --surface: rgba(255,255,255,0.76);
  --surface2: rgba(239,246,251,0.9);
  --surface-hover: rgba(255,255,255,0.94);
  --border: rgba(2,132,199,0.18);
  --text: #1e293b;
  --text-muted: #64748b;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-subtle: rgba(2,132,199,0.1);
  --accent2: rgba(2,132,199,0.1);
  --accent-rgb: 2,132,199;
  --green: #059669; --green2: rgba(5,150,105,0.1);
  --yellow: #b7791f; --yellow2: rgba(183,121,31,0.1);
  --red: #e11d48; --red2: rgba(225,29,72,0.1);
  --purple: #7c3aed; --purple2: rgba(124,58,237,0.1);
  --nav-bg: rgba(255,255,255,0.78);
  color-scheme: light;
}

html { scrollbar-width: thin; scrollbar-color: rgba(56,189,248,0.3) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56,189,248,0.22); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(56,189,248,0.4); border: 2px solid transparent; background-clip: padding-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif !important;
  background: var(--bg) !important;
  color: var(--text);
}
/* Fixed ambient gradient behind everything, echoing the blog's WebGL backdrop. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 22% 18%, rgba(56,189,248,0.10) 0%, transparent 42%),
    radial-gradient(circle at 82% 12%, rgba(167,139,250,0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(56,189,248,0.06) 0%, transparent 55%),
    linear-gradient(180deg, #111a30 0%, #0c1222 55%, #080d1a 100%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 18% 8%, rgba(2,132,199,0.22) 0%, transparent 38%),
    radial-gradient(ellipse at 86% 24%, rgba(71,116,145,0.16) 0%, transparent 42%),
    radial-gradient(ellipse at 45% 92%, rgba(125,173,198,0.2) 0%, transparent 48%),
    linear-gradient(145deg, #f8fbfd 0%, #dfeaf2 52%, #edf3f7 100%);
}

/* Glassify the common surface/card/panel classes across all tool pages. */
.container, .card, .guide-item, .overview, .step, .step-loc, .toc,
.pending, .items-table, .relic-table, .hero, .section, .relic-card,
.input-panel, .result-panel, .grid-card, .result-card, .empty-card,
.tip, .warn, .badge, .meta {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.hero { background: linear-gradient(135deg, rgba(30,41,59,0.6) 0%, rgba(20,30,50,0.5) 100%) !important; border: 1px solid var(--border) !important; }
.card, .guide-item, .overview, .step, .toc, .relic-card, .input-panel,
.result-panel, .grid-card, .result-card, .empty-card {
  border: 1px solid var(--border);
}
.card:hover, .guide-item:hover, .relic-card:hover {
  border-color: rgba(56,189,248,0.35) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
}

/* Back-to-blog affordance shown on every tool page (injected per page). */
.tool-topbar {
  max-width: 900px; margin: 0 auto 1.25rem; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--nav-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.tool-topbar a.home {
  display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent);
  text-decoration: none; font-size: 0.9rem; font-weight: 700;
}
.tool-topbar a.home:hover { color: var(--accent-hover); }
.tool-topbar a.home svg { width: 14px; height: 14px; }
.tool-topbar .toolbox-link { margin-left: auto; color: var(--text-muted); text-decoration: none; font-size: 0.78rem; }
.tool-topbar .toolbox-link:hover { color: var(--accent); }
.tool-theme-btn {
  min-width: 52px; padding: 0.34rem 0.55rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted);
  font: 500 0.72rem inherit; cursor: pointer;
}
.tool-theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Image slot — put a screenshot here by dropping a file at the given src.
   Until the image exists, the alt/caption text shows what it should contain.
   Usage: <figure class="img-slot"><img src="img/<map>/<name>.jpg" alt="说明">
            <figcaption>说明文字</figcaption></figure> */
.img-slot { margin: 10px 0; border: 1px dashed var(--border); border-radius: var(--radius-sm); overflow: hidden; background: rgba(56,189,248,0.04); }
.img-slot img { display: block; width: 100%; height: auto; }
.img-slot img[src=""], .img-slot img:not([src]) { display: none; }
/* When the image is absent (no <img> at all, or empty src), show the dashed
   placeholder box so the caption stays visible instead of collapsing. */
.img-slot:has(img[src=""]), .img-slot:has(img:not([src])), .img-slot:not(:has(img)), .img-slot.empty { min-height: 90px; display: flex; align-items: center; justify-content: center; }
.img-slot figcaption { font-size: 12px; color: var(--muted); padding: 8px 12px; line-height: 1.55; border-top: 1px solid var(--border); }
.img-slot figcaption::before { content: "📷 "; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 10px 0; }
.img-grid .img-slot { margin: 0; }

/* ---- Shared guide-page components (used by all cod-*.html map guides) ---- */
.guide-body { max-width: 820px; margin: 0 auto; padding: 0 16px 60px; line-height: 1.7; }
.guide-body .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 20px; }
.guide-body .back:hover { color: var(--accent); }
.guide-hero { text-align: center; margin-bottom: 30px; padding: 32px 20px; background: linear-gradient(135deg, rgba(30,41,59,0.6) 0%, rgba(20,30,50,0.5) 100%); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(14px); }
[data-theme="light"] .hero,
[data-theme="light"] .guide-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.84), rgba(225,239,247,0.72)) !important;
}
.guide-hero h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.guide-hero .sub { color: var(--muted); font-size: 14px; }
.guide-hero .tags { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.gtag { font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 500; background: var(--accent2); color: var(--accent); }
.gtag.season { background: var(--purple2); color: var(--purple); }
.gtag.diff { background: var(--yellow2); color: var(--yellow); }
.guide-body .notice { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 26px; font-size: 13px; color: var(--muted); line-height: 1.65; backdrop-filter: blur(14px); }
.guide-body .notice strong { color: var(--text); }
.guide-toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 28px; backdrop-filter: blur(14px); }
.guide-toc h3 { font-size: 15px; margin-bottom: 12px; color: var(--muted); }
.guide-toc ul { list-style: none; column-count: 2; column-gap: 24px; }
.guide-toc li { margin-bottom: 6px; break-inside: avoid; }
.guide-toc a { color: var(--accent); text-decoration: none; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.guide-toc a:hover { text-decoration: underline; }
.guide-toc .num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--accent2); color: var(--accent); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.gsection { margin-bottom: 32px; scroll-margin-top: 20px; }
.gsection-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.gsection-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; background: var(--accent2); }
.gsection-title { font-size: 20px; font-weight: 700; }
.gsection-sub { font-size: 13px; color: var(--muted); }
.gsteps { display: flex; flex-direction: column; gap: 12px; }
.gstep { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; backdrop-filter: blur(14px); }
.gstep-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.gstep-num { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; background: var(--accent2); color: var(--accent); }
.gstep-num.green { background: var(--green2); color: var(--green); }
.gstep-num.yellow { background: var(--yellow2); color: var(--yellow); }
.gstep-num.red { background: var(--red2); color: var(--red); }
.gstep-num.purple { background: var(--purple2); color: var(--purple); }
.gstep-title { font-size: 15px; font-weight: 600; }
.gstep-loc { font-size: 12px; color: var(--muted); background: var(--surface2); padding: 2px 8px; border-radius: 4px; margin-left: auto; }
.gstep p, .gstep li { font-size: 14px; color: var(--text); line-height: 1.7; }
.gstep ul { padding-left: 18px; margin: 6px 0; }
.gstep li { margin-bottom: 4px; }
.gstep strong { color: var(--accent-hover); }
.embedded-tool-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.42);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.embedded-tool-link:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}
.gstep .warn { background: var(--yellow2); border: 1px solid rgba(251,191,36,0.2); border-radius: 8px; padding: 10px 14px; margin-top: 8px; font-size: 13px; }
.gstep .warn::before { content: "⚠️ "; }
.gstep .verify { font-size: 11.5px; color: var(--muted); margin-top: 6px; font-style: italic; }
.gstep .effect { background: var(--green2); border: 1px solid rgba(52,211,153,0.2); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.gstep .effect::before { content: "✨ 遗物效果："; }
.gtable { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.gtable th, .gtable td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.gtable th { background: var(--surface2); font-weight: 600; color: var(--muted); }
.guide-footer { text-align: center; color: var(--muted); font-size: 13px; padding-top: 20px; border-top: 1px solid var(--border); margin-top: 40px; }
.guide-footer a { color: var(--accent); text-decoration: none; }
.guide-footer .sources, .footer .sources { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.guide-footer .sources a, .footer .sources a { color: var(--accent); margin: 0 2px; }
.guide-footer .sources a:hover, .footer .sources a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .tool-topbar { margin: 0 0 1rem; }
  .tool-topbar .toolbox-link { display: none; }
  .guide-hero h1 { font-size: 22px; }
  .gsection-title { font-size: 17px; }
  .gstep { padding: 14px; }
  .guide-toc ul { column-count: 1; }
}

@media (prefers-reduced-transparency: reduce) {
  .tool-topbar, .container, .card, .guide-item, .overview, .step, .step-loc,
  .toc, .hero, .section, .input-panel, .result-panel, .grid-card, .result-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

html.embedded { background: transparent; }
.embedded body { padding: 0 !important; background: transparent !important; }
.embedded body::before { display: none; }
.embedded .tool-topbar { display: none; }
.embedded .guide-body,
.embedded .container { max-width: none; padding: 0 0 1rem; }
.embedded .guide-body > .back,
.embedded .container > .back,
.embedded .container > .back-link { display: none; }
.embedded .guide-toc,
.embedded .toc { display: none; }
.embedded .guide-hero,
.embedded .hero { margin-top: 0; }

/* The original flip guide predates the shared guide components. Normalize its
   document typography and surfaces when it is rendered inside the blog. */
.tool-flip-guide.embedded .container { color: var(--text); font-size: 14px; line-height: 1.75; }
.tool-flip-guide.embedded .container > h1 {
  margin: 0;
  padding: 28px 20px 4px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(20,30,50,0.5));
  font-size: 26px;
  line-height: 1.35;
  text-align: center;
}
.tool-flip-guide.embedded .container > .meta {
  margin: 0 0 28px;
  padding: 2px 20px 24px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(20,30,50,0.5));
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
[data-theme="light"].tool-flip-guide.embedded .container > h1,
[data-theme="light"].tool-flip-guide.embedded .container > .meta {
  background: linear-gradient(135deg, rgba(255,255,255,0.84), rgba(225,239,247,0.72));
}
.tool-flip-guide.embedded h2 {
  margin: 32px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 20px;
  line-height: 1.4;
}
.tool-flip-guide.embedded h3 { margin: 24px 0 10px; font-size: 16px; }
.tool-flip-guide.embedded p,
.tool-flip-guide.embedded li { font-size: 14px; line-height: 1.75; }
.tool-flip-guide.embedded .tip,
.tool-flip-guide.embedded .warn { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.tool-flip-guide.embedded table { display: block; overflow-x: auto; margin: 14px 0; font-size: 13px; }
.tool-flip-guide.embedded th,
.tool-flip-guide.embedded td { padding: 8px 10px; background: var(--surface); }
.tool-flip-guide.embedded tr:hover td { background: var(--surface-hover); }
.tool-flip-guide.embedded .gcell.off { background: var(--surface2); border-color: var(--border); }

@media (max-width: 560px) {
  .tool-flip-guide.embedded .container > h1 { padding: 22px 14px 4px; font-size: 21px; }
  .tool-flip-guide.embedded .container > .meta { margin-bottom: 22px; padding: 2px 14px 18px; font-size: 12px; }
  .tool-flip-guide.embedded h2 { margin-top: 26px; font-size: 18px; }
  .tool-flip-guide.embedded h3 { font-size: 15px; }
  .tool-flip-guide.embedded p,
  .tool-flip-guide.embedded li { font-size: 13px; }
  .tool-flip-guide.embedded th,
  .tool-flip-guide.embedded td { min-width: 7.2rem; padding: 7px 8px; font-size: 12px; }
}
