:root, html[data-theme='dark'] {
  --darken: 0%;
  --bg-base: #0b0d12;
  --panel-base: rgba(20, 23, 31, .86);
  --panel-2-base: rgba(255, 255, 255, .055);
  --line-base: rgba(255, 255, 255, .10);
  --canvas-bg-base: #10121a;
  --bg: color-mix(in srgb, #000 var(--darken), var(--bg-base));
  --panel: color-mix(in srgb, #000 var(--darken), var(--panel-base));
  --panel-2: color-mix(in srgb, #000 var(--darken), var(--panel-2-base));
  --line: color-mix(in srgb, #000 var(--darken), var(--line-base));
  --canvas-bg: color-mix(in srgb, #000 var(--darken), var(--canvas-bg-base));
  --text: #f3f2f7;
  --muted: #9699a8;
  --accent: #a88bff;
  --accent-2: #80e4ca;
  --accent-gradient: linear-gradient(110deg, #b39aff, #7ddcc8);
  --danger: #f2666f;
  --grid: rgba(255, 255, 255, 0.045);
  --text-empty-bg: color-mix(in srgb, var(--accent) 13%, transparent);
  --shadow: 0 15px 55px rgba(0, 0, 0, .35);
  --radius: 12px;
}

html[data-theme='light'] {
  --bg: #e9edf4;
  --panel: #ffffff;
  --panel-2: #f2f5fa;
  --line: #d3dae6;
  --text: #1b2230;
  --muted: #647084;
  --accent: #356ae6;
  --accent-2: #168f72;
  --danger: #c92f45;
  --canvas-bg: #f7f9fc;
  --grid: rgba(25, 35, 55, 0.12);
  --shadow: 0 10px 30px rgba(30, 45, 80, 0.16);
  --radius: 12px;
}

* { box-sizing: border-box; }

/* el atributo hidden debe ganar siempre a los display de los componentes */
[hidden] { display: none !important; }


html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.sprite { display: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic { width: 17px; height: 17px; flex: none; }
.ic.big { width: 42px; height: 42px; stroke-width: 1.2; }

/* ---------- barra superior ---------- */
#topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 54px;
  display: flex;
  align-items: stretch;
  background: rgba(12, 14, 20, .78);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .24);
  backdrop-filter: blur(18px);
  z-index: 80;
  transform: translateY(-102%);
  opacity: 0;
  pointer-events: none;
  transition: transform .16s ease, opacity .16s ease;
  -webkit-app-region: drag;
  user-select: none;
}
body.chrome-visible #topbar {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#topbar-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar-main::-webkit-scrollbar { height: 0; }
#topbar .btn, #topbar select, #topbar input, #topbar label { -webkit-app-region: no-drag; }
#wincontrols {
  flex: none;
  display: flex;
  align-items: stretch;
  height: 100%;
  border-left: 1px solid var(--line);
}
.winbtn {
  width: 45px;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #a8aab5;
  cursor: pointer;
  -webkit-app-region: no-drag;
}
.winbtn:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.winbtn.close:hover { background: #d94358; color: #fff; }
.winbtn:active { background: color-mix(in srgb, var(--panel-2) 70%, var(--accent) 20%); }
.winbtn.close:active { background: #b52e42; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 650; letter-spacing: .02em;
  padding-right: 8px; white-space: nowrap;
}
.brand-mark {
  display: inline-flex; align-items: flex-start; gap: 1px;
  color: var(--text); font-size: 21px; line-height: 1; font-weight: 750;
  letter-spacing: -.08em;
}
.brand-mark small { margin-top: 2px; color: var(--accent); font-size: 9px; line-height: 1; font-weight: 800; letter-spacing: 0; }
.group { display: flex; align-items: center; gap: 4px; }
.spacer { flex: 1; }
.sep { width: 1px; height: 22px; background: var(--line); flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, transform .16s, box-shadow .16s, filter .16s;
  font: inherit;
}
.btn:hover { background: rgba(255, 255, 255, .09); border-color: color-mix(in srgb, var(--line) 45%, var(--accent) 55%); box-shadow: 0 5px 18px rgba(168, 139, 255, .1); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.icon { padding: 0 7px; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.full { width: 100%; justify-content: center; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--panel-2) 70%, var(--danger) 25%); }

select, input[type='number'], input[type='text'] {
  height: 30px; padding: 0 8px;
  background: rgba(9, 11, 17, .68); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; outline: none; max-width: 190px;
}
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 139, 255, .13); }
.modal-card input[type='text'] { max-width: none; height: 34px; }
input[type='range'] { accent-color: var(--accent); height: 20px; }
input[type='color'] {
  width: 30px; height: 26px; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: none; cursor: pointer;
}
input[type='checkbox'] { accent-color: var(--accent); }

/* ---------- escenario ---------- */
#stage {
  position: relative;
  height: 100%;
  display: flex;
  align-items: stretch;
}

#view {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: clip;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 0);
  background-size: var(--grid-size, var(--grid-base, 40px)) var(--grid-size, var(--grid-base, 40px));
  background-position: var(--grid-pos, 0 0);
  cursor: default;
  touch-action: none;
  user-select: none;
}
#view::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 18% 10%, rgba(137, 106, 255, .09), transparent 42%),
              radial-gradient(ellipse at 88% 88%, rgba(83, 201, 178, .055), transparent 39%);
}
#view.panning { cursor: grabbing; }
#view.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }
#view.no-grid { background-image: none; }

#world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; will-change: transform; }
#overlay { position: absolute; inset: 0; pointer-events: none; }
#marquee {
  position: absolute; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: none;
}

.group-bg {
  position: absolute; z-index: 0; pointer-events: none;
  border: 1px solid; border-radius: 14px;
  box-shadow: 0 10px 35px rgba(0,0,0,.12), 0 0 0 1px rgba(255,255,255,.025);
}
.item {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 50%;
  user-select: none;
  contain: layout style paint;
}
.item-img {
  position: absolute; left: 50%; top: 50%;
  width: 100%; height: 100%; object-fit: fill; display: block;
  transform: translate(-50%, -50%); transform-origin: 50% 50%;
  pointer-events: none; user-select: none;
}
.item.is-broken { background: repeating-linear-gradient(45deg, #2a1f24, #2a1f24 8px, #241b20 8px, #241b20 16px); }
.item.is-broken::after {
  content: 'imagen no disponible'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); font-size: 13px;
}
.item-text {
  width: 100%; height: 100%; margin: 0; padding: 6px 8px;
  border: 0; outline: none; resize: none; overflow: hidden;
  background: transparent; color: var(--text);
  font-family: inherit; line-height: 1.25; white-space: pre-wrap;
  user-select: none; pointer-events: none;
}
.item-text:focus, .item-text.editing { user-select: text; pointer-events: auto; }
.item.is-empty .item-text { outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -1px; }

.sel-box { position: absolute; border: 1px solid var(--accent); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.sel-box.group { border-style: dashed; box-shadow: none; }
.handle {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  background: #fff; border: 1px solid var(--accent); border-radius: 2px;
}
.handle-rot { border-radius: 50%; background: var(--accent); }
.handle-nw, .handle-se { cursor: nwse-resize; }
.handle-ne, .handle-sw { cursor: nesw-resize; }
.handle-n, .handle-s { cursor: ns-resize; }
.handle-e, .handle-w { cursor: ew-resize; }

/* ---------- elementos flotantes ---------- */
#toolbar {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(22px);
}
.tool {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; color: #a8aab5;
  border: 0; border-radius: 8px; cursor: pointer;
}
.tool:hover { background: rgba(255,255,255,.08); color: var(--text); }
.tool.active { background: var(--accent-gradient); color: #161522; box-shadow: 0 5px 22px rgba(143,117,255,.22); }

#zoombar {
  position: absolute; left: 12px; bottom: 12px;
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(22px);
}
#zoombar .btn { border-color: transparent; background: transparent; }
#zoombar .btn:hover { background: var(--panel-2); }
#zoomLabel { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }

#statusbar {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; gap: 8px; align-items: center;
  padding: 6px 11px; font-size: 12px;
  background: rgba(20, 23, 31, .78);
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--muted); backdrop-filter: blur(18px);
}
.dotsep { opacity: .5; }
.muted { color: var(--muted); }

#emptyhint {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  text-align: center; color: var(--muted); pointer-events: none;
}
#emptyhint p { margin: 4px 0; }
#emptyhint strong { color: var(--text); font-size: 15px; }
#emptyhint .ic { color: var(--line); }
body.has-items #emptyhint { display: none; }
body.dragging #toolbar, body.dragging #zoombar, body.dragging #statusbar { backdrop-filter: none; }

/* ---------- inspector ---------- */
#inspector {
  position: relative; flex: none; width: 258px; height: 100%;
  background: rgba(16, 18, 26, .92); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 20;
  box-shadow: -12px 0 40px rgba(0,0,0,.2); backdrop-filter: blur(20px);
}
.insp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px; border-bottom: 1px solid var(--line);
  font-weight: 650; letter-spacing: .01em;
}
.insp-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.row > span:first-child { width: 66px; color: var(--muted); flex: none; }
.row input[type='range'] { flex: 1; min-width: 0; }
.row output { width: 42px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.row.btns { flex-wrap: wrap; gap: 5px; }
.row.btns .btn { flex: 1; justify-content: center; }
.chk { display: flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.colorwrap { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); }
.colorwrap input[type='color'] { width: 24px; height: 24px; }
input[type='number'] { width: 62px; }
#rowColors { flex-wrap: wrap; }

/* ---------- popover y modales ---------- */
#popover {
  position: absolute; right: 10px; top: 54px; z-index: 60; width: 250px;
  background: rgba(20, 23, 31, .9); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; box-shadow: var(--shadow); backdrop-filter: blur(22px);
  display: flex; flex-direction: column; gap: 9px;
}
#popover h4 { margin: 0 0 2px; font-size: 13px; }
#popover .row > span:first-child { width: 130px; }

#helpmodal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .55);
  display: grid; place-items: center;
  backdrop-filter: blur(3px);
}
.modal-card {
  background: rgba(20, 23, 31, .94); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px 24px; width: min(680px, 92vw);
  box-shadow: 0 22px 80px rgba(0,0,0,.48); backdrop-filter: blur(24px);
}
.modal-card h3 { margin: 0 0 12px; }
.modal-card h4 { margin: 12px 0 6px; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
.cols p { margin: 3px 0; color: var(--muted); }
kbd {
  display: inline-block; padding: 1px 5px; margin: 0 1px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
}

#askmodal, #newboardmodal {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0, 0, 0, .55);
  display: grid; place-items: center;
  backdrop-filter: blur(3px);
}
.modal-card.narrow { width: min(400px, 92vw); }
.modal-card .text-input { width: 100%; margin-bottom: 14px; }
.modal-card .row.end { justify-content: flex-end; gap: 8px; }
.btn.primary { background: var(--accent-gradient); border-color: rgba(255,255,255,.2); color: #161522; font-weight: 700; box-shadow: 0 8px 28px rgba(143,117,255,.18); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 10px 34px rgba(143,117,255,.28); }
.nb-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.nb-field .text-input { margin-bottom: 0; }
.nb-pathrow { display: flex; align-items: center; gap: 8px; }
.nb-path {
  flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel-2); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left;
}
.nb-hint { color: var(--muted); font-size: 11px; line-height: 1.35; }

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 200; padding: 9px 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); max-width: 70vw;
}
#toast.err { border-color: var(--danger); color: var(--danger); }
#toast.at-cursor { pointer-events: none; border-color: var(--accent); }

@media (max-width: 820px) {
  #inspector { width: 220px; }
  .cols { grid-template-columns: 1fr; }
  .btn span { display: none; }
  #btnAddImage span, #btnFit span { display: inline; }
}

/* iPad/tablet: controles cómodos al tacto y espacio para el área segura. */
@media (pointer: coarse) {
  .btn, .tool { min-width: 44px; min-height: 44px; }
  #toolbar { left: max(10px, env(safe-area-inset-left)); padding: 7px; gap: 5px; }
  .tool { width: 44px; height: 44px; }
  #zoombar { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); }
  #statusbar { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .handle { width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; }
  input[type='range'] { min-height: 34px; }
  #topbar { padding-top: env(safe-area-inset-top); }
  #topbar-main { min-height: 54px; }
}

@media (max-width: 700px) {
  #stage { padding-top: env(safe-area-inset-top); }
  #inspector { position: absolute; z-index: 30; right: 0; top: env(safe-area-inset-top); bottom: 0; height: auto; width: min(340px, 88vw); }
  #statusHint, #statusbar .dotsep { display: none; }
  #statusbar { font-size: 11px; }
  #emptyhint { width: min(80vw, 360px); }
}

/* Biblioteca de inicio solo para la versión web. */
body.web-mode.web-home #topbar,
body.web-mode.web-home #stage,
body.web-mode.web-home #popover,
body.web-mode.web-home #helpmodal,
body.web-mode.web-home #newboardmodal,
body.web-mode.web-home #ctxmenu { display: none !important; }
body.web-mode.web-home #askmodal { z-index: 300; }
body.web-mode #toast { z-index: 400; }
#webWelcome { position: fixed; inset: 0; z-index: 250; display: none; flex-direction: column; overflow: auto; background: var(--bg); }
body.web-mode.web-home #webWelcome { display: flex; }
.web-welcome-head { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.web-welcome-head .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.web-welcome-head .brand-mark { font-size: 22px; letter-spacing: -.08em; }
.web-welcome-head .brand-mark small { color: var(--accent); font-size: 10px; }
.web-welcome-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.web-welcome-main { width: min(1180px, 100%); margin: 0 auto; padding: 36px 24px 56px; }
.web-welcome-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.web-welcome-title h1 { margin: 0; font-size: 24px; }
.web-welcome-title p { margin: 4px 0 0; color: var(--muted); }
.web-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; }
.web-board-card { display: flex; min-height: 190px; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 9px; padding: 12px; overflow: hidden; text-align: left; background: linear-gradient(145deg, rgba(168,139,255,.13), rgba(125,220,200,.055)), var(--panel); border: 1px solid var(--line); border-radius: 16px; transition: border-color .16s, transform .16s; }
.web-board-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.web-board-open { display: flex; min-height: 130px; flex: 1; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 7px; padding: 2px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.web-board-open strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.web-board-open > span:last-child { color: var(--muted); font-size: 12px; }
.web-board-preview { display: grid; width: 100%; flex: 1; place-items: center; color: var(--accent); font-size: 44px; opacity: .55; }
.web-board-preview.has-thumbnail { opacity: 1; }
.web-board-thumb { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; border-radius: 8px; }
.web-board-actions { display: flex; gap: 7px; padding-top: 8px; border-top: 1px solid var(--line); }
.web-board-actions .btn { flex: 1; justify-content: center; }
.web-board-empty { padding: 28px; margin-top: 12px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
body.web-mode #rowGroup { flex-wrap: wrap; }
body.web-mode #rowGroup > span:first-child { width: 100%; }
body.web-mode #rowGroup .btn { flex: 1 1 auto; justify-content: center; }
@media (max-width: 600px) {
  .web-welcome-head { min-height: 0; padding: 12px; align-items: flex-start; flex-direction: column; }
  .web-welcome-actions { margin-left: 0; width: 100%; }
  .web-welcome-actions .btn { flex: 1; justify-content: center; white-space: nowrap; }
  .web-welcome-main { padding: 24px 14px 40px; }
  .web-board-card { min-height: 150px; }
}


/* ---------- menú contextual ---------- */
#ctxmenu {
  position: fixed; z-index: 120; min-width: 254px;
  max-height: calc(100vh - 16px); overflow-y: auto;
  background: rgba(20, 23, 31, .94); border: 1px solid var(--line);
  border-radius: 15px; padding: 7px; box-shadow: 0 18px 56px rgba(0,0,0,.42); backdrop-filter: blur(22px);
  display: flex; flex-direction: column; gap: 1px;
}
#ctxmenu[hidden] { display: none; }
.ctx-title { padding: 5px 9px 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.ctx-sub { padding: 5px 9px 3px; color: var(--muted); font-size: 11px; }
.ctx-state { font-size: 11px; color: var(--muted); }
#ctxmenu button.is-active .ctx-state { color: var(--accent); }
#ctxmenu button {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  width: 100%; padding: 7px 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
#ctxmenu button:hover { background: var(--panel-2); }
#ctxmenu button.is-active { color: var(--accent); }
#ctxmenu button.danger { color: var(--danger); }
#ctxmenu button:disabled { opacity: .38; cursor: default; }
#ctxmenu button:disabled:hover { background: transparent; }
#ctxmenu kbd { font-size: 10px; color: var(--muted); background: transparent; border: 0; padding: 0; }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.ctx-colors { padding: 5px 9px 7px; display: flex; flex-direction: column; gap: 6px; }
.ctx-colors > span { font-size: 11px; color: var(--muted); }
.ctx-swatches { display: flex; gap: 6px; }
.ctx-swatches button { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.ctx-swatches button:hover { border-color: #fff; }
.ctx-palette { padding: 5px 9px 7px; display: flex; flex-direction: column; gap: 6px; }
.ctx-palette > span { font-size: 11px; color: var(--muted); }
.ctx-swatchlist { display: flex; flex-wrap: wrap; gap: 5px; }
.ctx-swatch {
  width: 21px; height: 21px; padding: 0; border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  cursor: pointer; flex: none;
}
.ctx-swatch:hover { border-color: #fff; transform: translateY(-1px); }
#ctxmenu button.ctx-swatch { width: 21px; height: 21px; padding: 0; border-radius: 5px; }
#ctxmenu button.ctx-swatch:hover { border-color: #fff; }
#ctxmenu .ctx-swatches button { width: 20px; height: 20px; padding: 0; border: 2px solid transparent; border-radius: 50%; }
#ctxmenu .ctx-swatches button:hover { border-color: #fff; background: transparent; }
.ctx-gif { padding: 3px 9px 7px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ctx-gif > span { flex: none; }
.gif-controls { display: flex; align-items: center; gap: 3px; flex: 1; }
#ctxmenu .gif-controls button {
  width: auto; min-width: 27px; height: 26px; padding: 0 6px;
  justify-content: center; gap: 0;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2);
}
#ctxmenu .gif-controls button:hover { border-color: var(--accent); }
.gif-frame { min-width: 42px; text-align: center; color: var(--muted); font-size: 11px; }
.insp-palette {
  display: flex; flex-direction: column; gap: 6px;
  padding: 5px 0 5px; font-size: 12px;
}
.insp-palette > span { color: var(--muted); }
.insp-palette em { font-style: normal; font-size: 11px; opacity: .75; }
#inspFlipY .ic { transform: rotate(90deg); }
.ctx-range {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px 7px; font-size: 12px;
}
.ctx-range > span { flex: none; }
.ctx-range input[type='range'] { flex: 1; min-width: 0; }
.ctx-range output { width: 34px; text-align: right; color: var(--muted); font-size: 11px; }
#rowGroup select, #rowFontFamily select { flex: 1; min-width: 0; }
