/* PixelBucket — quiet ink-and-primer chrome, with color reserved for paint and the marigold active state. */

@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/rubik-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/rubik-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #24223a;
  --ink-2: #5d5a74;
  --ink-3: #9794ab;
  --primer: #ecebf3;
  --panel: #fbfbfd;
  --line: #dddbe7;
  --hover: #e8e6f1;
  --press: #dad7e7;
  --mat: #cfcdd9;
  --marigold: #f6c445;
  --marigold-deep: #c9951a;
  --marigold-soft: #fdf0c4;
  --shadow-float: 0 1px 2px rgba(36, 34, 58, .10), 0 10px 28px rgba(36, 34, 58, .18);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font: 13px/1.35 var(--font);
  color: var(--ink);
  background: var(--mat);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: none; border: 1px solid transparent; padding: 0; margin: 0; border-radius: 6px;
  cursor: default; display: inline-flex; align-items: center; justify-content: center;
}
button:disabled { color: var(--ink-3); }
button:disabled .acc { fill: #ece7d6; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
i[data-icon] { display: inline-flex; flex: none; font-style: normal; }
i[data-icon] svg { display: block; width: 100%; height: 100%; }
.acc { fill: var(--marigold); }
kbd { font: inherit; font-size: 12px; color: var(--ink-3); }
[hidden] { display: none !important; }

.arrow {
  display: inline-block; width: 6px; height: 6px; margin-left: 6px; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); opacity: .7;
}
.arrow.up { transform: translateY(2px) rotate(-135deg); margin: 0; }
.arrow.more { margin: 0; box-shadow: 3px 3px 0 -1.5px currentColor; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; position: relative; }

/* ------------------------------------------------------------------ top bar */
#topbar {
  flex: none; height: 44px; display: flex; align-items: center; gap: 14px; padding: 0 8px 0 12px;
  background: var(--primer); position: relative; z-index: 3;
  -webkit-app-region: drag; app-region: drag;
}
.wco #topbar {
  height: max(44px, env(titlebar-area-height, 44px));
  padding-left: calc(env(titlebar-area-x, 0px) + 12px);
  padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 8px);
}
#topbar button, #topbar input { -webkit-app-region: no-drag; app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.app-icon { width: 22px; height: 22px; }
.wordmark { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
#tabs { display: flex; align-items: stretch; height: 100%; gap: 2px; }
#tabs button {
  position: relative; height: 100%; padding: 0 12px; border: 0; border-radius: 0; color: var(--ink-2); font-weight: 500;
}
#tabs button:hover { color: var(--ink); }
#tabs .tab::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 3px; background: transparent;
}
#tabs .tab.active { color: var(--ink); }
#tabs .tab.active::after { background: var(--marigold); }
#file-tab { color: var(--ink) !important; isolation: isolate; }
#file-tab::before { content: ''; position: absolute; inset: 7px 0; border-radius: 8px; background: transparent; z-index: -1; }
#file-tab:hover::before, #file-tab.open::before { background: var(--hover); }
#tabs .tab.ctx::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--marigold);
  margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 1px var(--marigold-deep);
}
#title {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--ink-2);
  padding-left: 14px; border-left: 1px solid var(--line); height: 20px; white-space: nowrap;
}
#doc-name { overflow: hidden; text-overflow: ellipsis; }
#dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--marigold); flex: none; box-shadow: 0 0 0 1px var(--marigold-deep); }
.qat { display: flex; align-items: center; gap: 2px; flex: none; }
.qat-btn { width: 32px; height: 32px; border-radius: 8px; }
.qat-btn i { width: 20px; height: 20px; }
.qat-btn:not(:disabled):hover { background: var(--hover); }
.qat-btn:not(:disabled):active { background: var(--press); }
.qat-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.qat-btn.help { font-weight: 700; font-size: 14px; }
.chev { width: 8px; height: 8px; border-left: 1.6px solid var(--ink); border-top: 1.6px solid var(--ink); transform: translateY(2px) rotate(45deg); }
.collapsed .chev { transform: translateY(-2px) rotate(225deg); }

/* ------------------------------------------------------------------ ribbon */
#ribbon {
  flex: none; height: 100px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 2;
}
.collapsed #ribbon { display: none; }
.collapsed.peek #ribbon {
  display: block; position: absolute; left: 0; right: 0; top: var(--ribbon-top, 44px); z-index: 50; box-shadow: var(--shadow-float);
}
.panel { display: flex; height: 100%; padding: 6px 4px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.group { flex: none; display: flex; flex-direction: column; height: 100%; padding: 0 8px; position: relative; }
.group + .group::before {
  content: ''; position: absolute; left: 0; top: 8px; height: 56px; width: 1px; background: var(--line);
}
.group-body { flex: 1; display: flex; align-items: flex-start; gap: 3px; min-height: 0; }
.group-label { height: 20px; line-height: 18px; text-align: center; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }

.group > .group-btn { display: none; }
.group.squeezed > .group-btn { display: inline-flex; min-width: 56px; }
.group.squeezed > .group-body { display: none; }
.group-popup {
  position: fixed; z-index: 950; display: flex; padding: 8px 10px; margin-top: 4px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-float);
}
.group-popup > .group-body { flex: none; }

/* control states */
:is(.lg, .sm, .tb, .shape-btn, .tile, .gallery-scroll button):not(:disabled):hover { background: var(--hover); }
:is(.lg, .sm, .tb, .shape-btn, .tile, .gallery-scroll button):not(:disabled):active,
:is(.lg, .sm).open { background: var(--press); }
:is(.lg, .tb, .shape-btn, .tile, .sm).active,
:is(.lg, .tb, .shape-btn, .tile, .sm).active:not(:disabled):hover { background: var(--marigold); border-color: var(--marigold-deep); }
.active .acc, .split-lg.active .split-top .acc { fill: #fff6d8; }

.lg { flex-direction: column; justify-content: flex-start; min-width: 46px; height: 70px; padding: 7px 5px 0; gap: 5px; border-radius: 8px; }
.lg i { width: 26px; height: 26px; }
.lg .lbl { line-height: 14px; text-align: center; white-space: nowrap; font-size: 12px; }
.sm { justify-content: flex-start; height: 24px; padding: 0 8px 0 5px; gap: 6px; white-space: nowrap; }
.sm i { width: 18px; height: 18px; }
.sm .arrow { margin-left: 2px; }
.stack { display: flex; flex-direction: column; gap: 1px; }

.split-lg { display: flex; flex-direction: column; width: 56px; height: 70px; border: 1px solid transparent; border-radius: 8px; overflow: hidden; }
.split-top { height: 40px; width: 100%; border: 0; border-radius: 0; }
.split-top i { width: 26px; height: 26px; }
.split-bottom { height: 29px; width: 100%; border: 0; border-radius: 0; flex-direction: column; line-height: 14px; font-size: 12px; padding-bottom: 3px; }
.split-bottom .arrow { margin: 1px 0 0; }
.split-lg:hover, .split-lg.open { border-color: var(--line); }
.split-top:hover, .split-bottom:hover { background: var(--hover); }
.split-top:active, .split-bottom:active, .split-lg.open .split-bottom { background: var(--press); }
.split-lg.active { border-color: var(--marigold-deep); }
.split-lg.active .split-top { background: var(--marigold); }

.tool-grid { display: grid; grid-template-columns: repeat(3, 30px); grid-auto-rows: 29px; gap: 3px; margin-top: 4px; }
.tb { width: 30px; height: 29px; }
.tb i { width: 20px; height: 20px; }
.fmt { width: 30px; height: 26px; font-size: 14px; }
.fmt-i { font-style: italic; }

#g-brushes, #g-size { padding-bottom: 20px; }

/* shapes */
.gallery-wrap { display: flex; height: 74px; border-radius: 10px; background: var(--primer); padding: 1px 0 1px 3px; }
.gallery {
  width: 170px; height: 72px; overflow: hidden; display: grid; grid-template-columns: repeat(7, 24px);
  grid-auto-rows: 24px; align-content: start; scroll-behavior: smooth;
}
.shape-btn { width: 24px; height: 24px; border-radius: 5px; }
.shape-btn img { width: 16px; height: 16px; pointer-events: none; }
.gallery-scroll { display: flex; flex-direction: column; width: 18px; padding: 2px 2px 2px 0; gap: 1px; }
.gallery-scroll button { flex: 1; width: 100%; border-radius: 4px; color: var(--ink-2); }
#g-shapes .stack { margin-left: 6px; }

/* colors: paint drops */
.colors-body { gap: 2px; }
.color-sel { min-width: 46px; }
.cs-swatch {
  display: block; flex: none; width: 24px; height: 24px; margin-top: 4px; border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(36, 34, 58, .28);
}
.cs-swatch.big { width: 30px; height: 30px; margin-top: 0; }
.cs-fill { display: block; width: 100%; height: 100%; border-radius: 50%; }
.color-sel .lbl { margin-top: auto; padding-bottom: 5px; }
.color-sel.active, .color-sel.active:not(:disabled):hover { background: var(--marigold-soft); border-color: transparent; }
.color-sel.active .cs-swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--marigold-deep); }
.palette { display: grid; grid-template-columns: repeat(10, 22px); grid-auto-rows: 22px; margin: 2px 6px 0 6px; }
.pal { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; }
.pal span {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(36, 34, 58, .18); transition: transform 80ms ease-out;
}
.pal:not(:disabled):hover span { transform: scale(1.18); box-shadow: inset 0 0 0 1px rgba(36, 34, 58, .35), 0 1px 3px rgba(36, 34, 58, .3); }
.pal.empty span { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* view tab */
.checks { flex-direction: column; gap: 5px; padding: 6px 6px 0 4px; }
.chk { display: flex; align-items: center; gap: 7px; height: 19px; white-space: nowrap; }
.chk input { margin: 0; accent-color: var(--ink); width: 15px; height: 15px; }

/* text tab */
.font-body { flex-direction: column; gap: 6px; padding: 6px 4px 0; }
.font-row { display: flex; gap: 4px; align-items: center; }
#font-family, #font-size { height: 28px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 0 8px; }
#font-family { width: 160px; }
#font-size { width: 46px; border: 0; background: transparent; padding: 0 0 0 8px; height: 26px; }
.combo { display: flex; align-items: center; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.combo:focus-within { border-color: var(--ink); }
.combo #font-size:focus-visible { outline: none; }
.combo-btn { width: 22px; height: 26px; border-radius: 0 6px 6px 0; color: var(--ink-2); }
.combo-btn .arrow { margin: 0; }
.combo-btn:hover, .combo.open .combo-btn { background: var(--hover); }
.menu.fontsizes { width: 84px; min-width: 0; max-height: 280px; overflow-y: auto; }
.menu.fontsizes .mi { height: 26px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.bg-btn { height: 30px; }
.bg-btn i { width: 20px; height: 20px; }

/* ------------------------------------------------------------------ menus */
.menu {
  position: fixed; z-index: 1000; width: max-content; min-width: 120px; max-width: calc(100vw - 8px); padding: 4px; margin-top: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-float);
}
.mh { padding: 8px 10px 4px; color: var(--ink-3); font-size: 12px; }
.mh:first-child { padding-top: 4px; }
.mi { display: flex; width: 100%; height: 30px; justify-content: flex-start; gap: 9px; padding: 0 10px 0 6px; white-space: nowrap; text-align: left; }
.mi span { flex: 1 1 auto; }
.mi kbd { margin-left: 16px; }
.mi:not(:disabled):hover { background: var(--hover); }
.mi i { width: 20px; height: 20px; }
.mi.checked { background: var(--marigold-soft); }
.mi.checked:hover { background: #fbe7a6; }
#menu-outline .mi::before, #menu-fill .mi::before {
  content: ''; width: 14px; height: 14px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3);
}
#menu-outline .mi.checked::before, #menu-fill .mi.checked::before {
  background: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink), inset 0 0 0 4px #fff;
}
.menu.tiles { display: grid; grid-template-columns: repeat(3, 54px); gap: 4px; padding: 8px; min-width: 0; }
.tile { width: 54px; height: 54px; background: var(--panel); border-color: var(--line); border-radius: 8px; }
.tile.checked { background: var(--marigold-soft); border-color: var(--marigold-deep); }
.tile canvas { width: 40px; height: 40px; pointer-events: none; }
.menu.sizes { width: 150px; padding: 4px; }
.size-item { height: 32px; padding: 0 12px; }
.size-item.checked { background: var(--marigold-soft); }
.size-line { flex: 1; background: var(--ink); min-height: 1px; border-radius: 4px; }
.menu.shapes-all { display: grid; grid-template-columns: repeat(7, 28px); gap: 2px; min-width: 0; padding: 6px; }
.menu.shapes-all .shape-btn { width: 28px; height: 28px; }
.menu.shapes-all .shape-btn.checked { background: var(--marigold); }

/* ------------------------------------------------------------------ file menu */
#filemenu { position: fixed; inset: 0; z-index: 900; }
.fm-panel {
  position: absolute; left: 8px; top: calc(var(--fm-top, 44px) + 2px); display: flex; width: 620px; max-width: calc(100vw - 16px);
  height: 432px; max-height: calc(100vh - var(--fm-top, 44px) - 12px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float); overflow: hidden;
}
.fm-left { width: 236px; flex: none; padding: 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.fm-item { display: flex; width: 100%; height: 38px; justify-content: flex-start; gap: 12px; padding: 0 10px; border-radius: 8px; }
.fm-item i { width: 22px; height: 22px; }
.fm-item span:not(.sub-arrow) { flex: 1; text-align: left; }
.fm-item:hover, .fm-item.hot { background: var(--hover); }
.fm-item .sub-arrow { width: 7px; height: 7px; border-right: 1.5px solid var(--ink-2); border-top: 1.5px solid var(--ink-2); transform: rotate(45deg); margin-right: 4px; }
.fm-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.fm-right { flex: 1; padding: 14px 14px 12px; background: var(--panel); border-left: 1px solid var(--line); min-width: 0; overflow-y: auto; }
.fm-head { font-weight: 600; font-size: 14px; padding: 0 8px 10px; }
#recent-list { list-style: none; margin: 0; padding: 0; }
#recent-list li.muted { padding: 6px 8px; color: var(--ink-3); }
.recent { display: flex; width: 100%; justify-content: flex-start; height: 32px; gap: 10px; padding: 0 8px; }
.recent:hover { background: var(--hover); }
.recent .num { color: var(--ink-3); width: 12px; font-variant-numeric: tabular-nums; }
.recent .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-sub { display: flex; width: 100%; justify-content: flex-start; align-items: flex-start; gap: 12px; padding: 9px 8px; text-align: left; border-radius: 8px; }
.fm-sub i { width: 24px; height: 24px; }
.fm-sub:hover { background: var(--hover); }
.fm-sub span { display: flex; flex-direction: column; gap: 2px; color: var(--ink-2); line-height: 1.4; }
.fm-sub b { font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------------ workspace */
#main {
  flex: 1; min-height: 0; display: grid; position: relative;
  grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 0 minmax(0, 1fr);
}
#main.rulers { grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: 18px minmax(0, 1fr); }
#main:not(.rulers) :is(#ruler-h, #ruler-v, #ruler-corner) { display: none; }
#ruler-corner { grid-area: 1 / 1; background: var(--primer); }
#ruler-h { grid-area: 1 / 2; width: 100%; height: 18px; display: block; }
#ruler-v { grid-area: 2 / 1; width: 18px; height: 100%; display: block; }
#workspace { grid-area: 2 / 2; overflow: auto; background: var(--mat); position: relative; outline: none; }
#ws-inner { display: inline-block; padding: 8px 24px 24px 8px; vertical-align: top; }
#canvas-host { position: relative; touch-action: none; }
#canvas, #preview { position: absolute; left: 0; top: 0; display: block; }
#canvas { background: #fff; box-shadow: 0 1px 2px rgba(36, 34, 58, .16), 0 6px 20px rgba(36, 34, 58, .12); }
#preview { pointer-events: none; }
#grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(36, 34, 58, .22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(36, 34, 58, .22) 1px, transparent 1px);
}
#eraser-cursor { position: absolute; border: 1px solid var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .8); pointer-events: none; z-index: 3; }

#frame { position: absolute; cursor: move; z-index: 4; }
#frame::before {
  content: ''; position: absolute; inset: -1px; pointer-events: none;
  border: 1px dashed var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
}
#frame.no-handles { pointer-events: none; cursor: inherit; }
#frame.no-handles .h { display: none; }
.h { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); z-index: 5; }
.h[data-handle=nw] { left: -5px; top: -5px; cursor: nwse-resize; }
.h[data-handle=n] { left: calc(50% - 4.5px); top: -5px; cursor: ns-resize; }
.h[data-handle=ne] { right: -5px; top: -5px; cursor: nesw-resize; }
.h[data-handle=e] { right: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.h[data-handle=se] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.h[data-handle=s] { left: calc(50% - 4.5px); bottom: -5px; cursor: ns-resize; }
.h[data-handle=sw] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.h[data-handle=w] { left: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.h.free { transform: translate(-50%, -50%); cursor: crosshair; background: var(--marigold); }

#textbox { position: absolute; box-sizing: content-box; border: 4px solid transparent; cursor: move; z-index: 6; }
#textbox textarea {
  display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; resize: none; overflow: hidden;
  outline: 1px dashed var(--ink); outline-offset: 0; white-space: pre-wrap; overflow-wrap: break-word;
  cursor: text; user-select: text; -webkit-user-select: text; background: transparent;
}

.ch { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink-2); z-index: 2; }
.ch:hover { background: var(--marigold); border-color: var(--ink); }
.ch[data-ch=e] { left: 100%; top: calc(50% - 5px); margin-left: 4px; cursor: ew-resize; }
.ch[data-ch=s] { top: 100%; left: calc(50% - 5px); margin-top: 4px; cursor: ns-resize; }
.ch[data-ch=se] { left: 100%; top: 100%; margin: 4px 0 0 4px; cursor: nwse-resize; }
#ghost { position: absolute; left: 0; top: 0; border: 1.5px dashed var(--ink); background: rgba(246, 196, 69, .12); pointer-events: none; z-index: 7; }

/* ------------------------------------------------------------------ status bar */
#statusbar {
  flex: none; height: 30px; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 6px; background: var(--primer);
  color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums;
}
.sb-cell { display: flex; align-items: center; gap: 6px; width: 140px; flex: none; padding: 0 6px; }
.sb-cell i { width: 16px; height: 16px; color: var(--ink-3); }
.sb-cell:has(span:empty) i, .sb-file.empty i { visibility: hidden; }
.sb-spacer { flex: 1; }
.sb-zoom { display: flex; align-items: center; gap: 6px; }
#sb-zoom { min-width: 44px; text-align: right; color: var(--ink); }
.sb-btn { width: 22px; height: 22px; font-size: 15px; line-height: 1; color: var(--ink-2); }
.sb-btn:hover { background: var(--hover); color: var(--ink); }
#zoom-slider { -webkit-appearance: none; appearance: none; width: 120px; height: 18px; background: transparent; margin: 0; }
#zoom-slider::-webkit-slider-runnable-track { height: 3px; background: var(--line); border-radius: 3px; }
#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%;
  background: var(--marigold); border: 1.5px solid var(--ink);
}
#zoom-slider::-moz-range-track { height: 3px; background: var(--line); border-radius: 3px; }
#zoom-slider::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--marigold); border: 1.5px solid var(--ink); }

@media (max-width: 760px) {
  .wordmark, #title { display: none; }
  #topbar { gap: 6px; }
  .sb-cell { width: auto; min-width: 0; }
  .sb-sel, .sb-file { display: none; }
}

/* ------------------------------------------------------------------ floating windows */
#thumb {
  position: fixed; right: 20px; top: 170px; z-index: 800; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-float); overflow: hidden;
}
.thumb-title { height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 12px; font-weight: 500; }
.thumb-body { background: var(--mat); padding: 10px; display: grid; place-items: center; min-width: 140px; min-height: 90px; }
#thumb-canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgba(36, 34, 58, .2); }
#fullscreen { position: fixed; inset: 0; z-index: 3000; background: var(--mat); display: grid; place-items: center; cursor: default; }
#fs-canvas { max-width: 100vw; max-height: 100vh; image-rendering: pixelated; display: block; box-shadow: 0 6px 24px rgba(36, 34, 58, .2); }

/* ------------------------------------------------------------------ dialogs */
.dlg-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: rgba(36, 34, 58, .22); }
.dlg { display: flex; flex-direction: column; background: #fff; border-radius: 16px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); box-shadow: 0 2px 4px rgba(36, 34, 58, .12), 0 24px 60px rgba(36, 34, 58, .28); }
.dlg-title {
  height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 22px;
  font-size: 16px; font-weight: 600;
}
.dlg-close { width: 30px; height: 30px; border-radius: 50%; color: var(--ink-2); font-size: 13px; }
.dlg-close:hover { background: var(--hover); color: var(--ink); }
.dlg-close:active { background: var(--press); }
.dlg-body { padding: 4px 22px 16px; overflow: auto; min-height: 0; }
.dlg-buttons { padding: 4px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.dlg-text { margin: 0; white-space: pre-line; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.dlg-question { color: var(--ink); font-size: 14px; padding: 2px 0 4px; }
.btn-std { min-width: 84px; height: 34px; padding: 0 16px; background: #fff; border: 1px solid var(--line); border-radius: 9px; font-weight: 500; }
.btn-std:not(:disabled):hover { background: var(--hover); }
.btn-std:not(:disabled):active { background: var(--press); }
.btn-std.default { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-std.default:not(:disabled):hover { background: #3a3757; }
.btn-std.default:not(:disabled):active { background: #14132a; }
.btn-std.wide { width: 100%; margin-top: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 8px 12px 12px; }
legend { padding: 0 4px; color: var(--ink-2); font-size: 12px; }
input.num, .dlg input[type=text] { height: 30px; width: 70px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: #fff; }
input.num:focus, .dlg input[type=text]:focus { border-color: var(--ink); outline: 2px solid var(--marigold); outline-offset: 0; }
label.radio, label.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; white-space: nowrap; }
label.radio input, label.check input { margin: 0; accent-color: var(--ink); }

.rs-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.rs-lbl { width: 74px; }
.rs-row > .rs-lbl:first-child { width: 30px; }
.rs-icon { width: 20px; height: 15px; flex: none; border: 1.5px solid var(--ink-2); border-radius: 3px; }
.rs-icon.rs-v { width: 14px; height: 20px; margin: 0 3px; }
.rs-icon.rs-sh { transform: skewX(-25deg); }
.rs-icon.rs-sv { transform: skewY(-25deg); }

.props .kv { display: flex; gap: 8px; margin: 5px 0; }
.props .kv span:first-child { width: 96px; color: var(--ink-2); }
.props-row { display: flex; gap: 12px; }
.props-row fieldset { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.props-size { display: flex; align-items: center; gap: 12px; }
.props-size label { display: flex; align-items: center; gap: 6px; }

.about { display: flex; gap: 18px; align-items: flex-start; }
.about-name { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.about p { margin: 6px 0; line-height: 1.5; user-select: text; max-width: 52ch; }
.muted { color: var(--ink-3); }

/* edit colors */
.ec { display: flex; flex-wrap: wrap; gap: 18px 22px; }
.ec-left { width: 236px; flex: none; }
.ec-label { margin: 0 0 8px; color: var(--ink-2); font-size: 12px; }
.ec-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; margin-bottom: 16px; }
.ec-grid.custom { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.ec-swatch { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(36, 34, 58, .18); }
.ec-grid.custom .ec-swatch { width: 22px; height: 22px; }
.ec-swatch:hover, .ec-swatch.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.ec-right { width: 236px; flex: none; }
.ec-pickers { display: flex; gap: 10px; align-items: flex-start; }
.ec-spec-wrap { position: relative; line-height: 0; cursor: crosshair; border-radius: 8px; overflow: hidden; }
.ec-cross {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(36, 34, 58, .6), inset 0 0 0 1px rgba(36, 34, 58, .6);
}
.ec-lum-wrap { position: relative; line-height: 0; cursor: ns-resize; padding: 0 6px; }
.ec-lum { border-radius: 6px; }
.ec-lum-arrow { position: absolute; left: 1px; right: 1px; height: 6px; margin-top: -3px; border-radius: 3px; border: 2px solid var(--ink); background: rgba(255, 255, 255, .5); }
.ec-prev-wrap { margin-top: 14px; }
.ec-preview { height: 30px; border-radius: 8px; overflow: hidden; display: flex; box-shadow: inset 0 0 0 1px rgba(36, 34, 58, .15); }
.ec-preview > div { flex: 1; }
.ec-prev-label { display: flex; justify-content: space-around; margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.ec-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ec-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: var(--ink-2); font-size: 12px; }
.ec-num { width: 100% !important; }
.ec-hex { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--ink-2); font-size: 12px; }
.ec-hex input { flex: 1; width: auto !important; min-width: 0; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ motion & print */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
#print-area { display: none; }
@media print {
  html, body { overflow: visible; height: auto; background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  #print-area img { max-width: 100%; display: block; }
}
