/* ── AI Video Wiki: Film Lab Editorial ── */
:root {
  --ink: #14181c;
  --ink-soft: #3a4450;
  --muted: #6b7785;
  --paper: #f0f3f6;
  --paper-2: #e4eaf0;
  --surface: #fafbfc;
  --line: #c5d0db;
  --line-soft: #dbe3eb;
  --teal: #0a5c63;
  --teal-deep: #063f44;
  --teal-soft: #d4e8ea;
  --amber: #c47b1a;
  --amber-soft: #f5e6d0;
  --frame: #1e2a32;
  --sidebar-w: 260px;
  --top-h: 56px;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(20, 24, 28, 0.06), 0 12px 32px rgba(20, 24, 28, 0.06);
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--top-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(10, 92, 99, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(196, 123, 26, 0.06), transparent 45%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

a:hover {
  color: var(--teal-deep);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(250, 251, 252, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wiki-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 8px 10px;
  background: var(--teal-soft);
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.wiki-crumb a {
  color: var(--teal-deep);
  text-decoration: none;
  font-weight: 600;
}

.wiki-crumb a:hover {
  text-decoration: underline;
}

.wiki-crumb-sep {
  color: var(--muted);
  font-family: var(--font-mono);
}

.wiki-crumb-current {
  color: var(--ink-soft);
}

.footer-hub {
  margin-top: 12px !important;
}

.footer-hub a {
  font-weight: 600;
  text-decoration: none;
}

.footer-hub a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .brand-sub {
    display: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
}

.brand-mark::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--surface);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.top-tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-tabs::-webkit-scrollbar {
  display: none;
}

.top-tab {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.top-tab:hover {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.top-tab.active {
  background: var(--teal);
  color: #fff;
}

.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
}

/* ── Layout ── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--top-h));
}

.sidebar {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  padding: 24px 16px 48px;
  border-right: 1px solid var(--line);
  background: rgba(250, 251, 252, 0.65);
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px 8px;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.toc a:hover {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.toc a.active {
  background: var(--teal-soft);
  color: var(--teal-deep);
  border-left-color: var(--teal);
  font-weight: 600;
}

.toc .toc-child {
  padding-left: 12px;
}

.toc .toc-child a {
  font-size: 0.8rem;
  padding: 5px 10px;
  color: var(--muted);
}

.main {
  padding: 32px 40px 80px;
  min-width: 0;
}

/* ── Hero ── */
.hero {
  margin-bottom: 40px;
  animation: rise 0.7s ease both;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
}

.hero-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--amber);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 42em;
  margin: 0 0 28px;
}

.hero-figure {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--frame);
}

.hero-figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hero-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(20, 24, 28, 0.85));
  color: #e8eef2;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ── Sections ── */
.section {
  margin-bottom: 56px;
  scroll-margin-top: calc(var(--top-h) + 20px);
  animation: rise 0.55s ease both;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--amber);
  letter-spacing: 0.06em;
}

.section h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  margin: 0;
}

.section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 28px 0 10px;
  scroll-margin-top: calc(var(--top-h) + 20px);
}

.section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--teal-deep);
}

.section p {
  margin: 0 0 14px;
  color: var(--ink);
}

.section-intro {
  color: var(--ink-soft);
  font-size: 1rem;
  margin-bottom: 20px;
  max-width: 48em;
}

/* ── Cards / figures ── */
.figure {
  margin: 20px 0 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.figure figcaption {
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--paper);
  border-top: 1px solid var(--line-soft);
}

.callout {
  margin: 20px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.callout.amber {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.callout p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ── Grid cards for paradigms ── */
.para-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.para-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.para-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.para-card .tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  background: var(--frame);
  color: #d4e8ea;
  border-radius: 2px;
  margin-bottom: 10px;
}

.para-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}

.para-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.para-card .io {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal);
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

th {
  background: var(--paper);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

td code,
p code,
li code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--teal-deep);
}

/* ── Shot chips ── */
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}

.shot-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.shot-chip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  opacity: 0.7;
}

.shot-chip .en {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.shot-chip .cn {
  font-weight: 600;
  margin: 4px 0 6px;
  font-size: 0.95rem;
}

.shot-chip p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ── Workflow orchestrator ── */
.workflow-panel {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workflow-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.workflow-toolbar .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.wf-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.15s;
}

.wf-btn:hover,
.wf-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.wf-btn.play {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
  font-weight: 600;
}

.wf-btn.play:hover {
  background: #a86610;
}

.workflow-canvas {
  position: relative;
  padding: 28px 20px 20px;
  min-height: 420px;
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #f7f9fb;
  overflow-x: auto;
}

.wf-graph {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 16px 12px;
  min-width: 640px;
  position: relative;
  z-index: 1;
}

.wf-node {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  font-family: var(--font-body);
  color: var(--ink);
}

.wf-node:hover {
  border-color: var(--teal);
  box-shadow: 0 4px 16px rgba(10, 92, 99, 0.12);
}

.wf-node.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 3px rgba(10, 92, 99, 0.15);
}

.wf-node.pulse {
  animation: pulse-node 0.8s ease;
}

.wf-node .wf-id {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--amber);
  letter-spacing: 0.06em;
}

.wf-node .wf-title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 2px 0 4px;
}

.wf-node .wf-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.wf-node[data-lane="intel"] { border-top: 3px solid var(--teal); }
.wf-node[data-lane="visual"] { border-top: 3px solid #2a7a8c; }
.wf-node[data-lane="gen"] { border-top: 3px solid var(--amber); }
.wf-node[data-lane="audio"] { border-top: 3px solid #8b5e3c; }
.wf-node[data-lane="asset"] { border-top: 3px solid #4a5568; }
.wf-node[data-lane="out"] { border-top: 3px solid var(--teal-deep); }

.wf-detail {
  border-top: 1px solid var(--line);
  padding: 20px 22px 24px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.wf-detail h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
}

.wf-detail .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.wf-detail p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.wf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.wf-link {
  font-size: 0.78rem;
  padding: 5px 10px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  color: var(--teal-deep);
  text-decoration: none;
  background: var(--teal-soft);
  transition: background 0.15s;
}

.wf-link:hover {
  background: #c5dde0;
}

.wf-io-box {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 14px;
}

.wf-io-box h5 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.wf-io-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.wf-io-box li {
  margin-bottom: 4px;
}

.pipeline-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 16px 0;
  font-size: 0.82rem;
}

.pipeline-steps .step {
  background: var(--frame);
  color: #dce6eb;
  padding: 5px 10px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.pipeline-steps .arrow {
  color: var(--amber);
  font-weight: 700;
}

/* ── Model badges ── */
.model-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.model-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.model-row .mod-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--teal);
  font-weight: 600;
}

.model-row p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ── Glossary ── */
.glossary {
  columns: 2;
  column-gap: 28px;
  margin: 16px 0;
}

.glossary dt {
  font-weight: 600;
  font-size: 0.9rem;
  break-after: avoid;
  margin-top: 10px;
}

.glossary dd {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  break-before: avoid;
}

/* ── Footer ── */
.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Animations ── */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-node {
  0% {
    box-shadow: 0 0 0 0 rgba(196, 123, 26, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(196, 123, 26, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(196, 123, 26, 0);
  }
}

.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }

/* ── Diagram SVG block ── */
.diagram {
  margin: 20px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
}

.diagram svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 10px;
}

/* ── Tabs within section ── */
.local-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.local-tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink-soft);
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
}

.local-tab.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--teal-deep);
  font-weight: 600;
}

.local-panel {
  display: none;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--surface);
  border-radius: 0 0 6px 6px;
}

.local-panel.active {
  display: block;
  animation: rise 0.35s ease;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--top-h);
    width: min(300px, 88vw);
    z-index: 90;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    background: var(--surface);
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
  }

  .brand-sub {
    display: none;
  }

  .main {
    padding: 20px 16px 64px;
  }

  .wf-detail {
    grid-template-columns: 1fr;
  }

  .glossary {
    columns: 1;
  }

  .model-row {
    grid-template-columns: 1fr;
  }

  .wf-graph {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    min-width: 0;
    width: 100%;
  }

  .workflow-canvas {
    min-height: 0;
    padding: 16px 12px;
  }

  .top-tabs {
    max-width: 42vw;
    -webkit-overflow-scrolling: touch;
  }

  .section {
    margin-bottom: 40px;
  }

  .section h2 {
    font-size: 1.4rem;
  }

  .hero-lead {
    font-size: 0.95rem;
  }

  .pipeline-steps {
    gap: 4px 6px;
  }

  .pipeline-steps .step {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .local-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .local-tabs::-webkit-scrollbar {
    display: none;
  }

  .local-tab {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .table-wrap {
    margin-left: -4px;
    margin-right: -4px;
    border-radius: 4px;
  }

  .diagram {
    padding: 12px 8px;
  }

  .prompt-ex-body pre {
    font-size: 0.72rem;
  }
}

@media (max-width: 560px) {
  :root {
    --top-h: 96px;
  }

  .topbar {
    height: auto;
    min-height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    gap: 6px 8px;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 0;
  }

  .sidebar {
    top: calc(52px + 40px + env(safe-area-inset-top));
    height: calc(100vh - 92px - env(safe-area-inset-top));
    height: calc(100dvh - 92px - env(safe-area-inset-top));
  }

  html {
    scroll-padding-top: calc(92px + env(safe-area-inset-top) + 12px);
  }

  .section,
  .section h3,
  #fl-frames,
  #ip-adapter,
  #char-lora {
    scroll-margin-top: calc(92px + env(safe-area-inset-top) + 12px);
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
  }

  .top-tabs {
    display: flex;
    order: 10;
    flex: 1 0 100%;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 2px 8px;
    border-top: 1px solid var(--line-soft);
    padding-top: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .top-tab {
    font-size: 0.72rem;
    padding: 8px 12px;
    min-height: 36px;
  }

  .main {
    padding: 16px max(12px, env(safe-area-inset-left)) max(48px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  }

  .hero {
    margin-bottom: 28px;
  }

  .hero h1 {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .hero-figure img,
  .figure img {
    aspect-ratio: 16 / 10;
  }

  .hero-caption,
  .figure figcaption {
    font-size: 0.72rem;
    padding: 8px 10px;
  }

  .section-header {
    gap: 8px;
  }

  .section h2 {
    font-size: 1.28rem;
  }

  .section h3 {
    font-size: 1.08rem;
  }

  .para-grid,
  .shot-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .wf-graph {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .wf-node {
    padding: 10px 8px;
  }

  .wf-node .wf-title {
    font-size: 0.82rem;
  }

  .wf-node .wf-desc {
    font-size: 0.68rem;
  }

  .workflow-toolbar {
    padding: 10px 12px;
    gap: 6px;
  }

  .wf-btn {
    font-size: 0.72rem;
    padding: 5px 9px;
  }

  .prompt-formula {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .prompt-formula .slot::after {
    content: none;
  }

  .asset-prompt-grid,
  .asset-duo {
    grid-template-columns: 1fr;
  }

  .callout {
    padding: 12px 14px;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .issue-table td:first-child {
    white-space: normal;
  }

  .site-footer {
    font-size: 0.75rem;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 28, 0.35);
  z-index: 80;
}

.sidebar-backdrop.show {
  display: block;
}

/* ── Prompt examples ── */
.prompt-formula {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0 24px;
}

.prompt-formula .slot {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 12px 10px;
  text-align: center;
  position: relative;
}

.prompt-formula .slot strong {
  display: block;
  font-size: 0.82rem;
  color: var(--teal-deep);
  margin-bottom: 4px;
}

.prompt-formula .slot span {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.prompt-formula .slot::after {
  content: "→";
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--amber);
  font-weight: 700;
  font-size: 0.85rem;
}

.prompt-formula .slot:last-child::after {
  content: none;
}

.prompt-ex {
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.prompt-ex-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}

.prompt-ex-head .badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--frame);
  color: #d4e8ea;
}

.prompt-ex-head .badge.good {
  background: var(--teal);
}

.prompt-ex-head .badge.bad {
  background: #8b3a3a;
}

.prompt-ex-head .scene {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.prompt-ex-head .model {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.prompt-ex-body {
  padding: 12px 14px;
}

.prompt-ex-body .label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.prompt-ex-body pre {
  margin: 0 0 12px;
  padding: 12px;
  background: #1e2a32;
  color: #dce6eb;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.prompt-ex-body pre.neg {
  background: #2a2220;
  color: #e8d4c8;
}

.prompt-ex-body .note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.prompt-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.asset-prompt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 20px;
}

.asset-prompt-grid .prompt-ex {
  margin: 0;
}

.asset-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0 24px;
}

.asset-duo .figure {
  margin: 0;
}

.issue-table td:first-child {
  white-space: nowrap;
  font-size: 0.86rem;
}

.issue-table tbody tr:nth-child(even) {
  background: rgba(212, 232, 234, 0.25);
}

@media (max-width: 720px) {
  .asset-prompt-grid,
  .asset-duo {
    grid-template-columns: 1fr;
  }

  .prompt-compare {
    grid-template-columns: 1fr;
  }

  .prompt-formula .slot::after {
    content: none;
  }

  .issue-table td:first-child {
    white-space: normal;
  }
}
