:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-2: #0d9488;
  --border: #e2e8f0;
  --stage: #0f172a;
  --stage-border: #1e293b;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

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

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, canvas, svg { max-width: 100%; display: block; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius);
  z-index: 9999;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.site-nav a.is-active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  font-weight: 600;
}


.page-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.tool-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 14px;
}
.tool-hero h1 {
  margin: 0 0 6px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.tool-lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}
.trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.trust-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(13, 148, 136, 0.09);
  border: 1px solid rgba(13, 148, 136, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.workbench-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px;
  margin-bottom: 36px;
}

.pbr-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.pbr-cta-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.btn-primary, .btn-outline, .btn-sample {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; text-decoration: none; }
.btn-outline[aria-pressed="true"] {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-sample {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-sample.is-active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.pbr-samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pbr-samples-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}


.pbr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.pbr-tab {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pbr-tab:hover { color: var(--text); border-color: #cbd5e1; }
.pbr-tab.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.pbr-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: start;
}
.pbr-viewports {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.viewport-card {
  background: var(--stage);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.viewport-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #172235;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
}
.viewport-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
}
.viewport-canvas-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background-color: #0b1120;
  background-image: linear-gradient(45deg, #131c31 25%, transparent 25%),
    linear-gradient(-45deg, #131c31 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #131c31 75%),
    linear-gradient(-45deg, transparent 75%, #131c31 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewport-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
}
.viewport-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  background: #172235;
  border-top: 1px solid var(--stage-border);
}
.vp-mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.vp-mini-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.source-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: var(--bg);
}
.source-strip.is-dragover {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}
.source-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: #0f172a;
}
.source-info {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  color: var(--muted);
}
.source-info strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.pbr-controls {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ctrl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ctrl-val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.ctrl-select,
.comment-fields input,
.comment-fields textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
}
.ctrl-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23475569' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}
input, select, textarea {
  font-size: 16px;
}
input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.ctrl-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ctrl-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}
.ctrl-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin: 0;
}
.pbr-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 20px;
}
.pbr-status.is-error { color: #b91c1c; font-weight: 600; }
.pbr-status.is-ok { color: var(--accent-2); font-weight: 600; }


.article-flow {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.prose-section, .faq-section, .related-section, .engage-section, .doc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.prose-section h2, .faq-section h2, .related-section h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.25;
}
.geo-lead {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
.prose-section p {
  margin: 0 0 12px;
  color: var(--muted);
}
.prose-section p.geo-lead { color: var(--text); }
.prose-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}
.prose-list li { margin-bottom: 8px; }
.prose-list strong { color: var(--text); }

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
.spec-table th {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.spec-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
}
.spec-table tr:last-child td { border-bottom: 0; }

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.faq-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.faq-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.3;
  color: var(--text);
}
.faq-card p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.related-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.related-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.related-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}


.engage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.engage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.like-count {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}
.share-msg, .comment-msg { font-size: 14px; color: var(--accent-2); font-weight: 500; }
.comment-summary { font-size: 14px; color: var(--muted); }
.comments-wrap h3 { margin: 0 0 12px; font-size: 18px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.comment-fields { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; }
.comment-submit-row { display: flex; align-items: center; gap: 12px; }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-list[data-gf-empty] .comment-empty-msg { display: block; }
.comment-empty-msg { display: none; color: var(--muted); font-size: 14px; margin: 0; }
.comment-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.comment-item[data-gf-owner] { border-color: var(--accent); background: rgba(37, 99, 235, 0.04); }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.owner-badge { background: var(--accent); color: #ffffff; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.comment-body { margin: 0; font-size: 15px; color: var(--text); }
.comment-replies { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.reply-btn, .reply-cancel { background: none; border: 0; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.reply-banner { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.doc-shell { max-width: 920px; }
.doc-card h1 { margin: 0 0 10px; font-size: 32px; line-height: 1.2; }
.doc-lead, .doc-meta { color: var(--muted); margin: 0 0 18px; }
.doc-body h2 { margin: 24px 0 8px; font-size: 22px; }
.doc-body p, .doc-body li { color: var(--muted); }
.not-found-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 16px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr);
  gap: 24px;
}
.footer-brand strong { font-size: 16px; display: block; margin-bottom: 6px; }
.footer-brand p { margin: 0; font-size: 14px; color: var(--muted); }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.footer-col { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.footer-heading { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.footer-bottom p { margin: 0; }

@media (max-width: 920px) {
  .pbr-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 12px; }
  .site-nav { padding-bottom: 2px; }
  .page-shell { padding: 12px 12px 36px; }
  .tool-hero h1 { font-size: 26px; }
  .tool-lead { font-size: 14px; }
  .trust-pills { display: none; }
  .workbench-wrap { padding: 10px; }
  .pbr-cta-group { width: 100%; }
  .pbr-cta-group .btn-primary, .pbr-cta-group .btn-outline { flex: 1 1 calc(50% - 4px); padding: 0 10px; font-size: 14px; }
  .pbr-viewports { grid-template-columns: 1fr; }
  .ctrl-checks { grid-template-columns: 1fr; }
  .faq-grid, .related-grid, .comment-fields, .footer-inner { grid-template-columns: 1fr; }
  .prose-section, .faq-section, .related-section, .engage-section, .doc-card { padding: 16px; }
}
