/* ===============================================================
   Shift MCP Agent — Visual Pipeline Board & Whiteboard Canvas
   =============================================================== */

/* Edge-to-edge full-screen Whiteboard mode */
.module-overlay.is-board {
  overflow: hidden !important;
  background: var(--c-bg) !important;
}

.module-overlay.is-board .module-window {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  animation: none !important;
}

.module-overlay.is-board .module-header {
  display: none !important;
}

.module-overlay.is-board .module-body {
  height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.board-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--c-bg);
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem 1rem;
  background: var(--c-bg);
  border-bottom: 1.5px solid var(--c-ink);
  gap: 0.8rem;
  flex-wrap: wrap;
  z-index: 100;
  user-select: none;
}

.board-exit-btn {
  border: 1.5px solid var(--c-ink) !important;
  background: transparent !important;
  font-weight: 900 !important;
}

.board-exit-btn:hover {
  background: var(--c-ink) !important;
  color: var(--c-bg) !important;
}

.board-tool-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.board-tool-btn {
  font-family: var(--f-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.65rem;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid rgba(10, 10, 10, 0.12);
  color: var(--c-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  border-radius: 0;
}

.board-tool-btn:hover {
  background: rgba(10, 10, 10, 0.08);
  border-color: var(--c-ink);
}

.board-tool-btn.is-active {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

.board-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(10, 10, 10, 0.3);
  cursor: pointer;
  display: inline-block;
  transition: transform 0.15s ease;
}

.board-color-dot:hover,
.board-color-dot.is-active {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px var(--c-ink);
}

.board-color-dot.color-ink {
  background: #0A0A0A;
}

.board-color-dot.color-red {
  background: #ff003c;
}

.board-color-dot.color-cyan {
  background: #00ffcc;
}

.board-canvas-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--c-bg);
  background-image: radial-gradient(rgba(10, 10, 10, 0.12) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.board-canvas-viewport.is-drawing {
  cursor: crosshair;
}

.board-canvas-viewport.is-eraser {
  cursor: cell;
}

.board-canvas-viewport.is-panning,
.board-canvas-viewport.space-pan-active {
  cursor: grabbing !important;
}

/* Pannable Stage: Contains Nodes and SVG Wires */
.board-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  will-change: transform;
  transform-origin: 0 0;
  contain: layout style;
}

/* Freehand Drawing Canvas: Scaled to viewport, strokes translated via pan */
.board-draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.board-canvas-viewport.is-drawing .board-draw-canvas,
.board-canvas-viewport.is-eraser .board-draw-canvas {
  pointer-events: auto;
}

/* SVG Wires Layer */
.board-svg-wires {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.board-wire-group {
  cursor: pointer;
}

.board-wire-hitbox {
  fill: none;
  stroke: transparent;
  stroke-width: 18px;
  pointer-events: stroke;
  cursor: pointer;
}

.board-wire-path {
  fill: none;
  stroke: var(--c-ink);
  stroke-width: 2.2px;
  stroke-linecap: round;
  pointer-events: stroke;
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

.board-wire-group:hover .board-wire-path {
  stroke: var(--c-glitch-a) !important;
  stroke-width: 3.5px !important;
}

.board-wire-path.is-active {
  stroke: var(--c-glitch-b) !important;
  stroke-width: 3.5px !important;
  stroke-dasharray: 8 4;
  animation: wireFlow 0.8s linear infinite;
}

@keyframes wireFlow {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.board-wire-preview {
  fill: none;
  stroke: var(--c-glitch-b);
  stroke-width: 3px;
  stroke-dasharray: 6 4;
  animation: wireFlow 0.6s linear infinite;
  pointer-events: none;
}

.board-connect-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  background: var(--c-ink);
  color: var(--c-bg);
  border: 1.5px solid var(--c-glitch-b);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  user-select: none;
  pointer-events: auto;
}

.board-connect-banner-cancel {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--c-bg);
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-connect-banner-cancel:hover {
  background: var(--c-glitch-a);
  color: #FFFFFF;
}

.board-layers-sidebar.is-collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  padding: 0 !important;
  display: none !important;
}

.board-node-card.is-selected {
  outline: 2px solid var(--c-ink);
  box-shadow: 6px 6px 0 var(--c-ink) !important;
}

/* Nodes Container */
.board-nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}

.board-workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  width: 100%;
  height: calc(100% - 48px);
  position: relative;
  overflow: hidden;
}

/* Left Sidebar: Projects, Collection Add, and Layers ("слева меню в котором можно создавать новые слои") */
.board-layers-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--c-bg);
  border-right: 1.5px solid var(--c-ink);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 50;
  user-select: none;
  overflow-y: auto;
}

.board-sidebar-section {
  padding: 0.8rem 1rem;
  border-bottom: 1.5px solid var(--c-ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.board-sidebar-title {
  font-family: var(--f-display);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

/* Project Selector ("выбор проекта") */
.board-project-select {
  width: 100%;
  font-family: var(--f-display);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.04);
  border: 1.5px solid var(--c-ink);
  padding: 0.45rem 0.6rem;
  outline: none;
  cursor: pointer;
}

/* Collection Add Button ("плюсик где можно выбрать модуль из коллекции") */
.board-btn-add-collection {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--f-display);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: var(--c-ink);
  color: var(--c-bg);
  border: 1.5px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-btn-add-collection:hover {
  background: var(--c-glitch-b);
  color: var(--c-ink);
  border-color: var(--c-ink);
}

.board-add-plus {
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 900;
}

/* Layers Header & Add Button */
.board-layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-layers-add-btn {
  font-family: var(--f-display);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  background: transparent;
  color: var(--c-ink);
  border: 1.5px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-layers-add-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-layers-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.board-layer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  background: rgba(10, 10, 10, 0.02);
  border: 1px solid rgba(10, 10, 10, 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-layer-card:hover {
  border-color: var(--c-ink);
}

.board-layer-card.is-active {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

.board-layer-card.is-active .board-layer-name,
.board-layer-card.is-active .board-layer-badge {
  color: var(--c-bg);
}

.board-layer-card.is-active .board-layer-action-btn {
  border-color: var(--c-bg);
  color: var(--c-bg);
}

.board-layer-main {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.board-layer-name {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-layer-action-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.board-layer-action-btn {
  background: none;
  border: 1px solid rgba(10, 10, 10, 0.2);
  color: var(--c-ink);
  font-family: var(--f-display);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-layer-action-btn:hover {
  border-color: var(--c-glitch-a);
  color: var(--c-glitch-a);
}

.board-layer-action-btn.is-hidden {
  opacity: 0.45;
  text-decoration: line-through;
}

/* Node Card & Rock-Solid Text Inputs ("ввод текста в блоки не работает" - fixed!) */
.board-node-card {
  position: absolute;
  width: 260px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-ink);
  box-shadow: 4px 4px 0 rgba(10, 10, 10, 0.15);
  pointer-events: auto;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.board-node-card:hover {
  box-shadow: 6px 6px 0 rgba(10, 10, 10, 0.25);
}

.board-node-card.is-running {
  border-color: var(--c-glitch-b);
  box-shadow: 0 0 14px rgba(0, 255, 204, 0.4);
}

.board-node-card.is-completed {
  border-color: #10B981;
}

.board-node-card.is-failed {
  border-color: var(--c-glitch-a);
}

.board-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  background: rgba(10, 10, 10, 0.05);
  border-bottom: 1.5px solid var(--c-ink);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.board-node-header:active {
  cursor: grabbing;
}

.board-node-badge {
  font-family: var(--f-display);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  text-transform: uppercase;
}

.board-node-badge.trigger {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-node-badge.db {
  background: rgba(10, 10, 10, 0.1);
  color: var(--c-ink);
}

.board-node-badge.ai {
  background: var(--c-glitch-b);
  color: var(--c-ink);
}

.board-node-badge.telegram {
  background: #2563EB;
  color: #FFFFFF;
}

.board-node-badge.note {
  background: rgba(255, 0, 60, 0.1);
  color: var(--c-glitch-a);
}

.board-node-badge.condition {
  background: #F59E0B;
  color: #FFFFFF;
}

.board-node-badge.custom,
.board-node-badge.free,
.board-node-badge.logic {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-node-layer-tag {
  font-family: var(--f-display);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--c-ink-muted);
  text-transform: uppercase;
  margin-left: auto;
  margin-right: 0.5rem;
}

.board-node-del-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--c-ink-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.board-node-del-btn:hover {
  color: var(--c-glitch-a);
}

.board-node-body {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.board-node-title-input {
  width: 100%;
  font-family: var(--f-display);
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--c-ink);
  background: transparent;
  border: 1px solid transparent;
  padding: 0.2rem 0.35rem;
  outline: none;
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.board-node-title-input:focus {
  border-color: var(--c-ink);
  background: rgba(10, 10, 10, 0.04);
}

.board-node-desc-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--c-ink);
  line-height: 1.35;
  background: rgba(10, 10, 10, 0.02);
  border: 1px solid rgba(10, 10, 10, 0.1);
  padding: 0.4rem 0.5rem;
  outline: none;
  resize: vertical;
  min-height: 48px;
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.board-node-desc-input:focus {
  border-color: var(--c-ink);
  background: #FFFFFF;
}

.board-node-telemetry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--c-ink-muted);
  margin-top: 0.1rem;
}

/* Module Collection Modal / Library */
.board-collection-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-collection-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.65);
}

.board-collection-dialog {
  position: relative;
  width: 90vw;
  max-width: 720px;
  max-height: 85dvh;
  background: var(--c-bg);
  border: 2px solid var(--c-ink);
  box-shadow: 12px 12px 0 var(--c-ink);
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: modFloatingFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.board-collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 2px solid var(--c-ink);
  background: rgba(10, 10, 10, 0.03);
}

.board-collection-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.board-collection-tag {
  font-family: var(--f-display);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--c-ink-muted);
}

.board-collection-title {
  font-family: var(--f-display);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--c-ink);
  margin: 0;
}

.board-collection-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--c-ink);
  cursor: pointer;
  line-height: 1;
}

.board-collection-close-btn:hover {
  color: var(--c-glitch-a);
}

.board-collection-body {
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.board-catalog-category {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.board-catalog-cat-title {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

.board-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
}

.board-catalog-card {
  padding: 0.8rem;
  background: rgba(10, 10, 10, 0.02);
  border: 1.5px solid rgba(10, 10, 10, 0.15);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.board-catalog-card:hover {
  border-color: var(--c-ink);
  background: rgba(10, 10, 10, 0.06);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--c-ink);
}

.board-catalog-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-catalog-card-title {
  font-family: var(--f-display);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--c-ink);
}

.board-catalog-card-desc {
  font-size: 0.68rem;
  color: var(--c-ink-mid);
  line-height: 1.35;
}

/* Ports on left and right edges ("связей может быть несколько") */
.board-port {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-bg);
  border: 2px solid var(--c-ink);
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
}

.board-port:hover,
.board-port.is-connecting {
  background: var(--c-glitch-b);
  border-color: var(--c-ink);
  transform: translateY(-50%) scale(1.35);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.8);
}

.board-port-in {
  left: -9px;
}

.board-port-out {
  right: -9px;
  color: var(--c-ink);
}

.board-port.has-wires {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-port .port-count {
  font-size: 0.5rem;
  font-weight: 900;
  color: var(--c-bg);
}

/* Layer Isolation ("слои, должны быть изолированными") */
.board-layer-isolate-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--f-display);
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--c-ink);
  cursor: pointer;
  padding: 0.25rem 0;
  margin-top: 0.25rem;
  user-select: none;
}

.board-layer-isolate-toggle input {
  accent-color: var(--c-ink);
  cursor: pointer;
}

.board-node-card.is-inactive-layer {
  opacity: 0.35 !important;
  filter: grayscale(80%);
  pointer-events: none !important;
  border-style: dashed !important;
  box-shadow: none !important;
}

.board-node-locked-badge {
  font-family: var(--f-display);
  font-size: 0.55rem;
  font-weight: 900;
  color: var(--c-glitch-a);
  background: rgba(255, 0, 60, 0.1);
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--c-glitch-a);
}

.board-node-layer-tag {
  cursor: pointer;
  transition: color 0.15s ease;
}

.board-node-layer-tag:hover {
  color: var(--c-ink);
  text-decoration: underline;
}

/* Connection Source & Target Highlights */
.board-node-card.is-connect-source {
  border-color: var(--c-glitch-b) !important;
  box-shadow: 0 0 16px rgba(0, 255, 204, 0.6) !important;
}

.board-node-card.is-connect-target {
  cursor: pointer;
  border-color: rgba(0, 255, 204, 0.7);
}

.board-node-card.is-connect-target:hover {
  border-color: var(--c-glitch-b) !important;
  box-shadow: 0 0 14px rgba(0, 255, 204, 0.5) !important;
}

/* Wires / Connections Pill List on Card ("связей может быть несколько") */
.board-node-wires-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
  padding-top: 0.25rem;
  border-top: 1px dashed rgba(10, 10, 10, 0.12);
}

.board-wire-pill {
  font-family: var(--f-display);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid rgba(10, 10, 10, 0.2);
  padding: 0.1rem 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-wire-pill:hover {
  background: var(--c-glitch-a);
  color: #FFFFFF;
  border-color: var(--c-glitch-a);
}

/* Floating Pan & Zoom HUD ("немного перетаскивать экран", "зум") */
.board-pan-hud {
  position: absolute;
  bottom: 0.8rem;
  right: 0.8rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--c-bg);
  border: 1.5px solid var(--c-ink);
  padding: 0.3rem 0.45rem;
  box-shadow: 3px 3px 0 rgba(10, 10, 10, 0.15);
  user-select: none;
}

.board-hud-group {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.board-hud-sep {
  width: 1px;
  height: 18px;
  background: rgba(10, 10, 10, 0.2);
  margin: 0 0.15rem;
}

.board-hud-btn {
  background: transparent;
  border: 1px solid rgba(10, 10, 10, 0.3);
  color: var(--c-ink);
  font-family: var(--f-display);
  font-size: 0.68rem;
  font-weight: 900;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-hud-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-hud-btn.is-primary {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-pan-coord {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--c-ink-muted);
  padding-left: 0.35rem;
}

.board-btn-add-free {
  background: var(--c-ink) !important;
  color: var(--c-bg) !important;
}

.board-btn-add-free .board-add-plus {
  background: var(--c-bg) !important;
  color: var(--c-ink) !important;
}



/* --- MOBILE OPTIMIZATIONS (100dvh, Safe Areas, Touch Targets) --- */

@media (max-width: 768px) {
  /* 1. Ensure viewport is strictly 100dvh and no pull-to-refresh */
  body, html {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100vw;
    touch-action: none; /* disable browser pull-to-refresh globally */
  }

  /* 2. Safe Area Insets for HUD and floating elements */
  .board-pan-hud {
    bottom: calc(env(safe-area-inset-bottom, 16px) + 12px) !important;
    right: calc(env(safe-area-inset-right, 16px) + 12px) !important;
    left: auto !important;
    width: auto !important;
    max-width: calc(100vw - 24px);
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px 6px;
    box-shadow: 3px 3px 0 rgba(10, 10, 10, 0.2);
  }

  /* 3. Touch Ergonomics: 44x44px min targets */
  .board-tool-btn, .action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  
  /* Active feedback for touch */
  .board-tool-btn:active, .action-btn:active, .board-catalog-card:active {
    transform: scale(0.95);
    transition: transform 0.05s ease;
  }

  /* 4. Fullscreen Modules on Mobile */
  .module-window {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border: none;
    border-radius: 0;
    margin: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
  }

  .module-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scrolling */
  }

  /* 5. One column Catalog for easy reachability */
  .board-catalog-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .board-catalog-card {
    min-height: 80px; /* easier to tap */
  }
  
  /* 6. Nodes and Ports easier to tap */
  .board-port {
    width: 32px;
    height: 32px;
    transform: none !important; /* prevent visual overlap */
  }
  .board-port-in { left: -16px; margin-top: -16px; }
  .board-port-out { right: -16px; margin-top: -16px; }
  
  .board-node-header {
    padding: 12px 16px;
  }
}
.module-body { touch-action: pan-y !important; }
.board-collection-dialog { touch-action: pan-y !important; }

@media (max-width: 768px) {
  /* Prevent iOS zoom on focus */
  input, textarea, select, .board-node-title-input, .board-node-desc-input {
    font-size: 16px !important;
  }
}
/* --- MOBILE LAYOUT FIXES --- */

@media (max-width: 768px) {
  /* 1. Top Toolbar: single row, horizontal scroll */
  .board-toolbar {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 12px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
  }
  .board-toolbar::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
  }

  /* 2. Sidebar: Hide or make it a drawer / bottom sheet */
  .board-sidebar {
    display: none !important; /* Temporarily hide on mobile to free space */
  }

  /* 3. Board Container: Adjust flex to take full remaining space */
  .board-wrapper {
    flex-direction: column !important;
  }
}
/* --- MOBILE LAYOUT FIXES --- */

@media (max-width: 768px) {
  /* 1. Top Toolbar: single row, horizontal scroll */
  .board-toolbar {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 12px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
  }
  .board-toolbar::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
  }

  /* 2. Sidebar: Hide or make it a drawer / bottom sheet */
  .board-sidebar {
    display: none !important; /* Temporarily hide on mobile to free space */
  }

  /* 3. Board Container: Adjust flex to take full remaining space */
  .board-wrapper {
    flex-direction: column !important;
  }
}

@media (max-width: 768px) {
  .board-workspace {
    flex-direction: column !important;
  }
  
  .board-layers-sidebar {
    display: none !important; /* Hide sidebar completely to save space for the board */
  }

  .board-canvas-viewport {
    width: 100vw !important;
    height: 100% !important;
    flex: 1 !important;
  }
}

@media (max-width: 768px) {
  .board-tool-group {
    flex-wrap: nowrap !important;
  }
}

/* --- MOBILE SIDEBAR TOGGLE --- */
@media (max-width: 768px) {
  #btn-mobile-sidebar-toggle {
    display: flex !important;
    font-weight: 800;
    color: var(--c-ink);
  }

  .board-layers-sidebar {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 280px !important;
    height: 100% !important;
    z-index: 1000 !important;
    background: var(--c-bg) !important;
    border-right: 2px solid var(--c-ink) !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex !important; /* override the display: none */
  }

  .board-layers-sidebar.is-mobile-open {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  /* Hide the generic module header for the board so it doesn't waste space and cause accidental exits */
  .module-overlay.is-board .module-header {
    display: none !important;
  }
}

/* ========================================================
   CUSTOM PROJECT PICKER & MODAL (EDITORIAL BRUTALISM)
   ======================================================== */
.board-project-picker {
  position: relative;
  width: 100%;
}

.board-project-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: var(--f-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.04);
  border: 1.5px solid var(--c-ink);
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.board-project-trigger:hover {
  background: rgba(10, 10, 10, 0.08);
}

.board-project-trigger:active {
  transform: scale(0.98);
}

.board-project-caret {
  font-size: 0.75rem;
  font-weight: 900;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.board-project-picker.is-open .board-project-caret {
  transform: rotate(180deg);
}

/* Custom Dropdown Menu (No OS picker) */
.board-project-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 180px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-ink);
  box-shadow: 4px 4px 0 var(--c-ink);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: boardFadeIn 0.15s ease-out;
}

.board-project-picker.is-open .board-project-menu {
  display: flex;
}

@keyframes boardFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.board-project-list {
  max-height: 200px;
  overflow-y: auto;
}

.board-project-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  font-family: var(--f-display);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--c-ink);
  border-bottom: 1px solid rgba(10, 10, 10, 0.06);
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.board-project-item:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-project-item.is-active {
  background: rgba(10, 10, 10, 0.08);
  font-weight: 900;
}

.board-project-item.is-active:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-project-mark {
  font-size: 0.7rem;
  color: var(--c-glitch-b);
}

.board-project-item:hover .board-project-mark {
  color: var(--c-glitch-b);
}

.board-project-add-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.6rem 0.65rem;
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.03);
  border: none;
  border-top: 1.5px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.board-project-add-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.board-project-add-plus {
  font-size: 0.85rem;
  font-weight: 900;
}

/* Custom Minimalist Modal Dialog */
.board-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.board-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.65);
}

.board-modal-box {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--c-bg);
  border: 2px solid var(--c-ink);
  box-shadow: 6px 6px 0 var(--c-ink);
  padding: 1.2rem;
  animation: boardModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes boardModalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.board-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.board-modal-tag {
  font-family: var(--f-display);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--c-ink-muted);
}

.board-modal-title {
  margin: 0;
  font-family: var(--f-display);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--c-ink);
}

.board-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-ink);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}

.board-modal-label {
  display: block;
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--c-ink-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.board-modal-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-family: var(--f-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--c-ink);
  background: #FFFFFF;
  border: 1.5px solid var(--c-ink);
  outline: none;
  box-sizing: border-box;
}

.board-modal-input:focus {
  border-color: var(--c-glitch-b);
  box-shadow: 0 0 0 2px rgba(0, 255, 204, 0.35);
}

.board-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.board-modal-btn {
  padding: 0.5rem 0.9rem;
  font-family: var(--f-display);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.board-modal-btn.is-cancel {
  background: transparent;
  border: 1.5px solid var(--c-ink);
  color: var(--c-ink);
}

.board-modal-btn.is-cancel:hover {
  background: rgba(10, 10, 10, 0.08);
}

.board-modal-btn.is-submit {
  background: var(--c-ink);
  border: 1.5px solid var(--c-ink);
  color: var(--c-bg);
}

.board-modal-btn.is-submit:hover {
  background: var(--c-glitch-b);
  color: var(--c-ink);
}

/* ========================================================
   Action Card & Action Recorder (Сбор действий & UI автоматизация)
   ======================================================== */

.board-node-card.is-action-card {
  width: 290px;
  border-left: 4px solid var(--c-glitch-b);
}

.board-node-badge.action {
  background: var(--c-glitch-b);
  color: var(--c-ink);
  font-weight: 900;
  letter-spacing: 0.06em;
}

/* Action Type Tabs */
.action-type-tabs {
  display: flex;
  gap: 2px;
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid var(--c-ink);
  padding: 2px;
  margin-bottom: 8px;
}

.action-type-tab {
  flex: 1;
  font-family: var(--f-display);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 2px;
  background: transparent;
  color: var(--c-ink);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.action-type-tab:hover {
  background: rgba(10, 10, 10, 0.1);
}

.action-type-tab.is-active {
  background: var(--c-ink);
  color: var(--c-bg);
}

/* Action Fields */
.action-field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.action-field-label {
  font-family: var(--f-display);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

.action-target-input,
.action-value-input {
  width: 100%;
  font-family: var(--f-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 7px;
  border: 1px solid var(--c-ink);
  background: #FFFFFF;
  color: var(--c-ink);
  outline: none;
  box-sizing: border-box;
}

.action-target-input:focus,
.action-value-input:focus {
  border-color: var(--c-glitch-b);
  box-shadow: 0 0 0 1px var(--c-ink);
}

.action-sub-options {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-click-mode-select {
  flex: 1;
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 5px;
  border: 1px solid var(--c-ink);
  background: #FFFFFF;
  color: var(--c-ink);
  outline: none;
  cursor: pointer;
}

.action-dir-buttons {
  display: flex;
  gap: 3px;
}

.action-dir-btn {
  flex: 1;
  font-family: var(--f-display);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 4px 2px;
  border: 1px solid var(--c-ink);
  background: transparent;
  color: var(--c-ink);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.action-dir-btn:hover {
  background: rgba(10, 10, 10, 0.08);
}

.action-dir-btn.is-active {
  background: var(--c-glitch-b);
  color: var(--c-ink);
  font-weight: 900;
  border-color: var(--c-ink);
}

/* Card Action Footer */
.action-card-footer {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(10, 10, 10, 0.2);
}

.action-test-btn {
  font-family: var(--f-display);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 4px 8px;
  background: var(--c-ink);
  color: var(--c-bg);
  border: 1px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.action-test-btn:hover {
  background: var(--c-glitch-b);
  color: var(--c-ink);
}

.action-chain-next-btn {
  flex: 1;
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 4px 6px;
  background: transparent;
  color: var(--c-ink);
  border: 1px solid var(--c-ink);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.action-chain-next-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

/* Floating Action Recorder Dock (Панель быстрой записи / сбора действий) */
.board-action-recorder-dock {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-bg);
  border: 2px solid var(--c-ink);
  box-shadow: 6px 6px 0 var(--c-ink);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 100;
  user-select: none;
  max-width: 94vw;
  flex-wrap: wrap;
}

.recorder-dock-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding-right: 6px;
  border-right: 1.5px solid var(--c-ink);
}

.recorder-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-glitch-a);
  animation: recPulse 1.2s ease-in-out infinite alternate;
}

@keyframes recPulse {
  0% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.15); }
}

.recorder-dock-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.recorder-action-btn {
  font-family: var(--f-display);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 4px 8px;
  background: var(--c-bg);
  color: var(--c-ink);
  border: 1.5px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.recorder-action-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.recorder-action-btn:active {
  transform: scale(0.96);
}

.recorder-close-btn {
  font-size: 1.1rem;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--c-ink);
  cursor: pointer;
  padding: 2px 6px;
  font-weight: 900;
}

.recorder-close-btn:hover {
  color: var(--c-glitch-a);
}

/* ========================================================
   Custom Fields Constructor (Конструктор полей: ввод, галочка и т.д.)
   ======================================================== */

.board-custom-fields-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(10, 10, 10, 0.2);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.custom-fields-title {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

.custom-fields-add-btns {
  display: flex;
  gap: 3px;
}

.btn-add-field-action {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 4px;
  background: rgba(10, 10, 10, 0.05);
  color: var(--c-ink);
  border: 1px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-add-field-action:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.custom-fields-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: rgba(10, 10, 10, 0.03);
  border: 1px solid rgba(10, 10, 10, 0.15);
  padding: 3px 5px;
}

.custom-field-row:hover {
  border-color: var(--c-ink);
}

.custom-field-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.field-input-checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--c-ink);
  cursor: pointer;
  flex-shrink: 0;
}

.custom-field-editable-label {
  font-family: var(--f-display);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  border-bottom: 1px dotted transparent;
}

.custom-field-editable-label:hover,
.custom-field-editable-label:focus {
  border-bottom-color: var(--c-ink);
  background: rgba(255, 255, 255, 0.6);
}

.custom-field-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.field-input-text,
.field-input-number {
  flex: 1;
  min-width: 0;
  font-family: var(--f-body);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 4px;
  border: 1px solid var(--c-ink);
  background: #FFFFFF;
  color: var(--c-ink);
  outline: none;
}

.custom-field-del-btn {
  font-size: 0.9rem;
  line-height: 1;
  color: var(--c-ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
}

.custom-field-del-btn:hover {
  color: var(--c-glitch-a);
}

.board-node-card.is-form-card {
  border-width: 2px;
  border-color: var(--c-ink);
  min-width: 260px;
}

.board-node-badge.form {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

.custom-fields-empty-hint {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 700;
  color: var(--c-ink-muted);
  text-align: center;
  padding: 6px 4px;
  background: rgba(10, 10, 10, 0.02);
  border: 1px dashed rgba(10, 10, 10, 0.15);
}

/* ========================================================
   Modular Note Capabilities: Добавление функционала в записку
   ======================================================== */

.board-block-add-capability {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed rgba(10, 10, 10, 0.15);
}

.add-capability-label {
  font-family: var(--f-display);
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--c-ink-muted);
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.btn-add-capability {
  font-family: var(--f-display);
  font-size: 0.52rem;
  font-weight: 800;
  padding: 2px 6px;
  background: rgba(10, 10, 10, 0.04);
  color: var(--c-ink);
  border: 1px solid rgba(10, 10, 10, 0.25);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-add-capability:hover {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

.btn-remove-section {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--c-ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
  transition: color 0.12s ease;
}

.btn-remove-section:hover {
  color: var(--c-glitch-a);
}

/* Mode: Output / Display */
.board-output-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.output-title {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

.output-format-tabs {
  display: flex;
  gap: 2px;
}

.btn-output-fmt {
  font-family: var(--f-display);
  font-size: 0.5rem;
  font-weight: 800;
  padding: 1px 4px;
  border: 1px solid var(--c-ink);
  background: none;
  color: var(--c-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-output-fmt.is-active {
  background: var(--c-ink);
  color: var(--c-bg);
}

.output-display-box {
  width: 100%;
  box-sizing: border-box;
  font-family: monospace;
  font-size: 0.65rem;
  line-height: 1.35;
  padding: 5px 6px;
  background: #0A0A0A;
  color: #00FFCC;
  border: 1px solid var(--c-ink);
  resize: vertical;
  min-height: 52px;
  max-height: 140px;
  outline: none;
}

/* Mode: Menu / Choice Options */
.board-menu-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.menu-title {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

.btn-add-menu-option {
  font-family: var(--f-display);
  font-size: 0.54rem;
  font-weight: 800;
  padding: 2px 4px;
  background: rgba(10, 10, 10, 0.05);
  color: var(--c-ink);
  border: 1px solid var(--c-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-add-menu-option:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.menu-options-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.menu-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 5px;
  background: rgba(10, 10, 10, 0.03);
  border: 1px solid rgba(10, 10, 10, 0.15);
  cursor: pointer;
  transition: all 0.12s ease;
}

.menu-option-row:hover {
  border-color: var(--c-ink);
}

.menu-option-row.is-selected {
  background: rgba(10, 10, 10, 0.08);
  border-color: var(--c-ink);
  font-weight: 800;
}

.menu-radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.menu-radio-input {
  width: 13px;
  height: 13px;
  accent-color: var(--c-ink);
  cursor: pointer;
  flex-shrink: 0;
}

.menu-editable-label {
  font-family: var(--f-display);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  border-bottom: 1px dotted transparent;
}

.menu-editable-label:hover,
.menu-editable-label:focus {
  border-bottom-color: var(--c-ink);
  background: rgba(255, 255, 255, 0.6);
}

.menu-option-del-btn {
  font-size: 0.9rem;
  line-height: 1;
  color: var(--c-ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
}

.menu-option-del-btn:hover {
  color: var(--c-glitch-a);
}
