/* ===== Workstation Docs — design ported from browser-mirror.pages.dev/docs ===== */
:root {
  --bg: #000000;
  --panel: #131316;
  --panel-2: #0d0d10;
  --card: #0f0f13;
  --border: #212126;
  --border-strong: #2c2c33;
  --text: #ffffff;
  --muted: #9394a1;
  --muted-2: #6e6f7c;
  --accent: #6c47ff;
  --accent-hover: #7c5bff;
  --accent-soft: rgba(108, 71, 255, 0.14);
  --ok: #43d17f;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --radius: 6px;
  --radius-lg: 12px;
  --sidebar-w: 282px;
  --toc-w: 232px;
  --topbar-h: 64px;
  --content-max: 780px;
  --font: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #2a2a31 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #26262d; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #34343d; background-clip: content-box; }

/* ===== Top bar (spans only the content column, like the reference) ===== */
.topbar {
  position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 0 22px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
}
.mobile-brand { display: none; }
.pill {
  font-size: 11.5px; color: var(--muted); border: 1px solid var(--border-strong);
  padding: 1px 8px; border-radius: 999px; background: transparent; line-height: 18px;
}
.pill.accent { color: #cbbcff; border-color: rgba(108,71,255,.35); background: var(--accent-soft); }

.search {
  width: 300px; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 11px; color: var(--muted); cursor: text;
}
.search input {
  border: 0; background: transparent; color: var(--text); font-family: var(--font);
  font-size: 13.5px; flex: 1; outline: none; min-width: 0;
}
.search input::placeholder { color: var(--muted-2); }
.search .kbd { font-size: 11px; color: var(--muted-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; line-height: 18px; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.btn {
  font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: var(--radius); padding: 7px 14px; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-sm { padding: 4px 12px; line-height: 20px; }
.btn-ghost { color: var(--text); border-color: transparent; background: #26262c; }
.btn-ghost:hover { background: #303038; }
.btn-primary { color: #fff; background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn .arr { font-size: 12px; opacity: .9; }

/* ===== Layout shell ===== */
.shell { display: flex; padding-top: var(--topbar-h); }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w);
  background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 14px 12px 40px;
  display: flex; flex-direction: column;
}
.side-brand { display: flex; align-items: center; gap: 8px; padding: 4px 6px 16px; }
.side-brand .logo {
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, #fff, #cfcfe6);
  color: #000; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.side-brand .name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; margin-right: 2px; }
.content {
  margin-left: var(--sidebar-w); flex: 1; min-width: 0;
  display: flex; justify-content: flex-start; gap: 56px;
  padding: 44px 56px 120px;
}
.article { width: 100%; max-width: var(--content-max); min-width: 0; }
.article.wide { max-width: 1140px; }

/* right-hand TOC */
.toc { width: var(--toc-w); flex: none; position: sticky; top: calc(var(--topbar-h) + 40px); align-self: flex-start; max-height: calc(100vh - var(--topbar-h) - 80px); overflow-y: auto; }
.toc h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin: 0 0 12px; }
.toc a { display: block; font-size: 13px; color: var(--muted); padding: 4px 0 4px 12px; border-left: 1px solid var(--border); transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); border-left-color: var(--accent); }

/* ===== Sidebar: SDK-style selector + Guides/Reference modes + flat list ===== */
.selector-label { font-size: 13px; color: var(--text); font-weight: 500; padding: 2px 6px 8px; }
.selector {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--border); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; color: var(--text); cursor: default; margin-bottom: 14px;
}
.selector .av { width: 24px; height: 24px; border-radius: 50%; background: #0b0b0e; border: 1px solid var(--border-strong); display: grid; place-items: center; color: #fff; font-size: 12px; }
.selector .st { display: flex; flex-direction: column; line-height: 1.25; }
.selector .st b { font-size: 13.5px; font-weight: 500; }
.selector .st span { font-size: 11px; color: var(--muted); }
.selector .cc { margin-left: auto; color: var(--muted); font-size: 13px; }

.side-mode {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted);
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer; transition: background .12s, color .12s;
  position: relative;
}
.side-mode svg { width: 17px; height: 17px; opacity: .85; }
.side-mode .rc { margin-left: auto; color: var(--muted-2); font-size: 13px; }
.side-mode:hover { color: var(--text); background: color-mix(in srgb, var(--panel) 60%, #fff 4%); }
.side-mode.active { background: #1e1e25; color: var(--text); }

.side-divider { height: 1px; background: var(--border); margin: 12px 4px; }

.side-list { display: flex; flex-direction: column; }
.side-sublabel { font-size: 12px; color: var(--muted-2); letter-spacing: .04em; padding: 12px 10px 6px; }
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 14px; color: var(--muted); font-weight: 400;
  padding: 8px 10px; border-radius: var(--radius); transition: background .12s, color .12s;
}
.side-link:hover { color: var(--text); background: color-mix(in srgb, var(--panel) 60%, #fff 4%); }
.side-link.active { color: var(--text); background: #1e1e25; font-weight: 450; }
.side-link .rc { color: var(--muted-2); font-size: 13px; }
.side-link.sub { padding-left: 18px; font-size: 13.5px; }

/* ===== Hero / landing ===== */
.hero { margin-bottom: 36px; }
.hero h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin: 0 0 20px; }
.hero p.lead { color: var(--muted); font-size: 15px; line-height: 1.78; max-width: 680px; margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 28px 0 12px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: border-color .16s, background .16s, transform .16s;
}
.card:hover { border-color: var(--border-strong); background: #131318; transform: translateY(-2px); }
.card .chip { width: 40px; height: 40px; border-radius: 10px; background: #17171d; border: 1px solid var(--border); display: grid; place-items: center; margin-bottom: 14px; color: #cbbcff; }
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.section-title { font-size: 24px; font-weight: 600; margin: 56px 0 6px; letter-spacing: -0.01em; }

/* ===== Rendered markdown ===== */
.md { min-width: 0; }
.md h1, .md h2, .md h3, .md h4 { letter-spacing: -0.015em; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.md h1 { font-size: 32px; font-weight: 600; margin: 4px 0 20px; line-height: 1.25; }
.md h2 { font-size: 22px; font-weight: 600; margin: 40px 0 14px; padding-top: 20px; border-top: 1px solid var(--border); }
.md h2:first-of-type { border-top: 0; padding-top: 0; }
/* first H2 of a section page acts as the page title */
.md > h2:first-child { font-size: 32px; margin: 4px 0 20px; }
.md h3 { font-size: 18px; font-weight: 600; margin: 30px 0 10px; }
.md h4 { font-size: 15px; font-weight: 600; margin: 22px 0 8px; color: #d8d8e2; }
.md p, .md li { color: #cdced6; font-size: 15px; line-height: 1.72; }
.md a:not(.card) { color: #b7a4ff; }
.md a:not(.card):hover { text-decoration: underline; }
.md strong { color: #fff; font-weight: 600; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 5px 0; }
.md li::marker { color: var(--muted-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.md blockquote {
  margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: #d3d3de;
}
.md blockquote p { color: #d3d3de; margin: 6px 0; }

/* inline + block code */
.md code { font-family: var(--mono); font-size: 13px; }
.md :not(pre) > code {
  background: #1a1a20; border: 1px solid var(--border); color: #e6c9ff;
  padding: 1px 6px; border-radius: 5px; font-size: 12.5px;
}
.md pre {
  position: relative; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 16px; overflow-x: auto; margin: 16px 0;
}
.md pre code { color: #d6d6e0; font-size: 13px; line-height: 1.6; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--muted);
  background: #17171d; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 9px; cursor: pointer; opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.md pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #fff; border-color: var(--border-strong); }
.copy-btn.done { color: var(--ok); border-color: rgba(67,209,127,.4); }

/* tables */
.md table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.md th { background: #17171d; color: #fff; font-weight: 600; }
.md td { color: #cdced6; }
.md tr:nth-child(even) td { background: rgba(255,255,255,.015); }

/* syntax highlight (hljs-compatible token classes) */
.hljs-keyword,.hljs-built_in,.hljs-literal { color: #c792ea; }
.hljs-string,.hljs-attr { color: #a5e075; }
.hljs-number,.hljs-symbol { color: #ffb454; }
.hljs-comment { color: #5c6370; font-style: italic; }
.hljs-title,.hljs-title.function_ { color: #7cc7ff; }
.hljs-variable,.hljs-template-variable { color: #e6c9ff; }
.hljs-meta { color: #56b6c2; }
.hljs-params { color: #d6d6e0; }

/* ===== Script viewer ===== */
.script-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.script-head h1 { font-size: 26px; margin: 0; font-family: var(--mono); font-weight: 600; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(67,209,127,.35); background: rgba(67,209,127,.08); }
.script-desc { color: var(--muted); font-size: 15px; margin: 6px 0 18px; max-width: 680px; }

.side-top { padding: 0 4px 6px; }

/* ===== Feature tiles (landing) ===== */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 26px 0 8px; }
.feature-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.feature-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; cursor: pointer; transition: border-color .16s, background .16s, transform .16s;
  display: flex; flex-direction: column; min-height: 132px;
}
.feature-tile:hover { border-color: var(--border-strong); background: #131318; transform: translateY(-2px); }
.feature-tile .ic { color: #c9cad6; margin-bottom: 14px; }
.feature-tile h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; }
.feature-tile p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* ===== Explore-by rows (icon + text list) ===== */
.exp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 40px; margin: 22px 0 8px; }
.exp-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.exp-row { display: flex; gap: 14px; padding: 14px 8px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; border-radius: 8px; }
.exp-row:hover { background: rgba(255,255,255,.02); }
.exp-row .ic { flex: none; width: 30px; height: 30px; border-radius: 8px; background: #16161c; border: 1px solid var(--border); display: grid; place-items: center; color: #b7a4ff; }
.exp-row .tx b { display: block; font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.exp-row .tx span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ===== CTA panels ===== */
.cta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 24px 0 8px; }
.cta {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(108,71,255,.14), transparent 60%), var(--panel-2);
}
.cta h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.cta p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ===== prev / next pager ===== */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.pn {
  display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; transition: border-color .15s, background .15s;
}
.pn:hover { border-color: var(--border-strong); background: #131318; }
.pn.next { text-align: right; align-items: flex-end; }
.pn-dir { font-size: 12px; color: var(--muted-2); }
.pn-title { font-size: 14.5px; font-weight: 600; color: var(--text); }

/* ===== meta row + footer ===== */
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.docs-footer { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.footer-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 24px; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand .logo { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg,#fff,#cfcfe6); color:#000; font-weight:700; font-size:13px; display:grid; place-items:center; }
.footer-col h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 0 0 12px; }
.footer-col a { display: block; font-size: 13px; color: var(--muted); padding: 4px 0; }
.footer-col a:hover { color: var(--text); }
.footer-note { font-size: 12.5px; color: var(--muted-2); line-height: 1.6; max-width: 260px; }
.md .docs-footer a, .docs-footer a { color: var(--muted); text-decoration: none; }
.md .docs-footer a:hover, .docs-footer a:hover { color: var(--text); text-decoration: none; }
.footer-bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted-2); }

/* mobile */
.menu-btn { display: none; }
.backdrop { display: none; }
@media (max-width: 1100px) { .toc { display: none; } .content { padding: 32px 28px 100px; } }
@media (max-width: 860px) {
  .topbar { left: 0; }
  .search { display: none; }
  .mobile-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
  .mobile-brand .logo { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg,#fff,#cfcfe6); color:#000; font-weight:700; font-size:13px; display:grid; place-items:center; }
  .menu-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; color: var(--text); }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; z-index: 60; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 28px 18px 100px; }
  .cards, .feature-grid, .feature-grid.cols-3, .exp-grid, .exp-grid.cols-3, .cta-grid { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 20px; }
  .backdrop.show { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.5); z-index: 40; }
}
@media (max-width: 1200px) and (min-width: 861px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
