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

:root {
  --bg: #000000;
  --surface: #121212;
  --surface-raised: #1e1e1e;
  --border: #404040;
  --border-active: #8fb3a4;
  --hover-surface: rgba(255, 255, 255, 0.07);
  --hover-border: rgba(255, 255, 255, 0.16);
  --param-group-bg: rgba(255, 255, 255, 0.05);
  --param-group-border: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #949494;
  --connected: #6fcf6f;
  --font-sans: 'Helvetica Neue', Helvetica, 'Arimo', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --wb-library-width: 288px;
  --wb-context-width: 320px;
  --wb-topbar-height: 56px;
}

html, body {
  height: 100%;
}

.wb-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.wb-mobile-gate {
  display: none;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
}

.wb-mobile-gate .wb-logo {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.wb-app {
  display: none;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

@media (max-width: 767px) {
  .wb-mobile-gate { display: flex; }
}

@media (min-width: 768px) {
  .wb-app { display: flex; }
  .wb-mobile-gate { display: none; }
}

.wb-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--wb-library-width) minmax(0, 1fr) var(--wb-context-width);
}

.wb-column {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-column--library {
  border-right: 1px solid #262626;
}

.wb-column--context {
  border-left: 1px solid #262626;
}

.wb-column--editor {
  overflow-y: auto;
}

.wb-stub {
  padding: 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Centred by layout, not by transform.
   The previous `left: 50%; transform: translate(-50%, …)` broke as soon as GSAP
   animated `y`: GSAP takes ownership of `transform` and resolves the -50% into a
   fixed pixel offset measured from the element's width at that instant. Every
   later message with a different length kept that stale offset and sat off-centre
   by half the width difference. Pinning left/right and letting auto margins do
   the centring leaves `transform` entirely to GSAP. */
.wb-toast {
  position: fixed;
  bottom: 80px;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: fit-content;
  max-width: min(90vw, 460px);
  transform: translateY(20px);
  opacity: 0;
  visibility: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  color: var(--text);
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* ── Library → slot drag ghost ── */
.wb-dnd-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 500;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1e1e1e;
  border: 1px solid #8fb3a4;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0.92;
  will-change: transform;
}

.wb-dnd-ghost-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-dnd-ghost-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fb3a4;
}

/* Over the trash the chip switches from "where this lands" to "what this
   costs", so the accent flips before the pointer is released. */
.wb-dnd-ghost--danger {
  border-color: #e08080;
}

.wb-dnd-ghost--danger .wb-dnd-ghost-hint {
  color: #e08080;
}

body.wb-dnd-active {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

body.wb-dnd-active .wb-column--editor {
  opacity: 0.45;
  transition: opacity 0.15s;
  pointer-events: none;
}

body.wb-dnd-active .wb-column--context {
  outline: 1px solid rgba(143, 179, 164, 0.35);
  outline-offset: -1px;
}

body.wb-dnd-active .wb-column--context {
  outline: 1px solid rgba(143, 179, 164, 0.35);
  outline-offset: -1px;
}

body.wb-dnd-active .wb-ctx-slot {
  border-color: rgba(143, 179, 164, 0.28);
  background: rgba(143, 179, 164, 0.04);
}

/* ── Shared modal shell ── */
body.wb-modal-open {
  overflow: hidden;
}

.wb-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wb-modal[hidden] {
  display: none;
}

.wb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wb-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(80dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.wb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.wb-modal-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.wb-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.wb-modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.wb-modal-body {
  padding: 16px 18px 18px;
  overflow-y: auto;
}

/* ── Contact / Get help form ── */
.wb-contact-form {
  display: flex;
  flex-direction: column;
}

.wb-contact-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  border: none;
}

.wb-contact-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wb-contact-radios {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wb-contact-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.wb-contact-radio:has(input:checked) {
  color: var(--text);
}

.wb-contact-radio input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.wb-contact-radio input:checked {
  border-color: var(--border-active);
  background: var(--border-active);
  box-shadow: inset 0 0 0 3px var(--surface-raised);
}

.wb-contact-radio input:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

.wb-contact-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}

.wb-contact-input:hover:not(:focus):not(.wb-contact-input--error) {
  background: var(--hover-surface);
  border-color: var(--hover-border);
}

.wb-contact-input:focus {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.wb-contact-input--error {
  border-color: rgba(224, 128, 128, 0.65);
}

.wb-contact-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
  font-weight: 400;
}

.wb-contact-error {
  font-size: 12px;
  color: #e08080;
  margin: 0;
  line-height: 1.4;
}

.wb-contact-note {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.wb-contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wb-contact-actions .wb-tb-btn--block {
  margin-bottom: 8px;
}

.wb-contact-actions .wb-tb-btn--block:last-child {
  margin-bottom: 0;
}

/* Shared knob ring used by editor column */
.wb-knob-ring::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  background: conic-gradient(
    from 225deg,
    var(--border-active) 0deg,
    var(--border-active) calc(var(--knob-pct, 50) * 2.7deg),
    transparent calc(var(--knob-pct, 50) * 2.7deg)
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  pointer-events: none;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
