html { color-scheme: dark; }
:root {
  --bg: #16181d;
  --bg-panel: #1e222a;
  --bg-panel-2: #262b35;
  --bg-input: #12151b;
  --bg-hover: #2f3542;
  --bg-active: #3a4252;
  --line: #343b49;
  --line-2: #4a5366;
  --text: #e8eaef;
  --text-dim: #9aa3b5;
  --text-faint: #6b7384;
  --accent: #3d8bfd;
  --accent-2: #2ec4b6;
  --ok: #3dd68c;
  --warn: #f0c14b;
  --danger: #e85d4c;
  --canvas: #2a2f3a;
  --bezel: #0b0d11;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

.app {
  --left-w: 228px;
  --right-w: 268px;
  display: grid;
  grid-template-columns: var(--left-w) 1fr var(--right-w);
  grid-template-rows: 34px 30px 44px minmax(0, 1fr) 214px 26px;
  height: 100%;
}
.titlebar { grid-column: 1 / -1; }
.menubar { grid-column: 1 / -1; }
.toolbar { grid-column: 1 / -1; }
.left { grid-column: 1; grid-row: 4; }
.workspace { grid-column: 2; grid-row: 4; }
.right { grid-column: 3; grid-row: 4; }
.bottom { grid-column: 1 / -1; grid-row: 5; }
.statusbar { grid-column: 1 / -1; grid-row: 6; }

.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: linear-gradient(180deg, #222733, #1a1e27);
  border-bottom: 1px solid var(--line);
}
.logo {
  width: 18px; height: 18px; border-radius: 4px;
  background: conic-gradient(from 210deg, #2ec4b6, #3d8bfd, #7a5cff, #2ec4b6);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.titlebar h1 {
  font-size: 13px; font-weight: 600; margin: 0; letter-spacing: 0.02em;
}
.titlebar .proj { color: var(--text-dim); font-weight: 400; }
.titlebar .dirty { color: var(--warn); margin-left: 6px; }
.titlebar .discord-link {
  margin-left: auto;
  color: #c4d4ff;
  text-decoration: none;
  font: 12px var(--font);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #5865f2;
  background: rgba(88, 101, 242, 0.22);
}
.titlebar .discord-link:hover { color: #fff; background: #5865f2; }

.menubar {
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.menubar button.menu {
  background: none; border: 0; color: var(--text);
  font: 12.5px var(--font); padding: 4px 10px; border-radius: 4px; cursor: pointer;
}
.menubar button.menu:hover, .menubar button.menu.open { background: var(--bg-hover); }
.menubar .menu-discord {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 6px;
  background: rgba(88, 101, 242, 0.22); border: 1px solid #5865f2;
  color: #c4d4ff; text-decoration: none;
  font: 12.5px var(--font); padding: 3px 10px; border-radius: 4px; cursor: pointer;
}
.menubar .menu-discord svg { display: block; flex: 0 0 auto; }
.menubar .menu-discord:hover { color: #fff; background: #5865f2; }
.menu-pop {
  position: absolute; top: 28px; min-width: 220px;
  background: var(--bg-panel-2); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 4px; z-index: 50; box-shadow: var(--shadow);
}
.menu-pop button {
  display: flex; width: 100%; justify-content: space-between;
  background: none; border: 0; color: var(--text); font: 12.5px var(--font);
  padding: 6px 10px; border-radius: 4px; cursor: pointer;
}
.menu-pop button:hover { background: var(--accent); color: #fff; }
.menu-pop kbd { color: var(--text-faint); font: 11px var(--mono); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.toolbar .grp { display: flex; gap: 4px; align-items: center; flex: 0 0 auto; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: 0 0 auto; }
.tb {
  height: 28px; min-width: 28px; padding: 0 8px;
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 5px;
  font: 12px/1 var(--font); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; flex: 0 0 auto; box-sizing: border-box;
}
.tb[hidden] { display: none !important; }
.tb:hover { background: var(--bg-hover); border-color: var(--line-2); }
.tb.primary { background: #1f4f9a; border-color: #2d6fd0; }
.tb.primary:hover { background: #275db3; }
.tb.ok { background: #146b48; border-color: #1d8a5d; }
.tb select, .toolbar select {
  height: 28px; background: var(--bg-input); color: var(--text);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; font: 12px var(--font);
}
#lvglVerSelect { width: 4.4em; min-width: 4.4em; }
.toolbar .meta { color: var(--text-dim); font-size: 12px; margin-left: 4px; }

.left, .right, .bottom {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  position: relative;
}
.col-resizer {
  position: absolute; top: 0; right: -3px; width: 6px; height: 100%;
  cursor: col-resize; z-index: 12; background: transparent;
}
.col-resizer:hover, .col-resizer:active,
body.col-resizing .col-resizer {
  background: var(--accent);
}
body.col-resizing { cursor: col-resize; user-select: none; }
.right { border-right: 0; border-left: 1px solid var(--line); }
.bottom { border-top: 1px solid var(--line); flex-direction: column; }

.pane-h {
  height: 26px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); background: #1a1e26; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.toolbox {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px;
  flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto;
}
.tool {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 6px; padding: 6px 8px; cursor: grab; font-size: 12px;
}
.tool:hover { border-color: var(--accent); background: #243044; }
.tool .ic {
  width: 22px; height: 22px; border-radius: 4px;
  display: grid; place-items: center; background: #1a1e26; color: var(--accent-2);
  font-size: 11px; font-weight: 700; flex: 0 0 22px;
}
.tool.ghost { opacity: 0.55; }

.res-pane {
  flex: 0 0 46%;
  min-height: 210px;
  max-height: 58%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-top: 1px solid var(--line);
  background: #1a1e26;
}
.res-tabs { display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.res-tabs button {
  flex: 1; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-dim); font: 11px var(--font); padding: 6px 4px; cursor: pointer;
}
.res-tabs button.on { color: var(--text); border-bottom-color: var(--accent); background: var(--bg-panel); }
.res-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
}
.res-item, .page-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; border-radius: 5px; font-size: 12px; cursor: pointer;
}
.res-item:hover, .page-item:hover { background: var(--bg-hover); }
.res-item.on, .page-item.on { background: #1d3a66; }
.page-item .id { color: var(--text-faint); font: 11px var(--mono); margin-right: 8px; }
.page-item-right { display: flex; align-items: center; gap: 6px; }
.page-lock-btn {
  width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg-input); color: var(--text-dim);
  cursor: pointer;
}
.page-lock-btn:hover { border-color: var(--line-2); color: var(--text); }
.page-lock-btn.on {
  background: #3a2e14; border-color: #c9a227; color: #f0d78c;
}
.page-lock-btn .padlock,
.page-lock-badge .padlock {
  width: 13px; height: 13px; display: block;
  fill: currentColor;
}
.page-lock-btn .padlock circle { fill: var(--bg-input); }
.page-lock-btn.on .padlock circle { fill: #3a2e14; }
.page-item.locked { outline: 1px dashed rgba(201, 162, 39, 0.35); }
.lock-banner {
  padding: 8px 10px;
  background: #3a2e14;
  color: #f0d78c;
  font-size: 12px;
  border-bottom: 1px solid #c9a227;
}
.toolbox.page-locked { opacity: 0.42; pointer-events: none; }
.device-screen.page-locked { cursor: default; }
.page-lock-badge {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 8;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0d78c;
  background: rgba(40, 32, 12, 0.78);
  border-radius: 4px;
  pointer-events: none;
}
.res-subhead {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint); padding: 10px 8px 4px;
}
.hidden-comp { padding-left: 14px; }
.hidden-comp .id { font-size: 10px; }
.mini-btns { display: flex; gap: 4px; padding: 6px; flex: 0 0 auto; border-top: 1px solid var(--line); }
.mini-btns button { flex: 1; min-width: 0; padding: 0 4px; }

.pic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pic-item {
  position: relative;
  background: #12151b;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}
.pic-item:hover { border-color: var(--line-2); }
.pic-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pic-item .thumb {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: contain;
  background:
    linear-gradient(45deg, #2a2f3a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2f3a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2f3a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2f3a 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-color: #0b0d11;
}
.pic-item .meta {
  font-size: 10px;
  line-height: 1.3;
  padding: 4px 6px 5px;
  color: var(--text-dim);
}
.pic-item .meta b {
  display: block;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pic-item .del {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border: 0; border-radius: 4px;
  background: rgba(0,0,0,0.65); color: #fff; cursor: pointer;
  font-size: 12px; line-height: 18px; padding: 0; display: none;
}
.pic-item:hover .del { display: block; }

.res-tabs button { font-size: 10.5px; }

.ir-frame {
  background: #0b0d11;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 8px;
}
.ir-frame canvas { max-width: 100%; height: auto; display: block; background: #000; }
.ic-frame {
  background: repeating-conic-gradient(#2a2f3a 0% 25%, #1a1e26 0% 50%) 50% / 16px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}
.ic-frame canvas {
  image-rendering: pixelated;
  display: block;
  max-width: 100%;
  height: auto;
  background: transparent;
}

.tool-modal { width: min(980px, 96vw); }
.tool-split { display: grid; grid-template-columns: 1fr 1.15fr; gap: 16px; }
.tool-preview canvas, .atlas-wrap {
  width: 100%; background: #0b0d11; border: 1px solid var(--line); border-radius: 6px;
}
.tool-preview canvas { height: 72px; display: block; }
.atlas-wrap { max-height: 220px; overflow: auto; }
.atlas-wrap img { display: block; max-width: 100%; image-rendering: pixelated; background:
  repeating-conic-gradient(#1a1e26 0% 25%, #12151b 0% 50%) 50% / 12px 12px; }

.gmov-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gmov-layout { display: grid; grid-template-columns: 1fr 240px; gap: 12px; min-height: 280px; }
.gmov-frames {
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
  overflow: auto; min-height: 260px; max-height: 360px;
  padding: 8px; background: var(--bg-input); border: 1px solid var(--line); border-radius: 6px;
}
.gm-frame {
  width: 88px; background: #12151b; border: 1px solid var(--line); border-radius: 5px;
  overflow: hidden; position: relative; cursor: pointer;
}
.gm-frame img { width: 100%; height: 64px; object-fit: contain; display: block; background: #0b0d11; }
.gm-frame .ix { font-size: 10px; color: var(--text-dim); padding: 2px 4px; }
.gm-frame .del { position: absolute; top: 2px; right: 2px; display: none; }
.gm-frame:hover .del { display: block; }
.gmov-play {
  background: #0b0d11; border: 1px solid var(--line); border-radius: 6px;
  height: 140px; display: grid; place-items: center; margin-bottom: 8px; overflow: hidden;
}
.gmov-play img { max-width: 100%; max-height: 140px; object-fit: contain; }

.w-gmov { overflow: hidden; background: #111; }
.w-gmov img.pic-fit { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; }

.font-item { display: flex; align-items: center; gap: 8px; }
.font-item canvas { background: #0b0d11; border-radius: 3px; }

@media (max-width: 900px) {
  .tool-split, .gmov-layout { grid-template-columns: 1fr; }
}

.workspace {
  background:
    radial-gradient(circle at 50% 40%, #2c3340 0%, var(--canvas) 55%);
  position: relative; overflow: hidden;
}
.workspace-inner {
  position: absolute; inset: 0; overflow: auto;
}
.device-zoom-slot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.device-wrap { transform-origin: center center; }
.lcd-zoom {
  position: absolute; right: 12px; bottom: 12px; z-index: 6;
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-panel); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 4px;
  box-shadow: var(--shadow);
}
.lcd-zoom .tb { min-width: 28px; height: 26px; padding: 0 8px; }
.lcd-zoom #zoomPct {
  min-width: 3.6em; text-align: center;
  font: 11px var(--mono); color: var(--text-dim); user-select: none;
}
.device-bezel {
  background: linear-gradient(160deg, #3a404c, #16181e);
  border-radius: 18px; padding: 18px 18px 28px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
}
.device-bezel.round {
  border-radius: 50%;
  padding: 14px;
  overflow: hidden;
}
.device-bezel.round .device-label {
  display: none;
}
.device-screen.round,
.device-screen.round .page-bg {
  border-radius: 50%;
  overflow: hidden;
}
.device-screen.round.grid-on::after {
  border-radius: 50%;
}
.device-label {
  position: absolute; left: 0; right: 0; bottom: 8px; text-align: center;
  font-size: 10px; letter-spacing: 0.14em; color: #8b93a3; text-transform: uppercase;
}
.device-screen {
  position: relative; overflow: hidden; background: #000;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #111;
}
.page-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  display: block;
}
.page-bg.fit-stretch { object-fit: fill; }
.page-bg.fit-crop { object-fit: cover; object-position: top left; }
.device-screen.grid-on::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}
.widget { z-index: 1; }
.widget {
  position: absolute; overflow: hidden;
  border: 1px solid transparent;
}
.widget-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  display: block;
}
.widget-bg.fit-stretch { object-fit: fill; }
.widget-bg.fit-crop { object-fit: cover; object-position: top left; }
.widget .w-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: inherit;
  justify-content: inherit;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pic-pick {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
}
.pic-pick select {
  flex: 1; min-width: 0;
  background: var(--bg-input);
  color: var(--text);
  color-scheme: dark;
}
.pic-pick img {
  width: 22px; height: 18px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 3px; background: #111; flex: 0 0 22px;
}
.widget.selected { outline: 1px solid var(--accent); outline-offset: 0; }
.widget.vis-hidden {
  opacity: 0.38 !important;
  outline: 1px dashed rgba(154, 163, 181, 0.9);
  outline-offset: -1px;
}
.widget.vis-hidden.selected {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}
.widget.vis-hidden::after {
  content: "hidden";
  position: absolute;
  left: 2px;
  top: 2px;
  z-index: 6;
  padding: 0 4px;
  font: 9px/14px var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8eaef;
  background: rgba(20, 24, 32, 0.72);
  border-radius: 3px;
  pointer-events: none;
}
.widget.hotspot {
  background: repeating-linear-gradient(45deg, rgba(61,139,253,0.12), rgba(61,139,253,0.12) 6px, transparent 6px, transparent 12px);
  border: 1px dashed rgba(61,139,253,0.55);
}
.w-text, .w-number {
  display: flex; padding: 0 6px; white-space: nowrap;
}
.w-button, .w-dual {
  display: flex;
  padding: 0 6px;
  border-radius: 4px; font-weight: 600; letter-spacing: 0.04em;
}
.w-progress {
  display: block;
  padding: 0;
  margin: 0;
  line-height: 0;
  font-size: 0;
  overflow: hidden;
}
.w-progress > .bar {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  z-index: 0;
}
.w-slider .track {
  position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px;
}
.w-slider .knob {
  position: absolute; top: 50%; width: 14px; height: 22px; margin-top: -11px; border-radius: 3px;
  background: #dfe6f2; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.w-keypad, .w-numpad {
  box-sizing: border-box;
  overflow: hidden;
  background: #101010;
}
.kb-key {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-weight: 700;
  font-size: inherit;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.35);
  user-select: none;
  pointer-events: none;
  box-sizing: border-box;
}
.kb-key.spec { font-size: 0.95em; }
.widget.kb-focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.w-textinput {
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
  padding: 0 8px;
  box-sizing: border-box;
}
.w-textinput.ti-empty {
  color: rgba(232, 234, 239, 0.4) !important;
}
.w-check, .w-radio {
  display: flex; border: 2px solid currentColor;
}
.w-check { border-radius: 4px; }
.w-radio { border-radius: 50%; }
.w-gauge canvas, .w-wave canvas, .w-waveform canvas, .w-bargraph canvas, .w-qr canvas,
.w-battery canvas, .w-cell canvas, .w-wifi canvas, .w-shape canvas { width: 100%; height: 100%; display: block; background: transparent; }
.widget.w-shape { overflow: visible; background: transparent; }
.w-shape.drawing { cursor: crosshair; outline: 1px dashed var(--accent); }
.w-shape.shape-empty { border: 1px dashed rgba(61, 139, 253, 0.45); }
.shape-cv { pointer-events: none; }
.shape-pt {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 2px;
  z-index: 7;
  cursor: grab;
  pointer-events: auto;
  box-sizing: border-box;
}
.shape-pt:active { cursor: grabbing; }
.shape-hint {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 6;
  padding: 2px 6px;
  font: 10px/14px var(--font);
  color: #e8eaef;
  background: rgba(20, 24, 32, 0.72);
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}
.shape-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.shape-tools .prop-hint {
  flex: 1 1 100%;
  padding: 0;
}
.w-battery, .w-cell, .w-wifi { background: transparent; }
.w-camera { overflow: hidden; background: #111; }
.w-camera .cam-feed {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.w-camera .cam-label {
  position: absolute; left: 6px; bottom: 4px; z-index: 1;
  font-size: 10px; letter-spacing: 0.08em; color: #9fef9f;
  text-shadow: 0 1px 2px #000;
}
.w-scrolltext { overflow: hidden; }
.scroll-cv { display: block; width: 100%; height: 100%; pointer-events: none; }
.w-xfloat, .w-sltext, .w-filestream, .w-audio { display: flex; padding: 0 6px; }
.w-crop { overflow: hidden; background: #111; }
.crop-img { position: absolute; max-width: none; pointer-events: none; }
.w-touchcap { overflow: hidden; }
.touchcap-cv { width: 100%; height: 100%; display: block; }
.sw-knob {
  position: absolute; top: 3px; width: 22px; height: calc(100% - 6px);
  border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  left: 3px; transition: left 0.15s;
}
.w-switch.on .sw-knob { left: calc(100% - 25px); }
.widget.w-combo { overflow: visible; }
.w-combo { display: flex; padding: 0 8px; }
.w-combo.open { z-index: 8; }
.combo-caret { opacity: 0.7; font-size: 12px; margin-left: auto; padding-left: 6px; }
.combo-drop {
  position: absolute; left: 0; right: 0; top: 100%;
  z-index: 9; border: 1px solid rgba(255,255,255,0.18);
  max-height: 140px; overflow: auto; box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.w-textselect, .w-datarecord, .w-filebrowser {
  overflow: auto; font-size: 11px; line-height: 1.35;
}
.list-row { padding: 3px 6px; white-space: nowrap; }
.list-row.hdr { opacity: 0.65; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.12); }
.list-row.on { border-radius: 3px; }
.w-video { background: #111; display: flex; align-items: center; justify-content: center; color: #9aa3b5; }
.w-expicture { overflow: hidden; background: #111; }
.w-expicture img.pic-fit,
.w-gmov img.pic-fit,
.w-video img.pic-fit {
  display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
}
.w-picture {
  overflow: hidden;
  background: #111;
}
.w-icon {
  overflow: hidden;
  background: transparent;
}
.w-picture img.pic-fit,
.w-icon img.pic-fit {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.w-picture.fit-stretch img.pic-fit,
.w-icon.fit-stretch img.pic-fit,
.w-expicture.fit-stretch img.pic-fit { object-fit: fill; }
.w-picture.fit-contain img.pic-fit,
.w-icon.fit-contain img.pic-fit,
.w-expicture.fit-contain img.pic-fit { object-fit: contain; }
.w-picture.fit-cover img.pic-fit,
.w-icon.fit-cover img.pic-fit,
.w-expicture.fit-cover img.pic-fit { object-fit: cover; }
.w-piclist {
  overflow: hidden;
  background: #111;
}
.w-piclist .piclist-inner { min-height: 100%; }
.w-piclist .piclist-row {
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa3b5;
  font-size: 11px;
  background: #1a1e26;
}
.w-piclist .piclist-row img.pic-fit {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.w-piclist.fit-stretch .piclist-row img.pic-fit { object-fit: fill; }
.w-piclist.fit-contain .piclist-row img.pic-fit { object-fit: contain; }
.w-piclist.fit-cover .piclist-row img.pic-fit { object-fit: cover; }
.w-piclist .piclist-empty {
  padding: 12px 8px;
  color: #6b7384;
  font-size: 11px;
  text-align: center;
}
.handle {
  position: absolute; width: 8px; height: 8px; background: #fff;
  border: 1px solid var(--accent); z-index: 5;
}
.handle.nw { left: -4px; top: -4px; cursor: nwse-resize; }
.handle.ne { right: -4px; top: -4px; cursor: nesw-resize; }
.handle.sw { left: -4px; bottom: -4px; cursor: nesw-resize; }
.handle.se { right: -4px; bottom: -4px; cursor: nwse-resize; }
.handle.n { left: calc(50% - 4px); top: -4px; cursor: ns-resize; }
.handle.s { left: calc(50% - 4px); bottom: -4px; cursor: ns-resize; }
.handle.w { left: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.handle.e { right: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.marquee {
  position: absolute; border: 1px dashed var(--accent); background: rgba(61,139,253,0.08); pointer-events: none;
}

.prop-grid { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.prop-row {
  display: grid; grid-template-columns: 86px 1fr; border-bottom: 1px solid var(--line);
  min-height: 26px; font-size: 12px; flex: 0 0 auto;
}
.prop-row label {
  display: flex; align-items: center; padding: 0 8px; color: var(--text-dim);
  background: #1a1e26; border-right: 1px solid var(--line);
}
.prop-row.rw label { color: #3dd68c; }
.prop-row.on,
.prop-row.on label { background: #1d3a66; }
.prop-hint {
  margin-top: auto;
  min-height: 52px;
  padding: 8px 10px;
  font: 11px var(--font);
  color: var(--text);
  background: #12151b;
  border-top: 1px solid var(--line);
  line-height: 1.4;
  white-space: pre-wrap;
}
.prop-row .val { display: flex; align-items: center; gap: 6px; padding: 2px 6px; min-width: 0; }
.prop-row input, .prop-row select {
  width: 100%; background: var(--bg-input); border: 0; color: var(--text);
  font: 12px var(--mono); outline: none; min-width: 0;
  color-scheme: dark;
}
.prop-row select option,
.pic-pick select option,
select option {
  background-color: #1e222a;
  color: #e8eaef;
}
.prop-row select option:checked,
.pic-pick select option:checked {
  background-color: #1d3a66;
  color: #ffffff;
}
.prop-row input[type="color"] { width: 22px; height: 18px; padding: 0; border: 0; background: none; }
.prop-row .ro { color: var(--text-faint); font: 12px var(--mono); padding: 0 4px; }
.no-sel { padding: 16px; color: var(--text-faint); font-size: 12px; line-height: 1.5; }

.bottom { display: flex; flex-direction: column; }
.ev-tabs { display: flex; background: #1a1e26; border-bottom: 1px solid var(--line); }
.ev-tabs button {
  background: none; border: 0; border-right: 1px solid var(--line);
  color: var(--text-dim); font: 12px var(--font); padding: 7px 12px; cursor: pointer;
}
.ev-tabs button.on { background: var(--bg-panel); color: var(--text); }
.ev-body { flex: 1; display: flex; min-height: 0; }
.ev-editor, .output {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.ac-pop {
  position: fixed; z-index: 80; min-width: 260px; max-width: 420px; max-height: 240px;
  overflow: auto; padding: 4px 0;
  background: #1c212b; border: 1px solid #3d4a62; border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45); display: none;
}
.ac-pop.show { display: block; }
.ac-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 0 10px; align-items: center;
  padding: 5px 10px; cursor: pointer; font: 12px var(--mono); color: #e8eaef;
}
.ac-item .k {
  font: 10px var(--font); letter-spacing: 0.04em; text-transform: uppercase;
  color: #8b95a8; justify-self: start;
}
.ac-item .lab { color: #f2f5fa; }
.ac-item .det { grid-column: 2; color: #8b95a8; font: 11px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item.on, .ac-item:hover { background: #243656; }
.ac-item.on .k { color: #9ec1ff; }
.ac-hint {
  padding: 3px 10px 5px; color: #6d7686; font: 10px var(--font);
  border-top: 1px solid #2a3140; margin-top: 2px;
}

.ev-editor textarea, .output pre {
  flex: 1; margin: 0; border: 0; resize: none; outline: none;
  background: var(--bg-input); color: #d7e0f0;
  font: 12.5px/1.45 var(--mono); padding: 8px 10px;
  user-select: text;
}
.output { border-left: 1px solid var(--line); max-width: 42%; }
.output pre { color: #b7c0d0; white-space: pre-wrap; overflow: auto; }
.output .err { color: var(--danger); }
.output .warn { color: var(--warn); }
.output .ok { color: var(--ok); }

.statusbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 10px; font-size: 11px; color: var(--text-dim);
  background: #14171d; border-top: 1px solid var(--line);
}
.statusbar b { color: var(--text); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 6px; }
.dot.bad { background: var(--danger); }

.modal-back {
  position: fixed; inset: 0; background: rgba(8,10,14,0.55);
  display: none; align-items: center; justify-content: center; z-index: 80;
}
.modal-back.show { display: flex; }
.modal {
  width: min(760px, 94vw); max-height: 88vh; overflow: auto;
  background: var(--bg-panel); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: var(--shadow);
}
.modal h2 { margin: 0; font-size: 15px; padding: 14px 16px 8px; }
.modal .body { padding: 8px 16px 16px; }
.modal .row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.modal label { font-size: 12px; color: var(--text-dim); }
.modal input, .modal select, .modal textarea {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--line);
  border-radius: 5px; padding: 6px 8px; font: 12px var(--font); width: 100%;
}
.pin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 16px; }
.hint { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.cfg-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  font-size: 12px;
  line-height: 1.45;
  max-height: 240px;
  overflow: auto;
}
.cfg-box.ok { border-color: #2a6a4a; }
.cfg-box.has-warn { border-color: var(--warn); }
.cfg-box.has-err { border-color: var(--danger); }
.cfg-box .cfg-title { font-weight: 600; margin-bottom: 6px; color: var(--text); }
.cfg-box ul { margin: 0; padding-left: 18px; }
.cfg-box li { margin: 3px 0; }
.cfg-box li.err { color: var(--danger); }
.cfg-box li.warn { color: var(--warn); }
.cfg-box li.note { color: var(--text-dim); }
.gh-list {
  border: 1px solid var(--line); border-radius: 6px; max-height: 220px; overflow: auto;
  background: var(--bg-input); min-height: 72px;
}
.gh-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid var(--line); font: 12px var(--mono);
}
.gh-item:last-child { border-bottom: 0; }
.gh-item button { flex: 0 0 auto; }

.sim-back { position: fixed; inset: 0; background: rgba(8,10,14,0.62); display: none; z-index: 70; }
.sim-back.show {
  display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap;
  padding: 16px; gap: 16px; overflow: auto;
}
.sim-col { display: flex; flex-direction: column; gap: 10px; }
.sim-screen-wrap { display: flex; align-items: center; justify-content: center; }
.sim-term {
  width: min(480px, 96vw); min-width: 280px; background: var(--bg-panel); border: 1px solid var(--line-2);
  border-radius: 10px; display: flex; flex-direction: column; min-height: 0;
  max-height: calc(100vh - 32px); flex: 1 1 320px;
}
.sim-term h3 { margin: 0; padding: 10px 12px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--line); }
.sim-term-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.sim-lcd-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #5a6270; flex: 0 0 auto;
}
.sim-lcd-dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(61, 214, 140, 0.7); }
.sim-lcd-lab { flex: 1; min-width: 8em; font-size: 11.5px; color: var(--text-dim); }
.sim-lcd-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 10px 0; padding: 8px 10px;
  background: #3a2a12; border: 1px solid #8a6a22; border-radius: 6px;
  color: #f0c14b; font-size: 12px; line-height: 1.35;
}
.sim-lcd-banner[hidden] { display: none !important; }
.sim-lcd-banner .tb { flex: 0 0 auto; }
.sim-term-targets {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-dim); flex-wrap: wrap;
}
.sim-term-targets label { display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; color: var(--text); }
.sim-term-targets input { margin: 0; }
.sim-term-targets .sim-lcd-lab { flex: 1; min-width: 0; }
.sim-term-targets .tb { margin-left: auto; height: 24px; }
.sim-log {
  flex: 1; overflow: auto; font: 11.5px/1.45 var(--mono); padding: 8px 10px;
  color: #b7c0d0; background: var(--bg-input); min-height: 200px; user-select: text;
}
.sim-log .in { color: #9ad8ff; }
.sim-log .out { color: var(--ok); }
.sim-log .lcd { color: #f0c14b; }
.sim-log .sys { color: var(--text-dim); }
.sim-log .err { color: var(--danger); }
.sim-cmd { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.sim-cmd input { flex: 1; background: var(--bg-input); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; font: 12px var(--mono); }
.sim-cmd-hint { padding: 0 10px 8px; font-size: 10.5px; color: var(--text-faint); }

.toast {
  position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%);
  background: #11151c; border: 1px solid var(--line-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 12px; display: none; z-index: 90;
}
.toast.show { display: block; }

.ver-pill {
  display: inline-block; font-size: 10px; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 999px; margin: 0 6px 0 2px;
  background: #146b48; color: #d4ffe8; vertical-align: middle;
}
.ver-pill.v1 { background: #3a4252; color: #c5ccd8; }
.app-ver {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--accent-2); margin: 0 2px 0 4px; letter-spacing: 0.04em;
  vertical-align: middle;
}
.cl-list { display: flex; flex-direction: column; gap: 14px; }
.cl-rel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-input);
}
.cl-rel.current { border-color: var(--accent-2); }
.cl-rel h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
}
.cl-ver {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 1px 7px;
  border-radius: 999px;
  background: #146b48;
  color: #d4ffe8;
  margin-right: 6px;
  vertical-align: middle;
}
.cl-date { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.cl-rel ul { margin: 0; padding-left: 18px; }
.cl-rel li { margin: 5px 0; font-size: 12px; line-height: 1.45; color: var(--text); }


.hw-pane, .ino-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-input);
}
.hw-pane[hidden], .ino-pane[hidden], #evEditorPane[hidden] { display: none !important; }
.hw-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.hw-table-wrap { flex: 1; overflow: auto; }
.hw-table { width: 100%; border-collapse: collapse; font: 12px var(--font); }
.hw-table th {
  text-align: left; color: var(--text-dim); font-weight: 600;
  padding: 6px 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #151922;
}
.hw-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.hw-table input, .hw-table select {
  width: 100%; background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; font: 11.5px var(--mono);
}
.hw-table .pin { width: 64px; }
.hw-table .ms { width: 70px; }
.hw-table .tiny { width: 56px; }
.hw-table .wid { min-width: 90px; }
.conflict { color: var(--warn); }

.ino-tabs { display: flex; border-bottom: 1px solid var(--line); background: #1a1e26; }
.ino-tabs button {
  background: none; border: 0; border-right: 1px solid var(--line);
  color: var(--text-dim); font: 12px var(--font); padding: 6px 12px; cursor: pointer;
}
.ino-tabs button.on { color: var(--accent-2); background: var(--bg-input); }
.ino-text {
  flex: 1; margin: 0; border: 0; resize: none; outline: none;
  background: var(--bg-input); color: #d7e0f0;
  font: 12.5px/1.45 var(--mono); padding: 8px 10px; user-select: text;
}
.bind-chip {
  display: inline-block; margin-top: 8px; padding: 4px 8px;
  font-size: 11px; border-radius: 4px; background: #14352e; color: #9ee7d4;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3c4454; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
