/* ==========================================================================
   MILIASTRA LUA API — BRUTALIST COFFEE & GOLD AESTHETIC (ELDEN / ALTUS PALETTE)
   Clean, professional documentation, collapsible methods, live editor
   ========================================================================== */

:root {
  --bg-main: #241f1a;      /* Dark Brown Paper */
  --bg-workspace: #1c1814; /* Deepened workspace */
  --bg-secondary: #2e2821; /* Lighter bark/paper for headers */
  --bg-card: #201b17;
  --bg-code: #100d0a;
  --bg-hover: #2d261f;
  --bg-active: #382f25;

  --text-primary: #a18a5e; /* Burnished Elden Gold */
  --text-bright: #eed9ab;  /* Grace of Gold */
  --text-muted: #756345;   /* Weathered Parchment */
  --text-dim: #544631;     /* Charcoal Bark */
  --text-code: #dcd0ba;

  --border-gold: #483b27;
  --border-gold-bright: #a18a5e;
  --border-subtle: #332a1d;
  
  --accent-gold: #c4a059;
  --accent-red: #c95c52;
  --accent-green: #6ca876;
  --accent-cyan: #5fa8b8;
  --accent-purple: #ab85cc;
  --accent-orange: #d9884e;

  --font-mono: 'JetBrains Mono', 'Space Mono', monospace;
  --font-title: 'Cinzel', serif, var(--font-mono);
  
  --shadow-brutal: 3px 3px 0px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 0 12px rgba(161, 138, 94, 0.15);
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-workspace);
  border-left: 1px solid var(--border-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--border-gold);
  border: 1px solid var(--bg-workspace);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-gold-bright);
}

/* Selection */
::selection {
  background: #a18a5e44;
  color: #fff2d1;
}

/* Base App Layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-main);
  overflow: hidden;
}

/* Top Banner / Header */
.codex-header {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-gold);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

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

.brand-symbol {
  font-size: 18px;
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(196, 160, 89, 0.5);
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-bright);
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  border-left: 1px solid var(--border-gold);
  padding-left: 10px;
  margin-left: 4px;
}

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

.stat-pill {
  font-size: 11px;
  background: var(--bg-workspace);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  color: var(--text-muted);
}
.stat-pill strong {
  color: var(--text-bright);
}

/* Nav Tabs */
.codex-nav {
  display: flex;
  background: var(--bg-workspace);
  border-bottom: 1px solid var(--border-gold);
  padding: 0 12px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--text-bright);
  border-bottom-color: var(--border-gold-bright);
  background: var(--bg-secondary);
}

/* Main Workspace */
.codex-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Left Sidebar - Search & Explorer */
.codex-sidebar {
  width: 380px;
  min-width: 280px;
  max-width: 500px;
  background: var(--bg-workspace);
  border-right: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.search-box-container {
  padding: 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-code);
  border: 1px solid var(--border-gold-bright);
  padding: 6px 10px;
  gap: 8px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

.search-icon {
  color: var(--text-bright);
  font-size: 14px;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-shortcut-hint {
  font-size: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  color: var(--text-muted);
  padding: 1px 4px;
  border-radius: 2px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.1s ease;
}

.filter-pill:hover {
  border-color: var(--text-primary);
  color: var(--text-bright);
}

.filter-pill.active {
  background: var(--text-primary);
  color: #100d0a;
  font-weight: 700;
  border-color: var(--text-bright);
}

/* Sidebar List */
.items-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.item-row {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  gap: 8px;
  transition: background 0.1s ease;
  user-select: none;
}

.item-row:hover {
  background: var(--bg-hover);
  border-left-color: var(--border-gold);
}

.item-row.selected {
  background: var(--bg-secondary);
  border-left-color: var(--border-gold-bright);
}

.item-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border: 1px solid var(--border-gold);
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge-func { color: var(--accent-orange); border-color: rgba(217, 136, 78, 0.4); }
.badge-field { color: var(--accent-cyan); border-color: rgba(95, 168, 184, 0.4); }
.badge-enum { color: var(--accent-purple); border-color: rgba(171, 133, 204, 0.4); }
.badge-class { color: var(--accent-gold); border-color: rgba(196, 160, 89, 0.4); }
.badge-global { color: var(--accent-red); border-color: rgba(201, 92, 82, 0.4); }
.badge-example { color: var(--accent-green); border-color: rgba(108, 168, 118, 0.4); }

.item-text-wrap {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-parent {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-results {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Right Content Area */
.codex-content {
  flex: 1;
  background: var(--bg-main);
  overflow-y: auto;
  padding: 24px 32px 64px;
  display: flex;
  flex-direction: column;
}

/* Section Headers */
.section-header {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header:first-of-type {
  margin-top: 4px;
}

.section-header .sub-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
}

/* Doc Entry Header Banner */
.doc-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-brutal);
}

.doc-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.doc-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--accent-gold);
}

.doc-source-file {
  font-size: 11px;
  color: var(--text-muted);
}

.doc-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
  font-family: var(--font-mono);
  word-break: break-word;
}

.doc-subtitle {
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 4px;
}

.doc-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Brutalist Buttons */
.brutal-btn {
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.1s ease;
}

.brutal-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
}

.brutal-btn:active {
  transform: translate(1px, 1px);
}

.brutal-btn-gold {
  background: var(--bg-secondary);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
}
.brutal-btn-gold:hover {
  background: var(--text-primary);
  color: #1c1814;
}

/* ==========================================================================
   COLLAPSIBLE PROPERTIES & FIELDS ACCORDION
   ========================================================================== */

.fields-accordion-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-gold);
  margin-bottom: 24px;
}

.field-accordion-item {
  border-bottom: 1px solid var(--border-gold);
  background: transparent;
  transition: background 0.12s ease;
}

.field-accordion-item:hover {
  background: rgba(46, 40, 33, 0.4);
}

.field-accordion-item.highlighted-item {
  background: rgba(161, 138, 94, 0.12);
  border-left: 3px solid var(--border-gold-bright);
}

.field-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  gap: 12px;
}

.field-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.field-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  cursor: pointer;
}

.field-type-badge {
  color: var(--accent-cyan);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.field-signature-code {
  font-size: 13.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.field-type-tag {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.field-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.field-accordion-body {
  padding: 8px 14px 14px 38px;
  border-top: 1px dashed var(--border-subtle);
  background: rgba(28, 24, 20, 0.6);
}

.field-desc-text {
  font-size: 13px;
  color: var(--text-code);
  margin-bottom: 8px;
  line-height: 1.5;
}

.field-meta-row {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.access-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  display: inline-block;
}

.access-tween {
  color: var(--accent-orange);
  background: rgba(217, 136, 78, 0.12);
  border: 1px solid rgba(217, 136, 78, 0.4);
}

.access-rw {
  color: var(--accent-gold);
  background: rgba(196, 160, 89, 0.12);
  border: 1px solid rgba(196, 160, 89, 0.4);
}

.access-ro {
  color: var(--text-muted);
  background: rgba(117, 99, 69, 0.12);
  border: 1px solid rgba(117, 99, 69, 0.3);
}

/* ==========================================================================
   COLLAPSIBLE METHODS ACCORDION (LINE SEPARATED, NO HEAVY BOXES)
   ========================================================================== */

.methods-accordion-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-gold);
  margin-bottom: 24px;
}

.method-accordion-item {
  border-bottom: 1px solid var(--border-gold);
  background: transparent;
  transition: background 0.12s ease;
}

.method-accordion-item:hover {
  background: rgba(46, 40, 33, 0.4);
}

.method-accordion-item.highlighted-item {
  background: rgba(161, 138, 94, 0.12);
  border-left: 3px solid var(--border-gold-bright);
}

.method-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  gap: 12px;
}

.method-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.method-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  cursor: pointer;
}

.method-type-badge {
  color: var(--accent-orange);
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.method-signature-text {
  font-size: 13.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.method-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.method-returns-tag {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.method-accordion-body {
  padding: 8px 14px 16px 38px;
  border-top: 1px dashed var(--border-subtle);
  background: rgba(28, 24, 20, 0.6);
}

.method-desc-text {
  font-size: 13px;
  color: var(--text-code);
  margin-bottom: 10px;
  line-height: 1.5;
}

.method-params-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 10px 0 4px;
}

/* Tables */
.ledger-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid var(--border-gold);
  background: var(--bg-workspace);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.ledger-table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-gold);
  border-right: 1px solid var(--border-gold);
}
.ledger-table th:last-child {
  border-right: none;
}

.ledger-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-code);
}
.ledger-table td:last-child {
  border-right: none;
}

.ledger-table tr:last-child td {
  border-bottom: none;
}

.ledger-table tr:hover td {
  background: rgba(161, 138, 94, 0.04);
}

.field-row.highlighted-row {
  background: rgba(161, 138, 94, 0.15) !important;
  border-left: 3px solid var(--border-gold-bright);
}

.type-tag {
  color: var(--accent-purple);
  font-weight: 500;
}

.param-name {
  color: var(--text-bright);
  font-weight: 700;
}

/* Blockquotes */
.echo-blockquote {
  border-left: 4px solid var(--border-gold-bright);
  background: var(--bg-workspace);
  padding: 10px 16px;
  margin: 12px 0;
  color: var(--text-bright);
  font-style: italic;
  font-size: 12.5px;
}

/* Lists & Tasks */
.inventory-list {
  list-style: none;
  margin: 10px 0 16px;
  padding-left: 4px;
}

.inventory-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 5px;
  color: var(--text-code);
}

.inventory-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--text-primary);
}

.inventory-list.numbered {
  counter-reset: inventory-counter;
}
.inventory-list.numbered li {
  counter-increment: inventory-counter;
}
.inventory-list.numbered li::before {
  content: counter(inventory-counter) ".";
  left: 0;
  color: var(--text-primary);
  font-size: 11px;
}

.task-list {
  list-style: none;
  margin: 10px 0 16px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-code);
}

.task-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-gold-bright);
  text-align: center;
  line-height: 12px;
  font-size: 10px;
  color: var(--text-bright);
  background: var(--bg-workspace);
  font-weight: bold;
}

/* Code Blocks & Inline */
.inline-rune {
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  display: inline-block;
}

.code-block-wrapper {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  margin: 10px 0 14px;
  box-shadow: var(--shadow-brutal);
}

.code-block-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
}

.code-block-title {
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-container {
  padding: 10px 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-code);
}

.code-container pre {
  margin: 0;
  font-family: inherit;
}

/* Syntax Highlighting */
.hl-kw { color: #e58282; font-weight: bold; }          /* keywords: function, local, if, return, end */
.hl-str { color: #8ec07c; }                             /* strings */
.hl-num { color: #83a598; }                             /* numbers */
.hl-com { color: #a4916c; font-style: italic; }         /* comments - visible warm parchment/gold */
.hl-doc { color: #b892e8; }                             /* annotations: ---@param, ---@return */
.hl-builtin { color: #fabd2f; font-weight: bold; }      /* game, script, Color, Enum */
.hl-enum-type { color: #d3869b; font-weight: 600; }     /* Enum.KeyEventType, Enum.EaseType */
.hl-enum-val { color: #b8bb26; font-weight: 500; }      /* CursorClick, OutQuad, KeyboardJumpKeyDown */
.hl-fn { color: #eed9ab; }                              /* function names */
.hl-op { color: #a18a5e; }                              /* operators +, -, ==, :, . */
.hl-bool { color: #d3869b; }                            /* true, false, nil */
.hl-type { color: #b8bb26; }                            /* type names */

/* Enhanced IDE Signature Tokens */
.hl-obj { color: #eed9ab; font-weight: 500; }           /* caller object: control, script, image */
.hl-fn-name { color: #fabd2f; font-weight: 700; }       /* method name: AddKeyEventListener */
.hl-field-name { color: #eed9ab; font-weight: 700; }    /* field name: anchoredPositionX */
.hl-param { color: #83a598; font-weight: 500; }         /* parameters in signature: eventType, callback */
.hl-paren { color: #a18a5e; font-weight: 700; }         /* parentheses: (, ) */
.hl-type-prim { color: #8ec07c; font-weight: 600; }     /* primitive types: boolean, number, string, void */
.hl-type-custom { color: #b892e8; font-weight: 600; }   /* engine types: ClientControlType, Tween, Vector3 */


/* Line Numbering for Code Blocks */
.code-with-lines {
  display: table;
  width: 100%;
}
.code-line {
  display: table-row;
}
.line-num {
  display: table-cell;
  width: 36px;
  text-align: right;
  padding-right: 12px;
  color: var(--text-dim);
  user-select: none;
  font-size: 11px;
  border-right: 1px solid var(--border-subtle);
}
.line-content {
  display: table-cell;
  padding-left: 10px;
}

/* Toast Feedback */
.rune-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold-bright);
  color: var(--text-bright);
  padding: 8px 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastFadeIn 0.2s ease-out;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   LIVE SYNTAX-HIGHLIGHTED SCRATCHPAD EDITOR
   ========================================================================== */

.scratchpad-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
}

.scratchpad-container.scratchpad-full-shell {
  padding: 10px 14px;
  background: var(--bg-workspace);
}

.scratchpad-toolbar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  padding: 6px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.scratchpad-source-pill {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
}

.sp-new-doc-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold-bright);
  padding: 3px 8px;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.65);
}

.sp-new-doc-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sp-new-doc-input {
  width: 170px;
  background: #120f0c;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 7px;
  outline: none;
}

.sp-new-doc-input:focus {
  border-color: var(--border-gold-bright);
}

.editor-frame-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-gold-bright);
  box-shadow: var(--shadow-brutal);
  background: var(--bg-code);
  overflow: hidden;
}

#snippet-select,
select.brutal-btn {
  background: var(--bg-workspace) !important;
  border: 1px solid var(--border-gold) !important;
  color: var(--text-bright) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 5px 10px !important;
  cursor: pointer !important;
  outline: none !important;
  transform: none !important;
  transition: background-color 0.12s ease, border-color 0.12s ease !important;
  appearance: menulist !important;
  -webkit-appearance: menulist !important;
  box-shadow: none !important;
}

#snippet-select:hover,
select.brutal-btn:hover {
  background: var(--bg-hover) !important;
  border-color: var(--border-gold-bright) !important;
}

#snippet-select:focus,
#snippet-select:active,
select.brutal-btn:focus,
select.brutal-btn:active {
  transform: none !important;
  outline: none !important;
  border-color: var(--border-gold-bright) !important;
}

#snippet-select option {
  background: var(--bg-workspace);
  color: var(--text-bright);
  padding: 6px 10px;
}

.editor-wrapper {
  display: flex;
  flex: 1;
  min-height: 280px;
  background: var(--bg-code);
  position: relative;
  overflow: hidden;
}

.editor-gutter {
  width: 48px;
  background: var(--bg-workspace);
  border-right: 1px solid var(--border-gold);
  color: var(--text-dim);
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
  font-size: 13px !important;
  line-height: 20px !important;
  letter-spacing: 0px !important;
  font-feature-settings: 'calt' 0, 'liga' 0 !important;
  font-variant-ligatures: none !important;
  padding: 12px 6px;
  text-align: right;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.gutter-line {
  height: 20px;
  line-height: 20px;
}

.gutter-line.active {
  color: var(--accent-gold);
  font-weight: 700;
}

#editor-gutter-inner,
#editor-code-output,
#editor-find-output {
  display: block;
  will-change: transform;
}

.editor-active-line-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 20px;
  background: rgba(161, 138, 94, 0.065);
  border-top: 1px solid rgba(161, 138, 94, 0.14);
  border-bottom: 1px solid rgba(161, 138, 94, 0.14);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.editor-code-container {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.editor-find-layer,
.editor-highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 12px !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
  font-size: 13px !important;
  line-height: 20px !important;
  letter-spacing: 0px !important;
  word-spacing: 0px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  font-feature-settings: 'calt' 0, 'liga' 0, 'zero' 0 !important;
  font-variant-ligatures: none !important;
  tab-size: 4 !important;
  -moz-tab-size: 4 !important;
  white-space: pre !important;
  word-wrap: normal !important;
  word-break: normal !important;
  overflow: hidden;
  pointer-events: none;
  color: var(--text-code);
  box-sizing: border-box !important;
  border: none !important;
}

.editor-find-layer {
  color: transparent !important;
  z-index: 0;
}

.editor-highlight-layer {
  z-index: 1;
}

.sp-find-mark {
  background: rgba(196, 160, 89, 0.32);
  color: transparent;
  outline: 1px solid rgba(196, 160, 89, 0.65);
  border-radius: 1px;
}

.sp-find-mark.active {
  background: rgba(238, 175, 65, 0.62);
  outline: 1.5px solid #ffd875;
}

/* Native Floating Find Bar ([img-2]) */
.sp-find-bar {
  position: absolute;
  top: 10px;
  right: 22px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1c1712;
  border: 2px solid var(--border-gold-bright);
  box-shadow: 4px 4px 0px var(--accent-gold), 0 8px 24px rgba(0, 0, 0, 0.85);
  padding: 6px 10px;
}

.sp-find-input {
  width: 195px;
  background: #120f0c;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}

.sp-find-input:focus {
  border-color: var(--border-gold-bright);
}

.sp-find-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 36px;
  text-align: center;
  user-select: none;
}

.sp-find-nav-btn {
  width: 26px;
  height: 24px;
  background: #241e18;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sp-find-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-gold-bright);
  color: var(--accent-gold);
}

/* VSCode-Style Lua Autocomplete Popup ([img-3] & [img-4]) */
.sp-autocomplete-popup {
  position: absolute;
  z-index: 20;
  width: 370px;
  max-width: calc(100% - 20px);
  max-height: 236px;
  overflow-y: auto;
  background: #1d1915;
  border: 1px solid var(--border-gold-bright);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
  padding: 3px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  user-select: none;
}

.ac-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 10px;
  color: #d5c8b0;
  cursor: pointer;
  line-height: 18px;
}

.ac-item-row:hover {
  background: rgba(161, 138, 94, 0.16);
}

.ac-item-row.active {
  background: rgba(88, 122, 150, 0.38);
  outline: 1px solid #63b0df;
  outline-offset: -1px;
  color: #ffffff;
}

.ac-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.ac-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ac-icon-field {
  color: #56b6c2;
}

.ac-icon-method {
  color: #b892e8;
}

.ac-icon-enum {
  color: #e5c07b;
}

.ac-icon-word,
.ac-icon-kw {
  font-size: 9.5px;
  font-weight: 700;
  color: #c8beaa;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 3px;
  border-radius: 2px;
  line-height: 14px;
}

.ac-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-match-hl {
  color: #6ce0f5;
  font-weight: 700;
}

.ac-item-row.active .ac-match-hl {
  color: #7ee8fa;
}

.ac-item-detail {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.ac-item-row.active .ac-item-detail {
  color: #e8dec8;
}

/* Compact Attached Status & Metrics Footer */
.editor-status-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 12px;
  background: #17130f;
  border-top: 1px solid var(--border-gold);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.editor-footer-left,
.editor-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-footer-tag {
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.editor-footer-sep {
  color: var(--border-gold);
}

.editor-highlight-layer code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
  font-size: 13px !important;
  line-height: 20px !important;
  letter-spacing: 0px !important;
  word-spacing: 0px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  font-feature-settings: 'calt' 0, 'liga' 0, 'zero' 0 !important;
  font-variant-ligatures: none !important;
  tab-size: 4 !important;
  -moz-tab-size: 4 !important;
  white-space: pre !important;
  word-wrap: normal !important;
  word-break: normal !important;
}

.editor-highlight-layer span {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  letter-spacing: 0px !important;
  word-spacing: 0px !important;
  font-weight: inherit !important;
  font-style: normal !important;
}

.editor-interactive-textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 12px !important;
  background: transparent;
  color: transparent;
  caret-color: var(--accent-gold);
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
  font-size: 13px !important;
  line-height: 20px !important;
  letter-spacing: 0px !important;
  word-spacing: 0px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  font-feature-settings: 'calt' 0, 'liga' 0, 'zero' 0 !important;
  font-variant-ligatures: none !important;
  tab-size: 4 !important;
  -moz-tab-size: 4 !important;
  white-space: pre !important;
  word-wrap: normal !important;
  word-break: normal !important;
  border: none !important;
  outline: none !important;
  resize: none;
  box-sizing: border-box !important;
  overflow: auto;
  z-index: 2;
  -webkit-text-fill-color: transparent;
}

.editor-interactive-textarea::selection {
  background: rgba(161, 138, 94, 0.4);
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.scratchpad-output {
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  padding: 10px 14px;
  font-size: 12px;
  flex-shrink: 0;
}

/* Keybind Matrix & Enum Matrix */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.matrix-card {
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  padding: 8px 12px;
  transition: all 0.1s ease;
  cursor: pointer;
}
.matrix-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-gold-bright);
}
.matrix-card .card-name {
  font-weight: 700;
  color: var(--text-bright);
  font-size: 12px;
}
.matrix-card .card-val {
  font-size: 11px;
  color: var(--accent-gold);
  margin-top: 2px;
}
.matrix-card .card-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Lua Code Examples Thumbnails (trimmed to klee_runner 484:281 ratio) */
.examples-matrix-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  gap: 12px;
}

.example-matrix-card {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
}

.example-thumb-frame {
  width: 100%;
  aspect-ratio: 484 / 281;
  margin-top: 8px;
  border: 1px solid var(--border-gold);
  background: var(--bg-code);
  overflow: hidden;
  position: relative;
}

.example-detail-thumb-frame {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 484 / 281;
  margin-top: 10px;
  border: 1px solid var(--border-gold);
  background: var(--bg-code);
  box-shadow: var(--shadow-brutal);
  overflow: hidden;
  position: relative;
}

.example-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.2s ease;
}

.example-matrix-card:hover .example-thumb-img {
  transform: scale(1.03);
}

/* ============================================================================
   LUA SIMULATION MODAL & VIRTUAL CANVAS RUNTIME
   ============================================================================ */
.sim-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 8, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: background 0.15s ease;
}

.sim-modal-backdrop.undocked {
  background: transparent !important;
  backdrop-filter: none !important;
  pointer-events: none !important;
  padding: 0 !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.sim-modal-window {
  width: 100%;
  max-width: 1180px;
  height: 90vh;
  max-height: 820px;
  background: var(--bg-main);
  border: 2px solid var(--border-gold-bright);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(212, 175, 55, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sim-modal-window.undocked {
  pointer-events: auto !important;
  position: fixed !important;
  top: 60px;
  right: 40px;
  width: 960px;
  height: 720px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  min-width: 520px;
  min-height: 380px;
  resize: both;
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.95), 0 0 20px rgba(212, 175, 55, 0.25);
  z-index: 10000;
}

.sim-modal-window.maximized {
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  resize: none !important;
  border-width: 0 !important;
  border-radius: 0 !important;
  z-index: 10001;
}

.sim-modal-header {
  height: 44px;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  flex-shrink: 0;
}

.sim-modal-header.draggable {
  cursor: grab;
}

.sim-modal-header.draggable:hover {
  background: #362e24;
}

.sim-modal-header.dragging {
  cursor: grabbing;
}

.sim-modal-window.undocked::-webkit-resizer {
  background-color: var(--border-gold);
  border: 1px solid var(--border-gold-bright);
}

.sim-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38ef7d;
  box-shadow: 0 0 8px #38ef7d;
  animation: pulse-green 1.5s infinite alternate;
}

@keyframes pulse-green {
  0% { opacity: 0.5; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.1); }
}

.sim-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.5px;
}

.sim-header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-header-controls .brutal-btn {
  padding: 3px 8px !important;
  font-size: 13px !important;
  font-weight: 700;
  min-width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sim-settings-btn.active {
  background: var(--border-gold) !important;
  color: #fff !important;
  border-color: var(--border-gold-bright) !important;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* Secondary Simulation Viewport Toolbar (Collapsible via [ ⚙ ]) */
.sim-viewport-toolbar {
  display: none;
  min-height: 38px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-gold);
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  flex-shrink: 0;
  overflow-x: auto;
  user-select: none;
  flex-wrap: wrap;
  animation: slideDown 0.15s ease-out;
}

.sim-viewport-toolbar.open {
  display: flex;
}

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

.sim-tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-tool-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sim-select {
  padding: 3px 8px !important;
  font-size: 11px !important;
  height: 26px !important;
  background: var(--bg-workspace) !important;
  border: 1px solid var(--border-gold) !important;
  color: var(--text-bright) !important;
  outline: none !important;
  cursor: pointer;
  transform: none !important;
}

.sim-num-input {
  width: 64px;
  height: 26px;
  background: var(--bg-workspace);
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 4px;
  text-align: center;
  outline: none;
}

.sim-num-input:focus {
  border-color: var(--border-gold-bright);
}

.sim-dim-x {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.sim-viewport-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-workspace);
  position: relative;
}

.sim-canvas-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14110d;
  overflow: hidden;
  padding: 12px;
}

.sim-canvas-wrapper.allow-scroll {
  overflow: auto !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#miliastra-sim-canvas {
  background: #1c1814;
  border: 1px solid var(--border-gold);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0,0,0,0.5);
  cursor: crosshair;
  outline: none;
  display: block;
}

#miliastra-sim-canvas.mode-fit {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#miliastra-sim-canvas.mode-native {
  max-width: none !important;
  max-height: none !important;
}

#miliastra-sim-canvas:focus {
  border-color: var(--border-gold-bright);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 12px rgba(212, 175, 55, 0.35);
}

.sim-console-drawer {
  width: 340px;
  border-left: 2px solid var(--border-gold);
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.15s ease;
}

.sim-console-drawer.collapsed {
  display: none !important;
}

.sim-console-header {
  height: 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.sim-log-count {
  font-size: 10px;
  color: var(--text-muted);
}

.sim-console-logs {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  background: #181410;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-log-row {
  display: flex;
  gap: 6px;
  word-break: break-all;
}

.sim-log-time {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 10px;
}

.sim-log-row.info .sim-log-text {
  color: var(--text-code);
}

.sim-log-row.error .sim-log-text {
  color: #ff5555;
  font-weight: 700;
}

.sim-modal-footer {
  height: 30px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sim-separator {
  margin: 0 8px;
  color: var(--border-subtle);
}

#sim-fps-indicator {
  color: var(--accent-gold);
  font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .sim-viewport-body {
    flex-direction: column;
  }
  .sim-console-drawer {
    width: 100%;
    height: 180px;
    border-left: none;
    border-top: 2px solid var(--border-gold);
  }
  .codex-body {
    flex-direction: column;
  }
  .codex-sidebar {
    width: 100%;
    max-width: none;
    height: 40vh;
    border-right: none;
    border-bottom: 2px solid var(--border-gold);
  }
  .codex-content {
    padding: 16px;
    height: 60vh;
  }
  .project-explorer-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TAB 5: 3-COLUMN MILIASTRA INTERFACE LAYOUT EDITOR (FULL SCREEN)
   ========================================================================== */

.codex-body.full-width-mode .codex-sidebar {
  display: none !important;
}

.codex-body.full-width-mode .codex-content {
  padding: 0;
  overflow: hidden;
}

.mw-editor-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg-workspace);
  overflow: hidden;
}

.mw-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
  flex-shrink: 0;
}

.mw-topbar-left,
.mw-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mw-topbar-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.06em;
  padding-right: 6px;
  border-right: 1px solid var(--border-gold);
}

.mw-editor-columns {
  display: grid;
  grid-template-columns: 270px 1fr 330px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* LEFT COLUMN: Hierarchy Tree (Top) + .lua Files (Bottom) */
.mw-left-hierarchy {
  display: flex;
  flex-direction: column;
  background: #17130f;
  border-right: 1px solid var(--border-gold);
  min-height: 0;
  overflow: hidden;
}

.mw-tree-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.mw-tree-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  padding: 4px 8px;
  font-size: 11px;
}

.mw-search-svg-wrap,
.sp-find-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.mw-tree-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  width: 100%;
}

.mw-tree-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  color: var(--text-muted);
  font-size: 11px;
}

.mw-add-control-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #1c1712;
  border-bottom: 1px solid var(--border-gold);
  flex-shrink: 0;
}

.mw-add-control-select {
  flex: 1;
  min-width: 0;
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono), 'Segoe UI Emoji', 'Apple Color Emoji', 'Segoe UI Symbol', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  outline: none;
  cursor: pointer;
}

.mw-add-control-select:hover,
.mw-add-control-select:focus {
  border-color: var(--border-gold-bright);
  background: #18130e;
}

.mw-add-control-select option,
.sim-select option {
  background: #18130e;
  color: var(--text-bright);
  padding: 5px 8px;
  font-size: 11.5px;
}

.mw-hierarchy-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mw-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: #211b15;
  border: 1px solid #30271d;
  color: var(--text-primary);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.mw-tree-item.dragging {
  opacity: 0.45;
  border-style: dashed;
}

.mw-tree-item.drag-over-target {
  background: rgba(196, 160, 89, 0.28) !important;
  border: 1px dashed var(--border-gold-bright) !important;
  box-shadow: inset 0 0 0 1px var(--accent-gold);
}

.mw-tree-item:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
  border-color: var(--border-gold);
}

.mw-tree-item.selected {
  background: linear-gradient(90deg, #4b3c26, #382c1c);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
  font-weight: 700;
}

.mw-tree-caret {
  width: 14px;
  height: 14px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 14px;
  flex-shrink: 0;
}

.mw-tree-caret.clickable {
  color: var(--accent-gold);
  cursor: pointer;
}

.mw-tree-caret.clickable:hover {
  color: var(--text-bright);
  background: rgba(196, 160, 89, 0.2);
}

.mw-tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 3px;
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
}

.mw-tree-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-tree-script-badge {
  margin-left: auto;
  background: rgba(196, 160, 89, 0.16);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  white-space: nowrap;
  max-width: 115px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* Bottom Section: .lua Files Drawer */
.mw-lua-files-drawer {
  border-top: 2px solid var(--border-gold);
  background: #14100d;
  display: flex;
  flex-direction: column;
  max-height: 38%;
  flex-shrink: 0;
}

.mw-lua-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.mw-lua-files-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-lua-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #1e1813;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.mw-lua-file-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-gold);
}

.mw-lua-file-item.active {
  background: rgba(196, 160, 89, 0.2);
  border-color: var(--border-gold-bright);
  border-left: 3px solid var(--accent-gold);
}

.mw-lua-file-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.mw-lua-file-meta {
  min-width: 0;
  flex: 1;
}

.mw-lua-file-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-lua-file-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CENTER COLUMN: Clean Static Workspace Stage OR .lua Code Preview */
.mw-center-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background-color: #211c17;
  background-image: radial-gradient(rgba(161, 138, 94, 0.22) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
  position: relative;
}

.mw-stage-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.mw-stage-workspace.is-panning,
.mw-stage-workspace.is-panning * {
  cursor: grabbing !important;
}

/* Viewport Zoom & Middle-Mouse Pan HUD Bar */
.mw-stage-viewport-hud {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 18, 14, 0.92);
  border: 1px solid var(--border-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  padding: 3px 8px;
  user-select: none;
}

.mw-vp-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.mw-vp-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 8px;
}

.mw-vp-btn {
  background: #14100d;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mw-vp-btn:hover {
  border-color: var(--border-gold-bright);
  background: #2a2219;
  color: var(--accent-gold);
}

.mw-vp-reset-btn {
  font-size: 9.5px;
  padding: 0 6px;
}

.mw-vp-zoom-readout {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 38px;
  text-align: center;
}

/* Native 960x640 Stage Frame — matches 60 FPS Simulator Canvas 1:1 */
.mw-stage-frame {
  position: relative;
  width: 960px;
  height: 640px;
  flex-shrink: 0;
  transform-origin: center center;
  background: #181410;
  background-image:
    linear-gradient(rgba(161, 138, 94, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(161, 138, 94, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  border: 1.5px solid var(--border-gold);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
  user-select: none;
  cursor: pointer;
}

.mw-stage-frame.root-selected {
  border-color: var(--border-gold-bright);
  box-shadow: 0 0 0 1px rgba(238, 217, 171, 0.35), 0 10px 32px rgba(0, 0, 0, 0.65);
}

.mw-stage-axis-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(161, 138, 94, 0.16);
  pointer-events: none;
}

.mw-stage-axis-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(161, 138, 94, 0.16);
  pointer-events: none;
}

.mw-stage-root-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(20, 16, 13, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  pointer-events: none;
}

/* Corner Resize Handles */
.mw-gizmo-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--text-bright);
  border: 1px solid #1c1814;
}
.mw-gizmo-corner.tl { top: -5px; left: -5px; }
.mw-gizmo-corner.tr { top: -5px; right: -5px; }
.mw-gizmo-corner.bl { bottom: -5px; left: -5px; }
.mw-gizmo-corner.br { bottom: -5px; right: -5px; }

/* Interactive Static Presets inside the Stage (zero padding so visual dimensions & font size match Simulator 1:1) */
.mw-static-preset {
  position: absolute;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  outline: 1px dashed rgba(161, 138, 94, 0.38);
  outline-offset: -1px;
  background: transparent;
  padding: 0;
  z-index: 4;
}

.mw-static-preset:hover {
  outline: 1.5px dashed var(--border-gold-bright);
}

.mw-static-preset.selected {
  outline: none;
}

/* Top-Level Active Selection Gizmo Overlay (always sits on top of all visual layers while preserving layer order) */
.mw-active-selection-gizmo {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid #39b8f5;
  background: rgba(57, 184, 245, 0.06);
  box-shadow: 0 0 0 1px rgba(57, 184, 245, 0.25);
  cursor: move;
}

.mw-preset-tag-top {
  position: absolute;
  top: -19px;
  left: 0;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-gold);
  background: #14100d;
  border: 1px solid var(--border-gold);
  padding: 0 5px;
  white-space: nowrap;
}

.mw-preset-keyhint {
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  color: #181410;
  font-size: 12px;
  font-weight: 700;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mw-btn-main-label {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-bright);
  font-weight: 700;
  background: #3a3024;
  border: 1px solid var(--border-gold-bright);
}

.mw-preset-white-bar {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.mw-preset-banner {
  width: 100%;
  height: 100%;
  background: rgba(46, 68, 42, 0.9);
  border: 1px solid var(--border-gold-bright);
  color: var(--text-bright);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mw-preset-orb {
  font-size: 52px;
  color: #daaf4e;
  text-shadow: 0 0 14px rgba(218, 175, 78, 0.6);
  line-height: 1;
}

.mw-preset-action-btn {
  width: 100%;
  height: 100%;
  background: rgba(46, 38, 30, 0.92);
  border: 1px solid var(--border-gold-bright);
  color: var(--text-bright);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CENTER MODE B: Editable .lua Script Panel */
.mw-lua-preview-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-code);
}

.mw-lua-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
}

.mw-lua-editor-split {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mw-node-lua-textarea {
  flex: 1;
  width: 100%;
  background: #14100d;
  color: var(--text-bright);
  border: none;
  outline: none;
  resize: none;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 4;
}

.mw-lua-live-note {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.mw-script-input {
  width: 100%;
  background: var(--bg-code);
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 5px 8px;
  outline: none;
}

.mw-script-input:focus {
  border-color: var(--border-gold-bright);
}

/* RIGHT COLUMN: Selected Node Script & Relative Reference Inspector */
.mw-right-inspector {
  display: flex;
  flex-direction: column;
  background: #181410;
  border-left: 1px solid var(--border-gold);
  min-height: 0;
  overflow: hidden;
}

.mw-inspector-header {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-gold);
  flex-shrink: 0;
}

.mw-inspector-top-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.mw-inspector-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.mw-inspector-index-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.mw-copy-index-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 11px;
}

.mw-inspector-id-tag {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  padding: 0 5px;
  font-size: 10px;
  color: var(--accent-gold);
}

.mw-inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mw-insp-section {
  background: #1f1a15;
  border: 1px solid var(--border-subtle);
  padding: 9px 10px;
}

.mw-insp-sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-bright);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.mw-insp-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
  border-bottom: 1px dashed rgba(161, 138, 94, 0.14);
}

.mw-insp-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin: 6px 0 4px;
}

@media (max-width: 1024px) {
  .mw-editor-columns {
    grid-template-columns: 240px 1fr 290px;
  }
}

/* ============================================================================
   HIERARCHY SIBLING REORDERING & DRAG-BEFORE / DRAG-AFTER INDICATORS
   ============================================================================ */
.mw-tree-item.drag-over-before {
  box-shadow: inset 0 2px 0 0 var(--border-gold-bright);
  background: rgba(196, 160, 89, 0.12);
}

.mw-tree-item.drag-over-after {
  box-shadow: inset 0 -2px 0 0 var(--border-gold-bright);
  background: rgba(196, 160, 89, 0.12);
}

.mw-tree-reorder-btns {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  flex-shrink: 0;
}

.mw-tree-item:hover .mw-tree-reorder-btns,
.mw-tree-item.selected .mw-tree-reorder-btns {
  opacity: 1;
}

.mw-tree-script-badge + .mw-tree-reorder-btns {
  margin-left: 4px;
}

.mw-tree-mini-btn {
  background: #14100d;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 8.5px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}

.mw-tree-mini-btn:hover {
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
  background: #2e261d;
}

/* ============================================================================
   RIGHT INSPECTOR: RENAMEABLE HEADER, [ Basic | Script ] TABS, & BASIC CARDS
   ============================================================================ */
.mw-insp-name-input {
  flex: 1;
  min-width: 0;
  background: #14100d;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  outline: none;
}

.mw-insp-name-input:focus {
  border-color: var(--border-gold-bright);
  box-shadow: 0 0 0 1px rgba(238, 217, 171, 0.25);
}

.mw-insp-more-btn {
  background: #14100d;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mw-insp-more-btn:hover {
  border-color: #e07a6b;
  color: #e07a6b;
}

.mw-insp-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: #120e0b;
  border: 1px solid var(--border-gold);
  padding: 2px;
  margin-top: 8px;
}

.mw-insp-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 8px;
  cursor: pointer;
}

.mw-insp-tab-btn:hover {
  color: var(--text-bright);
}

.mw-insp-tab-btn.active {
  background: #382e23;
  color: var(--text-bright);
  box-shadow: inset 0 0 0 1px var(--border-gold-bright);
}

.mw-basic-card {
  background: #1e1914;
  border: 1px solid var(--border-subtle);
}

.mw-order-bar {
  padding: 8px 10px;
  background: #1a1511;
}

.mw-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mw-icon-btn {
  background: #14100d;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  cursor: pointer;
}

.mw-icon-btn:hover:not(:disabled) {
  background: #2e261d;
  border-color: var(--border-gold-bright);
}

.mw-icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.mw-basic-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: #262019;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}

.mw-basic-card-header:hover {
  background: #2e271e;
}

.mw-sec-caret {
  font-size: 11px;
  color: var(--accent-gold);
  width: 12px;
  display: inline-block;
}

.mw-sec-title-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-bright);
}

.mw-sec-menu-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 5px;
  cursor: pointer;
}

.mw-sec-menu-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-bright);
}

.mw-basic-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.mw-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-basic-label {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
}

.mw-size-hint-icon {
  font-size: 11px;
  color: var(--text-muted);
  cursor: help;
}

/* 4-Device Segmented Bar ([img-2]) */
.mw-device-seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #13100c;
  border: 1px solid var(--border-subtle);
  padding: 2px;
  gap: 2px;
}

.mw-device-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mw-device-btn:hover {
  color: var(--text-bright);
  background: rgba(161, 138, 94, 0.1);
}

.mw-device-btn.active {
  background: #362c21;
  color: var(--text-bright);
  border-color: var(--border-gold);
}

/* Switch Toggles ([img-2]) */
.mw-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.mw-switch {
  position: relative;
  width: 36px;
  height: 19px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.mw-switch.on {
  background: rgba(196, 160, 89, 0.28);
  border-color: var(--border-gold-bright);
}

.mw-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-muted);
}

.mw-switch.on .mw-switch-knob {
  transform: translateX(17px);
  background: var(--text-bright);
}

/* Dual Axis Numeric Inputs (X/Y, W/H) ([img-2]) */
.mw-dual-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mw-axis-box {
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  padding: 0 0 0 6px;
  height: 26px;
  min-width: 0;
}

.mw-axis-box:focus-within {
  border-color: var(--border-gold-bright);
}

.mw-axis-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
  user-select: none;
  cursor: ew-resize;
}

.mw-axis-tag.x,
.mw-axis-tag.w {
  color: #d68a59;
}

.mw-axis-tag.y,
.mw-axis-tag.h {
  color: #7eb876;
}

.mw-axis-tag.z {
  color: #68b5d6;
}

.mw-axis-box input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: right;
  padding-right: 5px;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Hide ugly native white browser number spin buttons */
.mw-axis-box input::-webkit-outer-spin-button,
.mw-axis-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Custom Brutalist Dark-Coffee & Burnished-Gold Up/Down Stepper */
.mw-num-spin {
  display: flex;
  flex-direction: column;
  width: 15px;
  height: 100%;
  border-left: 1px solid var(--border-subtle);
  background: #181410;
  flex-shrink: 0;
}

.mw-spin-btn {
  flex: 1;
  width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 6.5px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.mw-spin-btn.up {
  border-bottom: 1px solid rgba(74, 62, 49, 0.55);
}

.mw-spin-btn:hover {
  background: #2e261d;
  color: var(--text-bright);
}

.mw-spin-btn:active {
  background: rgba(196, 160, 89, 0.3);
  color: var(--accent-gold);
}

/* Rotate + Mirror Left/Right & Mirror Up/Down Row ([img-2]) */
.mw-rotate-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mw-mirror-btn {
  width: 28px;
  height: 26px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mw-mirror-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-bright);
}

.mw-mirror-btn.active {
  background: rgba(196, 160, 89, 0.25);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
}

.mw-basic-select {
  width: 100%;
  height: 26px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 6px;
  outline: none;
}

/* Waypoint Settings Trigger & 4x4 Popover Grid ([img-2], [img-4]) */
.mw-waypoint-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.mw-wp-trigger-btn {
  background: #14100d;
  border: 1px solid var(--border-gold);
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mw-wp-trigger-btn:hover,
.mw-wp-trigger-btn.open {
  border-color: var(--border-gold-bright);
  box-shadow: 0 0 0 1px rgba(238, 217, 171, 0.3);
}

.mw-wp-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 236px;
  background: #1c1712;
  border: 1.5px solid var(--border-gold-bright);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.85);
  padding: 8px;
  z-index: 80;
}

.mw-wp-popover-title {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: 0.03em;
}

.mw-wp-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.mw-wp-preset-cell {
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mw-wp-preset-cell:hover {
  border-color: var(--border-gold-bright);
  background: #2a2219;
}

.mw-wp-preset-cell.active {
  border-color: #4fc3f7;
  box-shadow: 0 0 0 1px rgba(79, 195, 247, 0.4);
  background: rgba(79, 195, 247, 0.08);
}

.mw-insp-code-snippet {
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.45;
  padding: 8px;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

/* ============================================================================
   STAGE WAYPOINT TRIANGLES, DASHED GUIDES & ACTIVE CYAN GIZMO HANDLES
   ([img-3], [img-5], [img-6], [img-7], [img-8])
   ============================================================================ */
.mw-static-preset.is-dimmed-hidden {
  opacity: 0.42;
  filter: grayscale(0.4);
}

/* Selected UIControl active gizmo frame is rendered by .mw-active-selection-gizmo on top of all layers */
.mw-static-preset.selected {
  outline: none;
  border: none;
  background: transparent;
  cursor: move;
}

.mw-waypoint-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

.mw-wp-dashed-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed rgba(230, 220, 200, 0.68);
  pointer-events: none;
  opacity: 0;
}

.mw-wp-dashed-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1.5px dashed rgba(230, 220, 200, 0.68);
  pointer-events: none;
  opacity: 0;
}

.mw-wp-dashed-v.visible,
.mw-wp-dashed-h.visible {
  opacity: 1;
}

.mw-wp-rect {
  position: absolute;
  border: 1.5px dashed rgba(245, 184, 46, 0.75);
  background: rgba(245, 184, 46, 0.04);
  pointer-events: none;
  opacity: 0;
}

.mw-wp-rect.visible {
  opacity: 1;
}

/* 4 Inward-Pointing 45° Waypoint Triangles ([img-3, 5, 6, 7, 8]) */
.mw-wp-tri {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: auto;
  cursor: pointer;
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}

/* Position each triangle outside its corner so when all 4 collapse to 1 point they form an X crosshair! */
.mw-wp-tri.tl {
  transform: translate(-100%, -100%);
}
.mw-wp-tri.tr {
  transform: translate(0%, -100%);
}
.mw-wp-tri.bl {
  transform: translate(-100%, 0%);
}
.mw-wp-tri.br {
  transform: translate(0%, 0%);
}

.mw-wp-tri:hover polygon {
  stroke: #f5b82e;
  fill: rgba(245, 184, 46, 0.35);
}

/* Active Control Gizmo Overlay inside Selected Box */
.mw-ctrl-gizmo-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 4 Grabbable Side Bars */
.mw-edge-handle {
  position: absolute;
  pointer-events: auto;
  z-index: 32;
}
.mw-edge-handle.top {
  top: -5px;
  left: 6px;
  right: 6px;
  height: 9px;
  cursor: ns-resize;
}
.mw-edge-handle.bottom {
  bottom: -5px;
  left: 6px;
  right: 6px;
  height: 9px;
  cursor: ns-resize;
}
.mw-edge-handle.left {
  left: -5px;
  top: 6px;
  bottom: 6px;
  width: 9px;
  cursor: ew-resize;
}
.mw-edge-handle.right {
  right: -5px;
  top: 6px;
  bottom: 6px;
  width: 9px;
  cursor: ew-resize;
}

/* 4 White Corner Dots ([img-3]) */
.mw-corner-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #1d8ec4;
  pointer-events: auto;
  z-index: 34;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}
.mw-corner-dot.tl {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}
.mw-corner-dot.tr {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}
.mw-corner-dot.bl {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}
.mw-corner-dot.br {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}
.mw-corner-dot:hover {
  transform: scale(1.25);
  background: #f5b82e;
  border-color: #14100d;
}

/* Top Rotation Spinner Stem & Curved Dual-Arrow Handle ([img-3, 5, 8]) */
.mw-rot-stem {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 1.5px;
  height: 20px;
  background: #39b8f5;
  transform: translateX(-50%);
  pointer-events: none;
}

.mw-rot-handle {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  pointer-events: auto;
  z-index: 35;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}

.mw-rot-handle:active {
  cursor: grabbing;
}

.mw-rot-handle:hover path,
.mw-rot-handle:hover polyline {
  stroke: #f5b82e;
}

/* Compact Draggable Cyan Center / Pivot Ring Dot (◎) ([img-3, 5, 7, 8]) */
.mw-pivot-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #29b6f6;
  background: rgba(20, 16, 13, 0.9);
  box-shadow: 0 0 0 1px #ffffff, 0 1px 3px rgba(0, 0, 0, 0.85);
  transform: translate(-50%, -50%);
  cursor: grab;
  pointer-events: auto;
  z-index: 36;
}

/* Invisible expanded grab target so the compact 8px dot is effortless to grab */
.mw-pivot-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.mw-pivot-dot:hover {
  border-color: #f5b82e;
}

.mw-pivot-dot:active {
  cursor: grabbing;
}

/* ============================================================================
   TEXTBOXCONTROL, IMAGE SETTINGS, MASK SETTINGS & CONTROLLER NAVIGATION
   ([img-1] .. [img-12])
   ============================================================================ */

/* Font Size Editable Combo Box + Popover ([img-1], [img-2], [img-3]) */
.mw-fontsize-combo {
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  height: 28px;
}

.mw-fontsize-combo:focus-within {
  border-color: var(--border-gold-bright);
}

.mw-fontsize-inp {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.mw-fontsize-inp::-webkit-outer-spin-button,
.mw-fontsize-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mw-fontsize-drop-btn {
  width: 28px;
  height: 100%;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.mw-fontsize-drop-btn:hover {
  background: #2a2219;
  color: var(--text-bright);
}

.mw-fontsize-popover {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 230px;
  overflow-y: auto;
  background: #231d17;
  border: 1.5px solid var(--border-gold-bright);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.85);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.mw-fontsize-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.mw-fontsize-opt:hover {
  background: #362c21;
  color: var(--text-bright);
}

.mw-fontsize-opt.active {
  background: rgba(196, 160, 89, 0.22);
  color: var(--text-bright);
  font-weight: 700;
}

.mw-opt-check {
  color: var(--accent-gold);
  font-weight: 700;
}

.mw-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #382e23;
  border: 1px solid var(--border-gold);
  color: var(--text-bright);
  font-size: 9.5px;
  font-weight: 700;
  cursor: help;
}

/* Color Swatch + 6-Char Hex + Paint Icon + Opacity % Box ([img-1], [img-3], [img-4]) */
.mw-color-row {
  display: grid;
  grid-template-columns: 1fr 68px;
  gap: 6px;
}

.mw-color-hex-box {
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  padding: 0 6px 0 4px;
  height: 28px;
  min-width: 0;
  gap: 6px;
}

.mw-color-hex-box:focus-within,
.mw-color-hex-box.picker-open {
  border-color: var(--border-gold-bright);
  box-shadow: 0 0 0 1px rgba(245, 184, 46, 0.25);
}

.mw-color-swatch-wrap {
  position: relative;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  background:
    linear-gradient(45deg, #444 25%, transparent 25%),
    linear-gradient(-45deg, #444 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #444 75%),
    linear-gradient(-45deg, transparent 75%, #444 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.mw-color-swatch-wrap:hover {
  border-color: #f5b82e;
  transform: scale(1.08);
}

.mw-color-swatch-wrap.zero-alpha::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ffffff 48%, rgba(30, 25, 20, 0.85) 52%);
  pointer-events: none;
}

.mw-color-swatch-fill {
  display: block;
  width: 100%;
  height: 100%;
}

.mw-color-hex-inp {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.mw-color-wheel-trigger-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.mw-color-wheel-trigger-btn:hover {
  background: rgba(245, 184, 46, 0.16);
  border-color: rgba(245, 184, 46, 0.55);
  transform: scale(1.08);
}

.mw-color-wheel-svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

/* ============================================================================
   INTERACTIVE HSV COLOR WHEEL & COLOR PICKER POPOVER
   ============================================================================ */
.mw-color-wheel-popover {
  position: fixed;
  width: 246px;
  background: linear-gradient(180deg, #1f1914 0%, #16120e 100%);
  border: 1.5px solid #c8a86b;
  border-radius: 5px;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.88),
    0 0 0 1px rgba(15, 12, 9, 0.95),
    inset 0 1px 0 rgba(255, 232, 179, 0.14);
  z-index: 9999;
  font-family: var(--font-mono);
  color: var(--text-bright);
  user-select: none;
  overflow: hidden;
}

.mw-cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #33291f 0%, #241d16 100%);
  border-bottom: 1px solid rgba(200, 168, 107, 0.45);
  cursor: move;
}

.mw-cw-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.mw-cw-title-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.mw-cw-title-text {
  font-size: 10px;
  font-weight: 800;
  color: #f7e8c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-cw-mode-pills {
  display: inline-flex;
  background: #14100c;
  border: 1px solid rgba(196, 160, 89, 0.35);
  border-radius: 3px;
  padding: 1px;
  gap: 2px;
  flex-shrink: 0;
}

.mw-cw-mode-btn {
  background: transparent;
  border: none;
  color: #a99778;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 2px;
  cursor: pointer;
}

.mw-cw-mode-btn:hover {
  color: #f7e8c8;
}

.mw-cw-mode-btn.active {
  background: rgba(245, 184, 46, 0.25);
  color: #ffe8a3;
}

.mw-cw-close-btn {
  width: 19px;
  height: 19px;
  border-radius: 3px;
  background: #17130f;
  border: 1px solid rgba(196, 160, 89, 0.42);
  color: #d6c3a0;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mw-cw-close-btn:hover {
  border-color: #f5b82e;
  background: #33271a;
  color: #ffffff;
}

.mw-cw-body {
  padding: 9px 10px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mw-cw-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #120f0c;
  border: 1px solid #3a3025;
  border-radius: 4px;
  padding: 6px 6px 4px 6px;
}

#mw-cw-canvas {
  display: block;
  cursor: crosshair;
}

.mw-cw-canvas-labels {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 2px 10px 0 18px;
  font-size: 8.5px;
  color: #9e8d72;
  font-weight: 700;
}

.mw-cw-alpha-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mw-cw-alpha-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #cbb997;
  font-weight: 700;
}

.mw-cw-alpha-track {
  position: relative;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgba(200, 168, 107, 0.55);
  cursor: ew-resize;
  background:
    linear-gradient(45deg, #484848 25%, transparent 25%),
    linear-gradient(-45deg, #484848 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #484848 75%),
    linear-gradient(-45deg, transparent 75%, #484848 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.mw-cw-alpha-gradient {
  position: absolute;
  inset: 0;
  border-radius: 2px;
}

.mw-cw-alpha-thumb {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 7px;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1.5px solid #14100c;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.mw-cw-hex-compare-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mw-cw-compare-swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 48px;
  height: 25px;
  border-radius: 3px;
  border: 1px solid rgba(200, 168, 107, 0.55);
  overflow: hidden;
  flex-shrink: 0;
  background:
    linear-gradient(45deg, #444 25%, transparent 25%),
    linear-gradient(-45deg, #444 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #444 75%),
    linear-gradient(-45deg, transparent 75%, #444 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
}

.mw-cw-comp-new,
.mw-cw-comp-orig {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  display: block;
}

.mw-cw-comp-orig {
  cursor: pointer;
  border-left: 1px solid rgba(0, 0, 0, 0.45);
}

.mw-cw-comp-new span,
.mw-cw-comp-orig span {
  display: block;
  width: 100%;
  height: 100%;
}

.mw-cw-hex-input-box {
  flex: 1;
  min-width: 0;
  height: 25px;
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid #3f3427;
  border-radius: 3px;
  padding: 0 6px;
  gap: 3px;
}

.mw-cw-hex-input-box:focus-within {
  border-color: #f5b82e;
}

.mw-cw-hash {
  color: #9e8d72;
  font-size: 11px;
  font-weight: 700;
}

#mw-cw-hex-inp {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f7e8c8;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mw-cw-copy-btn {
  width: 25px;
  height: 25px;
  background: #181410;
  border: 1px solid #3f3427;
  border-radius: 3px;
  color: #d6c3a0;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mw-cw-copy-btn:hover {
  border-color: #f5b82e;
  color: #ffffff;
  background: #2b231b;
}

.mw-cw-rgba-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.mw-cw-chan-box {
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid #3a3025;
  border-radius: 3px;
  height: 24px;
  padding: 0 4px;
  min-width: 0;
}

.mw-cw-chan-box:focus-within {
  border-color: #f5b82e;
}

.mw-cw-chan-tag {
  font-size: 9px;
  font-weight: 800;
  margin-right: 3px;
  flex-shrink: 0;
}

.mw-cw-chan-tag.r { color: #ef6b6b; }
.mw-cw-chan-tag.g { color: #68d391; }
.mw-cw-chan-tag.b { color: #63b3ed; }
.mw-cw-chan-tag.a { color: #e6c275; }

.mw-cw-chan-box input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

.mw-cw-chan-box input::-webkit-outer-spin-button,
.mw-cw-chan-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mw-cw-swatches-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-cw-swatches-title {
  font-size: 8.5px;
  font-weight: 700;
  color: #9e8d72;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mw-cw-swatches-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.mw-cw-preset-swatch {
  height: 18px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.mw-cw-preset-swatch:hover {
  transform: scale(1.14);
  border-color: #f5b82e;
  z-index: 2;
}

.mw-color-alpha-box {
  display: flex;
  align-items: center;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  padding: 0 6px;
  height: 28px;
}

.mw-color-alpha-box:focus-within {
  border-color: var(--border-gold-bright);
}

.mw-color-alpha-box input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  -moz-appearance: textfield;
  appearance: textfield;
}

.mw-color-alpha-box input::-webkit-outer-spin-button,
.mw-color-alpha-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mw-alpha-pct-sign {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: 2px;
}

/* 6-Button Align Bar ([img-1], [img-3]) */
.mw-align-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.mw-align-btn {
  height: 26px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mw-align-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-bright);
}

.mw-align-btn.active {
  background: rgba(196, 160, 89, 0.26);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
}

/* Rich Text Toolbar & Content Textarea ([img-1], [img-3]) */
.mw-richtext-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.mw-richtext-tag-btns {
  display: flex;
  gap: 3px;
}

.mw-rt-btn {
  background: #14100d;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  cursor: pointer;
}

.mw-rt-btn:hover {
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
  background: #2a2219;
}

.mw-tb-content-box {
  width: 100%;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  padding: 7px 8px;
  resize: vertical;
  outline: none;
}

.mw-tb-content-box:focus {
  border-color: var(--border-gold-bright);
}

/* Reference Asset Resource Card ([img-3], [img-4]) */
.mw-asset-resource-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #14100d;
  border: 1px solid var(--border-subtle);
  padding: 7px 8px;
}

.mw-asset-resource-card.library-open {
  border-color: var(--border-gold-bright);
  background: #1d1712;
}

.mw-asset-thumb {
  width: 38px;
  height: 38px;
  background: #1f1a15;
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.mw-asset-thumb:hover {
  border-color: var(--border-gold-bright);
  background: #2b231b;
}

.mw-asset-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.mw-asset-title-text {
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-asset-id-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.mw-asset-copy-btn,
.mw-asset-lib-btn,
.mw-asset-del-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
}

.mw-asset-copy-btn:hover,
.mw-asset-lib-btn:hover,
.mw-asset-lib-btn.active {
  color: var(--text-bright);
  border-color: var(--border-gold);
}

.mw-asset-del-btn:hover {
  color: #e07a6b;
  border-color: rgba(224, 122, 107, 0.4);
}

/* Bottom 1/3 Screen Image Resource Selector Library Drawer ([img-3], [img-4]) */
.mw-editor-shell {
  position: relative;
}

.mw-asset-lib-drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  min-height: 215px;
  max-height: 310px;
  background: #17130f;
  border-top: 2px solid var(--border-gold-bright);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  z-index: 95;
}

.mw-asset-lib-topbar {
  height: 36px;
  padding: 0 12px;
  background: #211b15;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mw-asset-lib-search-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mw-asset-lib-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  height: 24px;
  padding: 0 8px;
  width: 240px;
}

.mw-asset-lib-search-box:focus-within {
  border-color: var(--border-gold-bright);
}

.mw-asset-lib-search-icon {
  font-size: 11px;
  color: var(--text-muted);
}

.mw-asset-lib-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  width: 100%;
}

.mw-asset-lib-filter-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
}

.mw-asset-lib-close-btn {
  width: 26px;
  height: 24px;
  background: #14100d;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mw-asset-lib-close-btn:hover {
  border-color: var(--border-gold-bright);
  background: #2a2219;
}

.mw-asset-lib-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 165px 1fr;
}

.mw-asset-lib-sidebar {
  background: #14100d;
  border-right: 1px solid var(--border-subtle);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-asset-lib-cat {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.mw-asset-lib-cat.active {
  background: rgba(196, 160, 89, 0.22);
  border-color: var(--border-gold-bright);
  color: var(--text-bright);
}

.mw-asset-lib-grid {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  overflow-y: auto;
}

.mw-asset-lib-item {
  position: relative;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.mw-asset-lib-card {
  width: 84px;
  height: 84px;
  background: #231d17;
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.mw-asset-lib-item:hover .mw-asset-lib-card {
  border-color: var(--border-gold);
  background: #2b241c;
}

.mw-asset-lib-item.selected .mw-asset-lib-card {
  border-color: #f5b82e;
  box-shadow: 0 0 0 1px #f5b82e;
  background: #2f261c;
}

.mw-asset-lib-graphic {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mw-asset-lib-caption {
  font-size: 10.5px;
  color: var(--text-bright);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mw-asset-lib-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #110e0b;
  border: 1px solid var(--border-gold-bright);
  padding: 5px 8px;
  font-size: 10.5px;
  color: var(--text-bright);
  white-space: nowrap;
  z-index: 120;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}

.mw-asset-lib-item:hover .mw-asset-lib-tooltip {
  display: block;
}

.mw-one-to-one-btn {
  width: 32px;
}

.mw-1to1-badge {
  font-size: 9px;
  font-weight: 700;
  border: 1px solid currentColor;
  padding: 0 2px;
  line-height: 1.1;
}

/* Mask Settings Sliders + Number Boxes ([img-7], [img-10], [img-12]) */
.mw-slider-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 8px;
}

.mw-range-slider {
  width: 100%;
  accent-color: var(--accent-gold);
  cursor: pointer;
  height: 5px;
}

.mw-slider-num-box {
  width: 100%;
  height: 26px;
  background: #120f0c;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 6px;
  text-align: left;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.mw-slider-num-box:focus {
  border-color: var(--border-gold-bright);
}

.mw-slider-num-box::-webkit-outer-spin-button,
.mw-slider-num-box::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================================
   BUTTON STATE MACHINE INSPECTOR CARD (ClientUIPresetButtonControl)
   ========================================================================== */
.mw-btn-sm-box {
  background: #17130f;
  border: 1px solid #3a3024;
  border-radius: 3px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mw-btn-sm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mw-btn-sm-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.mw-btn-sm-count {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-bright);
  background: #28211a;
  border: 1px solid #4a3d2d;
  padding: 1px 6px;
  border-radius: 2px;
}

.mw-btn-sm-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

.mw-btn-state-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.mw-btn-state-pill {
  height: 24px;
  background: #211b15;
  border: 1px solid #3d3328;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 2px;
  padding: 0 4px;
}

.mw-btn-state-pill:hover {
  border-color: var(--border-gold);
  color: var(--text-bright);
  background: #2b231b;
}

.mw-btn-state-pill.active {
  background: #3d301e;
  border-color: #f5b82e;
  color: #f5b82e;
}

.mw-btn-slot-row {
  padding: 5px 6px;
  background: #1c1712;
  border: 1px solid #2e261d;
  border-radius: 3px;
}

.mw-btn-slot-row.is-active-state {
  border-color: rgba(245, 184, 46, 0.55);
  background: #231c14;
}

.mw-btn-slot-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.mw-btn-active-tag {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #f5b82e;
  letter-spacing: 0.03em;
}

.mw-btn-slot-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mw-btn-jump-child {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  font-size: 12px;
  padding: 0;
}

.mw-btn-jump-child:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ============================================================================
   KEYHINTCONTROL INSPECTOR CARD & GAMEPAD / KEYBIND SHOWCASE ([img-1]..[img-6])
   ============================================================================ */
.mw-keyhint-card .mw-keyhint-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mw-keyhint-gamepad-details {
  margin: 4px 0 6px 0;
  border: 1px solid rgba(196, 160, 89, 0.24);
  border-radius: 4px;
  background: rgba(18, 15, 12, 0.72);
  padding: 5px 7px;
}

.mw-keyhint-gamepad-summary {
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #e8c67a;
  user-select: none;
  padding: 2px 0;
}

.mw-keyhint-gamepad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 2px;
}

.mw-keyhint-gp-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #231e19;
  border: 1px solid rgba(161, 138, 94, 0.25);
  border-radius: 3px;
  padding: 4px 6px;
  color: #d8c8a8;
  font-family: var(--font-mono);
  font-size: 9.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.mw-keyhint-gp-chip:hover {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.12);
  color: #fff3d1;
}

.mw-keyhint-gp-chip.active {
  border-color: #f5b82e;
  background: rgba(245, 184, 46, 0.2);
  color: #fff8e3;
  box-shadow: inset 0 0 0 1px rgba(245, 184, 46, 0.35);
}

.mw-keyhint-gp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #14110e;
  border: 1px solid rgba(200, 168, 107, 0.5);
  color: #f5b82e;
  font-weight: 800;
  font-size: 9px;
  flex-shrink: 0;
}

.mw-keyhint-gp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-keyhint-rebind-card {
  margin-top: 4px;
  padding: 8px 9px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(38, 31, 23, 0.92) 0%, rgba(25, 20, 15, 0.95) 100%);
  border: 1px solid rgba(212, 175, 55, 0.32);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mw-keyhint-rebind-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #f5b82e;
  letter-spacing: 0.02em;
}

.mw-keyhint-rebind-pill {
  font-size: 8.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(245, 184, 46, 0.16);
  border: 1px solid rgba(245, 184, 46, 0.45);
  color: #ffe299;
}

.mw-keyhint-rebind-desc {
  margin: 0;
  font-size: 10px;
  line-height: 1.42;
  color: #cbbba0;
}

.mw-keyhint-rebind-desc code {
  color: #f5d68e;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  padding: 0 3px;
  border-radius: 2px;
}

.mw-keyhint-rebind-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-keyhint-rebind-label {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #a99778;
}

.mw-keyhint-rebind-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.mw-keyhint-rebind-input {
  width: 64px !important;
  text-align: center;
  font-weight: 800;
  color: #ffe599 !important;
}

.mw-keyhint-preset-btn {
  padding: 3px 6px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #d8c6a2;
  background: #28221c;
  border: 1px solid rgba(161, 138, 94, 0.35);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.mw-keyhint-preset-btn:hover {
  border-color: #f5b82e;
  color: #fff5d6;
  background: rgba(245, 184, 46, 0.16);
}

.mw-keyhint-listener-card {
  margin-top: 4px;
  padding: 7px 8px;
  border-radius: 4px;
  background: rgba(16, 13, 10, 0.82);
  border: 1px solid rgba(161, 138, 94, 0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mw-keyhint-listener-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #d4b886;
}

.mw-keyhint-copy-btn {
  padding: 2px 6px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f5b82e;
  background: rgba(245, 184, 46, 0.12);
  border: 1px solid rgba(245, 184, 46, 0.4);
  border-radius: 3px;
  cursor: pointer;
}

.mw-keyhint-copy-btn:hover {
  background: rgba(245, 184, 46, 0.25);
  color: #fff6db;
}

.mw-keyhint-listener-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #bfb093;
}

.mw-keyhint-listener-rows code {
  color: #8fd4a0;
  word-break: break-all;
}

/* ============================================================================
   UI ANIMATION SETTINGS (SELECT VFX) & TEMPLATE REFERENCE ([img-1]..[img-6])
   ============================================================================ */
.mw-vfx-select-empty-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(18, 15, 12, 0.72);
  border: 1.5px dashed rgba(196, 160, 89, 0.45);
  border-radius: 4px;
  color: #d8c6a2;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mw-vfx-select-empty-btn:hover {
  border-color: #f5b82e;
  background: rgba(245, 184, 46, 0.1);
  color: #fff6db;
}

.mw-vfx-selected-box,
.mw-ref-template-box {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  background: #181410;
  border: 1px solid rgba(196, 160, 89, 0.38);
  border-radius: 4px;
  padding: 4px;
}

.mw-vfx-selected-box.active,
.mw-ref-template-box.active {
  border-color: #f5b82e;
  box-shadow: 0 0 0 1px rgba(245, 184, 46, 0.28);
}

.mw-vfx-selected-main,
.mw-ref-template-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 2px 4px;
  text-align: left;
  cursor: pointer;
  color: var(--text-bright);
}

.mw-vfx-selected-main:hover,
.mw-ref-template-main:hover {
  background: rgba(245, 184, 46, 0.08);
  border-radius: 3px;
}

.mw-vfx-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff6db;
  flex-shrink: 0;
}

.mw-vfx-meta,
.mw-ref-template-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mw-vfx-meta-name,
.mw-ref-template-name {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  color: #f5e6c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-vfx-meta-sub,
.mw-ref-template-idx {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #a99778;
}

.mw-vfx-selected-actions,
.mw-ref-template-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mw-vfx-toggle-list-link {
  background: none;
  border: none;
  padding: 0;
  color: #f5b82e;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
}

.mw-vfx-toggle-list-link:hover {
  text-decoration: underline;
  color: #ffe599;
}

.mw-vfx-picker-panel {
  margin-top: 4px;
  padding: 7px;
  background: #14110d;
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mw-vfx-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(161, 138, 94, 0.22);
  font-family: var(--font-mono);
}

.mw-vfx-close-x {
  background: transparent;
  border: 1px solid rgba(161, 138, 94, 0.3);
  border-radius: 3px;
  color: #cbbba0;
  font-size: 10px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mw-vfx-close-x:hover {
  border-color: #f5b82e;
  color: #fff;
}

.mw-vfx-search-row input {
  width: 100%;
  height: 25px;
  background: #1c1814;
  border: 1px solid #3d3328;
  border-radius: 3px;
  color: var(--text-bright);
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.mw-vfx-scroll-list {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 2px;
}

.mw-vfx-group-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #e6c275;
  padding: 3px 2px 2px 2px;
  border-bottom: 1px solid rgba(196, 160, 89, 0.2);
}

.mw-vfx-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 3px;
  background: #1e1914;
  border: 1px solid rgba(161, 138, 94, 0.2);
  cursor: pointer;
  transition: all 0.12s ease;
}

.mw-vfx-row:hover {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.12);
}

.mw-vfx-row.selected {
  border-color: #f5b82e;
  background: rgba(245, 184, 46, 0.18);
  box-shadow: inset 0 0 0 1px rgba(245, 184, 46, 0.32);
}

.mw-vfx-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mw-vfx-row-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #f5e6c4;
}

.mw-vfx-row-idx {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #a99778;
}

.mw-vfx-play-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(245, 184, 46, 0.45);
  background: rgba(245, 184, 46, 0.14);
  color: #ffe299;
  font-size: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mw-vfx-play-btn:hover {
  background: #f5b82e;
  color: #181410;
}

.mw-ref-template-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(56, 130, 210, 0.18);
  border: 1px solid rgba(115, 175, 240, 0.55);
  color: #bfe0ff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mw-ref-goto-editor-btn {
  width: 100%;
  height: 27px;
  margin-top: 2px;
  border-radius: 3px;
  background: #28211a;
  border: 1px solid rgba(196, 160, 89, 0.4);
  color: #ebd5a7;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.mw-ref-goto-editor-btn:hover {
  border-color: #f5b82e;
  background: rgba(245, 184, 46, 0.15);
  color: #fff8e3;
}

.mw-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(196, 160, 89, 0.2);
  border: 1px solid rgba(196, 160, 89, 0.5);
  color: #f5d68e;
  font-size: 9px;
  font-weight: 800;
  cursor: help;
}

/* ==========================================================================
   DETACHED SIDE SELECTOR PANEL ATTACHED NEXT TO RIGHT MENU
   Used for:
   - Select VFX (UIAnimationControl 10001001..10001160 & Fullscreen 10002001..10002037)
   - Button State Machine 1-Tier Child Selector (Normal / Hover / Pressed / Disabled)
   - Client Control Template List (GridScroller Content & ReferenceControl)
   ========================================================================== */
.mw-side-open-chevron {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #c8a86b;
  padding: 0 3px;
  opacity: 0.85;
  flex-shrink: 0;
  transition: transform 0.12s ease, color 0.12s ease;
}

.mw-vfx-selected-main:hover .mw-side-open-chevron,
.mw-ref-template-main:hover .mw-side-open-chevron {
  color: #f5b82e;
}

.mw-side-selector-panel {
  position: absolute;
  top: 10px;
  right: 336px;
  width: 274px;
  max-height: calc(100% - 20px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1e1813 0%, #16120e 100%);
  border: 1.5px solid #c8a86b;
  border-radius: 5px;
  box-shadow:
    -10px 12px 32px rgba(0, 0, 0, 0.82),
    0 0 0 1px rgba(18, 14, 10, 0.95),
    inset 0 1px 0 rgba(255, 232, 179, 0.14);
  z-index: 70;
  overflow: hidden;
}

.mw-side-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #33291f 0%, #241d16 100%);
  border-bottom: 1px solid rgba(200, 168, 107, 0.48);
  flex-shrink: 0;
}

.mw-side-selector-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.mw-side-selector-hdr-icon {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: rgba(245, 184, 46, 0.16);
  border: 1px solid rgba(245, 184, 46, 0.5);
  color: #f5b82e;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mw-side-selector-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #f7e8c8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-side-selector-count-pill {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  color: #e6c275;
  background: rgba(18, 14, 10, 0.75);
  border: 1px solid rgba(196, 160, 89, 0.38);
  border-radius: 999px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.mw-side-selector-close {
  width: 21px;
  height: 21px;
  border-radius: 3px;
  background: #17130f;
  border: 1px solid rgba(196, 160, 89, 0.42);
  color: #d6c3a0;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.mw-side-selector-close:hover {
  border-color: #f5b82e;
  background: #33271a;
  color: #fff8e6;
}

.mw-side-selector-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 8px 6px 8px;
  padding: 0 7px;
  height: 27px;
  background: #120f0c;
  border: 1px solid #45392c;
  border-radius: 3px;
  flex-shrink: 0;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.mw-side-selector-search-wrap:focus-within {
  border-color: #f5b82e;
  box-shadow: 0 0 0 1px rgba(245, 184, 46, 0.25);
}

.mw-side-selector-search-icon {
  font-size: 10px;
  opacity: 0.75;
}

.mw-side-selector-search-wrap input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.mw-side-selector-search-wrap input::placeholder {
  color: #7c6d58;
}

.mw-side-search-clear {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(196, 160, 89, 0.2);
  color: #e6d2ad;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mw-side-search-clear:hover {
  background: rgba(245, 184, 46, 0.4);
  color: #fff;
}

.mw-side-selector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 8px 7px 8px;
  border-bottom: 1px solid rgba(196, 160, 89, 0.24);
  flex-shrink: 0;
}

.mw-side-selector-tabs.mw-side-tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

.mw-vfx-filter-tab {
  height: 23px;
  padding: 0 4px;
  border-radius: 3px;
  background: #15110d;
  border: 1px solid rgba(161, 138, 94, 0.34);
  color: #cbb997;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.mw-vfx-filter-tab:hover {
  border-color: #d4af37;
  background: #251e17;
  color: #f5e6c4;
}

.mw-vfx-filter-tab.active {
  background: linear-gradient(180deg, rgba(245, 184, 46, 0.28) 0%, rgba(196, 144, 34, 0.2) 100%);
  border-color: #f5b82e;
  color: #fff6db;
  box-shadow: inset 0 0 0 1px rgba(245, 184, 46, 0.25);
}

.mw-side-selector-list {
  flex: 1;
  min-height: 150px;
  max-height: 430px;
  overflow-y: auto;
  padding: 6px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: #6b573b #14100c;
}

.mw-side-selector-list::-webkit-scrollbar {
  width: 6px;
}

.mw-side-selector-list::-webkit-scrollbar-track {
  background: #14100c;
}

.mw-side-selector-list::-webkit-scrollbar-thumb {
  background: #5c4b33;
  border-radius: 3px;
}

.mw-side-selector-list::-webkit-scrollbar-thumb:hover {
  background: #c8a86b;
}

.mw-side-selector-group-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #e6c275;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 4px 3px 6px;
  background: rgba(34, 28, 21, 0.65);
  border-left: 2px solid #d4af37;
  border-bottom: 1px solid rgba(196, 160, 89, 0.22);
  border-radius: 2px;
  margin-top: 3px;
}

.mw-side-group-count {
  font-size: 8.5px;
  color: #cbb997;
  background: rgba(16, 13, 10, 0.7);
  border: 1px solid rgba(161, 138, 94, 0.3);
  border-radius: 3px;
  padding: 0 5px;
}

.mw-side-selector-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, #241e17 0%, #1d1812 100%);
  border: 1px solid rgba(161, 138, 94, 0.26);
  cursor: pointer;
  transition: all 0.12s ease;
}

.mw-side-selector-row:hover {
  border-color: #d4af37;
  background: linear-gradient(180deg, #30271d 0%, #251e16 100%);
  transform: translateX(1px);
}

.mw-side-selector-row.selected {
  border-color: #f5b82e;
  background: linear-gradient(90deg, rgba(245, 184, 46, 0.24) 0%, rgba(42, 33, 22, 0.92) 100%);
  box-shadow: inset 2px 0 0 #f5b82e, 0 0 0 1px rgba(245, 184, 46, 0.22);
}

.mw-side-choice-thumb {
  width: 26px !important;
  height: 26px !important;
  font-size: 11px !important;
  border-radius: 4px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.55);
  flex-shrink: 0;
}

.mw-side-selector-row-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.22;
}

.mw-side-selector-row-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #f7e8c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-side-selector-row.selected .mw-side-selector-row-name {
  color: #fff8e6;
}

.mw-side-selector-row-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: #a99778;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-side-selector-row-sub strong {
  color: #d6c3a0;
  font-weight: 700;
}

.mw-side-row-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mw-side-choice-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f5b82e;
  color: #18130e;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px rgba(245, 184, 46, 0.5);
}

.mw-tpl-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  color: #bfe0ff;
  background: rgba(56, 130, 210, 0.16);
  border: 1px solid rgba(115, 175, 240, 0.42);
  flex-shrink: 0;
}

.mw-side-selector-empty {
  padding: 16px 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(18, 14, 10, 0.55);
  border: 1px dashed rgba(161, 138, 94, 0.3);
  border-radius: 4px;
  line-height: 1.45;
}

.mw-vfx-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.mw-vfx-badge.is-loop {
  color: #ffe299;
  background: rgba(245, 184, 46, 0.16);
  border: 1px solid rgba(245, 184, 46, 0.48);
}

.mw-vfx-badge.is-once {
  color: #ffb8c6;
  background: rgba(255, 94, 126, 0.16);
  border: 1px solid rgba(255, 94, 126, 0.48);
}

.mw-side-selector-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  background: #14100c;
  border-top: 1px solid rgba(196, 160, 89, 0.32);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #b8a686;
  flex-shrink: 0;
}

.mw-side-footer-status {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-side-footer-status strong {
  color: #f5b82e;
}

.mw-side-footer-btn {
  padding: 2px 7px;
  border-radius: 3px;
  background: #241d16;
  border: 1px solid rgba(196, 160, 89, 0.4);
  color: #e6d2ad;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.mw-side-footer-btn:hover {
  border-color: #f5b82e;
  background: rgba(245, 184, 46, 0.18);
  color: #fff;
}

.mw-vfx-selected-box.active,
.mw-ref-template-box.active,
.mw-vfx-select-empty-btn.active {
  border-color: #f5b82e !important;
  box-shadow: 0 0 0 1px rgba(245, 184, 46, 0.45);
}