.back { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; color: var(--text); }
.back:hover { color: var(--accent); text-decoration: none; }
.back .icon { width: 16px; height: 16px; }
.nav-actions { display: flex; gap: 10px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }

:not(pre) > code { padding: 1px 6px; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); font-size: 0.86em; color: var(--text-bright); }

.p-hero { padding-block: 84px 72px; border-bottom: 1px solid var(--line); }
.p-title { margin: 0 0 18px; font-size: clamp(52px, 9vw, 104px); font-weight: 700; line-height: 0.95; letter-spacing: -0.04em; color: var(--text-bright); }
.p-title.long { font-size: clamp(44px, 7vw, 84px); line-height: 1; }
.p-tagline { margin: 0 0 22px; font-family: var(--mono); font-size: clamp(16px, 2vw, 20px); color: var(--muted); }
.p-tagline .hl { color: var(--accent); }
.p-desc { max-width: 42em; margin: 0 0 32px; font-size: 18.5px; }
.p-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }

.p-section { padding-block: 88px; border-bottom: 1px solid var(--line); }
.p-head { margin-bottom: 36px; }
.p-h2 { margin: 0; font-size: clamp(28px, 3.6vw, 38px); font-weight: 600; letter-spacing: -0.02em; color: var(--text-bright); }
.p-lead { max-width: 44em; margin: 14px 0 0; font-size: 17px; color: var(--muted); }
.mt { margin-top: 32px; }

.prose { max-width: 760px; }
.prose p { margin: 0 0 16px; font-size: 17.5px; }
.prose p:last-child { margin-bottom: 0; }

.gallery { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg-deep); }
.gallery-main { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery-main img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; transition: opacity 0.18s; }
.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); font-family: var(--mono); font-size: 13.5px; }
.g-label { color: var(--text-bright); }
.g-controls { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.g-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--text-bright); cursor: pointer; }
.g-btn:hover { border-color: var(--accent); color: var(--accent); }
.g-btn .icon { width: 18px; height: 18px; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 14px 2px 4px; }
.thumb { flex: none; width: 124px; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep); opacity: 0.5; cursor: pointer; transition: opacity 0.2s, border-color 0.2s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.thumb:hover { opacity: 0.85; }
.thumb[aria-current="true"] { border-color: var(--accent); opacity: 1; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 26px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-num { margin-bottom: 10px; font-family: var(--mono); font-size: 44px; font-weight: 500; line-height: 1; color: var(--accent); }
.stat-label { font-size: 15px; color: var(--muted); }

.f-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.f-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s; }
.f-card:hover { border-color: var(--accent-line); }
.f-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--text-bright); }
.f-card p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--muted); }

.steps { max-width: 800px; list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 18px; padding: 22px 0; border-top: 1px solid var(--line); }
.steps li:first-child { padding-top: 0; border-top: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); font-family: var(--mono); font-weight: 500; color: var(--accent); }
.steps h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 9px 0 6px; font-size: 17px; font-weight: 600; color: var(--text-bright); }
.steps p { margin: 0; font-size: 15.5px; color: var(--muted); }
.loop-tag { padding: 1px 8px; border: 1px dashed var(--accent-line); border-radius: 5px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--accent); }

.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.template { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: zoom-in; transition: border-color 0.2s; }
.template:hover { border-color: var(--accent-line); }
.template img { width: 100%; height: 260px; object-fit: cover; object-position: top; background: #fff; }
.template span { display: block; padding: 10px 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--accent); }

.code-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
.code-block { min-width: 0; }
.code-block.wide { grid-column: 1 / -1; }
.code-label { margin: 0 0 8px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.code-label.mt { margin-top: 36px; }
.code { margin: 0; padding: 18px 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-deep); font-family: var(--mono); font-size: 13.5px; line-height: 1.75; color: var(--text); }
.code .p { color: var(--accent); user-select: none; }
.code .c { color: var(--muted); }
.code .s { color: #a8e6c5; }
.code .k { color: #7fd1ff; }

.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stage { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stage-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.stage h3 { margin: 0; font-family: var(--mono); font-size: 14.5px; font-weight: 500; color: var(--text-bright); overflow-wrap: anywhere; }
.stage p { margin: 0 0 16px; font-size: 15.5px; color: var(--muted); }
.stage-out { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--text); }
.stage-out b { margin-right: 6px; font-weight: 500; color: var(--accent); }

.flow { display: grid; max-width: 900px; }
.flow-node { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.flow-node.accent { border-color: var(--accent-line); }
.flow-node h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 600; color: var(--text-bright); }
.flow-node p { margin: 0; font-size: 15.5px; color: var(--muted); }
.flow-tag { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--accent); }
.flow-split, .flow-arrows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.flow-arrow { position: relative; width: 2px; height: 30px; margin-inline: auto; background: var(--line-strong); }
.flow-arrow::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 8px; height: 8px; border-right: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong); transform: translateX(-50%) rotate(45deg); }

.table-wrap { max-width: 900px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { background: var(--surface); font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child, .tbl td:nth-child(2) { white-space: nowrap; }

.notes { max-width: 800px; list-style: none; margin: 0; padding: 0; }
.notes li { position: relative; padding: 16px 0 16px 28px; border-top: 1px solid var(--line); }
.notes li:first-child { padding-top: 0; border-top: 0; }
.notes li::before { content: ""; position: absolute; left: 2px; top: calc(16px + 0.62em); width: 9px; height: 9px; border: 2px solid var(--accent); border-radius: 2px; }
.notes li:first-child::before { top: 0.62em; }

.reaction-demo { max-width: 640px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.reaction-demo p { margin: 0 0 18px; color: var(--muted); }
.reactions { display: flex; flex-wrap: wrap; gap: 12px; }
.reaction { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; font-family: var(--mono); font-size: 14px; cursor: pointer; transition: transform 0.15s, background 0.2s; }
.reaction .icon { width: 18px; height: 18px; }
.reaction.like { border-color: var(--accent-line); color: var(--accent); }
.reaction.like:hover, .reaction.like.active { background: var(--accent-soft); }
.reaction.dislike { border-color: rgba(255, 138, 128, 0.35); color: #ff8a80; }
.reaction.dislike:hover { background: rgba(255, 138, 128, 0.08); }

.cta { padding-block: 112px; background: linear-gradient(to bottom, var(--bg), var(--bg-deep)); text-align: center; }
.cta-title { margin: 0 0 16px; font-size: clamp(30px, 4.4vw, 44px); font-weight: 600; letter-spacing: -0.02em; color: var(--text-bright); }
.cta-text { max-width: 34em; margin: 0 auto 32px; font-size: 17.5px; color: var(--muted); }
.cta .p-actions { justify-content: center; margin: 0; }

.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(5, 9, 8, 0.96); }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1400px, 100%); max-height: 86vh; border: 1px solid var(--line-strong); border-radius: 10px; }
.lb-btn { position: fixed; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text-bright); cursor: pointer; }
.lb-btn:hover { border-color: var(--accent); color: var(--accent); }
.lb-btn .icon { width: 20px; height: 20px; }
.lb-close { top: 18px; right: 18px; }
.lb-prev { top: 50%; left: 18px; transform: translateY(-50%); }
.lb-next { top: 50%; right: 18px; transform: translateY(-50%); }

.p-footer .container { justify-content: center; gap: 10px; }

@media (max-width: 860px) {
  .code-grid, .stages { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .nav-actions { display: none; }
  .p-hero { padding-block: 56px; }
  .p-section { padding-block: 68px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-num { font-size: 36px; }
  .flow-split, .flow-arrows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .flow-split { gap: 12px; }
  .flow-arrows .flow-arrow + .flow-arrow { display: none; }
  .template img { height: 220px; }
  .tbl td:first-child, .tbl td:nth-child(2) { white-space: normal; }
}
