@import url("tokens.css");

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

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: var(--slate-50);
}

/* Fixed top chrome — matches app hero-topbar */
.site-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--chrome-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  display: inline-flex;
  width: 26px;
  height: 26px;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(8, 20, 40, 0.22));
}

.site-chrome h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
}

.site-chrome-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-select {
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--slate-200);
  color: var(--slate-900);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}

.lang-select:focus {
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--navy-700),
    0 0 0 3px var(--navy-ring);
}

button {
  border: none;
  border-radius: var(--radius-button);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  background: var(--navy-700);
  color: #fff;
  transition: filter 120ms ease, transform 120ms ease;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary {
  background: var(--slate-200);
  color: var(--slate-900);
}

button.secondary:hover {
  filter: brightness(0.94);
}

button.ghost {
  background: transparent;
  color: var(--navy-700);
  padding: 6px 10px;
}

.user-pill {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--navy-100);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-700);
}

.user-pill.visible {
  display: inline-flex;
}

.user-pill .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy-700);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

/* Viewport + infinite plane */
.viewport {
  position: fixed;
  inset: var(--chrome-h) 0 0 0;
  cursor: grab;
  touch-action: none;
  background: linear-gradient(180deg, var(--slate-50) 0%, var(--navy-100) 100%);
  /* Dot-grid state, fed by canvas.js. These live on .viewport (not ::before)
     so the inline values JS writes here are inherited by the pseudo-element;
     defining them on ::before would shadow the inherited ones. */
  --dot-gap: 24px;
  --dot-x: 0px;
  --dot-y: 0px;
}

.viewport.is-dragging {
  cursor: grabbing;
}

.viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Dot grid is anchored to the world: it pans and zooms with the canvas
     content. canvas.js feeds --dot-x/--dot-y (the pan offset) and --dot-gap
     (a world-space gap multiplied by the live zoom) on .viewport; we only
     consume them here. The dot radius is kept proportional to the gap so the
     dots scale cleanly; at ~24px gap it resolves to ~1px. */
  --dot-radius: calc(var(--dot-gap) / 24);
  background-image: radial-gradient(
    circle,
    var(--slate-400) var(--dot-radius),
    transparent var(--dot-radius)
  );
  background-size: var(--dot-gap) var(--dot-gap);
  background-position: var(--dot-x) var(--dot-y);
  opacity: 0.35;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
  /* Intentionally NOT `will-change: transform`: promoting the whole world to a
     standalone compositor layer makes the browser keep one big rasterised
     backing store, which it discards and re-rasterises on a big scale change
     (zoom-out) — for a frame the content vanishes and the near-white page
     background shows through, read as a "white flash". Painting inline avoids
     that discard. */
}

/* Cards on the plane */
.plane-card {
  position: absolute;
  width: 304px;
  padding: 16px;
  background: var(--panel-bg);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  transform: translate(-50%, -50%);
  transition: box-shadow 120ms ease, transform 120ms ease;
  user-select: none;
}

.plane-card:not(.no-lift):hover {
  box-shadow: var(--shadow-card-hover);
  transform: translate(-50%, calc(-50% - 2px));
}

.plane-card.wide {
  width: 376px;
}

/* ====================================================================== *
 * Massive download banner — wide, short (height ≈ ¼ width), four apps
 * ====================================================================== */
.plane-card.download-card {
  width: 1180px;
  padding: 30px 40px 34px;
  background: linear-gradient(160deg, #ffffff 0%, #e9f1ff 100%);
  color: var(--slate-700);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.download-card .card-spot {
  display: none;
}
.download-card .dl-title {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-align: center;
  color: var(--slate-900);
}
.download-card .dl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
/* No box-inside-the-box: the apps sit directly on the light banner. */
.download-card .dl-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 12px 12px 14px;
  border-radius: 16px;
  background: transparent;
  border: none;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}
.download-card .dl-app:hover {
  transform: translateY(-4px);
  background: rgba(86, 168, 242, 0.1);
}
.download-card .dl-ico {
  display: block;
}
.download-card .dl-ico svg {
  width: 124px;
  height: 124px;
  filter: drop-shadow(0 10px 20px rgba(20, 40, 80, 0.22));
}
.download-card .dl-app strong {
  font-size: 21px;
  font-weight: 700;
  color: var(--slate-900);
}
.download-card .dl-app span {
  font-size: 14px;
  line-height: 1.45;
  color: var(--slate-600);
}

/* ====================================================================== *
 * "Completely free" card — bigger, roughly square, app blue/slate theme
 * ====================================================================== */
.plane-card.free-card {
  width: 840px;
  padding: 36px 44px 40px;
}
.free-card .card-spot {
  display: none;
}
.free-card h2 {
  font-size: 26px;
  margin: 8px 0 6px;
  color: var(--slate-900);
}
.free-card .free-intro {
  margin: 0 0 26px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--slate-600);
}
.free-points {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 34px;
}
.free-points li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--slate-600);
}
.free-points li .inj-ico {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  color: var(--navy-700);
}
.free-points strong {
  color: var(--slate-900);
}
.free-why {
  border-top: 1px solid var(--slate-200);
  padding-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.free-why h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--slate-900);
}
.why-item {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}
.why-item .inj-ico {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 3px;
  color: var(--navy-700);
}
.why-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--slate-600);
}
.why-item strong {
  color: var(--slate-800);
}

.plane-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--slate-900);
}

.plane-card p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--slate-600);
}

.plane-card .card-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.tag-home {
  background: var(--navy-100);
  color: var(--navy-700);
}

.tag-download {
  background: var(--cyan-50);
  color: var(--cyan-text);
}

.tag-feature {
  background: var(--gold-50);
  color: var(--gold-text);
}

.tag-platform {
  background: var(--navy-100);
  color: var(--navy-700);
}

.tag-account {
  background: var(--pink-50);
  color: var(--pink-text);
}

.tag-docs {
  background: var(--slate-200);
  color: var(--slate-600);
}

/* Home card — slightly larger */
.plane-card.home-card {
  width: 392px;
  text-align: center;
  padding: 24px 20px;
}

.home-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 6px 14px rgba(8, 20, 40, 0.28));
}

.home-logo svg {
  width: 60px;
  height: 60px;
  display: block;
}

.home-card h2 {
  font-size: 20px;
}

.home-card .subtitle {
  font-size: 14px;
  color: var(--slate-600);
  margin-bottom: 14px;
}

/* Download tiles inside cluster card */
.download-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.download-tile:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.download-tile-info {
  min-width: 0;
}

.download-tile-info strong {
  display: block;
  font-size: 13px;
  color: var(--slate-900);
}

.download-tile-info span {
  font-size: 11px;
  color: var(--slate-500);
}

.download-tile button {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 11px;
}

/* Feature list */
.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  font-size: 12px;
  line-height: 1.4;
  color: var(--slate-600);
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-list li strong {
  color: var(--slate-800);
}

/* Platform rows */
.platform-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.platform-row:last-child {
  border-bottom: none;
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--navy-700);
}

.platform-row p {
  margin: 0;
  font-size: 12px;
}

/* Zoom controls */
.zoom-controls {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zoom-controls button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

@media (max-width: 600px) {
  .plane-card {
    width: min(280px, calc(100vw - 48px));
  }

  .plane-card.wide {
    width: min(320px, calc(100vw - 48px));
  }

  .docs-card {
    width: min(600px, calc(100vw - 48px));
    height: 400px;
  }
}

/* Docs cards — split into a small Legal box and a large Manual box */
.docs-card {
  width: 820px;
  height: 660px;
  display: flex;
  flex-direction: column;
}

/* Privacy & Terms — smaller */
.docs-legal-card {
  width: 440px;
  height: 480px;
}

/* Instruction Manual — bigger */
.docs-manual-card {
  width: 880px;
  height: 720px;
}

.docs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.docs-header h2 {
  margin: 0;
  font-size: 16px;
}

.docs-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.docs-tabs button.active {
  background: var(--navy-700);
  color: #fff;
}

.docs-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.docs-body h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--slate-900);
}

.docs-body p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate-600);
  margin: 0 0 8px;
}

.docs-body ul {
  margin: 0 0 8px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate-600);
}

.docs-body code {
  font-size: 12px;
  background: var(--slate-200);
  padding: 2px 6px;
  border-radius: 6px;
}

.docs-body h2 {
  font-size: 15px;
  margin: 18px 0 6px;
  color: var(--slate-900);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 4px;
}

.docs-body h2:first-child {
  margin-top: 0;
}

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}

.docs-body th,
.docs-body td {
  text-align: left;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.docs-body th {
  background: var(--slate-50);
  font-weight: 600;
}

.docs-body hr {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  margin: 14px 0;
}

.docs-body pre {
  font-size: 11px;
  line-height: 1.4;
  padding: 10px;
  border-radius: 8px;
  background: var(--slate-900);
  color: #e2e8f0;
  overflow-x: auto;
  margin: 8px 0;
}

.docs-body blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--navy-300);
  background: var(--navy-100);
  font-size: 12px;
  color: var(--slate-600);
}

.docs-placeholder {
  font-size: 16px;
  color: var(--slate-400);
  text-align: center;
  margin-top: 140px;
}

/* Download inline detail */
.download-detail {
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--radius-card);
  background: var(--slate-50);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.download-detail p {
  font-size: 12px;
  color: var(--slate-600);
  margin: 0 0 8px;
  line-height: 1.4;
}

.download-detail pre {
  font-size: 11px;
  line-height: 1.4;
  padding: 8px;
  border-radius: 8px;
  background: var(--slate-900);
  color: #e2e8f0;
  overflow-x: auto;
  margin: 0 0 8px;
}

.download-detail .dl-zip-btn {
  font-size: 11px;
  padding: 5px 10px;
}

/* Account card — FIXED SIZE: the box never resizes between states. The three
 * states (credentials / verify / signed-in) swap inside .account-body, which
 * fills the constant-height card; the note stays pinned to the bottom. */
.account-card {
  width: 320px;
  height: 392px;
  display: flex;
  flex-direction: column;
}

.account-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-form[hidden],
.account-signed-in[hidden] {
  display: none;
}

.account-form label,
.account-name-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-800);
}

.account-form input,
.account-name-form input {
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-family: var(--font);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
}

.account-form input:focus,
.account-name-form input:focus {
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--navy-700),
    0 0 0 3px var(--navy-ring);
}

.account-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.account-hint {
  font-size: 12px;
  color: var(--slate-600);
  margin: 0 0 6px;
  line-height: 1.4;
}

.account-note {
  font-size: 11px;
  color: var(--slate-500);
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

/* Signed-in state */
.account-signed-in {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.account-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--navy-700);
}

.account-id-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-id-text strong {
  font-size: 15px;
  color: var(--slate-900);
}

.account-email {
  font-size: 12px;
  color: var(--slate-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-delete {
  margin-top: auto;
  align-self: flex-start;
  background: transparent;
  color: var(--red-text, #dc2626);
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.account-delete:hover {
  filter: none;
  text-decoration: underline;
}

/* Destructive primary button (used by confirm popups) */
button.danger {
  background: var(--red-text, #dc2626);
  color: #fff;
}

/* ====================================================================== *
 * CardPopup — per-box feedback / confirm overlay (see docs/DESIGN.md)
 * ====================================================================== */
.card-popup-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.card-popup-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.card-popup {
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  width: fit-content;
  max-width: 92%;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.26);
  transform: translateY(8px) scale(0.97);
  transition: transform 200ms ease;
}

.card-popup-overlay.visible .card-popup {
  transform: none;
}

.card-popup-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-popup-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--slate-400);
}

.card-popup-success .card-popup-dot { background: #16a34a; }
.card-popup-error .card-popup-dot { background: var(--red-text, #dc2626); }
.card-popup-info .card-popup-dot { background: var(--navy-700); }

.card-popup-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--slate-800);
}

.card-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.card-popup-actions button {
  font-size: 12px;
  padding: 7px 12px;
}

/* YouTube tag system — large panel wrapping three boxes */
.youtube-card {
  width: 1320px;
}

.yt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.yt-header h2 {
  margin: 0;
  font-size: 17px;
}

.yt-api-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
}

.yt-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-400);
}

.yt-api-status.online .yt-status-dot {
  background: #16a34a;
}

.yt-api-status.offline .yt-status-dot {
  background: #dc2626;
}

.yt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "tree tree"
    "creators watched"
    "contribute similar";
  gap: 12px;
  align-items: start;
}

.yt-tree-box {
  grid-area: tree;
  min-width: 0;
}

.yt-creators-box {
  grid-area: creators;
  min-width: 0;
}

.yt-watched-box {
  grid-area: watched;
  min-width: 0;
}

.yt-contribute-box {
  grid-area: contribute;
  min-width: 0;
}

.yt-similar-box {
  grid-area: similar;
  min-width: 0;
}

/* opt-in consent row */
.yt-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--slate-500);
  cursor: pointer;
}
.yt-consent input {
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--navy-500, #2a4a73);
}

/* lookup input + button */
.yt-watched-input {
  display: flex;
  gap: 8px;
  align-items: center;
}
.yt-watched-input .yt-input {
  flex: 1 1 auto;
}
.yt-watch-go {
  flex: 0 0 auto;
  border: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-700);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.yt-watch-go:hover {
  background: var(--slate-100);
}

/* watched-creator rows */
.yt-watched-list {
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.yt-watched {
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
}
.yt-watched-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.yt-watched-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--slate-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yt-watched-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--slate-500);
}
.yt-watched-subs {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.yt-cache-stats {
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

/* state badges */
.yt-state {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.yt-state-tagged {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}
.yt-state-pending {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}
.yt-state-below_floor {
  color: var(--slate-600);
  background: var(--slate-100);
  border-color: var(--slate-200);
}
.yt-state-unknown {
  color: var(--slate-500);
  background: var(--slate-50);
  border-color: var(--slate-200);
}
.yt-state-discovered {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.yt-state-processing {
  color: #1e40af;
  background: #dbeafe;
  border-color: #bfdbfe;
}
.yt-state-done {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}
.yt-state-failed {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}
.yt-state-unsure {
  color: #6b21a8;
  background: #f3e8ff;
  border-color: #e9d5ff;
}

/* Full-state legend (#5): every possible pipeline state with its live count. */
.yt-state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.yt-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.yt-legend-chip .yt-legend-count {
  font-weight: 700;
  color: var(--slate-700);
}
.yt-legend-chip.zero {
  opacity: 0.4;
}

/* queue monitor copy + per-row extras */
.yt-queue-note {
  margin: 6px 0 4px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--slate-500);
}
.yt-queue-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--slate-400, #94a3b8);
}
.yt-queue-new {
  border-color: var(--navy-500, #2a4a73);
  box-shadow: 0 0 0 2px rgba(42, 74, 115, 0.12);
  animation: yt-queue-pop 1.2s ease;
}
@keyframes yt-queue-pop {
  0% { background: #eef4ff; }
  100% { background: #fff; }
}

/* first-run consent modal */
.yt-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  padding: 20px;
}
.yt-consent-card {
  max-width: 460px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 24px 24px 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}
.yt-consent-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--slate-900, #0f172a);
}
.yt-consent-text {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--slate-600);
}
.yt-consent-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.yt-consent-yes,
.yt-consent-no {
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--slate-300);
}
.yt-consent-yes {
  background: var(--navy-600, #1f3a5f);
  color: #fff;
  border-color: var(--navy-600, #1f3a5f);
}
.yt-consent-no {
  background: #fff;
  color: var(--slate-600);
}

.yt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.yt-box-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  font-variant-numeric: tabular-nums;
}

.yt-box-sub {
  margin: -2px 0 8px;
  font-size: 11px;
  color: var(--slate-400);
}

.yt-box {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.yt-box-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

.yt-input {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-family: var(--font);
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  margin-bottom: 8px;
}

.yt-input:focus {
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--navy-700),
    0 0 0 3px var(--navy-ring);
}

.yt-empty {
  font-size: 12px;
  color: var(--slate-400);
  margin: 6px 0;
}

/* 2D tag tree (virtualized) */
.yt-tree {
  position: relative;
  height: 460px;
  overflow: auto;
  background:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px) 0 0 / 100% 22px,
    var(--slate-50);
  border-radius: var(--radius-button);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.yt-tree-canvas {
  position: relative;
}

.yt-tree-lines {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.yt-tree-lines line {
  stroke: rgba(100, 116, 139, 0.55);
  stroke-width: 1.2;
}

.yt-tree-nodes {
  position: absolute;
  top: 0;
  left: 0;
}

.yt-tnode {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  box-sizing: border-box;
  padding: 0 6px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  border-left: 3px solid transparent;
  overflow: hidden;
}

.yt-tnode.leaf {
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}

.yt-tnode.root {
  background: var(--navy-700);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.yt-tnode.root .yt-tnode-label {
  color: #fff;
}

.yt-tnode-swatch {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--slate-400);
}

.yt-tnode.leaf .yt-tnode-swatch {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.yt-tnode-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-tnode.leaf .yt-tnode-label {
  font-weight: 500;
  font-size: 10px;
  color: var(--slate-600);
}

/* Creator list */
.yt-creator-list {
  overflow-y: auto;
  max-height: 520px;
  min-height: 360px;
}

.yt-creator {
  padding: 8px;
  border-radius: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.yt-creator:last-child {
  border-bottom: none;
}

.yt-creator-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.yt-creator-head .yt-creator-handle {
  margin-left: 0;
}
.yt-creator-head .yt-state {
  margin-left: auto;
}

.yt-creator-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-900);
}

.yt-creator-handle {
  font-size: 11px;
  color: var(--slate-500);
  margin-left: 6px;
}

.yt-creator-tags {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.yt-creator-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--slate-400);
}

/* Creator id + subscriber meta line */
.yt-creator-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}
.yt-creator-id {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10.5px;
  color: var(--slate-400);
  user-select: all;
}
.yt-creator-subs {
  font-weight: 600;
  color: var(--slate-600);
}

/* Creators box: search-mode dropdown + filter input on one row */
.yt-creators-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}
.yt-creators-controls .yt-input {
  flex: 1 1 auto;
  margin: 0;
}
.yt-mode-select {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--slate-700);
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  cursor: pointer;
}
.yt-mode-select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--navy-700), 0 0 0 3px var(--navy-ring);
}

/* Tag-tree search (top-right of the tree box head) */
.yt-tree-search {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.yt-tree-search-input {
  width: 168px;
  padding: 5px 9px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 12px;
  font-family: var(--font);
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
}
.yt-tree-search-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--navy-700), 0 0 0 3px var(--navy-ring);
}
.yt-tree-search-count {
  min-width: 44px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}
.yt-tree-nav {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: var(--slate-100);
  color: var(--slate-600);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
  font-size: 13px;
  line-height: 1;
}
.yt-tree-nav:hover:not(:disabled) {
  background: var(--navy-700);
  color: #fff;
}
.yt-tree-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.yt-tree-dl {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border: none;
  border-radius: 7px;
  background: var(--slate-100);
  color: var(--slate-600);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.yt-tree-dl:hover:not(:disabled) {
  background: var(--navy-700);
  color: #fff;
}
.yt-tree-dl:disabled {
  opacity: 0.4;
  cursor: default;
}

/* While searching: dim non-matches, highlight matches, ring the current one. */
.yt-tree-nodes.searching .yt-tnode:not(.match) {
  opacity: 0.28;
}
.yt-tnode.match {
  box-shadow: 0 0 0 1.5px var(--navy-700);
}
.yt-tnode.current {
  box-shadow: 0 0 0 2px #b45309, 0 0 0 5px rgba(180, 83, 9, 0.25);
  background: #fff7ed;
  z-index: 3;
}

/* Heatmap toggle (#11) active state. */
.yt-tree-heatmap.active {
  background: #b45309;
  color: #fff;
}

/* Clickable tag nodes (open co-occurrence). */
.yt-tnode.clickable { cursor: pointer; }
.yt-tnode.clickable:hover { box-shadow: 0 0 0 1.5px var(--navy-700); }

/* Per-node count chip used by the heatmap (#11) and co-occurrence (#12). */
.yt-tnode-count {
  margin-left: auto;
  padding-left: 4px;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #7c2d12;
  opacity: 0.85;
}

/* Co-occurrence selection (#12): the seed pops, hits keep their tint (set
   inline), misses fade back so the related set reads at a glance. */
.yt-tnode.cooccur-seed {
  box-shadow: 0 0 0 2px #6d28d9, 0 0 0 5px rgba(109, 40, 217, 0.25);
  z-index: 3;
}
.yt-tnode.cooccur-dim { opacity: 0.22; }
.yt-tnode.cooccur-hit { box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.4); }

/* Co-occurrence status bar above the tree. */
.yt-tree-cooccur {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: #f5f3ff;
  border: 1px solid #ede9fe;
  font-size: 12px;
}
.yt-cooccur-label { color: #5b21b6; font-weight: 600; }
.yt-cooccur-clear {
  margin-left: auto;
  border: none;
  background: #ede9fe;
  color: #5b21b6;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.yt-cooccur-clear:hover { background: #ddd6fe; }

.yt-tree-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--slate-500);
}

/* Clickable creator cards + selected state (drives the Similar box, #13). */
.yt-creator.clickable { cursor: pointer; }
.yt-creator.clickable:hover { background: var(--slate-50); }
.yt-creator.selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--navy-700);
}

/* Similar Creators box (#13). */
.yt-similar-seed { margin-bottom: 8px; }
.yt-similar-seed strong { color: var(--slate-800); }
.yt-similar-list { max-height: 280px; overflow-y: auto; }
.yt-similar-score {
  flex: 0 0 auto;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #5b21b6;
  background: #f3e8ff;
  border: 1px solid #e9d5ff;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Contribute box (#9). */
.yt-contribute-input {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  font-family: var(--mono, monospace);
  font-size: 12px;
  line-height: 1.5;
}
.yt-contribute-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.yt-btn {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--navy-700);
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.yt-btn:hover:not(:disabled) { background: var(--navy-800, #1e3a5f); }
.yt-btn:disabled { opacity: 0.45; cursor: default; }
.yt-contribute-msg {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--slate-600);
}
.yt-contribute-msg.ok { color: #166534; }
.yt-contribute-msg.warn { color: #9a3412; }

/* Home demo links */
.home-demo-links {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.demo-link {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-button);
  color: var(--navy-700);
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.demo-link.primary {
  color: #fff;
  background: var(--navy-700);
  box-shadow: none;
}

.demo-link:hover {
  filter: brightness(1.05);
}

/* ============================ App / Extension demo cards ============================ */
/* The popup UI is fluid (it fills 100vw / 100vh of the iframe). Both demos use
   the SAME display scale (0.814815) and the SAME 1728×1080 viewport, so:
     1. Text: the 12px Arial UI renders at 12 * 0.814815 = 9.78px in BOTH demos —
        identical on-screen text size (as in real life: px is px on one monitor).
     2. External size: both screens are 1408×880, so the two cards are the same
        size. The macOS app is simply shown at a maximized window (it is freely
        resizable; only a 720×560 minimum is enforced — MacBlockerPanelApp.swift),
        which is why we can render it at the browser tab's resolution.
   Card width = screen width + 2 * 16px (.plane-card padding, border-box). */
.app-demo-card,
.ext-demo-card {
  width: 1440px;   /* 1408 screen + 32 padding */
}

.popup-frame-wrap {
  overflow: hidden;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.popup-frame {
  display: block;
  border: none;
  transform-origin: top left;
}

/* Extension: launches as a full browser tab (background.js opens popup.html
   via chrome.tabs.create), so a full-screen logical resolution (1728×1080,
   a 16" laptop) is the faithful size. */
.ext-demo-card .popup-frame-wrap {
  width: 1408px;   /* 1728 * 0.814815 */
  height: 880px;   /* 1080 * 0.814815 */
}
.ext-demo-card .popup-frame {
  width: 1728px;
  height: 1080px;
  transform: scale(0.814815);
}

/* App: the macOS panel hosts the same fluid web UI in a resizable window
   (default 1100×760, min 720×560 — MacBlockerPanelApp.swift). To match the
   extension's external size at the same text scale, we render it maximized at
   the same 1728×1080 viewport and the same 0.814815 scale. */
.app-demo-card .popup-frame-wrap {
  width: 1408px;   /* 1728 * 0.814815 */
  height: 880px;   /* 1080 * 0.814815 */
}
.app-demo-card .popup-frame {
  width: 1728px;
  height: 1080px;
  transform: scale(0.814815);
}

/* How-it-works flow cards */
.howto-card {
  width: 620px;
}

.howto-card h2 {
  margin: 6px 0 6px;
}

.flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 12px 0 14px;
}

.flow-stage {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
}

.flow-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--navy-700, #1e3a8a);
}

.flow-dot {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
}

.dot-ext {
  background: #2563eb;
}

.dot-hub {
  background: #9333ea;
}

.dot-app {
  background: #0f766e;
}

.flow-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-body strong {
  font-size: 13px;
  color: var(--slate-900);
}

.flow-body span {
  font-size: 12px;
  line-height: 1.4;
  color: var(--slate-600);
}

.flow-arrow {
  width: 2px;
  height: 18px;
  margin: 4px 0 4px 26px;
  background: rgba(100, 116, 139, 0.45);
  position: relative;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(100, 116, 139, 0.6);
}

.flow-arrow-two {
  margin-left: 7px;
}

.flow-arrow-two::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid rgba(100, 116, 139, 0.6);
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flow-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy-700, #1e3a8a);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
}

.flow-note {
  font-size: 12px;
  line-height: 1.45;
  color: var(--slate-600);
  margin: 0;
}

.demo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.demo-header h2 {
  margin: 0;
  font-size: 17px;
}

.demo-flag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-text);
  background: var(--gold-50);
  border: 1px solid var(--gold-200);
  padding: 3px 8px;
  border-radius: 999px;
}

.demo-grid {
  display: grid;
  gap: 12px;
}

.app-grid {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "groups timers"
    "schedule settings";
}


.demo-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.demo-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.demo-box-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

.demo-box-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  font-variant-numeric: tabular-nums;
}

.demo-list {
  overflow-y: auto;
  max-height: 168px;
}

.demo-empty {
  font-size: 12px;
  color: var(--slate-400);
  margin: 6px 0;
}

/* Rows */
.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.demo-row:last-child {
  border-bottom: none;
}

.demo-row-main {
  flex: 1;
  min-width: 0;
}

.demo-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
}

.demo-row-sub {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Small icon buttons (reorder / delete) — override global button */
.demo-icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
  font-size: 13px;
  background: var(--slate-50);
  color: var(--slate-600);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.demo-icon-btn:hover {
  background: #fff;
}

/* Action button rows — make demo buttons compact + consistent */
.demo-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.demo-box button {
  font-size: 12px;
  padding: 7px 12px;
}

.demo-inline-form {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
}

.demo-inline-form.open {
  display: block;
}

.demo-field {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-input,
.demo-textarea {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-family: var(--font);
  background: var(--slate-50);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  margin-bottom: 8px;
}

.demo-inline-form .demo-input:last-of-type {
  margin-bottom: 0;
}

.demo-textarea {
  min-height: 70px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.demo-input:focus,
.demo-textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--navy-700), 0 0 0 3px var(--navy-ring);
}

/* Toggle switch */
.demo-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 23px;
  flex-shrink: 0;
}

.demo-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.demo-switch span {
  position: absolute;
  inset: 0;
  background: var(--slate-200);
  border-radius: 999px;
  transition: background 0.18s;
}

.demo-switch span::before {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}

.demo-switch input:checked + span {
  background: var(--navy-700);
}

.demo-switch input:checked + span::before {
  transform: translateX(17px);
}

/* Range slider */
.demo-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.demo-range-row input[type="range"] {
  flex: 1;
  accent-color: var(--navy-700);
}

.demo-range-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 12px;
  color: var(--slate-600);
  min-width: 70px;
  text-align: right;
}

/* Day pills */
.demo-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.demo-daypill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--slate-50);
  color: var(--slate-500);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.demo-daypill.on {
  background: var(--navy-700);
  color: #fff;
  box-shadow: none;
}

/* Freeze banner */
.demo-freeze {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-button);
  background: var(--navy-100);
  color: var(--navy-700);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 10px;
}

.demo-freeze.on {
  display: flex;
}

.demo-freeze-clock {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.demo-freeze-label {
  flex: 1;
}

/* Toast */
.demo-toast-wrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.demo-toast {
  background: var(--slate-900);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-button);
  box-shadow: var(--shadow-panel);
  animation: demoToastIn 0.2s ease;
}

.demo-toast::before {
  content: "✓ ";
  color: #4ade80;
}

@keyframes demoToastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 600px) {
  .youtube-card {
    width: min(1320px, calc(100vw - 48px));
  }

  .yt-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tree"
      "creators"
      "watched"
      "contribute"
      "similar";
  }
}

@media (prefers-reduced-motion: reduce) {
  .plane-card,
  .download-tile,
  button,
  .world {
    transition: none !important;
  }
}

/* ====================================================================== *
 * Symbolic line icons (injected from icon-set.js via icons-inject.js)
 * Bold, single-weight, no fills — the same hand as the program icons.
 * ====================================================================== */
.inj-ico {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 2;
  color: inherit;
  transition: transform 160ms ease;
}

/* Card tags get a small leading glyph */
.plane-card .card-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.plane-card .card-tag .inj-ico {
  width: 12px;
  height: 12px;
}

/* Feature bullets */
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.feature-list li .inj-ico {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--navy-700);
}

/* Download tiles — leading product glyph, info expands, button to the right */
.download-tile {
  justify-content: flex-start;
  gap: 12px;
}
.download-tile .inj-ico {
  width: 24px;
  height: 24px;
  padding: 7px;
  box-sizing: content-box;
  border-radius: 11px;
  background: var(--navy-100);
  color: var(--navy-700);
}
.download-tile-info {
  flex: 1 1 auto;
}

/* Platform rows — glyph replaces the old colored dot */
.platform-row {
  align-items: center;
}
.platform-row .inj-ico {
  width: 26px;
  height: 26px;
  padding: 6px;
  box-sizing: content-box;
  border-radius: 10px;
  background: var(--navy-100);
  color: var(--navy-700);
}
.platform-row:nth-of-type(2) .inj-ico {
  background: var(--cyan-50);
  color: var(--cyan-text);
}
.platform-row:nth-of-type(3) .inj-ico {
  background: var(--pink-50);
  color: var(--pink-text);
}

/* Docs tabs */
.docs-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.docs-tabs button .inj-ico {
  width: 14px;
  height: 14px;
}

/* YouTube box titles */
.yt-box-title {
  display: flex;
  align-items: center;
  gap: 7px;
}
.yt-box-title .inj-ico {
  width: 16px;
  height: 16px;
  color: var(--navy-700);
}

/* Flow / AI step bodies — glyph spans both text rows on the left */
.flow-body[data-icon],
.ai-step-body[data-icon] {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 11px;
}
.flow-body[data-icon] .inj-ico,
.ai-step-body[data-icon] .inj-ico {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  width: 22px;
  height: 22px;
  color: var(--navy-700);
}
.flow-body[data-icon] strong,
.ai-step-body[data-icon] strong {
  grid-column: 2;
  grid-row: 1;
}
.flow-body[data-icon] span,
.ai-step-body[data-icon] span {
  grid-column: 2;
  grid-row: 2;
}

/* Hover micro-interaction: tag glyph gives a tiny nudge */
.plane-card:not(.no-lift):hover .card-tag .inj-ico {
  transform: scale(1.18) rotate(-4deg);
}

/* ====================================================================== *
 * Stat chips
 * ====================================================================== */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.stat-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 7px 11px;
  border-radius: 12px;
  background: var(--navy-100);
  line-height: 1.1;
}
.stat-chip b {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy-700);
}
.stat-chip i {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
}

/* ====================================================================== *
 * "Custom rules with AI" card
 * ====================================================================== */
.ai-card {
  width: 460px;
}
.ai-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}
.ai-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.ai-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--navy-700);
}
.ai-step-body strong {
  display: block;
  font-size: 13px;
  color: var(--slate-900);
}
.ai-step-body span {
  font-size: 12px;
  line-height: 1.45;
  color: var(--slate-600);
}
.ai-prompt {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-card);
  background: var(--slate-50);
  padding: 12px;
}
.ai-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}
.ai-prompt code {
  display: block;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--slate-800);
}

/* ====================================================================== *
 * Demo "Show me how" trigger
 * ====================================================================== */
/* Icon-only "show me how" trigger that launches the in-replica guided tour. */
.show-how.icon-btn {
  margin-left: auto;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--navy-300);
  border-radius: 12px;
  background: var(--navy-100);
  color: var(--navy-700);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.show-how.icon-btn:hover {
  background: var(--navy-300);
  transform: translateY(-1px) rotate(-8deg);
  box-shadow: 0 6px 14px rgba(30, 58, 138, 0.22);
}
.show-how.icon-btn .inj-ico {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

/* ====================================================================== *
 * In-replica guided tour — dashed bounding box + companion instruction card
 * ====================================================================== */
/* The overlay never blocks the page: it is a pure pass-through layer so the
   user can click any control in the replica freely. Only the small companion
   card re-enables pointer events for its own Skip / Back buttons. */
.rtour-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.rtour-overlay.is-visible {
  opacity: 1;
}

/* Dashed box drawn around the current UI target — just a line, no tint/fill,
   with a soft white halo so it stays legible over any background. */
.rtour-box {
  position: fixed;
  border: 2.5px dashed #2f6fd0;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
  pointer-events: none;
  transition: top 200ms ease, left 200ms ease, width 200ms ease, height 200ms ease;
}

/* Small companion instruction card placed next to the dashed box. */
.rtour-tip {
  position: fixed;
  width: 264px;
  max-width: calc(100vw - 28px);
  padding: 12px 14px 10px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(3, 12, 28, 0.42);
  pointer-events: none;
  transition: top 200ms ease, left 200ms ease;
}
/* Only re-enable clicks on the card while the tour is actually showing, so a
   leftover (hidden) card never blocks the replica underneath it. */
.rtour-overlay.is-visible .rtour-tip {
  pointer-events: auto;
}
.rtour-step {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy-700);
  margin: 0 0 4px;
}
.rtour-title {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--slate-900);
}
.rtour-body {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--slate-600);
}
/* Each sentence is rendered on its own line. */
.rtour-body span {
  display: block;
}
.rtour-done {
  display: block;
  margin: 0 0 12px;
  padding-left: 18px;
  position: relative;
  font-size: 12px;
  font-style: italic;
  color: var(--navy-700);
}
.rtour-done::before {
  content: "\2713";
  position: absolute;
  left: 0;
  font-style: normal;
  font-weight: 800;
}
.rtour-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.rtour-actions button {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: var(--slate-200);
  color: var(--slate-600);
}
.rtour-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ====================================================================== *
 * Animated mini-diagrams — sequential pulse along the flow steps
 * ====================================================================== */
@keyframes coachPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.65; }
}
@keyframes stepPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(30, 58, 138, 0); }
  35% { transform: scale(1.12); box-shadow: 0 0 0 5px rgba(86, 168, 242, 0.22); }
}
@keyframes arrowFlow {
  0% { transform: translateY(-6px); opacity: 0.2; }
  50% { opacity: 1; }
  100% { transform: translateY(6px); opacity: 0.2; }
}

@media (prefers-reduced-motion: no-preference) {
  .flow .flow-num,
  .flow .flow-dot {
    animation: stepPulse 2.6s ease-in-out infinite;
  }
  .flow .flow-stage:nth-of-type(2) .flow-num,
  .flow .flow-stage:nth-of-type(2) .flow-dot {
    animation-delay: 0.45s;
  }
  .flow .flow-stage:nth-of-type(3) .flow-num,
  .flow .flow-stage:nth-of-type(3) .flow-dot {
    animation-delay: 0.9s;
  }
  .flow-arrow {
    animation: arrowFlow 2.6s ease-in-out infinite;
  }
  .flow-arrow.flow-arrow-two {
    animation-delay: 0.45s;
  }
}

/* ====================================================================== *
 * Bigger, unmistakable icons
 * ====================================================================== */
.plane-card .card-tag .inj-ico {
  width: 14px;
  height: 14px;
}
.feature-list li .inj-ico {
  width: 19px;
  height: 19px;
}
.download-tile .inj-ico {
  width: 26px;
  height: 26px;
}
.platform-row .inj-ico {
  width: 28px;
  height: 28px;
}

/* Large corner "spot" badge — reads clearly even at the opening zoom */
.card-spot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(150deg, #243a63, #0d1830);
  box-shadow: 0 6px 16px rgba(8, 20, 40, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  z-index: 3;
  pointer-events: none;
}
.spot-ico {
  width: 26px;
  height: 26px;
  stroke: #cfe2ff;
  stroke-width: 2;
  fill: none;
}
.plane-card[data-spot] > h2 {
  padding-right: 54px;
}
/* The big content cards already have rich headers — keep their corners clean */
.youtube-card .card-spot,
.demo-card .card-spot,
.docs-card .card-spot {
  display: none;
}
.youtube-card[data-spot] > .yt-header h2,
.demo-card[data-spot] .demo-header h2 {
  padding-right: 0;
}

/* ====================================================================== *
 * "By the numbers" stats card
 * ====================================================================== */
.stats-card {
  width: 332px;
}
.num-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.num-cell {
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--navy-100);
  text-align: center;
}
.num-cell b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--navy-700);
}
.num-cell span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
}

/* ====================================================================== *
 * Global statistics panel (hourly time-series charts)
 * ====================================================================== */
.gstats-card {
  width: 980px;
  max-width: 92vw;
}
.gstats-card .stats-header h2 { margin: 10px 0 5px; font-size: 26px; }
.gstats-card .stats-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--slate-500);
}
.stats-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
}
.stats-range {
  display: inline-flex;
  border: 1px solid var(--navy-100);
  border-radius: 999px;
  overflow: hidden;
}
.stats-range button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
}
.stats-range button + button { border-left: 1px solid var(--navy-100); }
.stats-range button:hover { background: var(--navy-100); }
.stats-range button.active {
  background: var(--navy-700);
  color: #fff;
}
.stats-log {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  user-select: none;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.stat-tile {
  padding: 14px 14px 8px;
  border-radius: var(--radius-card);
  background: var(--navy-100);
}
.stat-tile-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.stat-tile-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-700);
}
.stat-tile-now {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}
.stat-chart-wrap { width: 100%; }
.stat-chart {
  width: 100%;
  height: 124px;
  display: block;
}
.stat-grid { stroke: rgba(15, 23, 42, 0.08); stroke-width: 1; }
.stat-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.stat-area { opacity: 0.12; stroke: none; }
.stat-dot { stroke: #fff; stroke-width: 1; }
.stat-axis {
  font-size: 9px;
  font-weight: 600;
  fill: var(--slate-500);
}
.stat-chart-empty { font-size: 11px; fill: var(--slate-500); }
@media (max-width: 560px) {
  .gstats-card { width: 92vw; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ====================================================================== *
 * "Get started" card
 * ====================================================================== */
.start-card {
  width: 332px;
}
.start-steps {
  counter-reset: step;
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.start-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  column-gap: 11px;
  align-items: center;
  padding-left: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--slate-600);
}
.start-steps li .inj-ico {
  grid-column: 1;
  width: 22px;
  height: 22px;
  color: var(--navy-700);
}
.start-steps li strong {
  color: var(--slate-900);
}
.start-cta {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-button);
  background: var(--navy-700);
  color: #fff;
  cursor: pointer;
}
.start-cta:hover {
  filter: brightness(1.08);
}

/* ====================================================================== *
 * "Who it's for" — expandable tiles
 * ====================================================================== */
.usecase-card {
  width: 340px;
}
.usecase-hint {
  font-size: 12px;
  color: var(--slate-500);
}
.usecase-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.usecase {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-card);
  background: #fff;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.usecase:hover {
  border-color: var(--navy-300);
  box-shadow: var(--shadow-card);
}
.usecase .inj-ico {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  color: var(--navy-700);
}
.usecase strong {
  grid-column: 2;
  font-size: 13px;
  color: var(--slate-900);
}
.usecase strong::after {
  content: "+";
  float: right;
  font-weight: 700;
  color: var(--slate-400);
}
.usecase.open strong::after {
  content: "–";
}
.usecase span {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.45;
  color: var(--slate-600);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 220ms ease, margin-top 220ms ease;
}
.usecase.open span {
  max-height: 120px;
  opacity: 1;
  margin-top: 5px;
}

/* ====================================================================== *
 * "What gets blocked" — before / after
 * ====================================================================== */
.blocked-card {
  width: 360px;
}
.ba-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--slate-200);
  margin: 4px 0 12px;
}
.ba-btn {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--slate-600);
  cursor: pointer;
}
.ba-btn.is-active {
  background: #fff;
  color: var(--navy-700);
  box-shadow: var(--shadow-card);
}
.ba-stage {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ba-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  column-gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-card);
  background: var(--slate-50);
  font-size: 12.5px;
  color: var(--slate-800);
  transition: opacity 220ms ease, background 220ms ease;
}
.ba-row .inj-ico {
  width: 18px;
  height: 18px;
  color: var(--slate-600);
}
.ba-row::after {
  content: "live";
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pink-text);
}
.ba-stage[data-state="after"] .ba-row {
  opacity: 0.55;
  background: var(--cyan-50);
}
.ba-stage[data-state="after"] .ba-row span {
  text-decoration: line-through;
}
.ba-stage[data-state="after"] .ba-row .inj-ico {
  color: var(--cyan-text);
}
.ba-stage[data-state="after"] .ba-row::after {
  content: "blocked";
  color: var(--cyan-text);
}
.ba-caption {
  font-size: 12px;
  line-height: 1.45;
  color: var(--slate-500);
  margin: 0;
}

/* ====================================================================== *
 * Interactive manual — a band of boxes, each pairing beginner-friendly
 * copy with a LIVE focused slice of the real popup (true shadow copy).
 * Driven by js/manual.js (lazy slice loading + the Next/Back tour).
 * ====================================================================== */
.manual-card {
  width: 720px;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-card > h2 {
  font-size: 21px;
  line-height: 1.2;
  margin: 2px 0 0;
  color: var(--slate-900);
}

.manual-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--slate-700);
}

.manual-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-copy .m-sec {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.manual-copy .m-sec h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--slate-900);
}
.manual-copy .m-sec p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate-600);
}
.manual-copy .m-sec p + p {
  margin-top: 6px;
}

/* Download/access links inside a manual box. */
.manual-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px !important;
}
.manual-links a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--navy-100, #eef2fb);
  color: var(--navy-700, #2f4d8a);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(47, 77, 138, 0.16);
  transition: background 0.15s ease, transform 0.15s ease;
}
.manual-links a:hover {
  background: var(--navy-200, #e0e7f8);
  transform: translateY(-1px);
}

/* Web vs App contrast — two labelled notes side by side. */
.plat-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.plat-note {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--slate-700);
  border: 1px solid transparent;
}
.plat-note .plat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.plat-note .plat-tag .inj-ico {
  width: 12px;
  height: 12px;
}
.plat-note.web {
  background: #eef5ff;
  border-color: #d6e6ff;
}
.plat-note.web .plat-tag {
  color: #1c5ca8;
}
.plat-note.app {
  background: #f3f0ff;
  border-color: #e2dbff;
}
.plat-note.app .plat-tag {
  color: #6d54c8;
}
.plat-note.single {
  grid-column: 1 / -1;
}
.plat-note strong {
  color: var(--slate-900);
}

/* The live slice — a focused, scaled view of the real popup. */
.manual-slice {
  margin-top: 4px;
}
/* Sized to the measured crop region by js/manual.js (applyRect). The values
   here are only a pre-measurement fallback; real width/height arrive live. */
.manual-slice-wrap {
  position: relative;
  width: 360px;
  height: 240px;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  transition: width 200ms ease, height 200ms ease;
}
.cb-manual-frame {
  display: block;
  border: none;
  transform-origin: top left;
  transform: scale(0.7);
  background: #fff;
}
.manual-slice-wrap::after {
  content: "Loading live view…";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--slate-400);
  pointer-events: none;
}
.manual-slice-wrap[data-fitted="1"]::after {
  display: none;
}

/* Active box during the tour. */
.manual-card.manual-active {
  box-shadow: 0 0 0 3px rgba(86, 168, 242, 0.55), var(--shadow-card-hover);
}

/* ---- Tour control bar (fixed, bottom-center) ---- */
.manual-tourbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--slate-900, #0f1b2e);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(8, 17, 33, 0.34);
  z-index: 60;
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}
.manual-tourbar.is-open {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.manual-tourbar .mt-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 120ms ease;
}
.manual-tourbar .mt-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}
.manual-tourbar .mt-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.manual-tourbar .mt-exit {
  background: transparent;
  font-size: 14px;
}
.manual-tourbar .mt-label {
  min-width: 220px;
  max-width: 320px;
  text-align: center;
  padding: 0 4px;
  line-height: 1.2;
}
.manual-tourbar .mt-count {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}
.manual-tourbar .mt-title {
  font-size: 13px;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .manual-tourbar {
    transition: none;
  }
}

/* ---- Chain library picker (#6) ---- */
.cb-chain-toggle {
  position: fixed;
  left: 18px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: none;
  border-radius: 999px;
  background: var(--slate-900, #0f1b2e);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(8, 17, 33, 0.3);
}
.cb-chain-toggle span {
  font-size: 16px;
  line-height: 1;
}
.cb-chain-toggle:hover {
  background: #16263f;
}
.cb-chain-panel {
  position: fixed;
  left: 18px;
  bottom: 70px;
  z-index: 61;
  width: 300px;
  max-height: min(64vh, 560px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(8, 17, 33, 0.28);
  overflow: hidden;
}
.cb-chain-panel.is-open {
  display: flex;
}
.cb-chain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--slate-900, #0f1b2e);
  border-bottom: 1px solid var(--slate-200, #e2e8f0);
}
.cb-chain-x {
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  color: var(--slate-400, #94a3b8);
  padding: 2px 4px;
}
.cb-chain-scroll {
  overflow-y: auto;
  padding: 8px 12px 14px;
}
.cb-chain-group {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-400, #94a3b8);
  margin: 12px 2px 6px;
}
.cb-chain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cb-chain-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.cb-chain-item:hover {
  background: #eef4ff;
}
.cb-chain-item.is-active {
  border-color: #56a8f2;
  background: #e7f1fe;
}
.cb-chain-none {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--slate-600, #475569);
  margin-bottom: 2px;
}
.cb-chain-sample {
  display: block;
  line-height: 0;
}
.cb-chain-name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--slate-600, #475569);
}

/* ====================================================================== *
 * Creator Q&A — Reddit-style feed (upper part)
 * ====================================================================== */
.qa-card {
  width: 1040px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qa-card .card-spot { display: none; }
.qa-card[data-spot] > .qa-header h2 { padding-right: 0; }

.qa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.qa-header h2 { margin: 0; font-size: 18px; }
.qa-sort {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  padding: 3px;
}
.qa-sort-btn {
  border: 0;
  background: transparent;
  font: 700 12px var(--font);
  color: var(--slate-600);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.qa-sort-btn.is-active {
  background: #fff;
  color: var(--navy-700);
  box-shadow: var(--shadow-card);
}
.qa-intro {
  margin: 0 !important;
  font-size: 12.5px;
  color: var(--slate-500);
}

/* Filter + topic chips */
.qa-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qa-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.qa-tag-row { padding-top: 2px; border-top: 1px dashed var(--slate-200); }
.qa-chip {
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-600);
  font: 700 11.5px var(--font);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}
.qa-chip:hover { border-color: var(--navy-300, #b9c6ec); color: var(--navy-700); }
.qa-chip.is-active {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: #fff;
}

.qa-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 720px;
  overflow-y: auto;
  padding-right: 4px;
}
.qa-empty {
  margin: 0 !important;
  padding: 18px;
  text-align: center;
  color: var(--slate-500);
}

/* A post / comment row: vote rail on the left, content on the right */
.qa-post {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-card);
}
.qa-post.is-pinned {
  border-color: var(--gold-300, #f0d49a);
  background: linear-gradient(180deg, var(--gold-50, #fff8ec), #fff 60%);
}
.qa-main { flex: 1; min-width: 0; }

/* Badge row above the title */
.qa-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
}
.qa-badge {
  display: inline-flex;
  align-items: center;
  font: 800 10.5px var(--font);
  letter-spacing: 0.01em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.qa-badge.is-tag { background: var(--slate-100, #eef1f6); color: var(--slate-600); border-color: var(--slate-200); }
.qa-badge.is-pin { background: var(--gold-100, #fbeccb); color: #9a6a16; border-color: var(--gold-300, #f0d49a); }
.qa-badge.is-answered { background: #e6f6ec; color: #1f8a4c; border-color: #bfe6cc; }
.qa-badge.is-creator {
  margin-left: 6px;
  background: var(--navy-100, #e7ecfa);
  color: var(--navy-700);
  border-color: var(--navy-200, #c7d3f3);
  font-size: 9.5px;
  padding: 1px 6px;
}

.qa-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-900);
}

/* Admin controls (pin + retag), only rendered for the creator account */
.qa-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  padding: 6px 8px;
  background: var(--navy-50, #f3f6fd);
  border: 1px dashed var(--navy-200, #c7d3f3);
  border-radius: 8px;
}
.qa-admin-btn {
  border: 1px solid var(--navy-300, #b9c6ec);
  background: #fff;
  color: var(--navy-700);
  font: 700 11.5px var(--font);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.qa-admin-btn:hover { background: var(--navy-100, #e7ecfa); }
.qa-admin-btn.is-on { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.qa-admin-btn:disabled { opacity: 0.6; cursor: default; }
.qa-meta {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-bottom: 6px;
}
.qa-author { font-weight: 700; color: var(--slate-600); }

.qa-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate-800);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.qa-body p { margin: 0 0 8px !important; font-size: 13px !important; color: var(--slate-800) !important; }
.qa-body p:last-child { margin-bottom: 0 !important; }
.qa-body ul, .qa-body ol { margin: 4px 0 8px; padding-left: 20px; font-size: 13px; color: var(--slate-800); }
.qa-body code {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 5px;
  padding: 0 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}
.qa-body a { color: var(--navy-700); }
.qa-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
  margin: 6px 0;
  display: block;
}
.qa-body blockquote {
  margin: 6px 0;
  padding: 2px 10px;
  border-left: 3px solid var(--slate-200);
  color: var(--slate-600);
}
.qa-body pre {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  font-size: 12px;
}

/* Vote rail */
.qa-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 0 0 30px;
  user-select: none;
}
.qa-up, .qa-down {
  border: 0;
  background: transparent;
  color: var(--slate-400);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 100ms ease, background 100ms ease;
}
.qa-up:hover { color: #e0792b; background: var(--gold-50); }
.qa-down:hover { color: #4f7bd6; background: var(--navy-100); }
.qa-vote.is-up .qa-up { color: #e0792b; }
.qa-vote.is-down .qa-down { color: #3f6fd1; }
.qa-score {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--slate-600);
  min-width: 18px;
  text-align: center;
}
.qa-vote.is-up .qa-score { color: #c2630f; }
.qa-vote.is-down .qa-score { color: #2f5fc0; }

/* Comments */
.qa-comments-toggle {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--slate-500);
  font: 700 12px var(--font);
  padding: 4px 0;
  cursor: pointer;
}
.qa-comments-toggle:hover { color: var(--navy-700); }
.qa-comments-toggle.is-open { color: var(--navy-700); }
.qa-comments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--slate-200);
  padding-top: 8px;
}
/* The `hidden` attribute must beat the `display:flex` above (class-only) — this
   selector (class + attr) wins, so "Hide comments" actually collapses the box. */
.qa-comments[hidden] { display: none; }
.qa-comment {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-left: 2px solid var(--slate-200);
  background: var(--slate-50);
  border-radius: 8px;
}
.qa-comment[hidden] { display: none; }
.qa-comment .qa-vote { flex-basis: 24px; }
.qa-comment .qa-up, .qa-comment .qa-down { font-size: 12px; }

/* A creator/admin reply stands out as the official answer */
.qa-comment.is-creator-comment {
  border-left-color: var(--navy-700);
  background: var(--navy-50, #f3f6fd);
}

/* Per-comment collapse toggle — vertically centred in the comment row, with the
   +/- glyph centred inside the button. */
.qa-collapse {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-500);
  font: 800 13px/1 var(--font);
  border-radius: 5px;
  cursor: pointer;
}
.qa-collapse:hover { color: var(--navy-700); border-color: var(--navy-300, #b9c6ec); }
.qa-comment.is-collapsed { opacity: 0.75; }

/* Per-post / per-comment actions row (toggle + reply) */
.qa-post-actions { display: flex; align-items: center; gap: 14px; }
.qa-reply-btn {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--slate-500);
  font: 700 12px var(--font);
  padding: 4px 0;
  cursor: pointer;
}
.qa-reply-btn:hover { color: var(--navy-700); }
.qa-reply-slot:empty { display: none; }
.qa-reply-slot { margin-top: 8px; }

/* Comment action row (reply / edit / delete) */
.qa-comment-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.qa-comment-actions .qa-reply-btn { margin-top: 0; }
.qa-edit-btn, .qa-del-btn, .qa-post-edit-btn, .qa-post-del-btn {
  border: 1px solid var(--navy-100);
  border-radius: 999px;
  background: #fff;
  color: var(--slate-500);
  font: 700 12px var(--font);
  padding: 3px 12px;
  cursor: pointer;
}
.qa-edit-btn, .qa-post-edit-btn { color: var(--navy-700); border-color: var(--navy-200, #c7d6ec); }
.qa-edit-btn:hover, .qa-post-edit-btn:hover { background: var(--navy-100); }
.qa-del-btn, .qa-post-del-btn { color: #b4452f; border-color: #e7c4bc; }
.qa-del-btn:hover, .qa-post-del-btn:hover { background: #fbece8; }
/* Tombstoned (deleted-but-kept) comments */
.qa-comment.is-deleted .qa-body { color: var(--slate-400); font-style: italic; }

/* Link-insert modal (fixed overlay, sits above the canvas transform) */
.qa-modal-ov {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}
.qa-modal {
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
}
.qa-modal-title { font: 800 15px var(--font); color: var(--slate-900); }
.qa-modal-input {
  font: 500 13px var(--font);
  color: var(--slate-900);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 9px 11px;
}
.qa-modal-input:focus { outline: 2px solid var(--navy-200, #c7d3f3); border-color: var(--navy-300, #b9c6ec); }
.qa-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Footer */
.qa-feed-foot { display: flex; justify-content: center; }
#qaLoadMore { font-size: 12px; padding: 6px 16px; }

/* ====================================================================== *
 * Composer (the "lower part") — new question + inline replies
 * ====================================================================== */
.qa-composer-slot { margin-top: 4px; }
.qa-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--slate-200);
  padding-top: 12px;
}
.qa-composer.is-reply {
  border-top: 0;
  padding: 10px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
}
.qa-composer-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--slate-900); }
.qa-composer-hint { margin: 0 !important; font-size: 11.5px; color: var(--slate-500); }
.qa-input {
  font: 600 13px var(--font);
  color: var(--slate-900);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.qa-input:focus, .qa-textarea:focus { outline: 2px solid var(--navy-200, #c7d3f3); border-color: var(--navy-300, #b9c6ec); }

/* Tag picker (new question) */
.qa-tagpick { display: flex; flex-wrap: wrap; gap: 5px; }
.qa-tagpick-chip {
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-600);
  font: 700 11px var(--font);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.qa-tagpick-chip:hover { border-color: var(--navy-300, #b9c6ec); color: var(--navy-700); }
.qa-tagpick-chip.is-on { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }

/* Markdown toolbar */
.qa-toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.qa-tool {
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700, #334155);
  font: 700 11.5px var(--font);
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
  min-width: 28px;
}
.qa-tool:hover { background: var(--slate-50); border-color: var(--navy-300, #b9c6ec); color: var(--navy-700); }
.qa-tool.is-on { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }

.qa-textarea {
  font: 500 13px/1.5 var(--font);
  color: var(--slate-900);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  resize: vertical;
  min-height: 70px;
}
/* The new-question editor is ~3x the reply editor's height. */
.qa-composer:not(.is-reply) .qa-textarea { min-height: 240px; }
.qa-preview {
  border: 1px dashed var(--slate-200);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
}

.qa-composer-actions { display: flex; align-items: center; gap: 8px; }
.qa-submit {
  border: 0;
  background: var(--navy-700);
  color: #fff;
  font: 700 13px var(--font);
  padding: 8px 16px;
  border-radius: var(--radius-button);
  cursor: pointer;
}
.qa-submit:hover { background: #1b3478; }
.qa-submit:disabled { opacity: 0.55; cursor: default; }
.qa-cancel {
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-600);
  font: 700 12.5px var(--font);
  padding: 7px 14px;
  border-radius: var(--radius-button);
  cursor: pointer;
}
.qa-cancel:hover { background: var(--slate-50); }

/* Clear-tags chip in the filter bar */
.qa-chip-clear { color: #b4452f; border-color: #eccac1; background: #fdf1ee; }
.qa-chip-clear:hover { color: #8f3422; border-color: #e2a899; }
