@font-face {
  font-family: "Pixelify Sans";
  src: url("assets/fonts/pixelifysans.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Jersey 15";
  src: url("assets/fonts/jersey15.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root[data-palette='bitbuddies'] {
  --bb-bg: #dce8ed;
  --bb-bg-alt: #cfdee5;
  --bb-surface: #cfdee5;
  --bb-field: #f2fbff;
  --bb-text: #151c1f;
  --bb-muted: #3b4d58;
  --bb-structure: #4b6071;
  --bb-structure-text: #f2fbff;
  --bb-action: #a9e9e9;
  --bb-action-text: #151c1f;
  --bb-track: #3b4d58;
  --bb-focus: #34576a;
  --bb-ink: #151c1f;
  --bb-light: #f2fbff;
  --bb-portrait: #a8b8ce;
  --bb-running: #4d9465;
  --bb-paused: #bd792b;
  --bb-blocked: #c6595b;
  --bb-shadow: rgba(21, 28, 31, 0.28);
  --bb-glass: rgba(242, 251, 255, 0.94);
  --bb-callout-bg: #fff3c7;
  --bb-callout-border: #151c1f;
  --bb-font-display: "Pixelify Sans", system-ui, sans-serif;
  --bb-font-label: "Jersey 15", system-ui, sans-serif;
  --bb-font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --bb-font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

:root[data-palette='bitbuddies'][data-theme='noite'] {
  --bb-bg: #151c1f;
  --bb-bg-alt: #1c262d;
  --bb-surface: #293843;
  --bb-field: #25333d;
  --bb-text: #f2fbff;
  --bb-muted: #bccdd9;
  --bb-structure: #687eaa;
  --bb-structure-text: #151c1f;
  --bb-action: #a9e9e9;
  --bb-action-text: #151c1f;
  --bb-track: #151c1f;
  --bb-focus: #a9e9e9;
  --bb-portrait: #4b6071;
  --bb-running: #8dd1a1;
  --bb-paused: #efb769;
  --bb-blocked: #f19595;
  --bb-shadow: rgba(8, 12, 16, 0.58);
  --bb-glass: rgba(37, 51, 61, 0.95);
  --bb-callout-bg: #ffefc2;
  --bb-callout-border: #151c1f;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bb-bg);
  color: var(--bb-text);
  font-family: var(--bb-font-body);
  line-height: 1.5;
  transition: background-color 240ms steps(4), color 240ms steps(4);
}

body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  max-width: 100%;
}

.pixel-art {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: 8px 14px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  font-family: var(--bb-font-label);
  border: 2px solid var(--bb-text);
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

:focus-visible {
  outline: 2px solid var(--bb-focus);
  outline-offset: 2px;
}

code {
  font-family: var(--bb-font-mono);
  font-size: 0.86em;
  padding: 1px 5px;
  background: var(--bb-surface);
  border: 1px solid var(--bb-structure);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  padding: 0 5px;
  font-family: var(--bb-font-label);
  font-size: 0.95rem;
  line-height: 1.2;
  background: var(--bb-field);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  box-shadow: 0 2px 0 var(--bb-structure);
}

/* ==================== ENRICHED COMPACT WEBSITE TOPBAR ==================== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bb-surface);
  border-bottom: 2px solid var(--bb-structure);
  z-index: 40;
  min-height: 54px;
  min-width: 0;
  max-width: 100%;
}

.header-brand {
  flex: none;
  min-width: 0;
}

.brand-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 2px solid transparent;
  padding: 2px 8px 2px 2px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}

.brand-trigger:hover {
  border-color: var(--bb-structure);
  background: var(--bb-field);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--bb-font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-copy small {
  font-family: var(--bb-font-label);
  font-size: 0.88rem;
  color: var(--bb-muted);
  margin-top: 2px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 2px solid transparent;
  color: var(--bb-muted);
  text-decoration: none;
  font-family: var(--bb-font-label);
  font-size: 0.98rem;
  white-space: nowrap;
  flex: none;
  transition: color 120ms, background-color 120ms, border-color 120ms;
}

.nav-link:hover {
  color: var(--bb-text);
  background: var(--bb-field);
  border-color: var(--bb-structure);
}

.nav-link.is-active {
  background: var(--bb-action);
  color: var(--bb-action-text);
  border-color: var(--bb-action-text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 0;
}

.lang-switch,
.theme-switch {
  display: inline-flex;
  border: 2px solid var(--bb-structure);
  background: var(--bb-field);
  flex: none;
}

.lang-btn,
.theme-btn {
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: var(--bb-muted);
  font-family: var(--bb-font-label);
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.theme-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 6px;
}

.lang-btn.is-active,
.theme-btn.is-active {
  background: var(--bb-structure);
  color: var(--bb-structure-text);
}

.topbar-github-btn,
.topbar-try-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  padding: 5px 8px;
  background: var(--bb-field);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  line-height: 1;
  white-space: nowrap;
  flex: none;
  transition: border-color 100ms, background-color 100ms;
}

.topbar-github-btn:hover,
.topbar-try-btn:hover {
  border-color: var(--bb-focus);
  background: var(--bb-bg);
}

.topbar-github-btn .gh-star {
  color: #bd792b;
  font-size: 0.85em;
  line-height: 1;
}

:root[data-theme='noite'] .topbar-github-btn .gh-star {
  color: #ffd16d;
}

.topbar-try-btn {
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 9px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 5px 11px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 2px solid var(--bb-action-text);
  box-shadow: 3px 3px 0 var(--bb-action-text);
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}

.cta-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--bb-action-text);
}

.cta-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--bb-action-text);
}

/* ==================== SPLIT-SCREEN WORKSPACE ==================== */
.split-workspace {
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 54%);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

/* ==================== LEFT PANE: PIXEL DIORAMA ==================== */
.stage.diorama-pane {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  background: var(--bb-bg);
  border-right: 3px solid var(--bb-structure);
}

#world-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

.world-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.stage-hud-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  max-width: calc(100% - 115px);
  background: var(--bb-glass);
  border: 2px solid var(--bb-structure);
  box-shadow: 3px 3px 0 var(--bb-shadow);
  font-family: var(--bb-font-label);
  font-size: 0.96rem;
  pointer-events: none;
}

.stage-hud-pill strong {
  font-family: var(--bb-font-display);
  font-size: 0.86rem;
  white-space: nowrap;
}

.stage-hint {
  color: var(--bb-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-sync-dot {
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--bb-action);
  border: 1px solid var(--bb-action-text);
  animation: pulse-blink 1.4s steps(2) infinite;
}

@keyframes pulse-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.stage-overview-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 18;
  padding: 4px 9px;
  background: var(--bb-glass);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  box-shadow: 3px 3px 0 var(--bb-shadow);
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  cursor: pointer;
  white-space: nowrap;
}

.stage-overview-btn:hover {
  border-color: var(--bb-focus);
}

.stage-overview-btn[aria-pressed="true"] {
  background: var(--bb-action);
  color: var(--bb-action-text);
  border-color: var(--bb-action-text);
}

/* ==================== CALLOUTS & STAGE TAGS ==================== */
.agent-foot-tag {
  position: absolute;
  transform: translate(-50%, 0);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  background: var(--bb-glass);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.9rem;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--bb-shadow);
}

.world-overlay[data-overview="true"] .agent-foot-tag {
  font-size: 0.74rem;
  padding: 0 4px;
}

.agent-foot-tag.is-hovered {
  border-color: var(--bb-action);
}

.agent-foot-tag.is-selected {
  background: var(--bb-action);
  color: var(--bb-action-text);
  border-color: var(--bb-action-text);
}

.foot-bit {
  display: inline-block;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.74rem;
  padding: 0 3px;
  background: var(--bb-structure);
  color: var(--bb-structure-text);
}

.agent-foot-tag.is-hovered .foot-bit {
  background: var(--bb-action);
  color: var(--bb-action-text);
}

.agent-foot-tag.is-selected .foot-bit {
  background: var(--bb-action-text);
  color: var(--bb-action);
}

.status-pip {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex: none;
}

.status-pip[data-status="working"] { background: var(--bb-running); }
.status-pip[data-status="waiting"] { background: var(--bb-blocked); }
.status-pip[data-status="shell"] { background: var(--bb-paused); }
.status-pip[data-status="done"] { background: var(--bb-action); }

.callout-anchor {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.callout-bubble-btn {
  pointer-events: auto;
  position: relative;
  margin-bottom: 5px;
  padding: 3px 8px;
  max-width: 175px;
  background: var(--bb-callout-bg);
  color: #151c1f;
  border: 2px solid var(--bb-callout-border);
  box-shadow: 2px 2px 0 var(--bb-shadow);
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transform-origin: bottom center;
  animation: callout-bubble 230ms steps(4) 160ms both;
}

.callout-bubble-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: var(--bb-callout-bg);
  border-right: 2px solid var(--bb-callout-border);
  border-bottom: 2px solid var(--bb-callout-border);
  clip-path: polygon(100% 0, 0 0, 50% 100%);
}

.callout-icon-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  animation: callout-hop 150ms steps(3) both, callout-glow 1.6s steps(4) 300ms infinite;
}

.callout-icon-btn canvas {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

@keyframes callout-hop {
  0% { transform: translateY(6px); opacity: 0.2; }
  55% { transform: translateY(-5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes callout-bubble {
  0% { transform: scaleY(0.2) translateY(6px); opacity: 0; }
  100% { transform: scaleY(1) translateY(0); opacity: 1; }
}

@keyframes callout-glow {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 4px #ffd16d); }
}

.station-badge {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  padding: 2px 7px;
  background: var(--bb-glass);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--bb-shadow);
  opacity: 0.92;
}

.station-badge:hover,
.station-badge.is-near {
  opacity: 1;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border-color: var(--bb-action-text);
}

.proximity-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  background: var(--bb-glass);
  border: 2px solid var(--bb-action);
  box-shadow: 4px 4px 0 var(--bb-shadow);
  font-family: var(--bb-font-label);
  font-size: 0.98rem;
  white-space: nowrap;
  max-width: calc(100% - 24px);
}

.proximity-bar[hidden] {
  display: none;
}

/* ==================== OFFICIAL BITBUDDIES SCROLLBAR (.bb-scroll) ==================== */
.bb-scroll {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.bb-scroll > .bb-scroll__viewport {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-inline-end: 0;
  scrollbar-width: none;
}

.bb-scroll > .bb-scroll__viewport::-webkit-scrollbar {
  display: none;
}

.bb-scroll__rail {
  position: absolute;
  inset: 6px 5px 6px auto;
  width: 13px;
  z-index: 32;
  border: 1px solid var(--bb-structure);
  border-radius: 2px;
  background: var(--bb-track);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.bb-scroll__rail.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.bb-scroll__rail[hidden] {
  display: none;
}

.bb-scroll__thumb {
  position: absolute;
  inset: 0 0 auto;
  cursor: grab;
  touch-action: none;
}

.bb-scroll__thumb[data-grabbed='true'] {
  cursor: grabbing;
}

.bb-scroll__thumb:focus-visible {
  outline: 2px solid var(--bb-focus);
  outline-offset: 2px;
}

.bb-scroll__face {
  display: grid;
  place-items: center;
  height: 100%;
  border: 1px solid var(--bb-ink);
  border-radius: 2px;
  background: var(--bb-action);
  box-shadow:
    inset 1px 0 var(--bb-light),
    inset -2px 0 rgba(21, 28, 31, 0.26);
  transition: transform 80ms ease-out;
}

.bb-scroll__face::after {
  content: '';
  width: 55%;
  height: 1px;
  background: var(--bb-ink);
  box-shadow: 0 3px var(--bb-ink), 0 -3px var(--bb-ink);
}

.bb-scroll__thumb:hover .bb-scroll__face {
  box-shadow: inset 0 0 0 1px var(--bb-light);
}

.bb-scroll__thumb[data-grabbed='true'] .bb-scroll__face {
  transform: scaleX(0.8);
}

/* ==================== RIGHT PANE: CONTINUOUS WEBSITE ==================== */
.page-pane {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  background-color: var(--bb-bg);
  scrollbar-width: none;
}

.page-pane::-webkit-scrollbar {
  display: none;
}

.page-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.page-section {
  width: 100%;
  background: var(--bb-bg);
  border: 0;
  border-bottom: 2px solid var(--bb-structure);
  padding: clamp(24px, 3.4vw, 40px) clamp(20px, 3.6vw, 40px);
  scroll-margin-top: 0;
  min-width: 0;
  transition: background-color 180ms steps(3), box-shadow 180ms steps(3);
}

.page-section--alt {
  background: var(--bb-bg-alt);
}

.page-section--hero {
  background: linear-gradient(180deg, var(--bb-bg-alt) 0%, var(--bb-bg) 78%);
}

.page-section:last-child {
  border-bottom: 0;
}

.page-section.is-active-section {
  box-shadow: inset 4px 0 0 var(--bb-action);
}

.is-synced-flash {
  animation: sync-flash 700ms steps(4);
}

@keyframes sync-flash {
  0%, 100% { box-shadow: inset 4px 0 0 var(--bb-action); }
  35% { box-shadow: inset 6px 0 0 var(--bb-action), inset 0 0 0 2px rgba(169, 233, 233, 0.35); }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.section-kicker {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bb-structure);
  color: var(--bb-structure-text);
  font-family: var(--bb-font-label);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.sync-pill {
  font-family: var(--bb-font-label);
  font-size: 0.9rem;
  padding: 2px 8px;
  background: var(--bb-field);
  color: var(--bb-muted);
  border: 2px solid var(--bb-structure);
}

/* ==================== HERO RIGHT PANE UPGRADE ==================== */
.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  margin-bottom: 10px;
  padding: 3px 10px;
  background: var(--bb-field);
  border: 1px solid var(--bb-structure);
  color: var(--bb-muted);
  font-family: var(--bb-font-label);
  font-size: 0.92rem;
}

.hero-status-dot {
  width: 7px;
  height: 7px;
  background: var(--bb-running);
  border: 1px solid var(--bb-ink);
  flex: none;
}

.hero-title {
  margin: 0 0 10px;
  font-family: var(--bb-font-display);
  font-size: clamp(1.55rem, 2.5vw, 2.18rem);
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.hero-agent-token {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.hero-agent-token strong {
  font-weight: 700;
}

.hero-inline-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.92em;
  height: 0.92em;
  padding: 2px;
  background: #151c1f;
  border: 2px solid var(--bb-structure);
  box-shadow: 2px 2px 0 var(--bb-shadow);
  flex: none;
}

.hero-inline-emblem canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-word-highlight {
  display: inline-block;
  padding: 0 6px;
  color: #a9e9e9;
  background: rgba(169, 233, 233, 0.14);
  border-bottom: 3px solid var(--bb-action);
}

:root[data-theme='dia'] .hero-word-highlight {
  color: #151c1f;
  background: var(--bb-action);
  border: 2px solid #151c1f;
  box-shadow: 2px 2px 0 #151c1f;
  line-height: 1.06;
}

.hero-lead {
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--bb-muted);
  max-width: 64ch;
}

.hero-lead strong {
  font-family: var(--bb-font-display);
  color: var(--bb-action);
  font-size: 1.04rem;
}

:root[data-theme='dia'] .hero-lead strong {
  color: var(--bb-focus);
}

.hero-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hero-prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  background: #151c1f;
  color: #f2fbff;
  border: 2px solid var(--bb-structure);
  box-shadow: 3px 3px 0 var(--bb-shadow);
  margin-bottom: 10px;
}

.hero-prompt-preview {
  background: transparent;
  border: 0;
  padding: 0;
  color: #a9e9e9;
  font-family: var(--bb-font-mono);
  font-size: 0.84rem;
}

.hero-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  font-family: var(--bb-font-label);
  font-size: 0.92rem;
  color: var(--bb-muted);
}

.meta-sq {
  font-size: 0.78em;
  line-height: 1;
}

.meta-sq--ok {
  color: var(--bb-running);
}

.meta-sq--ice {
  color: var(--bb-action);
}

:root[data-theme='dia'] .meta-sq--ice {
  color: var(--bb-focus);
}

.page-section h2 {
  margin: 2px 0 8px;
  font-family: var(--bb-font-display);
  font-size: clamp(1.32rem, 2.2vw, 1.62rem);
  line-height: 1.15;
}

.section-copy {
  margin: 0 0 16px;
  font-size: 0.96rem;
  color: var(--bb-muted);
  max-width: 72ch;
}

.hero-shot {
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.hero-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.stack-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* ==================== PIXEL CARDS & BUTTONS ==================== */
.pixel-card {
  background: var(--bb-field);
  border: 2px solid var(--bb-structure);
  padding: 14px 16px;
  min-width: 0;
}

.pixel-card h3 {
  margin: 0 0 6px;
  font-family: var(--bb-font-display);
  font-size: 1.04rem;
}

.pixel-card p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--bb-muted);
}

.pixel-card p:last-child {
  margin-bottom: 0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn-ice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  padding: 6px 12px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 2px solid var(--bb-action-text);
  box-shadow: 3px 3px 0 var(--bb-action-text);
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-ice--sm {
  padding: 3px 8px;
  font-size: 0.82rem;
  box-shadow: 2px 2px 0 var(--bb-action-text);
}

.btn-ice:hover:not(:disabled) {
  transform: translate(-1px, -1px);
}

.btn-ice:disabled,
.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  padding: 6px 10px;
  background: var(--bb-field);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.98rem;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--bb-focus);
  background: var(--bb-surface);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--bb-blocked);
  color: #151c1f;
  border: 2px solid #151c1f;
  box-shadow: 2px 2px 0 #151c1f;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

.btn-approve {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  background: var(--bb-running);
  color: #151c1f;
  border: 2px solid #151c1f;
  box-shadow: 2px 2px 0 #151c1f;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-approve:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.pixel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pixel-tab {
  padding: 5px 10px;
  background: var(--bb-field);
  color: var(--bb-muted);
  border: 2px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.96rem;
  cursor: pointer;
}

.pixel-tab:hover {
  border-color: var(--bb-focus);
  color: var(--bb-text);
}

.pixel-tab.is-active {
  background: var(--bb-action);
  color: var(--bb-action-text);
  border-color: var(--bb-action-text);
}

/* ==================== 3 ENGINES SPOTLIGHT & AGENT CARDS (P3) ==================== */
.engines-spotlight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.spotlight-shot {
  margin: 0;
  width: 232px;
  max-width: 100%;
}

.spotlight-shot img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.spotlight-copy h3 {
  margin: 0 0 6px;
}

.spotlight-copy p {
  margin: 0 0 10px;
}

.engine-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.engine-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.engine-client-card {
  background: var(--bb-field);
  border: 2px solid var(--bb-structure);
  box-shadow: 4px 4px 0 var(--bb-shadow);
  padding: 0;
  overflow: hidden;
  scroll-margin-top: 12px;
}

.engine-client-card.is-selected-agent {
  border-color: var(--bb-action);
}

.engine-client-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bb-surface);
  border-bottom: 2px solid var(--bb-structure);
}

.engine-client-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.96rem;
}

.engine-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  font-family: var(--bb-font-label);
  font-size: 0.92rem;
  border: 2px solid var(--bb-structure);
  background: var(--bb-field);
  color: var(--bb-text);
}

.engine-tag--codex { border-color: #657bfa; }
.engine-tag--claude { border-color: #dc906a; }
.engine-tag--antigravity { border-color: var(--bb-action); }

.engine-client-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-agent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.agent-visual-pair {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: var(--bb-surface);
  border: 2px solid var(--bb-structure);
  flex: none;
}

.portrait-box {
  position: relative;
  width: 48px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bb-portrait);
  border: 2px solid var(--bb-structure);
  overflow: hidden;
}

.portrait-reaction-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.emblem-box {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #151c1f;
  border: 2px solid var(--bb-structure);
}

.client-agent-meta {
  flex: 1;
  min-width: 190px;
}

.client-agent-meta h3 {
  margin: 0 0 3px;
  font-family: var(--bb-font-display);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.client-agent-meta p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--bb-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  border: 2px solid var(--bb-text);
  background: var(--bb-surface);
}

.status-pill[data-status="working"] { border-color: var(--bb-running); color: var(--bb-running); }
.status-pill[data-status="waiting"] { background: var(--bb-callout-bg); color: #151c1f; border-color: #151c1f; }
.status-pill[data-status="shell"] { border-color: var(--bb-paused); color: var(--bb-paused); }
.status-pill[data-status="done"] { border-color: var(--bb-action); color: var(--bb-text); }

/* Codex Interactive Permission Frame */
.permission-panel {
  border: 2px solid var(--bb-paused);
  background: var(--bb-surface);
  padding: 10px 12px;
}

.permission-panel.is-resolved {
  border-color: var(--bb-structure);
}

.permission-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--bb-font-label);
  font-size: 0.96rem;
  margin-bottom: 6px;
}

.bash-command-line {
  background: #151c1f;
  color: #f2fbff;
  border: 2px solid var(--bb-structure);
  padding: 7px 10px;
  font-family: var(--bb-font-mono);
  font-size: 0.84rem;
  overflow-x: auto;
}

/* Claude Code Associated Subagent Row */
.subagent-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  margin-left: 8px;
  background: var(--bb-surface);
  border-left: 3px solid #dc906a;
  border-top: 2px solid var(--bb-structure);
  border-right: 2px solid var(--bb-structure);
  border-bottom: 2px solid var(--bb-structure);
  font-size: 0.86rem;
}

.subagent-badge {
  font-family: var(--bb-font-label);
  font-size: 0.9rem;
  padding: 1px 6px;
  background: #dc906a;
  color: #151c1f;
  border: 1px solid #151c1f;
}

/* Antigravity Running Command Panel */
.shell-runner-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bb-surface);
  border: 2px solid var(--bb-paused);
}

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

.shell-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: #151c1f;
  color: #efb769;
  border: 2px solid var(--bb-paused);
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
}

/* ==================== TERMINAL COMMAND BOX ==================== */
.cmd-box {
  position: relative;
  background: #151c1f;
  color: #f2fbff;
  border: 2px solid var(--bb-structure);
  padding: 10px 12px;
  font-family: var(--bb-font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
}

.cmd-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  margin-top: 8px;
  padding: 4px 9px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 2px solid #f2fbff;
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  cursor: pointer;
}

.copy-btn:hover {
  background: #f2fbff;
}

/* ==================== QUOTA METER ==================== */
.quota-meter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quota-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--bb-font-label);
  font-size: 0.98rem;
}

.quota-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  padding: 4px;
  background: var(--bb-track);
  border: 2px solid var(--bb-structure);
}

.quota-cell {
  position: relative;
  height: 12px;
  background: rgba(168, 184, 206, 0.16);
  overflow: visible;
}

.quota-fill {
  position: absolute;
  inset: 0;
  background: var(--bb-action);
  transform-origin: left center;
  transform: scaleX(var(--fill, 0)) scaleY(var(--rebound, 1));
  box-shadow: inset 0 2px 0 #f2fbff;
}

.quota-flash {
  position: absolute;
  inset: -2px;
  background: #f2fbff;
  opacity: var(--flash, 0);
  pointer-events: none;
}

.quota-impact-glyph {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 4;
}

/* ==================== SCREENSHOT FRAMES ==================== */
.shot-frame {
  margin: 0;
  border: 2px solid var(--bb-structure);
  background: #151c1f;
  padding: 4px;
}

.shot-frame img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}

.shot-frame--large {
  box-shadow: 5px 5px 0 var(--bb-shadow);
}

.shot-caption {
  padding: 8px 8px 4px;
  font-size: 0.85rem;
  color: #bccdd9;
}

.shots-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.shots-pair .shot-frame {
  display: flex;
  flex-direction: column;
}

.shots-pair .shot-frame img {
  flex: 1;
  width: 100%;
  max-height: 410px;
  object-fit: contain;
  background: #151c1f;
}

/* ==================== PISO 4: SALA DE PLANEAMENTO & SALA DE REVISÃO ==================== */
.p4-rooms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.p4-room-card {
  display: flex;
  flex-direction: column;
}

.p4-room-card .engine-client-body {
  flex: 1;
}

.p4-room-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--bb-muted);
}

.engine-tag--planning {
  border-color: #bd9b47;
}

.engine-tag--review {
  border-color: var(--bb-action);
}

/* Mini Quadro da Sala de Planeamento */
.planning-board-mini {
  display: flex;
  flex-direction: column;
  flex: 1;
  border: 5px solid #345b73;
  border-top-color: #708e9e;
  border-left-color: #55778b;
  border-bottom-color: #1b3c53;
  background: #e2cda5;
  color: #263f3a;
  box-shadow: 0 0 0 2px #1c3445, 4px 4px 0 var(--bb-shadow);
  overflow: hidden;
}

:root[data-theme='noite'] .planning-board-mini {
  background: #d7bc8c;
}

.planning-mini-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #ac936e;
  background: rgba(255, 250, 238, 0.32);
}

.planning-mini-sections,
.planning-mini-zoom-tools {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.planning-sec-btn,
.planning-tool-btn {
  padding: 2px 7px;
  border: 1px solid #939f87;
  background: #faf7ed;
  color: #294b44;
  font-family: var(--bb-font-label);
  font-size: 0.86rem;
  line-height: 1.15;
  cursor: pointer;
}

.planning-sec-btn:hover,
.planning-tool-btn:hover {
  background: #eef4e6;
}

.planning-sec-btn.is-active {
  background: #285d52;
  color: #f2fbff;
  border-color: #1f483f;
}

.planning-tool-btn.is-active {
  background: #d6e5d6;
  border-color: #467f70;
  color: #1f483f;
}

.planning-zoom-readout {
  font-family: var(--bb-font-label);
  font-size: 0.84rem;
  color: #294a44;
  padding: 0 3px;
}

.planning-mini-canvas {
  flex: 1;
  padding: 10px;
  background: radial-gradient(circle, #6c866352 1px, transparent 1.1px) 2px 2px / 14px 14px;
  overflow: hidden;
}

.planning-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  transform-origin: top left;
  transition: transform 140ms steps(3);
}

.planning-mini-canvas.is-fit .planning-notes-grid {
  transform: scale(0.95);
}

.planning-mini-canvas.is-full .planning-notes-grid {
  transform: scale(1);
}

.planning-note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px 10px;
  min-height: 76px;
  color: #263f3a;
  border: 1px solid var(--note-edge, #bd9b47);
  border-bottom-width: 3px;
  background: var(--note-paper, #f7de8e);
  box-shadow: 2px 2px 0 rgba(67, 77, 59, 0.22);
}

.planning-note-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 50%, var(--note-edge, #bd9b47) 51%);
}

.planning-note-card[data-paper='amarelo'] {
  --note-paper: #f7de8e;
  --note-edge: #bd9b47;
}

.planning-note-card[data-paper='verde'] {
  --note-paper: #d0e3c9;
  --note-edge: #8ea685;
}

.planning-note-card[data-paper='azul'] {
  --note-paper: #c9e0eb;
  --note-edge: #82a6b8;
}

.planning-note-card strong {
  font-family: var(--bb-font-display);
  font-size: 0.78rem;
  line-height: 1.15;
}

.planning-note-card span {
  font-size: 0.74rem;
  line-height: 1.28;
  color: #314d45;
}

.planning-mini-tray {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 10px;
  padding: 0 14px;
  background: #91a5af;
  box-shadow: inset 0 1px #ccd4ce;
}

.planning-mini-tray i {
  display: block;
  width: 22px;
  height: 3px;
  background: #b78946;
  box-shadow: 2px 0 #e8dfcb;
}

.planning-mini-tray i:nth-child(2) {
  background: #3a647a;
}

.planning-mini-tray i:nth-child(3) {
  background: #976653;
}

/* Mini Ecrã CRT da Sala de Revisão */
.review-crt-mini {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 5px 5px 10px;
  background: #020203;
  border: 2px solid #4b545a;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 4px 4px 0 var(--bb-shadow);
}

.review-crt-glass {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #142330;
  color: #edf5f5;
  border: 1px solid #2c4352;
  overflow: hidden;
}

.review-crt-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(6, 10, 14, 0.24) 2px 4px);
}

.review-crt-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  background: #203442;
  border-bottom: 1px solid #3c596b;
  font-family: var(--bb-font-display);
  font-size: 0.86rem;
}

.review-crt-badge {
  padding: 1px 6px;
  font-family: var(--bb-font-label);
  font-size: 0.84rem;
  background: #ffd16d;
  color: #151c1f;
  border: 1px solid #151c1f;
}

.review-crt-badge.is-done {
  background: #8dd1a1;
}

.review-crt-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 9px;
  flex: 1;
}

.review-delivery-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  line-height: 1.32;
  color: #d1e0e7;
}

.review-meta-label {
  color: #a9e9e9;
  font-weight: 700;
}

.review-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.review-attach-chip {
  padding: 1px 6px;
  background: #1f3342;
  border: 1px solid #4b6e84;
  color: #f2fbff;
  font-family: var(--bb-font-mono);
  font-size: 0.7rem;
}

.review-crt-compare {
  border: 1px solid #3c596b;
  background: #101c26;
}

.review-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 7px;
  background: #1a2d3a;
  border-bottom: 1px solid #3c596b;
  font-family: var(--bb-font-label);
  font-size: 0.82rem;
  color: #bccdd9;
}

.review-compare-tag {
  color: #a9e9e9;
}

.review-compare-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #4f6b7d;
}

.review-compare-pane {
  padding: 6px 7px;
  background: #142330;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.review-pane-label {
  font-family: var(--bb-font-label);
  font-size: 0.8rem;
  color: #bccdd9;
}

.review-compare-pane--after .review-pane-label {
  color: #8dd1a1;
}

.review-mini-ui {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-bar {
  display: block;
  height: 5px;
}

.mini-bar.is-dim {
  background: #4b6071;
}

.mini-bar.is-warn {
  background: #efb769;
}

.mini-bar.is-ice {
  background: #a9e9e9;
}

.mini-bar.is-ok {
  background: #8dd1a1;
}

.review-crt-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 9px;
  background: #203442;
  border-top: 1px solid #3c596b;
}

.review-crt-source {
  font-family: var(--bb-font-label);
  font-size: 0.84rem;
  color: #bccdd9;
}

.btn-review-mark {
  padding: 3px 9px;
  font-size: 0.8rem;
}

.review-crt-led {
  position: absolute;
  right: 12px;
  bottom: 3px;
  width: 7px;
  height: 3px;
  background: #d78a56;
}

.review-crt-mini.is-reviewed .review-crt-led {
  background: #8dd1a1;
}

/* ==================== CENTRAL DE PROJETOS UI ILLUSTRATION ==================== */
.central-mockup-figure {
  background: var(--bb-field);
}

.cp-mock-window {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--bb-structure);
  background: var(--bb-bg);
  color: var(--bb-text);
  overflow: hidden;
}

.cp-mock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #151c1f;
  color: #f2fbff;
  border-bottom: 2px solid var(--bb-structure);
}

.cp-mock-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--bb-font-display);
  font-size: 0.98rem;
}

.cp-mock-bar-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cp-mock-root-pill {
  padding: 1px 7px;
  border: 1px solid #4b6071;
  background: #25333d;
  color: #a9e9e9;
  font-family: var(--bb-font-mono);
  font-size: 0.74rem;
}

.cp-mock-win-min {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #618296;
  font-size: 0.95rem;
  line-height: 1;
}

.cp-mock-body {
  display: grid;
  grid-template-columns: minmax(185px, 34%) minmax(0, 1fr);
}

.cp-mock-sidebar {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 10px;
  background: var(--bb-surface);
  border-right: 2px solid var(--bb-structure);
}

.cp-mock-side-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bb-font-label);
  font-size: 0.9rem;
  color: var(--bb-muted);
}

.cp-mock-count {
  padding: 0 5px;
  background: var(--bb-field);
  border: 1px solid var(--bb-structure);
  color: var(--bb-text);
  font-size: 0.8rem;
}

.cp-mock-filter {
  margin-left: auto;
  padding: 1px 6px;
  background: var(--bb-field);
  border: 1px solid var(--bb-structure);
  color: var(--bb-text);
  font-size: 0.8rem;
}

.cp-mock-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  background: var(--bb-field);
  border: 1px solid var(--bb-structure);
  color: var(--bb-muted);
  font-size: 0.78rem;
}

.cp-mock-search-dot {
  width: 8px;
  height: 8px;
  border: 2px solid var(--bb-muted);
  border-radius: 50%;
  flex: none;
}

.cp-mock-folders {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cp-mock-folder {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-left-width: 3px;
}

.cp-mock-folder.is-active {
  background: var(--bb-field);
  border-color: var(--bb-structure);
  border-left-color: var(--bb-action);
}

.cp-mock-folder-ico {
  width: 14px;
  height: 11px;
  background: var(--folder-col, #a9e9e9);
  border: 1px solid #151c1f;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.cp-mock-folder-ico--lg {
  width: 22px;
  height: 17px;
}

.cp-mock-folder-meta {
  min-width: 0;
}

.cp-mock-folder-meta strong,
.cp-mock-folder-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-mock-folder-meta strong {
  font-family: var(--bb-font-display);
  font-size: 0.86rem;
}

.cp-mock-folder-meta small {
  font-family: var(--bb-font-mono);
  font-size: 0.69rem;
  color: var(--bb-muted);
}

.cp-mock-arrow {
  color: var(--bb-muted);
  font-size: 1rem;
  line-height: 1;
}

.cp-mock-chat {
  display: flex;
  flex-direction: column;
  background: var(--bb-field);
  min-width: 0;
}

.cp-mock-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bb-bg);
  border-bottom: 1px solid var(--bb-structure);
}

.cp-mock-chat-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cp-mock-chat-identity strong {
  display: block;
  font-family: var(--bb-font-display);
  font-size: 0.98rem;
  line-height: 1.1;
}

.cp-mock-path {
  display: block;
  font-family: var(--bb-font-mono);
  font-size: 0.72rem;
  color: var(--bb-muted);
}

.cp-mock-room-pill {
  padding: 2px 8px;
  background: var(--bb-surface);
  border: 1px solid var(--bb-structure);
  font-family: var(--bb-font-label);
  font-size: 0.86rem;
  color: var(--bb-muted);
}

.cp-mock-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-structure);
}

.cp-mock-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  background: var(--bb-bg);
  border: 1px solid var(--bb-structure);
  font-size: 0.76rem;
}

.cp-mock-tab.is-active {
  background: var(--bb-field);
  border-color: var(--bb-action);
  box-shadow: 2px 2px 0 var(--bb-shadow);
}

.cp-mock-tab .engine-tag {
  font-size: 0.78rem;
  padding: 0 5px;
}

.cp-mock-tab-agent {
  font-family: var(--bb-font-label);
  font-size: 0.84rem;
  color: var(--bb-text);
}

.cp-mock-transcript {
  padding: 12px;
  flex: 1;
}

.cp-mock-ready-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--bb-surface);
  border: 1px solid var(--bb-structure);
}

.cp-mock-avatar {
  width: 42px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bb-portrait);
  border: 2px solid var(--bb-structure);
  flex: none;
  overflow: hidden;
}

.cp-mock-avatar canvas {
  width: 38px;
  height: 42px;
  image-rendering: pixelated;
}

.cp-mock-ready-copy strong {
  display: block;
  font-family: var(--bb-font-display);
  font-size: 0.9rem;
  margin-bottom: 3px;
}

.cp-mock-ready-copy p {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--bb-text);
}

.cp-mock-ready-copy small {
  display: block;
  font-size: 0.76rem;
  color: var(--bb-muted);
}

.cp-mock-compose {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 7px 10px;
  background: var(--bb-bg);
  border: 1px solid var(--bb-structure);
}

.cp-mock-compose-placeholder {
  font-size: 0.8rem;
  color: var(--bb-muted);
}

.cp-mock-send-pill {
  padding: 3px 9px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 1px solid var(--bb-action-text);
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.76rem;
  flex: none;
}

/* ==================== CIRCUIT SECTION ==================== */
.circuit-hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bb-field);
  border: 2px solid var(--bb-action);
}

.house-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.house-btn {
  text-align: left;
  padding: 9px 10px;
  background: var(--bb-surface);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.house-btn:hover {
  border-color: var(--bb-focus);
}

.house-btn.is-active {
  background: var(--bb-field);
  border-color: var(--bb-action);
  box-shadow: 3px 3px 0 var(--bb-shadow);
}

/* ==================== FAQ & FOOTER ==================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  border: 2px solid var(--bb-structure);
  background: var(--bb-field);
}

.faq-item summary {
  padding: 10px 14px;
  font-family: var(--bb-font-display);
  font-size: 0.98rem;
  cursor: pointer;
}

.faq-item p {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 0.9rem;
  color: var(--bb-muted);
}

.page-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 2px solid var(--bb-structure);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.footer-brand strong {
  display: block;
  font-family: var(--bb-font-display);
  font-size: 0.98rem;
}

.footer-brand small {
  color: var(--bb-muted);
  font-size: 0.84rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: var(--bb-muted);
}

.page-footer a {
  color: var(--bb-focus);
  text-decoration: underline;
}

/* ==================== MOBILE CONTROLS ==================== */
.mobile-controls {
  display: none;
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 21;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(2, 30px);
  gap: 3px;
  pointer-events: auto;
}

.dpad-btn {
  background: var(--bb-glass);
  color: var(--bb-text);
  border: 2px solid var(--bb-structure);
  font-size: 0.86rem;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: var(--bb-action);
  color: var(--bb-action-text);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }

.mobile-act {
  pointer-events: auto;
  padding: 8px 12px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 2px solid var(--bb-action-text);
  box-shadow: 3px 3px 0 var(--bb-action-text);
  font-family: var(--bb-font-display);
  font-weight: 700;
}

/* ==================== GUIDED INSTALL PAGE (instalar.html) ==================== */
html.install-page,
body.install-body {
  height: 100%;
  overflow: hidden;
}

body.install-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}

.install-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}

.install-scroll-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.install-pane {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bb-bg-alt) 0%, var(--bb-bg) 320px);
}

.install-container {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(20px, 3.2vw, 38px) clamp(16px, 3vw, 32px) 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.install-hero {
  padding: clamp(18px, 2.6vw, 28px);
  box-shadow: 4px 4px 0 var(--bb-shadow);
}

.install-title {
  margin: 8px 0 10px;
  font-family: var(--bb-font-display);
  font-size: clamp(1.65rem, 3.1vw, 2.45rem);
  line-height: 1.18;
}

.install-subtitle {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--bb-muted);
  max-width: 68ch;
}

.install-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding-top: 12px;
  border-top: 2px solid var(--bb-structure);
}

.install-badge-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.install-badge-label {
  font-family: var(--bb-font-label);
  font-size: 0.94rem;
  color: var(--bb-muted);
  margin-right: 2px;
}

.install-switcher-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.install-mode-tabs {
  margin-bottom: 0;
}

.install-mode-tab {
  font-size: 1rem;
  padding: 6px 12px;
}

.install-prompt-card {
  box-shadow: 4px 4px 0 var(--bb-shadow);
}

.install-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.install-prompt-head > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.install-prompt-hint {
  font-family: var(--bb-font-label);
  font-size: 0.96rem;
  color: var(--bb-muted);
}

.install-mode-summary {
  margin: 0 0 12px;
  font-size: 0.94rem;
  color: var(--bb-muted);
}

.install-prompt-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}

.install-prompt-box pre {
  font-size: 0.86rem;
  line-height: 1.52;
  color: #a9e9e9;
}

.install-section-heading {
  margin: 0 0 10px;
  font-family: var(--bb-font-display);
  font-size: 1.24rem;
}

.install-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.install-step-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.install-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 2px 8px;
  background: var(--bb-action);
  color: var(--bb-action-text);
  border: 2px solid var(--bb-action-text);
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 0.84rem;
}

.install-step-card h3 {
  margin: 0;
  font-size: 1rem;
}

.install-step-card p {
  margin: 0;
  flex: 1;
}

.install-step-cmd {
  margin-top: auto;
}

.install-integrations-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.install-integrations-sub {
  margin: 0 0 6px;
}

.install-integrations-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.install-int-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bb-surface);
  border: 2px solid var(--bb-structure);
}

.install-int-card p {
  margin: 0;
  flex: 1;
  font-size: 0.86rem;
  color: var(--bb-muted);
}

.install-footer {
  margin-top: 6px;
}

.install-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (max-width: 1240px) {
  .brand-copy small {
    display: none;
  }
  .nav-link {
    padding: 4px 6px;
    font-size: 0.94rem;
  }
  .topbar-try-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .cta-btn {
    padding: 5px 9px;
    font-size: 0.82rem;
  }
  .p4-rooms-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1060px) {
  .site-header {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  .site-nav,
  .install-header-center {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--bb-structure);
    padding-top: 6px;
  }
  .cp-mock-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .cp-mock-sidebar {
    border-right: 0;
    border-bottom: 2px solid var(--bb-structure);
  }
  .install-steps-grid,
  .install-integrations-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .split-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(205px, 34dvh, 285px) minmax(0, 1fr);
  }
  .stage.diorama-pane {
    border-right: 0;
    border-bottom: 3px solid var(--bb-structure);
  }
  .page-section {
    padding: 20px 16px;
  }
  .two-col-grid,
  .three-col-grid,
  .house-cards-grid,
  .shots-pair,
  .engines-spotlight,
  .planning-notes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .spotlight-shot {
    width: 232px;
  }
  .mobile-controls {
    display: flex;
  }
  .stage-hint {
    display: none;
  }
}

@media (max-width: 600px) {
  .header-actions {
    flex-wrap: wrap;
    gap: 5px;
  }
  .split-workspace {
    grid-template-rows: clamp(185px, 29dvh, 235px) minmax(0, 1fr);
  }
  .cta-btn {
    padding: 5px 8px;
    font-size: 0.8rem;
  }
  .topbar-github-btn span#topbar-star-label,
  .topbar-github-btn span#install-star-label {
    display: none;
  }
  .stage-hud-pill {
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    font-size: 0.86rem;
  }
  .stage-overview-btn {
    top: 6px;
    right: 6px;
    padding: 2px 7px;
    font-size: 0.84rem;
  }
}

@media (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }
}
