/* ControlX Mission Control — StrmrX HUD (gold/black shell, neon-orange accent) */
:root {
  /* --accent + --gold are the two board colours. The Board colours picker (X tier)
     overrides them on <html> at runtime; everything below derives from them so a
     recolour reaches buttons, tiles, the aurora and the grid alike. */
  --accent: #E8732A;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --gold: #C8A96E;
  --bg1: #080808;
  --bg2: #111111;
  --surface: #1A1A1A;
  --surface2: #222;
  --text: #F0E6D3;
  --text2: #8A7A6A;
  --border: rgba(200,169,110,0.18);
  --border-active: rgba(232,115,42,0.55);
  --good: #50C878;
  --bad: #E0574E;
  --ease: cubic-bezier(.22,1,.36,1);
  /* Text sizing system: board fonts = base size × --text-scale (the Aa slider).
     Density/dock/width modes retune the base sizes; the slider scales them all. */
  --text-scale: 1;
  --fs-title: 17px; --fs-link: 12px;
  --fs-tile-label: 11px; --fs-tile-value: 24px; --fs-tile-off: 14px;
  --fs-btn: 14px; --fs-params: 11px; --fs-expander: 13px; --fs-pill: 13px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1000px 520px at 84% -8%, rgba(232,115,42,0.10), transparent 60%),
    radial-gradient(900px 520px at 8% 4%, rgba(200,169,110,0.07), transparent 58%),
    radial-gradient(1200px 700px at 50% -10%, #1a130c, var(--bg1)) fixed;
  color: var(--text);
  font-family: 'Segoe UI', 'Trebuchet MS', system-ui, sans-serif;
  min-height: 100vh;
  position: relative;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--text2); font-size: 14px; }
code, .mono { font-family: 'Cascadia Code', Consolas, monospace; }

/* The board's own toolbar. NOT sticky: the shared header is, at z-index 50, and an app
   bar that also pins to the top slides underneath it on scroll - the exact fault RaidX
   shipped. It scrolls with the board instead. */
.boardbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 16px 32px; border-bottom: 1px solid var(--border);
}
.boardbar-actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.18s var(--ease); font-family: inherit;
}
.btn:hover { border-color: var(--border-active); background: var(--surface2); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, var(--accent), #b6511a); color: #1a0d04; border: none; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: linear-gradient(180deg, var(--bad), #a83a33); color: #fff; border: none; }
.btn.editing { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgba(232,115,42,0.25); }

/* Customize board — the prominent entry point (not tucked away). */
.btn.customize {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
  border: 1px solid var(--border-active); color: var(--text);
  padding: 10px 18px; font-size: 14px; font-weight: 700; letter-spacing: 0.2px;
  box-shadow: 0 2px 14px rgba(232,115,42,0.18), inset 0 1px 0 rgba(255,255,255,0.05);
}
.btn.customize:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(232,115,42,0.28); }
.btn.customize.editing {
  background: linear-gradient(180deg, var(--accent), #b6511a); color: #1a0d04; border: none;
}

/* Edit toolbar — a big, unmissable banner while customizing. */
.edit-hint {
  display: flex; align-items: center; gap: 16px;
  margin: 16px 32px 0; padding: 14px 20px; font-size: 13px; color: var(--text2);
  border: 1px solid var(--border-active); border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), rgba(232,115,42,0.05));
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  animation: cxToolbarIn .35s var(--ease) backwards;
}
@keyframes cxToolbarIn { from { opacity: 0; transform: translateY(-8px); } }
.edit-hint-copy { flex: 1; line-height: 1.5; }
.edit-hint-copy > b { display: block; font-size: 15px; color: var(--text); margin-bottom: 2px; letter-spacing: 0.2px; }
.edit-hint b { color: var(--accent); }
.edit-hint .grip-chip {
  display: inline-block; color: var(--accent); font-weight: 900; transform: translateY(1px);
}
.edit-hint #edit-done { flex: none; }

/* Drag grips — the handles that make reordering obvious. */
.drag-grip {
  display: none; align-items: center; justify-content: center; flex: none;
  color: var(--text2); cursor: grab; border-radius: 8px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.drag-grip:hover { color: var(--accent); background: var(--accent-soft); }
.drag-grip:active { cursor: grabbing; }
.drag-grip svg { width: 18px; height: 18px; }
.editing-board .drag-grip { display: flex; }
.panel-grip { width: 26px; height: 30px; margin-left: -4px; }
.trigger-grip { width: 22px; height: 34px; }

/* While dragging: the moving item ghosts out; siblings glide to make room. */
.panel.dragging, .trigger-row-wrap.dragging {
  opacity: 0.4; outline: 2px dashed var(--border-active); outline-offset: 2px;
}
.editing-board .panel { transition: transform 0.22s var(--ease), border-color 0.25s var(--ease); }
.editing-board .panel[draggable="true"] { cursor: grab; }
.editing-board .panel { border-style: dashed; border-color: var(--border-active); }

/* Board grid — min() keeps cards from ever overflowing a narrow dock.
   No max-width: the grid fills however wide the window/dock is (more columns). */
.board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px;
  padding: 24px 32px 48px;
}

/* Plan slot bar — only rendered when the slot gate is enforced (post-beta). */
.slot-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 16px 32px -8px; padding: 11px 18px; font-size: 13px; color: var(--text2);
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, rgba(200,169,110,0.07), rgba(200,169,110,0.02));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.slot-bar b { color: var(--text); font-size: 13px; letter-spacing: 0.2px; }
.slot-plan {
  font-size: 10px; font-weight: 900; letter-spacing: 1.1px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; color: var(--text2);
  background: rgba(255,255,255,0.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.09);
}
.slot-upgrade { margin-left: auto; font-weight: 700; font-size: 13px; }
.slot-upgrade:hover { filter: brightness(1.15); }
html[data-view="dock"] .slot-bar { display: none; } /* dock space is precious */

/* Locked panel — the app is visible but its controls wait behind the plan
   gate. Dormant surface, live CTA: the upsell is the only bright thing. */
.panel.locked { border-style: solid; }
.panel.locked:hover { transform: none; border-color: var(--border); }
.panel.locked::before { opacity: 0.25; }
.panel.locked .panel-icon { filter: grayscale(0.75); opacity: 0.65; }
.panel.locked .panel-title h2 { color: var(--text2); }
.lock-block { padding: 4px 2px 2px; }
.lock-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; color: var(--text2);
  background: rgba(255,255,255,0.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.09);
}
.lock-msg { margin: 10px 0 12px; font-size: 13px; line-height: 1.5; color: var(--text2); }
.lock-actions .lock-cta {
  display: inline-block; text-decoration: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 26%, var(--surface)), var(--surface));
  border-color: var(--border-active); color: var(--text); font-weight: 700;
}
.lock-actions .lock-cta:hover { filter: brightness(1.1); transform: translateY(-1px); }
.lock-hint { margin-top: 10px; font-size: 11.5px; color: var(--text2); opacity: 0.75; }

/* App panel */
.panel {
  --app-accent: var(--gold);
  background: linear-gradient(180deg, var(--bg2), #0d0d0d);
  border: 1px solid var(--border); border-radius: 16px; padding: 20px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
  position: relative; overflow: hidden;
}
.panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--app-accent), transparent);
  opacity: 0.8;
}
.panel:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--app-accent) 45%, transparent); }
.panel.pinned::after {
  content: '📌'; position: absolute; top: 12px; right: 14px; font-size: 13px; opacity: 0.8;
}
.editing-board .panel.pinned::after { display: none; } /* the pin toggle takes its spot */
.panel.skeleton { min-height: 210px; animation: shimmer 1.4s infinite; border-color: rgba(255,255,255,0.05); }
@keyframes shimmer { 50% { opacity: 0.45; } }

.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--app-accent) 16%, #101010);
  border: 1px solid color-mix(in srgb, var(--app-accent) 40%, transparent);
  color: var(--app-accent);
}
.panel-icon svg { width: 22px; height: 22px; }
.panel-title { flex: 1; min-width: 0; }
.panel-title h2 { font-size: calc(var(--fs-title) * var(--text-scale)); letter-spacing: 0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-title a { font-size: calc(var(--fs-link) * var(--text-scale)); color: var(--text2); }
.panel-title a:hover { color: var(--app-accent); }

/* Status tiles */
.status-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tile {
  flex: 1; min-width: 110px; padding: 10px 14px; border-radius: 12px;
  background: #0c0c0c; border: 1px solid var(--border);
  overflow: hidden; /* nothing inside a tile ever pokes past its border */
}
.tile .tile-label {
  font-size: calc(var(--fs-tile-label) * var(--text-scale)); text-transform: uppercase; letter-spacing: 1.2px; color: var(--text2);
  overflow-wrap: break-word;
}
.tile .tile-value {
  font-size: calc(var(--fs-tile-value) * var(--text-scale)); font-weight: 800; font-family: 'Cascadia Code', Consolas, monospace;
  color: var(--app-accent); line-height: 1.3; transition: color 0.2s;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Long values (text states like "Collapsed", big numbers) drop to the small
   size so they FIT the tile instead of escaping it; full value rides `title`. */
.tile .tile-value.long { font-size: calc(var(--fs-tile-off) * var(--text-scale)); font-weight: 700; line-height: 1.6; }
.tile.bump .tile-value { animation: bump 0.5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.18); } }
.tile.offline .tile-value { color: var(--text2); font-size: calc(var(--fs-tile-off) * var(--text-scale)); font-weight: 600; }

/* Triggers */
.triggers { display: flex; flex-direction: column; gap: 8px; }
/* A switched-off control: gone from the board, dimmed here in Customize so it
   can come back. Same visual language as hidden tile blocks (.sec-off). */
.trigger-row-wrap.trigger-off .trigger-btn,
.trigger-row-wrap.trigger-off .trigger-grip { opacity: 0.32; filter: grayscale(0.6); }
.trigger-eye { flex: none; }
.trigger-row { display: flex; align-items: center; gap: 8px; }
.trigger-btn {
  flex: 1; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 11px; padding: 11px 14px; font-size: calc(var(--fs-btn) * var(--text-scale)); font-weight: 600; cursor: pointer;
  transition: all 0.18s var(--ease); font-family: inherit;
}
.trigger-btn:hover { border-color: color-mix(in srgb, var(--app-accent) 55%, transparent); background: var(--surface2); }
.trigger-btn:active { transform: scale(0.985); }
.trigger-btn .t-icon { color: var(--app-accent); display: grid; place-items: center; }
.trigger-btn .t-icon svg { width: 16px; height: 16px; }
.trigger-btn .t-icon .t-thumb { width: 24px; height: 24px; object-fit: contain; border-radius: 6px;
  background: color-mix(in srgb, var(--app-accent) 12%, transparent); }
.trigger-btn .t-params { margin-left: auto; font-size: calc(var(--fs-params) * var(--text-scale)); color: var(--text2); }
.trigger-btn.firing { border-color: var(--app-accent); animation: firepulse 0.6s var(--ease); }
@keyframes firepulse { 30% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--app-accent) 25%, transparent); } }

.expander {
  background: none; border: none; color: var(--text2); font-size: calc(var(--fs-expander) * var(--text-scale)); cursor: pointer;
  padding: 8px 4px 2px; font-family: inherit; text-align: left;
}
.expander:hover { color: var(--accent); }

/* Live checklist widget — "what's on stream right now" + tickable items.
   Declared by an app's manifest (checklist: true); data rides the status poll. */
.checklist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cl-label {
  display: flex; align-items: center; gap: 8px;
  font-size: calc(var(--fs-tile-label) * var(--text-scale)); text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text2); font-weight: 700;
}
.cl-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text2); flex: none;
}
.cl-live-dot.on {
  background: var(--bad);
  box-shadow: 0 0 0 0 rgba(224,87,78,0.5);
  animation: clPulse 2.2s var(--ease) infinite;
}
@keyframes clPulse { 40% { box-shadow: 0 0 0 6px rgba(224,87,78,0); } }
.cl-count {
  font-family: 'Cascadia Code', Consolas, monospace; font-weight: 800;
  font-size: calc(var(--fs-tile-off) * var(--text-scale)); color: var(--app-accent);
}
.cl-picker {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px;
  font-size: calc(var(--fs-btn) * var(--text-scale)); font-weight: 600; font-family: inherit; cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .22s var(--ease);
}
.cl-picker:hover, .cl-picker:focus {
  outline: none; border-color: color-mix(in srgb, var(--app-accent) 55%, transparent);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--app-accent) 14%, transparent);
}
.cl-items {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 340px; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: var(--surface2) transparent;
}
.cl-item {
  display: flex; align-items: center; gap: 10px;
  background: #0c0c0c; border: 1px solid var(--border); border-radius: 11px;
  padding: 7px 10px;
}
.cl-thumb {
  /* the collectible art is the point — it scales with the Aa slider; the pills don't */
  width: calc(34px * var(--text-scale)); height: calc(34px * var(--text-scale));
  flex: none; object-fit: contain; border-radius: 7px;
  background: color-mix(in srgb, var(--app-accent) 12%, transparent);
}
span.cl-thumb { display: grid; place-items: center; }
.cl-thumb.emoji { font-size: calc(21px * var(--text-scale)); background: none; }
.cl-thumb.fallback {
  font-weight: 800; color: var(--app-accent); text-transform: uppercase;
  font-size: calc(var(--fs-btn) * var(--text-scale));
}
.cl-name {
  flex: 1; min-width: 0; font-size: calc(var(--fs-btn) * var(--text-scale)); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Items that carry a preview link: thumbnail + name are clickable (open a peek). */
.cl-item-link .cl-thumb, .cl-item-link .cl-name { cursor: pointer; }
.cl-item-link .cl-name { text-decoration: underline dotted rgba(255,255,255,.28); text-underline-offset: 3px; }
.cl-item-link .cl-name:hover { color: var(--sx-accent, #a970ff); text-decoration-color: currentColor; }
.cl-chips { display: flex; gap: 6px; flex: none; }
.cl-chip {
  /* icon-only circles at a fixed size — the row's width belongs to the art + name,
     and the pills stay small no matter what the Aa slider does (state = color) */
  --chip: var(--good);
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: none;
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all .18s var(--ease);
}
.cl-chip .cl-chip-label { display: none; }
.cl-chip .cl-glyph { font-size: 13px; line-height: 1; }
.cl-chip:hover { border-color: color-mix(in srgb, var(--chip) 60%, transparent); color: var(--text); }
.cl-chip.on {
  background: color-mix(in srgb, var(--chip) 20%, #0c0c0c);
  border-color: color-mix(in srgb, var(--chip) 70%, transparent);
  color: var(--chip);
  box-shadow: 0 0 10px color-mix(in srgb, var(--chip) 22%, transparent);
}
.cl-chip.firing { animation: firepulse 0.6s var(--ease); }
.cl-empty { color: var(--text2); font-size: calc(var(--fs-expander) * var(--text-scale)); padding: 4px 2px; line-height: 1.5; }
.editing-board .checklist { opacity: 0.45; pointer-events: none; } /* customize mode reorders, never fires */

/* Edit-mode affordances */
.edit-controls { display: none; align-items: center; gap: 4px; }
.editing-board .edit-controls { display: flex; }
.icon-btn {
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  color: var(--text2); font-size: 14px; padding: 5px 7px; transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border); background: var(--surface); }
.icon-btn.active { color: var(--accent); }
.to-top { font-size: 15px; }

/* The collapsed-view cutoff line (edit mode): controls above it stay on the
   collapsed tile, the +/− buttons move the line. */
.collapse-divider {
  display: flex; align-items: center; gap: 8px; padding: 2px 0;
  animation: popin 0.2s var(--ease);
}
.collapse-divider .cd-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border-active), transparent); }
.collapse-divider .cd-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent); white-space: nowrap;
}
.collapse-divider .cd-btn { font-size: 13px; padding: 2px 8px; line-height: 1.3; border-color: var(--border); }
.collapse-divider .cd-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
/* The controls that make the collapsed cut wear an accent edge, so the cut
   reads at a glance even when a Wide card's grid breaks "above the line". */
.editing-board .trigger-row-wrap.on-tile .trigger-btn {
  box-shadow: inset 3px 0 0 var(--accent);
  border-color: var(--border-active);
}

/* Floating hover hint (data-hint) — body-mounted so tiles can't clip it. */
.hint-tip {
  position: fixed; z-index: 300; pointer-events: none; max-width: 260px;
  background: linear-gradient(180deg, var(--surface), #101010);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 12.5px; line-height: 1.45; padding: 8px 11px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  opacity: 0; transform: translateY(4px) scale(0.97);
  transition: opacity 0.12s ease-in, transform 0.12s ease-in;
}
.hint-tip.show { opacity: 1; transform: none; transition: opacity 0.18s var(--ease), transform 0.18s var(--ease); }

/* Param popover */
.popover {
  margin-top: 4px; padding: 14px; border-radius: 12px;
  background: #0c0c0c; border: 1px solid color-mix(in srgb, var(--app-accent) 45%, transparent);
  display: flex; flex-direction: column; gap: 10px;
  animation: popin 0.2s var(--ease);
}
@keyframes popin { from { opacity: 0; transform: translateY(-4px); } }
.popover .field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text2); }
.popover .field span { font-weight: 600; }
.popover .ms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.popover .ms-chip {
  padding: 5px 12px; border-radius: 100px; font-size: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  transition: all 0.15s var(--ease);
}
.popover .ms-chip:hover { border-color: var(--app-accent); color: var(--text); }
.popover .ms-chip:active { transform: scale(0.96); }
.popover .ms-chip.on {
  background: color-mix(in srgb, var(--app-accent) 18%, transparent);
  border-color: var(--app-accent);
  color: var(--app-accent);
}
.popover input, .popover select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit;
}
.popover input:focus, .popover select:focus { outline: none; border-color: var(--border-active); }
.popover .popover-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }

/* Connect more apps: the cross-promo shelf */
.more-apps { padding: 0 32px 40px; border-radius: 18px; }
.more-apps.flash { animation: shelf-flash 1.4s var(--ease); }
@keyframes shelf-flash {
  0%, 25% { background: var(--accent-soft); }
  100% { background: transparent; }
}
.more-apps h3 { font-size: 13px; color: var(--gold); text-transform: uppercase; letter-spacing: 1.6px; margin-bottom: 12px; }
.more-apps h3.mt { margin-top: 26px; }
.more-apps .muted { margin-bottom: 12px; font-size: 13px; }
.connect-head { padding: 26px 0 16px; }
.connect-head h2 { font-size: 19px; letter-spacing: 0.3px; margin-bottom: 6px; }
.connect-head .muted { max-width: 560px; margin-bottom: 0; font-size: 14px; line-height: 1.55; }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.connect-card {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  color: var(--text); transition: all 0.18s var(--ease);
}
.connect-card:hover { border-color: var(--border-active); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.connect-card:active { transform: scale(.97); transition: transform .09s var(--ease); }
.connect-card svg { width: 17px; height: 17px; color: var(--text2); margin-top: 2px; flex: none; }
.cc-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.cc-body b { font-size: calc(14px * var(--text-scale)); font-weight: 700; }
.cc-blurb { font-size: calc(12px * var(--text-scale)); color: var(--text2); line-height: 1.5; }
.cc-cta {
  margin-top: 3px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px;
}
.cc-cta.activate { color: var(--accent); background: var(--accent-soft); }
.cc-cta.soft { color: var(--text2); border: 1px solid var(--border); }

/* Dark (not-launched) apps — the admin-only group under the shelf. Collapsed by
   default and dimmed: testing links stay one click away without reading as the
   launchpad (the shelf itself only ever advertises live apps). */
.dark-details { margin-top: 26px; }
.dark-details summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text2); text-transform: uppercase; letter-spacing: 1.6px;
}
.dark-details summary::-webkit-details-marker { display: none; }
.dark-details summary::before { content: '▸'; transition: transform .18s var(--ease); }
.dark-details[open] summary::before { transform: rotate(90deg); }
.dark-details[open] summary { margin-bottom: 12px; }
.dark-grid .connect-card { opacity: .6; }
.dark-grid .connect-card:hover { opacity: 1; }

/* OBS dock: the shelf's stand-in — a dock is a control panel, not a browsing
   surface, so discovery stays on the full dashboard behind this one pointer. */
.dock-add-apps {
  display: none; margin: 8px 10px 14px; padding: 9px 14px; text-align: center;
  font-size: 13px; color: var(--text2); border: 1px dashed var(--border); border-radius: 12px;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.dock-add-apps:hover { color: var(--accent); border-color: var(--accent); }
html[data-view="dock"] .more-apps { display: none !important; }
html[data-view="dock"] .dock-add-apps:not(.hidden) { display: block; }

/* Free plan nudge under the shelf */
.upgrade-strip {
  margin-top: 28px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: 16px; border: 1px solid var(--border-active);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
}
.upgrade-strip .us-copy { display: flex; flex-direction: column; gap: 3px; min-width: 220px; flex: 1; }
.upgrade-strip .us-copy b { font-size: 14px; }
.upgrade-strip .us-copy span { font-size: 13px; color: var(--text2); line-height: 1.5; }
.upgrade-strip .us-cta { white-space: nowrap; }

/* Boardbar status (left side): live count + shelf jump */
.boardbar-status { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.connected-count { font-size: 13px; font-weight: 600; color: var(--text2); white-space: nowrap; }

/* Empty state */
.empty-state { text-align: center; padding: 90px 24px; max-width: 520px; margin: 0 auto; }
.empty-art { font-size: 54px; margin-bottom: 18px; }
.empty-state h2 { margin-bottom: 10px; letter-spacing: 0.5px; }
.empty-state p { color: var(--text2); font-size: 15px; line-height: 1.6; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 50;
}
.modal {
  width: min(420px, 92vw); background: linear-gradient(180deg, var(--bg2), #0c0c0c);
  border: 1px solid var(--border-active); border-radius: 16px; padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7); animation: popin 0.22s var(--ease);
}
.modal h3 { margin-bottom: 8px; }
.modal .muted { margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Toasts */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--surface); border: 1px solid var(--border-active); border-radius: 10px;
  padding: 12px 18px; font-size: 14px; animation: slidein 0.25s var(--ease); box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  max-width: 340px;
}
.toast.success { border-color: rgba(80,200,120,0.5); }
.toast.error { border-color: rgba(224,87,78,0.6); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; } }

/* App alerts — the `_alert` status contract (e.g. RaidX's incoming raider card).
   Pops top-center, accented by the app, dismissible, auto-fades. Springy in,
   smooth out (asymmetric enter/exit). */
.cx-alert-wrap {
  position: fixed; top: 14px; left: 0; right: 0; z-index: 110;
  display: flex; justify-content: center; pointer-events: none;
}
.cx-alert {
  pointer-events: auto; position: relative;
  width: min(440px, calc(100vw - 24px));
  background: linear-gradient(180deg, var(--bg2), #0c0c0c);
  border: 1px solid var(--al-accent, var(--border-active));
  border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.03);
  animation: cxAlertIn .34s cubic-bezier(.34,1.45,.5,1) both;
}
.cx-alert-wrap.out .cx-alert { animation: cxAlertOut .24s ease-in both; }
@keyframes cxAlertIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cxAlertOut { to { opacity: 0; transform: translateY(-10px); } }
.cx-alert-x {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text2);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px;
}
.cx-alert-x:hover { color: #fff; }
.cx-alert-head { display: flex; align-items: center; gap: 12px; }
.cx-alert-img {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--al-accent, var(--border-active)); flex: 0 0 48px;
}
.cx-alert-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--al-accent, #a970ff); margin-bottom: 2px;
}
.cx-alert-title { font-size: 16px; font-weight: 800; }
.cx-alert-body { font-size: 12.5px; color: var(--text2); margin-top: 8px; }
.cx-alert-note {
  margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.05); font-size: 12.5px; font-style: italic;
}
@media (prefers-reduced-motion: reduce) {
  .cx-alert, .cx-alert-wrap.out .cx-alert { animation: cxAlertFade .2s ease both; }
  @keyframes cxAlertFade { from { opacity: 0; } to { opacity: 1; } }
}
html[data-view="dock"] .cx-alert { width: min(340px, calc(100vw - 16px)); padding: 13px 14px; }

/* Raid takeover — an `_alert` carrying a full `card` (+ takeover flag) renders
   INSIDE its app tile, and the tile goes full-width, so the raider card is big
   and scoped to the RaidX area (reads great as an OBS dock). Springy in. */
.panel.panel--raid {
  grid-column: 1 / -1;
  box-shadow: 0 0 0 1px var(--app-accent, #7c3aed), 0 16px 44px rgba(124,58,237,0.28);
}
.raid-takeover {
  position: relative;
  margin: 2px 0 12px;
  padding: 16px 16px 14px;
  border: 1px solid var(--app-accent, #7c3aed);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(124,58,237,0.16), rgba(124,58,237,0.05));
  animation: rtIn .34s cubic-bezier(.34,1.45,.5,1) both;
}
@keyframes rtIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
.rt-x {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text2);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px;
}
.rt-x:hover { color: #fff; }
.rt-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--app-accent, #a970ff); margin-bottom: 10px;
}
.rt-main { display: flex; align-items: center; gap: 14px; }
.rt-avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--app-accent, #7c3aed); flex: 0 0 64px;
}
.rt-avatar-fb { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; background: var(--app-accent, #7c3aed); color: #fff; }
.rt-name { font-size: 22px; font-weight: 800; line-height: 1.1; }
.rt-viewers { font-size: 13px; color: var(--text2); margin-top: 3px; }
.rt-badges { margin-top: 6px; }
.rt-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.08); }
.rt-badge-new { background: rgba(124,58,237,0.28); }
.rt-history { font-size: 13px; color: var(--text2); margin-top: 12px; }
.rt-recall { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(124,58,237,0.16); border: 1px solid rgba(169,112,255,0.4); font-size: 13px; line-height: 1.45; }
.rt-noteedit { margin-top: 12px; }
.rt-notelabel { display: block; font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--text2); margin-bottom: 6px; }
.rt-noteinput {
  width: 100%; resize: vertical; min-height: 44px;
  background: rgba(255,255,255,0.05); color: var(--text, #fff);
  border: 1px solid var(--border, rgba(255,255,255,0.14)); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 13px; line-height: 1.4;
}
.rt-noteinput:focus { outline: none; border-color: var(--app-accent, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,0.22); }
.rt-noterow { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rt-notestatus { font-size: 12px; color: var(--text2); }
.rt-actions { margin-top: 12px; }
/* What they're streaming now / usually — from the RaidX card. */
.rt-game { font-size: 13px; color: var(--text2); margin-top: 3px; }
.rt-game strong { color: var(--text, #fff); }
.rt-usual { font-size: 12px; color: var(--text2); margin-top: 8px; opacity: .9; }
.rt-usual strong { color: var(--text, #fff); }
/* Multi-raid pager: page through raiders that landed close together. */
.rt-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.rt-pager-btn {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(169,112,255,0.5); background: rgba(124,58,237,0.18); color: var(--text, #fff);
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.rt-pager-btn:hover { background: rgba(124,58,237,0.34); }
.rt-pager-btn:active { transform: scale(0.92); }
.rt-pager-count { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--app-accent, #a970ff); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .raid-takeover { animation: none; } }
html[data-view="dock"] .rt-avatar, html[data-view="dock"] .rt-avatar-fb { width: 52px; height: 52px; flex-basis: 52px; font-size: 22px; }
html[data-view="dock"] .rt-name { font-size: 18px; }

/* ============================================================
   BOARD SETUP DRAWER (apps, presets, colors). Slides in from the
   right; works the same on the full dashboard and the OBS dock.
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; justify-content: flex-end;
  animation: cxFadeIn .2s var(--ease);
}
@keyframes cxFadeIn { from { opacity: 0; } }
.drawer {
  width: min(430px, 100%); height: 100%; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg2), #0b0b0b);
  border-left: 1px solid var(--border-active);
  box-shadow: -24px 0 80px rgba(0,0,0,0.6);
  animation: drawerIn .34s var(--cx-spring, cubic-bezier(.16,1.1,.3,1));
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: .4; } }
body.drawer-open { overflow: hidden; }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 19px; letter-spacing: .3px; }
.drawer-sub { color: var(--text2); font-size: 12.5px; margin-top: 2px; }
.drawer-x { font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 22px 20px; scrollbar-width: thin; scrollbar-color: var(--surface2) transparent; }
.drawer-sec { padding: 18px 0; border-bottom: 1px solid var(--border); }
.drawer-sec:last-child { border-bottom: none; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.sec-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--gold); }
.sec-count { font-size: 11px; color: var(--text2); font-weight: 600; }
.sec-note { font-size: 12.5px; color: var(--text2); line-height: 1.5; margin-bottom: 12px; }
.sec-empty { font-size: 12.5px; color: var(--text2); line-height: 1.5; padding: 6px 0; opacity: .85; }

/* Presets */
.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset-row { display: flex; align-items: center; gap: 6px; }
.preset-apply {
  flex: 1; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 11px; padding: 11px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .18s var(--ease); min-width: 0;
}
.preset-apply:hover { border-color: var(--border-active); background: var(--surface2); }
.preset-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.preset-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Manage apps: one row per app, tap the switch to show/hide */
.apps-manage { display: flex; flex-direction: column; gap: 6px; }
.manage-row {
  display: flex; align-items: center; gap: 11px;
  background: #0c0c0c; border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px;
  transition: opacity .18s var(--ease), border-color .18s var(--ease);
}
.manage-row.off { opacity: .5; }
.manage-icon { width: 26px; height: 26px; display: grid; place-items: center; color: var(--gold); flex: none; }
.manage-icon svg { width: 18px; height: 18px; }
.manage-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch {
  width: 42px; height: 24px; border-radius: 999px; flex: none; cursor: pointer; padding: 0;
  background: var(--surface2); border: 1px solid var(--border); position: relative;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text2); transition: transform .2s var(--cx-spring, cubic-bezier(.16,1.1,.3,1)), background .2s var(--ease);
}
.switch.on { background: var(--accent-soft); border-color: var(--border-active); }
.switch.on .switch-knob { transform: translateX(18px); background: var(--accent); }

/* Board colors: skins + custom */
.tier-badge {
  font-size: 10px; font-weight: 900; letter-spacing: .5px; color: #1a0d04;
  background: linear-gradient(180deg, var(--accent), #b6511a);
  border-radius: 6px; padding: 2px 7px;
}
.skin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 12px; }
.skin {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; border-radius: 12px; padding: 8px 4px 7px;
  cursor: pointer; font-family: inherit; transition: all .16s var(--ease);
}
.skin:hover { background: var(--surface); }
.skin.active { border-color: var(--border-active); background: var(--surface); }
.skin-swatch {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--g), var(--a) 72%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 3px 10px rgba(0,0,0,.4);
  transition: transform .18s var(--cx-spring, cubic-bezier(.16,1.1,.3,1));
}
.skin:hover .skin-swatch { transform: scale(1.08); }
.skin.active .skin-swatch { box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 0 0 2px var(--a), 0 3px 12px rgba(0,0,0,.5); }
.skin-name { font-size: 11px; color: var(--text2); font-weight: 600; }
.skin.active .skin-name { color: var(--text); }
.skin-custom {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #0c0c0c; border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
}
.skin-custom.active { border-color: var(--border-active); }
.custom-label { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.custom-swatch { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.custom-label input[type="color"] {
  width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; border-radius: 8px;
}
.custom-hint { font-size: 11.5px; color: var(--text2); }
.theme-lock { text-align: left; padding: 6px 0; }
.theme-lock .lock-chip { margin-bottom: 10px; }
.theme-lock-msg { font-size: 13px; color: var(--text2); line-height: 1.5; margin-bottom: 12px; }

/* Drawer footer: the how-it-works + help links (the "menu") */
.drawer-foot {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 22px; border-top: 1px solid var(--border); background: rgba(0,0,0,0.25);
}
.drawer-link {
  flex: 1; text-align: center; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text);
  transition: all .18s var(--ease);
}
.drawer-link:hover { border-color: var(--border-active); background: var(--surface2); color: var(--accent); }

/* Prompt modal input */
.prompt-input {
  width: 100%; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 15px; font-family: inherit;
}
.prompt-input:focus { outline: none; border-color: var(--border-active); }

#btn-setup.active { border-color: var(--accent); color: var(--accent); }
html[data-view="dock"] .drawer { width: min(360px, 100%); }
html[data-view="dock"] #btn-setup { padding: 7px 10px; font-size: 12.5px; }

/* ============================================================
   PREMIUM FX — "confident cockpit" pass  (RaidX template, calm skin)
   Premium here is carried by depth, glow and tactility, NOT loud motion —
   true to ControlX's "a cockpit, not a spreadsheet" north star.
   Two-track: full motion below; a reduced-motion block at the end keeps it
   deluxe (rich static glow + fades + press) for streamers who run animations off.
   ============================================================ */
:root {
  /* tint the shared core backdrop + any core components onto ControlX's palette */
  --sx-accent: var(--accent);
  --sx-glow-1: var(--accent);
  --sx-glow-2: var(--gold);
  /* local FX easings — confident: smooth, authoritative, a hair of overshoot */
  --cx-ease-in: cubic-bezier(.16, 1, .3, 1);
  --cx-spring:  cubic-bezier(.16, 1.1, .3, 1);
}

/* Living aurora — a slow, breathing gold/orange glow behind the cockpit.
   Sits above the base body wash (z-index:-1) but below all content. */
body::before {
  content: ""; position: fixed; inset: -25% -12% auto -12%; height: 92vh; z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(50% 58% at 82% 4%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    radial-gradient(44% 52% at 10% 0%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 60%),
    radial-gradient(38% 46% at 50% 40%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 66%);
  filter: blur(10px);
  animation: cxAurora 22s var(--ease) infinite alternate;
  will-change: transform, opacity;
}
@keyframes cxAurora {
  0%   { transform: translate3d(0, 0, 0) scale(1);          opacity: .72; }
  100% { transform: translate3d(-3.5%, 3%, 0) scale(1.16);  opacity: 1; }
}

/* Faint grid — the signature StrmrX backdrop lattice, tinted by the accent.
   Masked so it fades out toward the edges, keeping the center calm. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--gold) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--gold) 5%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% -10%, #000 30%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 50% -10%, #000 30%, transparent 78%);
}

/* Panels pour in — staggered, restrained (confident, not bouncy).
   `backwards` fill so hover/press transforms still work once it settles. */
.panel { animation: cxPanelIn .5s var(--cx-ease-in) backwards; }
@keyframes cxPanelIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.board .panel:nth-child(1) { animation-delay: .02s }
.board .panel:nth-child(2) { animation-delay: .07s }
.board .panel:nth-child(3) { animation-delay: .12s }
.board .panel:nth-child(4) { animation-delay: .17s }
.board .panel:nth-child(5) { animation-delay: .22s }
.board .panel:nth-child(6) { animation-delay: .27s }
.board .panel:nth-child(7) { animation-delay: .32s }
.board .panel:nth-child(n+8) { animation-delay: .37s }

/* Press = a physical compress — makes clicking a panel feel tactile. */
.panel:active { transform: translateY(-1px) scale(.99); transition: transform .1s var(--ease); }

/* The accent glow-bar travels across the top edge on hover (the signature sheen). */
.panel::before {
  background-size: 250% 100%; background-position: 100% 0;
  transition: background-position .85s var(--ease), opacity .3s var(--ease);
}
.panel:hover::before { background-position: 0% 0; opacity: 1; }

/* Universal tactility — EVERY button responds, whatever its class (icon/star/pin
   toggles, expanders, Customize, Sign out, and any inline/classless buttons).
   Calm-tuned press to fit the cockpit; specific rules below still win where set. */
button, [role="button"] {
  transition: transform .15s var(--cx-spring), filter .18s var(--ease), box-shadow .2s var(--ease);
}
button:hover, [role="button"]:hover { filter: brightness(1.08); }
button:active, [role="button"]:active { transform: scale(.95); transition: transform .08s var(--ease); }
.icon-btn:active { transform: scale(.9); transition: transform .08s var(--ease); }

/* Buttons feel tactile: springy press-compress; primary keeps its lift. */
.btn:active { transform: scale(.95); transition: transform .09s var(--ease); }
.btn.primary:hover { transform: translateY(-1px); }

/* Trigger rows — the true action items: soft accent glow on hover + press-compress. */
.trigger-btn { transition: all .18s var(--ease), box-shadow .22s var(--ease); }
.trigger-btn:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-accent) 30%, transparent),
              0 4px 18px color-mix(in srgb, var(--app-accent) 16%, transparent);
}
.trigger-btn:active { transform: scale(.97); transition: transform .09s var(--ease); }

/* More-apps pills — a touch of press. */

/* Refresh sweeps a half-turn on hover — a small cockpit flourish. */
#btn-refresh { transition: all .18s var(--ease), transform .5s var(--ease); }
#btn-refresh:hover { transform: rotate(180deg); }

/* ============================================================
   RESPONSIVE — density scales with width, so the board fits any
   window, half-screen, phone, or OBS dock without a special build.
   ============================================================ */
@media (max-width: 860px) {
  .boardbar { padding: 12px 16px; }
  .board { padding: 16px 16px 40px; gap: 14px; }
  .edit-hint { margin: 12px 16px 0; padding: 12px 16px; }
  .more-apps { padding: 0 16px 32px; }
}
@media (max-width: 640px) {
  :root { --fs-tile-value: 20px; }
  .boardbar { flex-wrap: wrap; row-gap: 8px; }
  .panel { padding: 16px; }
  .status-row { gap: 8px; margin-bottom: 12px; }
  .tile { min-width: 96px; padding: 8px 11px; }
  #toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  :root { --fs-title: 15px; --fs-tile-value: 18px; --fs-btn: 13px; }
  .boardbar { padding: 10px 12px; gap: 8px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn.customize { padding: 8px 12px; font-size: 13px; }
  .board { padding: 12px 10px 32px; gap: 10px; }
  .panel { padding: 13px; border-radius: 13px; }
  .panel-head { gap: 9px; margin-bottom: 10px; }
  .panel-icon { width: 34px; height: 34px; border-radius: 9px; }
  .panel-icon svg { width: 19px; height: 19px; }
  .tile { min-width: 84px; padding: 7px 10px; }
  .trigger-btn { padding: 10px 11px; }
  .edit-hint { flex-direction: column; align-items: stretch; gap: 10px; }
  .empty-state { padding: 56px 18px; }
}

/* ============================================================
   OBS DOCK VIEW (/dock) — same board, chrome trimmed + denser,
   and the ambient animation parked so it sips resources while it
   sits inside OBS for hours.
   ============================================================ */
html[data-view="dock"] .boardbar { padding: 9px 12px; gap: 8px; flex-wrap: wrap; row-gap: 6px; }
html[data-view="dock"] .boardbar-actions { gap: 6px; }
html[data-view="dock"] .boardbar-status { display: none; } /* discovery lives on the full dashboard */
/* The OBS dock is an EMBEDDED panel, not a browsing surface - the same reason the
   standard keeps overlays bare. The shared header and footer are hidden here rather
   than eating the dock's height; every other ControlX surface wears them. */
html[data-view="dock"] .sxh,
html[data-view="dock"] .sx-famfoot { display: none !important; }
html[data-view="dock"] .btn { padding: 7px 11px; font-size: 12.5px; }
html[data-view="dock"] .btn.customize { padding: 7px 12px; font-size: 12.5px; }
html[data-view="dock"] .board {
  padding: 12px 10px 28px; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}
html[data-view="dock"] .panel { padding: 13px; border-radius: 13px; }
html[data-view="dock"] .panel-head { gap: 9px; margin-bottom: 10px; }
html[data-view="dock"] .panel-icon { width: 32px; height: 32px; border-radius: 9px; }
html[data-view="dock"] .panel-icon svg { width: 18px; height: 18px; }
html[data-view="dock"] { --fs-title: 14.5px; --fs-link: 11px; --fs-tile-label: 10px; --fs-tile-value: 17px; --fs-btn: 13px; }
html[data-view="dock"] .status-row { gap: 7px; margin-bottom: 10px; }
html[data-view="dock"] .tile { min-width: 82px; padding: 7px 10px; border-radius: 10px; }
html[data-view="dock"] .trigger-btn { padding: 9px 11px; border-radius: 10px; }
html[data-view="dock"] .edit-hint { margin: 10px 10px 0; padding: 10px 12px; flex-direction: column; align-items: stretch; gap: 8px; font-size: 12px; }
html[data-view="dock"] .more-apps,
html[data-view="dock"] #more-apps { display: none; } /* discovery lives on the full dashboard */
html[data-view="dock"] #toast-container { left: 10px; right: 10px; bottom: 10px; }
html[data-view="dock"] .toast { max-width: none; padding: 10px 14px; font-size: 13px; }
html[data-view="dock"] .cl-items { max-height: 260px; }
html[data-view="dock"] .cl-item { padding: 6px 8px; gap: 8px; border-radius: 9px; }
html[data-view="dock"] .cl-thumb { width: 24px; height: 24px; }
html[data-view="dock"] .cl-chip { padding: 4px 8px; }
html[data-view="dock"] .cl-picker { padding: 8px 10px; border-radius: 10px; }
html[data-view="dock"] body::before { animation: none; opacity: .85; } /* static aurora — no idle GPU churn */
html[data-view="dock"] #btn-refresh:hover { transform: none; }

/* ============================================================
   COMPACT MODE — the ⊟ topbar toggle, persisted per device.
   Denser everything: smaller headings/tiles/buttons, tighter
   padding, glance-only info (dashboard links hidden). Stacks
   with dock view and all width breakpoints.
   ============================================================ */
#btn-density.active { border-color: var(--accent); color: var(--accent); }

/* Text-size slider (the Aa button) — scales board fonts via --text-scale
   while spacing stays put: bigger words, same tight footprint. */
.text-size-wrap { position: relative; }
#btn-text.active { border-color: var(--accent); color: var(--accent); }
.text-size-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: 216px;
  background: linear-gradient(180deg, var(--bg2), #0c0c0c);
  border: 1px solid var(--border-active); border-radius: 12px; padding: 14px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.55);
  display: flex; flex-direction: column; gap: 10px;
  animation: popin 0.2s var(--ease);
}
.text-size-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text2); font-weight: 600; }
.text-size-head b { color: var(--accent); font-family: 'Cascadia Code', Consolas, monospace; font-size: 13px; }
.text-size-pop input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.text-size-pop .btn { align-self: flex-end; }
html[data-density="compact"] .board {
  gap: 8px; padding: 10px 8px 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}
html[data-density="compact"] .panel { padding: 10px 11px; border-radius: 11px; }
html[data-density="compact"] .panel-head { gap: 8px; margin-bottom: 8px; }
html[data-density="compact"] .panel-icon { width: 26px; height: 26px; border-radius: 8px; }
html[data-density="compact"] .panel-icon svg { width: 15px; height: 15px; }
html[data-density="compact"] {
  --fs-title: 13.5px; --fs-tile-label: 9px; --fs-tile-value: 15px; --fs-tile-off: 11px;
  --fs-btn: 12.5px; --fs-params: 10px; --fs-expander: 11px; --fs-pill: 12px;
}
html[data-density="compact"] .panel-title h2 { letter-spacing: 0.2px; }
html[data-density="compact"] .panel-title a { display: none; } /* glance mode — open apps from the full layout */
html[data-density="compact"] .status-row { gap: 6px; margin-bottom: 8px; }
html[data-density="compact"] .tile { min-width: 72px; padding: 5px 8px; border-radius: 8px; }
html[data-density="compact"] .tile .tile-label { letter-spacing: 0.8px; }
html[data-density="compact"] .triggers { gap: 5px; }
html[data-density="compact"] .trigger-btn { padding: 7px 9px; gap: 7px; border-radius: 9px; }
html[data-density="compact"] .trigger-btn .t-icon svg { width: 13px; height: 13px; }
html[data-density="compact"] .trigger-btn .t-icon .t-thumb { width: 18px; height: 18px; }
html[data-density="compact"] .expander { padding: 5px 2px 0; }
html[data-density="compact"] .cl-items { max-height: 220px; gap: 4px; }
html[data-density="compact"] .cl-item { padding: 5px 7px; gap: 7px; border-radius: 8px; }
html[data-density="compact"] .cl-thumb { width: 20px; height: 20px; border-radius: 5px; }
html[data-density="compact"] .cl-thumb.emoji { font-size: 14px; }
html[data-density="compact"] .cl-chip { padding: 3px 7px; gap: 4px; }
html[data-density="compact"] .cl-chip .cl-glyph { font-size: 10px; }
html[data-density="compact"] .cl-chip-label { display: none; } /* glyph-only chips in glance mode */
html[data-density="compact"] .cl-picker { padding: 7px 9px; border-radius: 9px; }
html[data-density="compact"] .panel.pinned::after { top: 8px; right: 10px; font-size: 11px; }
html[data-density="compact"] .more-apps h3 { font-size: 11px; }
html[data-density="compact"] .connect-card { padding: 10px 12px; }

/* ============================================================
   TILE WIDTH — per-app column span set in Customize mode (the ↔
   toggle; saved in prefs, shared by dashboard + dock + presets).
   Spans only engage when the extra columns actually exist at the
   current window width; otherwise the tile quietly stays normal
   (phone, skinny side dock). Order matters: span-3 rules sit after
   their span-2 counterparts so the bigger size wins when both fit.
   ============================================================ */
@media (min-width: 768px) {
  .panel[data-span="2"], .panel[data-span="3"], .panel[data-span="4"] { grid-column: span 2; }
}
@media (min-width: 620px) {
  html[data-view="dock"] .panel[data-span="2"], html[data-view="dock"] .panel[data-span="3"], html[data-view="dock"] .panel[data-span="4"],
  html[data-density="compact"] .panel[data-span="2"], html[data-density="compact"] .panel[data-span="3"], html[data-density="compact"] .panel[data-span="4"] { grid-column: span 2; }
}
@media (min-width: 1128px) {
  .panel[data-span="3"], .panel[data-span="4"] { grid-column: span 3; }
}
@media (min-width: 920px) {
  html[data-view="dock"] .panel[data-span="3"], html[data-view="dock"] .panel[data-span="4"],
  html[data-density="compact"] .panel[data-span="3"], html[data-density="compact"] .panel[data-span="4"] { grid-column: span 3; }
}
@media (min-width: 1484px) {
  .panel[data-span="4"] { grid-column: span 4; }
}
@media (min-width: 1220px) {
  html[data-view="dock"] .panel[data-span="4"],
  html[data-density="compact"] .panel[data-span="4"] { grid-column: span 4; }
}
/* Full width always works — it just takes the whole row, however many columns. */
.panel[data-span="full"] { grid-column: 1 / -1; }

/* Wide tiles put the room to work: trigger buttons flow into side-by-side
   columns, the checklist header + picker share one row, and checklist items
   fill a grid — so a list-heavy app (CollectX) reads sideways instead of as
   one tall stack. Exactly what a short top-bar dock in OBS needs. */
@media (min-width: 620px) {
  .panel[data-span] .triggers {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-items: start;
  }
  .panel[data-span] .triggers .expander { grid-column: 1 / -1; }
  /* The cutoff line spans the whole grid — parked in one cell it points at
     nothing, and "which controls stay" becomes a guess. */
  .panel[data-span] .triggers .collapse-divider { grid-column: 1 / -1; }
  .panel[data-span] .cl-part-picker {
    display: grid; grid-template-columns: auto 1fr; align-items: center;
  }
  .panel[data-span] .cl-part-picker > .cl-empty { grid-column: 1 / -1; }
  .panel[data-span] .cl-items {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    align-content: start;
  }
}

/* The ↔ width toggle on each tile in Customize mode + its pick-a-width menu. */
.width-toggle { font-size: 12px; font-weight: 700; white-space: nowrap; letter-spacing: .2px; }
.width-pop {
  position: absolute; top: 52px; right: 12px; z-index: 6; min-width: 136px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: #0c0c0c; border: 1px solid var(--border-active); border-radius: 11px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.55); animation: popin 0.18s var(--ease);
}
.width-opt {
  background: none; border: none; color: var(--text); text-align: left;
  padding: 7px 11px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.width-opt:hover { background: var(--surface); }
.width-opt.active { color: var(--accent); background: var(--accent-soft); }
/* Let the menu (and drags) breathe past the card edge while customizing. */
.editing-board .panel { overflow: visible; }

/* Tile blocks — each block gets a slim handle bar in Customize mode:
   drag ⠿ to reorder blocks inside the tile, tap the eye to show/hide. */
.tile-sec.dragging { opacity: 0.4; outline: 2px dashed var(--border-active); outline-offset: 2px; }
.sec-bar {
  display: flex; align-items: center; gap: 6px; margin: 2px 0 7px;
  padding: 3px 6px; border: 1px dashed var(--border); border-radius: 9px;
  background: rgba(255,255,255,0.02);
}
.sec-grip { width: 20px; height: 22px; }
.sec-label {
  flex: 1; font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text2);
}
.sec-eye { font-size: 13px; padding: 2px 6px; }
.tile-sec.sec-off > :not(.sec-bar) { opacity: 0.3; filter: grayscale(0.5); }

/* ---- REDUCED MOTION: still deluxe, just calm. Static glow + depth + gentle
       fades + tactile press. No drift / traveling sheen / spin. ---- */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; opacity: 1; transform: translate3d(-1.5%, 1%, 0) scale(1.08); }
  .panel { animation: cxFade .4s ease backwards; }
  @keyframes cxFade { from { opacity: 0; } to { opacity: 1; } }
  .panel::before { transition: none; }
  .panel:hover::before { background-position: 100% 0; }
  #btn-refresh:hover { transform: none; }
  /* press-compress transforms kept — small + vestibular-safe */
}

/* ─── Top hotbar: stream-wide mode state. The co-stream strip is its first
       resident; future big mode switches (raid mode, ...) join it here. ─── */
.hotbar { margin: 16px 32px 0; }
.hotbar.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s ease-in, transform .2s ease-in; }
.cs-strip {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 20px; border-radius: 14px;
  border: 1px solid var(--border-active);
  background: linear-gradient(180deg, var(--accent-soft), rgba(232,115,42,0.04));
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  animation: cxToolbarIn .35s var(--ease) backwards;
}
.cs-badge {
  display: flex; align-items: center; gap: 8px; flex: none;
  font-size: 12px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent);
}
.cs-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  animation: csPulse 2.2s var(--ease) infinite;
}
@keyframes csPulse {
  0% { box-shadow: 0 0 0 0 rgba(232,115,42,0.45); }
  70% { box-shadow: 0 0 0 9px rgba(232,115,42,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,115,42,0); }
}
.cs-copy { flex: 1; min-width: 0; line-height: 1.45; }
.cs-with { font-size: 15px; font-weight: 700; color: var(--text); }
.cs-owners { font-size: 13px; color: var(--text2); }
.cs-reauth {
  margin-top: 6px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
  width: fit-content; color: #ffd27a;
  background: rgba(224,167,60,0.10); border: 1px solid rgba(224,167,60,0.35);
}
.cs-reauth a { color: #ffd27a; text-decoration: underline; }
.btn.cs-leave {
  flex: none; padding: 12px 22px; font-size: 15px; font-weight: 700;
  background: linear-gradient(180deg, var(--bad), #a83a33); color: #fff; border: none;
}
.btn.cs-leave:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.cs-leave:disabled { opacity: .6; cursor: default; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .cs-dot, .cs-strip { animation: none; }
  .hotbar.leaving { transition: opacity .2s ease-in; transform: none; }
}
/* Dock: same strip, tighter, button full width for a fat tap target. */
html[data-view="dock"] .hotbar { margin: 10px 12px 0; }
html[data-view="dock"] .cs-strip { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
html[data-view="dock"] .cs-copy { flex: 1 1 100%; order: 3; }
html[data-view="dock"] .cs-with { font-size: 13.5px; }
html[data-view="dock"] .cs-owners { font-size: 12px; }
html[data-view="dock"] .btn.cs-leave { margin-left: auto; padding: 10px 16px; font-size: 13.5px; }
