/* ==========================================================================
   Savvy Posts Grid — Documentation
   Modern-AI theme · deep navy, gradient accents, azure + coral
   ========================================================================== */

:root {
  /* Modern-AI theme: deep navy surfaces, gradient washes, azure accent with a
     coral counterpoint that ties back to the plugin icon. Kept off the old
     violet-to-cyan pairing on purpose — that was the previous identity. */
  --bg: #f7f9fc;
  --bg-soft: #eef2f8;
  --bg-sunken: #e2e8f2;
  --surface: #ffffff;
  --border: #dbe2ed;
  --border-strong: #b9c4d4;
  --rule: #0d1526;
  --text: #0d1526;
  --text-soft: #445063;
  --text-faint: #647083;
  --accent: #1b5fd0;
  --accent-2: #0e7c72;
  --accent-3: #c03a12;
  --accent-soft: #e4edfd;
  --code-bg: #0a1020;
  --code-fg: #e6ecf8;
  --inline-code-bg: #eef2f8;
  --inline-code-fg: #1b5fd0;
  --green: #15803d;
  --amber: #b45309;
  --grad-accent: linear-gradient( 135deg, #1b5fd0 0%, #0c728f 100% );
  --grad-page: none;
  --shadow: none;
  --radius: 3px;
  --header-h: 60px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html.dark {
  --bg: #070c18;
  --bg-soft: #0e1526;
  --bg-sunken: #141d33;
  --surface: #0b1120;
  --border: #1d2942;
  --border-strong: #2f3f5f;
  --rule: #46587c;
  --text: #eef3fc;
  --text-soft: #a3b1c9;
  --text-faint: #7a89a3;
  --accent: #5ba4ff;
  --accent-2: #2dd4bf;
  --accent-3: #ff8a5c;
  --accent-soft: #10203c;
  --code-bg: #05090f;
  --code-fg: #e6ecf8;
  --inline-code-bg: #14203a;
  --inline-code-fg: #7cb8ff;
  --green: #4ade80;
  --amber: #fbbf24;
  --grad-accent: linear-gradient( 135deg, #5ba4ff 0%, #2dd4bf 100% );
  /* Layered washes so the deep navy is not a flat slab. */
  --grad-page:
    radial-gradient( 1100px 620px at 78% -12%, rgba( 91, 164, 255, .13 ), transparent 68% ),
    radial-gradient( 900px 560px at -8% 12%, rgba( 45, 212, 191, .09 ), transparent 65% ),
    radial-gradient( 800px 500px at 50% 108%, rgba( 255, 138, 92, .07 ), transparent 70% );
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background-image: var( --grad-page );
  background-attachment: fixed;
  background-repeat: no-repeat;
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  /* Clears the fixed header. It lives here rather than on .content so it
     tracks --header-h automatically when the rail wraps on small screens. */
  padding-top: var(--header-h);
}

::selection { background: var(--accent); color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; min-height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: color-mix( in srgb, var( --bg ) 82%, transparent );
  backdrop-filter: blur( 14px );
  -webkit-backdrop-filter: blur( 14px );
  border-bottom: 1px solid var( --border-strong );
  z-index: 100;
}
.brand {
  display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--text);
  font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; white-space: nowrap;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 6px; flex: 0 0 auto; align-self: center;
  background: var( --grad-accent ); color: #fff;
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  display: grid; place-items: center;
}
.brand .ver {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-faint); border: 1px solid var(--border); border-radius: 2px;
  padding: 1px 6px; margin-left: 2px;
}
.header-spacer { flex: 1; }

.doc-search { position: relative; width: 300px; max-width: 38vw; }
.doc-search input {
  width: 100%; height: 36px; border-radius: 2px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 0 34px; font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color .15s;
}
html.dark .doc-search input { background: var(--bg-soft); }
.doc-search input:focus { border-color: var(--accent); }
.doc-search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--text-faint); pointer-events: none; }
.doc-search kbd {
  position: absolute; right: 8px; top: 50%; translate: 0 -50%;
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 2px; padding: 1px 5px; background: var(--bg-soft);
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 2px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-soft); cursor: pointer;
  display: grid; place-items: center; transition: color .15s, border-color .15s; flex: 0 0 auto;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }
html.dark .icon-sun { display: block; } html.dark .icon-moon { display: none; }
.icon-sun { display: none; }
.menu-btn { display: none; }

/* ---------- Chapter rail (top nav, replaces the old left sidebar) ---------- */
.rail-nav { display: flex; align-items: center; gap: 2px; margin-left: 14px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rail-nav::-webkit-scrollbar { display: none; }
.rail-nav a {
  white-space: nowrap; text-decoration: none; color: var(--text-soft);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 7px 11px; border: 1px solid transparent; border-radius: 2px;
  transition: color .12s, border-color .12s;
}
.rail-nav a:hover { color: var(--text); }
.rail-nav a { position: relative; }
/* The active tab was a 12% tint, which is nearly invisible on the navy
   surface. Accent text plus a gradient underline reads at a glance. */
.rail-nav a.active {
  color: var( --accent );
  border-color: transparent;
  background: color-mix( in srgb, var( --accent ) 16%, transparent );
}
.rail-nav a.active::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  background: var( --grad-accent ); border-radius: 2px;
}

/* ---------- Layout: one column, centred, no side rails ---------- */
.content {
  max-width: 940px; margin: 0 auto;
  padding: 46px 32px 130px; min-width: 0;
}

/* Masthead — flat editorial plate, no gradient card. */
.hero {
  position: relative; border: none; border-radius: 0; overflow: visible;
  padding: 14px 0 10px; margin-bottom: 0;
  background: none; color: var(--text);
}
/* Gradient rule instead of a flat ink bar. */
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var( --grad-accent );
}
.hero::after { content: none; }
.hero .eyebrow {
  display: block; margin: 18px 0 14px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); background: none; border: none; border-radius: 0; padding: 0;
}
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(38px, 6vw, 64px); letter-spacing: -.015em; line-height: 1.04;
  max-width: 15ch;
}
.hero p { margin-top: 18px; font-size: 17.5px; max-width: 62ch; color: var(--text-soft); }
.hero .badges { display: flex; flex-wrap: wrap; gap: 0; margin-top: 28px; }
.hero .badge {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  padding: 3px 14px; border-radius: 0; color: var(--text-soft);
  background: none; border: none; border-left: 1px solid var(--border-strong);
}
.hero .badge:first-child { padding-left: 0; border-left: none; }

/* ---------- Chapter plates ---------- */
.chapter { scroll-margin-top: calc(var(--header-h) + 16px); }
.chapter-head {
  position: relative;
  margin: 76px 0 52px; padding: 34px 0 30px;
  border-bottom: 1px solid var( --border );
}
.chapter-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var( --grad-accent );
}
.chapter-num {
  display: block; margin-bottom: 12px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  background: var( --grad-accent );
  -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content;
}
.chapter-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(30px, 4vw, 44px); letter-spacing: -.015em; line-height: 1.08;
}
.chapter-sub { margin-top: 12px; font-size: 16.5px; color: var(--text-soft); max-width: 62ch; }

section.doc-section { margin-bottom: 68px; scroll-margin-top: calc(var(--header-h) + 24px); }

.doc-section > h2 {
  font-family: var(--display); font-weight: 600;
  font-size: 30px; letter-spacing: -.015em; margin-bottom: 8px;
  padding-top: 6px; display: flex; align-items: baseline; gap: 14px;
}
.doc-section > h2 .sec-num {
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--accent); background: none; border: none; border-radius: 0; padding: 0;
}
.doc-section .lede { color: var(--text-soft); font-size: 16.5px; max-width: 68ch; margin-bottom: 28px; }

.doc-section h3 {
  font-family: var(--display); font-size: 21px; font-weight: 600; letter-spacing: -.01em;
  margin: 40px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.doc-section h4 { font-size: 15px; font-weight: 700; margin: 28px 0 10px; letter-spacing: .01em; }
.doc-section p { color: var(--text-soft); max-width: 70ch; margin-bottom: 14px; }
.doc-section ul, .doc-section ol { color: var(--text-soft); padding-left: 22px; margin-bottom: 16px; max-width: 70ch; }
.doc-section li { margin-bottom: 6px; }
.doc-section li::marker { color: var(--accent); font-family: var(--mono); font-size: .85em; }
.doc-section strong { color: var(--text); font-weight: 650; }
.doc-section a:not(.btn) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doc-section a:not(.btn):hover { text-decoration-thickness: 2px; }

hr.sec-rule { border: none; border-top: 1px solid var(--border); margin: 0 0 68px; }

/* ---------- Cards / grids ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 0; margin: 26px 0; border-top: 1px solid var(--border); }
.feature-card {
  background: none; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 20px 22px 20px 0; position: relative;
}
.feature-card:hover { transform: none; box-shadow: none; }
.feature-card .fc-icon {
  width: auto; height: auto; border-radius: 0; background: none; color: var(--accent);
  display: block; margin-bottom: 10px; font-size: 17px; line-height: 1;
}
.feature-card h4 { margin: 0 0 5px; font-size: 15px; font-weight: 700; }
.feature-card p { font-size: 13.5px; margin: 0; color: var(--text-soft); max-width: none; }

.step-list { counter-reset: step; list-style: none; padding: 0 !important; margin: 26px 0; max-width: 72ch; }
.step-list li {
  counter-increment: step; position: relative; padding: 0 0 24px 52px; margin: 0;
}
.step-list li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 1px;
  width: 32px; height: 26px; border-radius: 0;
  background: none; color: var(--accent); border: 1px solid var(--border-strong);
  font-family: var(--mono); font-weight: 600; font-size: 12px;
  display: grid; place-items: center; box-shadow: none;
}
.step-list li:not(:last-child)::after {
  content: ""; position: absolute; left: 15.5px; top: 33px; bottom: 2px; width: 1px;
  background: var(--border);
}
.step-list li b { display: block; color: var(--text); font-size: 15px; margin-bottom: 3px; }
.step-list li span { color: var(--text-soft); font-size: 14.5px; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto; margin: 20px 0 30px;
  background: color-mix( in srgb, var( --surface ) 70%, transparent );
  border: 1px solid var( --border ); border-radius: 8px;
  box-shadow: none;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
thead th {
  text-align: left; font-family: var(--mono);
  padding-left: 16px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-soft); background: none;
  padding: 11px 18px 11px 0; border-bottom: 1px solid var( --border-strong ); white-space: nowrap;
}
thead th:last-child { padding-right: 16px; }
tbody td { padding: 11px 18px 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-soft); vertical-align: top; }
tbody td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--bg-soft); }
td code, li code, p code, .nav-group code {
  font-family: var(--mono); font-size: .86em; background: var(--inline-code-bg); color: var(--inline-code-fg);
  border-radius: 2px; padding: 1px 5px; white-space: nowrap;
}

/* ---------- Code blocks ---------- */
.code-block { position: relative; margin: 20px 0 30px; border-radius: 8px; overflow: hidden; box-shadow: none; border: 1px solid var( --border-strong ); }
.code-block .cb-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--code-bg); color: #9a9182; font-family: var(--mono);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  padding: 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
html.dark .code-block .cb-head { background: var(--code-bg); }
/* Traffic-light dots retired in favour of a plain label bar. */
.cb-head .dots { display: none; }
.cb-head .lang { display: flex; align-items: center; }
.cb-head .lang::before { content: "//"; margin-right: 8px; color: var( --accent-2 ); }
.cb-copy {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: #9a9182; background: transparent; border: 1px solid rgba(255,255,255,.18);
  border-radius: 2px; padding: 3px 9px; cursor: pointer; transition: color .15s, border-color .15s;
}
.cb-copy:hover { color: #fff; border-color: rgba(255,255,255,.45); }
.code-block pre {
  background: var(--code-bg); color: var(--code-fg);
  padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  tab-size: 4;
}
.code-block code { font-family: inherit; }
/* token colors — warm set to match the paper palette */
.tk-c { color: #787f90; font-style: italic; }  /* comment */
.tk-k { color: #ff7b72; }                       /* keyword */
.tk-s { color: #9ece6a; }                       /* string */
.tk-f { color: #7aa2f7; }                       /* function */
.tk-n { color: #ff9e64; }                       /* number/const */
.tk-v { color: #e0af68; }                       /* variable */

/* ---------- Callouts ---------- */
.callout {
  display: flex; gap: 14px; padding: 15px 18px; border-radius: 0;
  margin: 20px 0 26px; font-size: 14.5px; max-width: 72ch;
  border: none; border-left: 3px solid var(--border-strong); background: var(--bg-soft);
}
.callout .ci { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 3px; }
.callout p { margin: 0; max-width: none; }
.callout.tip    { border-left-color: var(--green); background: var(--bg-soft); }
.callout.tip .ci{ color: var(--green); }
.callout.note   { border-left-color: var(--accent-2); background: var(--bg-soft); }
.callout.note .ci{ color: var(--accent-2); }
.callout.warn   { border-left-color: var(--amber); background: var(--bg-soft); }
.callout.warn .ci{ color: var(--amber); }
.callout b:first-child {
  display: block; margin-bottom: 2px; color: var(--text);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
}

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-block; font-family: var(--mono);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  border-radius: 2px; padding: 1px 7px; margin: 0 4px 4px 0; white-space: nowrap;
  border: 1px solid currentColor;
}
.pill.p-accent { background: none; color: var(--accent); }
.pill.p-green  { background: none; color: var(--green); }
.pill.p-amber  { background: none; color: var(--amber); }
.pill.p-gray   { background: none; color: var(--text-faint); }
.pill.p-rose   { background: none; color: var(--accent-3); }

/* control-type tag inside tables */
.ctype {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent-2); background: none; border: 1px solid currentColor;
  border-radius: 2px; padding: 1px 6px; white-space: nowrap;
}

/* ---------- Hook signature blocks ---------- */
.hook-card {
  border: none; border-left: 3px solid var(--accent); border-radius: 0;
  background: var(--bg-soft); padding: 16px 20px; margin: 16px 0; box-shadow: none;
}
.hook-card .hk-name { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--accent); }
.hook-card .hk-kind {
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; margin-left: 10px; color: var(--text-faint);
}
.hook-card p { font-size: 14px; margin: 8px 0 0; max-width: none; }

/* ---------- FAQ ---------- */
details.faq {
  border: none; border-bottom: 1px solid var(--border); border-radius: 0; background: none;
  margin-bottom: 0; overflow: hidden; max-width: 72ch;
}
details.faq:first-of-type { border-top: 1px solid var(--border); }
details.faq summary {
  cursor: pointer; padding: 15px 4px; font-weight: 600; font-size: 15px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; transition: color .12s;
}
details.faq summary:hover { background: none; color: var(--accent); }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-family: var(--mono); font-size: 17px; color: var(--accent); font-weight: 400; transition: rotate .2s; }
details.faq[open] summary::after { rotate: 45deg; }
details.faq .faq-body { padding: 0 4px 18px; color: var(--text-soft); font-size: 14.5px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--rule); padding: 26px 60px; color: var(--text-faint);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
}
.site-footer a { color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Search highlight ---------- */
mark.search-hit {
	background: color-mix( in srgb, var( --accent-3 ) 18%, transparent );
	color: inherit;
	border-radius: 0;
	padding: 0 2px;
	box-shadow: inset 0 -2px 0 var( --accent-3 );
}
.search-hidden { display: none !important; }
.search-status { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--text-faint); margin-bottom: 24px; display: none; }
.search-status.visible { display: block; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 80;
  width: 40px; height: 40px; border-radius: 2px; cursor: pointer;
  border: 0;
  background: var( --grad-accent ); color: #fff; font-size: 16px;
  box-shadow: 0 6px 20px rgba( 27, 95, 208, .35 );
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .12s, box-shadow .12s;
  transform: translateY(6px);
}
.to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { transform: translateY( -2px ); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .rail-nav a { padding: 7px 8px; letter-spacing: .06em; }
  .doc-search { width: 210px; }
}

/*
 * Under 900px the rail wraps to a second row and scrolls horizontally. The old
 * layout hid navigation behind a hamburger; here there is no sidebar to open,
 * so the chapter links have to stay reachable on the strip itself.
 */
@media (max-width: 900px) {
  :root { --header-h: 104px; }
  .site-header { flex-wrap: wrap; align-content: center; gap: 10px 12px; padding: 8px 16px; }
  .brand { order: 1; font-size: 16px; }
  .header-spacer { order: 2; }
  .doc-search { order: 3; width: auto; flex: 0 1 210px; max-width: none; }
  .icon-btn { order: 4; }
  .rail-nav {
    order: 5; width: 100%; margin-left: 0;
    gap: 4px; padding-bottom: 2px;
    border-top: 1px solid var(--border); padding-top: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .rail-nav a { padding: 6px 10px; font-size: 10.5px; }
  .content { padding: 30px 20px 90px; }
  .chapter-head { margin: 56px 0 40px; padding: 26px 0 24px; }
  .site-footer { padding: 22px 20px; flex-direction: column; gap: 6px; }
}

@media (max-width: 620px) {
  :root { --header-h: 100px; }
  .brand .ver { display: none; }
  .doc-search { flex: 1 1 auto; }
  .doc-search kbd { display: none; }
  .content { padding: 24px 16px 80px; }
  /* Tables stay readable by scrolling rather than crushing the columns. */
  .table-wrap { border-top-width: 1px; border-bottom-width: 1px; }
  table { font-size: 12.5px; }
  thead th, tbody td { padding-right: 12px; }
  .code-block pre { font-size: 11.5px; padding: 14px; }
  .hero .badges { gap: 2px 0; }
  .step-list li { padding-left: 42px; }
  .step-list li::before { width: 28px; height: 24px; font-size: 11px; }
  .step-list li:not(:last-child)::after { left: 13.5px; top: 30px; }
  .feature-grid { grid-template-columns: 1fr; }
  .to-top { right: 14px; bottom: 14px; }
}

@media (max-width: 420px) {
  .brand span.title-full { font-size: 15px; }
  .doc-search input { font-size: 12px; padding: 0 30px; }
}

/* ==========================================================================
   Self-playing Savvy Posts Grid demo (animated mock — section #demo)
   The widget mock carries its OWN palette, independent of the docs page theme.
   ========================================================================== */
.gnd-secnum::before { content: "\25B8"; font-size: 11px; margin-right: 6px; } /* ▸ */

.gnd-wrap { margin-top: 18px; }

.gnd-stage {
  border-radius: 10px;
  --w-bg: #ffffff; --w-card: #ffffff; --w-muted: #eef2f8;
  --w-border: #dbe2ed; --w-fg: #0d1526; --w-soft: #647083; --w-accent: #1b5fd0;
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--w-bg);
  padding: 18px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba( 0, 0, 0, .45 );
}
.gnd-live {
  position: absolute; top: 14px; right: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--w-soft);
  background: var(--w-muted); border: 1px solid var(--w-border);
  padding: 3px 8px; border-radius: 2px;
}
.gnd-dot { width: 6px; height: 6px; border-radius: 0; background: #dc2626; animation: gnd-pulse 1.4s ease-in-out infinite; }

/* Top margin clears the absolutely-positioned "auto-playing" badge, which
   would otherwise sit on top of the Filters button. */
.gnd-toolbar { display: flex; align-items: center; gap: 10px; margin: 24px 0 14px; }
.gnd-search {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--w-muted); border: 1px solid var(--w-border); border-radius: 2px;
  padding: 10px 13px; color: var(--w-fg); font-family: var(--mono); font-size: 13px;
}
.gnd-search-ico { opacity: .55; flex: none; }
.gnd-search-text { white-space: nowrap; }
.gnd-ph { color: var(--w-soft); opacity: .8; }
.gnd-search.typing .gnd-ph { display: none; }
.gnd-caret { width: 1.5px; height: 15px; background: var(--w-accent); margin-left: -2px; animation: gnd-blink 1.05s steps(1) infinite; }
.gnd-search.typing .gnd-caret { margin-left: 1px; }

.gnd-filterbtn {
  flex: none; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--w-border); background: var(--w-card); color: var(--w-fg);
  border-radius: 2px; padding: 10px 14px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.gnd-filterbtn.on { background: var(--w-accent); color: #fff; border-color: var(--w-accent); }

.gnd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 0; }
.gnd-chips:empty { display: none; }
.gnd-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; color: var(--w-accent); border: 1px solid var(--w-accent); border-radius: 2px;
  padding: 3px 7px 3px 10px; font-family: var(--mono); font-size: 11px; font-weight: 600;
  animation: gnd-pop .25s ease;
}
.gnd-chip b { background: none; border-radius: 0; width: auto; height: auto; display: inline; font-size: 12px; opacity: .7; }

.gnd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gnd-card {
  background: var(--w-card); border: 1px solid var(--w-border); border-radius: 0; padding: 10px;
  transition: opacity .25s ease, transform .25s ease;
}
.gnd-card.gnd-out { opacity: 0; transform: scale(.92); pointer-events: none; }
.gnd-card.gnd-collapsed { display: none; }
.gnd-thumb { height: 60px; border-radius: 4px; margin-bottom: 9px; background: linear-gradient( 135deg, #1b5fd0, #0c728f ); }
.gnd-card:nth-child(2) .gnd-thumb { background: linear-gradient( 135deg, #0e7c72, #2dd4bf ); }
.gnd-card:nth-child(3) .gnd-thumb { background: linear-gradient( 135deg, #c03a12, #f0872f ); }
.gnd-card:nth-child(4) .gnd-thumb { background: linear-gradient( 135deg, #2f3f5f, #647083 ); }
.gnd-card:nth-child(5) .gnd-thumb { background: linear-gradient( 135deg, #15803d, #4ade80 ); }
.gnd-card:nth-child(6) .gnd-thumb { background: linear-gradient( 135deg, #7a2f8f, #b0165c ); }
.gnd-tag { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--w-accent); }
.gnd-card h5 { font-size: 13.5px; line-height: 1.3; margin: 4px 0 4px; color: var(--w-fg); font-weight: 650; }
.gnd-card p { font-size: 12px; line-height: 1.45; color: var(--w-soft); }

.gnd-overlay {
  position: absolute; inset: 0; z-index: 2; border-radius: 0;
  background: rgba(28, 26, 21, .45); opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.gnd-overlay.open { opacity: 1; }
.gnd-panel {
  position: absolute; top: 0; right: 0; z-index: 3; height: 100%; width: 232px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--w-card); border-left: 1px solid var(--rule); padding: 16px;
  transform: translateX(100%);
  transition: transform .34s cubic-bezier(.4, 0, .2, 1);
}
.gnd-panel.open { transform: translateX(0); }
.gnd-panel h4 { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--w-fg); }
.gnd-fg-label { display: block; margin-bottom: 7px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--w-soft); }
/*
 * Rendered as radio controls: the widget's Display Type offers dropdown,
 * checkbox and radio, and the mock shows the radio case. Selection is carried
 * by the dial rather than a solid fill, so the chosen row stays readable.
 */
.gnd-opt {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px; padding: 9px 11px; cursor: pointer;
  font-size: 13px; color: var( --w-fg );
  border: 1px solid var( --w-border ); border-radius: 4px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.gnd-opt::before {
  content: ""; flex: none;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var( --w-border );
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.gnd-opt:hover { border-color: var( --w-soft ); }

.gnd-opt.sel {
  background: color-mix( in srgb, var( --w-accent ) 8%, transparent );
  color: var( --w-accent );
  border-color: var( --w-accent );
  font-weight: 600;
}

/* Inset shadow draws the filled dot without another element. */
.gnd-opt.sel::before {
  border-color: var( --w-accent );
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 15px var( --w-accent );
}
.gnd-panel-foot { margin-top: auto; display: flex; gap: 8px; }
.gnd-panel-foot button {
  flex: 1; padding: 9px; cursor: pointer;
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  border: 1px solid var(--w-border); border-radius: 2px; background: transparent; color: var(--w-fg);
}
.gnd-panel-foot button.primary { background: var(--w-accent); color: #fff; border-color: var(--w-accent); }

.gnd-caption { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.gnd-status { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--text-soft); }
.gnd-play {
  flex: none; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text); background: none; border: 1px solid var(--border-strong);
  border-radius: 2px; padding: 7px 14px; transition: color .15s, border-color .15s;
}
.gnd-play:hover { color: var(--accent); border-color: var(--accent); }

@keyframes gnd-blink { 50% { opacity: 0; } }
@keyframes gnd-pop { from { transform: scale(.6); opacity: 0; } }
@keyframes gnd-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.55); opacity: .45; } }

@media (max-width: 720px) {
  .gnd-grid { grid-template-columns: repeat(2, 1fr); }
  .gnd-panel { width: 74%; }
}
@media (max-width: 460px) {
  .gnd-grid { grid-template-columns: 1fr; }
  .gnd-caption { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .gnd-dot, .gnd-caret { animation: none; }
}
