/* ============================================================
   PIXXIVI — dark, glassy, rounded. Desktop: dock | stage | panel over a timeline.
   Phones: bottom tool bar, panels as bottom sheets, collapsible timeline.
   ============================================================ */
:root {
  --bg: #0b0c12; --bg2: #0f1018; --panel: #14151f; --panel2: #1a1b28; --panel3: #222336;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12);
  --text: #ebebf5; --muted: #8e8fa8; --dim: #5d5e75;
  --acc: #8b6cff; --acc2: #22d3ee; --good: #3ddc97; --warn: #ffb547; --bad: #ff5d73;
  --r: 12px; --r2: 8px; --tl-h: 232px;
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  --shadow: 0 10px 40px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); } .sm { font-size: 11.5px; } .mono { font-family: var(--mono); font-size: 11.5px; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.only-phone, .only-touch { display: none !important; }
kbd { font: 600 10.5px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.06); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }

/* ---------- app grid ---------- */
.app { display: grid; height: 100dvh; grid-template-rows: 52px 46px minmax(0, 1fr) var(--tl-h) 0; grid-template-columns: 100%; background:
  radial-gradient(1200px 600px at 20% -10%, rgba(139,108,255,.10), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(34,211,238,.07), transparent 60%), var(--bg); }
body.no-timeline .app { grid-template-rows: 52px 46px minmax(0,1fr) 0 0; }
body.no-timeline .timeline { display: none; }
body.focus .optionsbar, body.focus .sidepanel, body.focus .timeline { display: none; }
body.focus .app { grid-template-rows: 52px 0 minmax(0,1fr) 0 0; }
body.focus .workspace { grid-template-columns: 64px minmax(0,1fr) 0; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 6px; padding: 0 12px; border-bottom: 1px solid var(--line); background: rgba(13,14,21,.8); backdrop-filter: blur(14px); position: relative; z-index: 5; min-width: 0; }
.logo { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 2px; border-radius: 10px; }
.logo:hover { background: rgba(255,255,255,.04); }
.logo-mark { display: inline-flex; filter: drop-shadow(0 2px 10px rgba(139,108,255,.45)); }
.logo-word { font-weight: 800; font-size: 16px; letter-spacing: -.02em; background: linear-gradient(90deg, #fff, #c9bcff 60%, #8fe9f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.menubar { display: flex; gap: 1px; margin-left: 6px; }
.menubtn { padding: 6px 9px; border-radius: 8px; color: #c8c8d8; font-weight: 500; }
.menubtn:hover { background: rgba(255,255,255,.06); color: #fff; }
.tb-sep { width: 1px; height: 22px; background: var(--line2); margin: 0 8px; }
.projname { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; font-weight: 600; width: 180px; min-width: 104px; flex: 0 1 180px; }
.projname:hover { border-color: var(--line); } .projname:focus { border-color: var(--acc); background: var(--panel); outline: none; }
.sizechip { display: inline-flex; flex-shrink: 0; align-items: center; gap: 6px; height: 28px; padding: 0 10px; margin-left: 2px; border-radius: 8px; border: 1px solid var(--line2); background: rgba(255,255,255,.04); color: #d6d7ea; font: 600 12px var(--mono); white-space: nowrap; flex: none; }
.sizechip:hover { border-color: rgba(139,108,255,.6); color: #fff; background: rgba(139,108,255,.14); }
.sizechip:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.sizechip .ico, .sizechip svg { opacity: .8; }
.memsize { background: none; border: 0; padding: 0 2px; color: inherit; font: inherit; cursor: pointer; border-radius: 4px; }
.memsize:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.memsize:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.savestate { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.savestate .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.savestate.dirty .dot, .savestate.saving .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.savestate.error .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.searchbtn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 11px; border: 1px solid var(--line2); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.03); margin-right: 6px; }
.searchbtn:hover { border-color: rgba(139,108,255,.6); color: var(--text); }

/* ---------- buttons ---------- */
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: #cfcfe0; transition: background .12s, color .12s; flex: none; }
.ibtn:hover:not(:disabled) { background: rgba(255,255,255,.07); color: #fff; }
.ibtn.sm { width: 28px; height: 28px; border-radius: 8px; }
.ibtn.ghost { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 10px; font-weight: 600; background: var(--panel3); border: 1px solid var(--line2); white-space: nowrap; transition: transform .08s, background .15s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: #2a2b42; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.primary { background: linear-gradient(135deg, var(--acc), #6b4dff 55%, #4f8dff); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(139,108,255,.35); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); background: linear-gradient(135deg, var(--acc), #6b4dff 55%, #4f8dff); }
.btn.danger { background: rgba(255,93,115,.14); border-color: rgba(255,93,115,.35); color: #ff9aa9; }
.exportbtn { margin-left: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(255,255,255,.03); color: #cfd0e0; white-space: nowrap; font-size: 12px; transition: all .12s; }
.chip:hover { border-color: rgba(139,108,255,.55); color: #fff; }
.chip.on { background: rgba(139,108,255,.2); border-color: var(--acc); color: #fff; box-shadow: inset 0 0 0 1px rgba(139,108,255,.25); }
.chip.sm { height: 24px; padding: 0 8px; font-size: 11px; }
.seg { display: inline-flex; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.seg button:hover { color: #fff; }
.seg button.on { background: var(--panel3); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4), inset 0 0 0 1px rgba(139,108,255,.4); }
.sel { background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; height: 30px; padding: 0 8px; max-width: 220px; }
.sel.sm { height: 26px; font-size: 12px; }
.text { background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; height: 34px; padding: 0 10px; width: 100%; }
.text.sm { height: 26px; font-size: 12px; padding: 0 7px; }
.text:focus, .num:focus, .sel:focus { border-color: var(--acc); outline: none; }
.num { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; height: 28px; width: 64px; padding: 0 6px; font-family: var(--mono); font-size: 12px; }
.num.wide { width: 90px; height: 34px; font-size: 13px; }
.num.bad, .text.bad { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(255,93,115,.15); }
.field { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.field.col { display: flex; flex-direction: column; align-items: stretch; gap: 5px; margin-bottom: 10px; }
.field.col > span { font-weight: 600; color: #b9bad0; }
.lbl { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 14px 0 7px; }
.sl { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; flex: none; }
.sl input[type=range] { width: 110px; }
.sl-val { font-family: var(--mono); font-size: 11px; color: var(--text); min-width: 34px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--acc), var(--acc2)); opacity: .9; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(139,108,255,.45); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(139,108,255,.45); }
input[type=color] { width: 34px; height: 30px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); padding: 2px; cursor: pointer; }
.vsep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line2); flex: none; }
.err { color: #ff9aa9; font-size: 12px; min-height: 0; }
.err:not(:empty) { margin: 4px 0 8px; }
.warn { color: #ffcf85; font-size: 12px; background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.25); border-radius: 8px; padding: 6px 9px; margin: 6px 0; }
.warn:empty { display: none; }
.empty { color: var(--muted); font-size: 12px; padding: 6px 2px; margin: 0; }

/* ---------- options bar ---------- */
.optionsbar { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(16,17,26,.75); overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.optionsbar::-webkit-scrollbar { display: none; }
.opt-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--line2); color: #fff; flex: none; }
.opt-title .ico { color: var(--acc); }
.opt-badge { background: rgba(34,211,238,.15); color: var(--acc2); padding: 3px 9px; border-radius: 999px; font-weight: 700; font-size: 11px; }

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-columns: 64px minmax(0, 1fr) 296px; min-height: 0; }
.tooldock { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border-right: 1px solid var(--line); background: rgba(13,14,21,.55); overflow-y: auto; scrollbar-width: none; }
.dockgroup { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }
.toolbtn { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: #b4b5ca; transition: all .12s; position: relative; flex: none; }
.toolbtn:hover { background: rgba(255,255,255,.07); color: #fff; }
.toolbtn.on { color: #fff; background: linear-gradient(135deg, rgba(139,108,255,.55), rgba(79,141,255,.35)); box-shadow: 0 4px 16px rgba(139,108,255,.35), inset 0 0 0 1px rgba(255,255,255,.15); }
.swatches { position: relative; width: 46px; height: 46px; flex: none; margin-top: 6px; }
.sw { position: absolute; width: 30px; height: 30px; border-radius: 9px; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#555 0 25%, #888 0 50%) 0 0 / 8px 8px; }
.sw.fg { left: 0; top: 0; z-index: 1; } .sw.bg { right: 0; bottom: 0; border-color: #9a9ab0; }
.swapbtn { position: absolute; right: -2px; top: -4px; width: 18px; height: 18px; color: var(--muted); }
.swapbtn:hover { color: #fff; }

.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.canvas-host { position: absolute; inset: 0; }
.view-canvas { display: block; cursor: crosshair; touch-action: none; }
.floatpill { position: absolute; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: rgba(20,21,31,.82); border: 1px solid var(--line2); backdrop-filter: blur(12px); box-shadow: var(--shadow); z-index: 2; }
.zoompill { left: 12px; bottom: 12px; }
.zoomlbl { min-width: 54px; font: 600 12px var(--mono); padding: 0 4px; text-align: center; }
.readout { right: 12px; bottom: 12px; padding: 6px 12px; gap: 14px; font: 500 11.5px var(--mono); color: var(--muted); pointer-events: none; }
.readout #coords { color: var(--text); min-width: 56px; }
.quickundo { right: 12px; top: 12px; }

/* ---------- side panel ---------- */
.sidepanel { border-left: 1px solid var(--line); background: rgba(14,15,23,.65); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #33344a transparent; }
.pnl { border-bottom: 1px solid var(--line); }
.pnl-head { display: flex; align-items: center; gap: 6px; padding: 11px 14px; cursor: pointer; user-select: none; }
.pnl-head h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #b9bad0; }
.pnl-head > .ico { color: var(--dim); transition: transform .15s; }
.pnl.collapsed .pnl-head > .ico { transform: rotate(-90deg); }
.pnl.collapsed .pnl-body { display: none; }
.pnl-body { padding: 0 14px 14px; }
.pnl-tools { display: inline-flex; }
.fgbg { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.fgbg .swatches { margin: 0; }
.fgbg-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cpicker { display: flex; flex-direction: column; gap: 8px; }
.cp-sv { width: 100%; height: 150px; border-radius: 10px; cursor: crosshair; touch-action: none; display: block; }
.cp-hue, .cp-alpha { width: 100%; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none; display: block; }
.cp-row { display: flex; gap: 4px; }
.cp-hex { font-family: var(--mono); font-size: 12px; height: 28px; flex: 1.6; min-width: 0; }
.cp-n { width: auto; flex: 1; min-width: 0; padding: 0 3px; text-align: center; }
.recent { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.mini-sw { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#555 0 25%, #888 0 50%) 0 0 / 6px 6px; border: 1px solid rgba(255,255,255,.15); }
.mini-sw.lg { width: 30px; height: 30px; border-radius: 9px; }
.mini-sw.on { box-shadow: 0 0 0 2px #fff; }
.palpick { margin-bottom: 10px; } .palsel { width: 100%; max-width: none; }
.palgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(24px, 1fr)); gap: 3px; }
.palsw { aspect-ratio: 1; border-radius: 6px; background: var(--c); border: 1px solid rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); position: relative; transition: transform .08s; }
.palsw:hover { transform: scale(1.12); z-index: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.palsw.fg { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--acc); z-index: 1; }
.palsw.bg::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 6px; height: 6px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px #000; }
.palgrid > .empty { grid-column: 1 / -1; }
.palsw.add { background: rgba(255,255,255,.04); border: 1px dashed var(--line2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.pv { display: flex; flex-direction: column; gap: 8px; }
.pv-stage { display: flex; justify-content: center; align-items: center; min-height: 80px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px; border: 1px solid var(--line); }
.pv-canvas { image-rendering: pixelated; max-width: 100%; border-radius: 4px; }
.slices { display: flex; flex-direction: column; gap: 4px; }
.slice { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; }
.slice.on { background: rgba(139,108,255,.12); }
.slice-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.slice .text { flex: 1; min-width: 0; }
.slice-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 4px 10px 20px; }
.slice-edit .num { width: 56px; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; border-top: 1px solid var(--line); background: rgba(12,13,20,.92); position: relative; min-height: 0; }
.timeline.min .tl-header, .timeline.min .tl-body { display: none; }
.tl-resize { position: absolute; left: 0; right: 0; top: -4px; height: 8px; cursor: ns-resize; z-index: 3; }
.tl-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tl-bar::-webkit-scrollbar { display: none; }
.tl-transport { display: inline-flex; align-items: center; gap: 1px; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 11px; padding: 2px; }
.ibtn.play { width: 34px; height: 30px; color: #fff; background: linear-gradient(135deg, var(--acc), #4f8dff); border-radius: 9px; }
.ibtn.play.on { background: linear-gradient(135deg, #ff5d8f, var(--acc)); }
.tl-count { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); color: var(--muted); }
.tl-counter { width: 56px; text-align: center; }
.tl-durwrap { display: inline-flex; align-items: center; gap: 5px; }
.tl-dur { width: 62px; }
.tl-zoom { width: 90px; }
.tl-header { display: flex; flex: none; border-bottom: 1px solid var(--line); }
.tl-corner { width: 210px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 6px 0 12px; border-right: 1px solid var(--line); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); }
.tl-headwrap { flex: 1; min-width: 0; overflow: hidden; }
.tl-head { display: block; cursor: pointer; touch-action: pan-x; }
.tl-body { flex: 1; min-height: 0; display: flex; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #33344a transparent; }
.tl-layers { width: 210px; flex: none; border-right: 1px solid var(--line); align-self: flex-start; }
.lrow { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 2px; border-bottom: 1px solid rgba(255,255,255,.035); cursor: pointer; position: relative; background: transparent; transition: background .1s; }
.lrow:hover { background: rgba(255,255,255,.03); }
.lrow.on { background: linear-gradient(90deg, rgba(139,108,255,.22), rgba(139,108,255,.06)); }
.lrow.on::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--acc); }
.lrow.dragging { z-index: 4; background: var(--panel3); box-shadow: var(--shadow); }
.lrow.ref .lname { font-style: italic; color: var(--muted); }
.lgrip { color: var(--dim); cursor: grab; padding: 0 3px; font-size: 10px; letter-spacing: -2px; touch-action: none; }
.lbtn { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #c9cae0; flex: none; }
.lbtn:hover { background: rgba(255,255,255,.08); }
.lbtn.off { color: var(--dim); } .lbtn.locked { color: var(--warn); }
.lbtn.more { opacity: 0; } .lrow:hover .lbtn.more, .lrow.on .lbtn.more { opacity: 1; }
.lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; font-weight: 500; }
.lrow .text { flex: 1; }
.lcolor { width: 4px; height: 16px; border-radius: 2px; flex: none; }
.lbadge { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--acc2); background: rgba(34,211,238,.1); border-radius: 5px; padding: 1px 5px; flex: none; }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; align-self: flex-start; scrollbar-width: thin; scrollbar-color: #3a3b55 transparent; }
.tl-inner { position: relative; }
.tl-grid { position: absolute; top: 0; display: block; touch-action: pan-x; }

/* ---------- popovers / menus ---------- */
.popover { position: fixed; z-index: 60; background: rgba(24,25,37,.97); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(16px); animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu { padding: 6px; min-width: 250px; max-height: 78vh; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px 7px 6px; border-radius: 8px; text-align: left; color: #dcdcea; }
.menu-item:hover { background: rgba(139,108,255,.2); color: #fff; }
.menu-item.disabled { opacity: .4; }
.menu-item .ico { color: var(--muted); width: 16px; }
.menu-check { width: 12px; color: var(--acc2); font-weight: 700; }
.menu-label { flex: 1; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-head { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: 9px 10px 4px; }
.panel-pop { padding: 12px; }
.colorpop { width: 250px; display: flex; flex-direction: column; gap: 9px; }
.colorpop .sl input[type=range] { width: 120px; }
.layerpop { width: 280px; }
.pop-title { font-weight: 700; color: #fff; }

/* ---------- command palette ---------- */
.cmdk-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,6,10,.55); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade .12s; }
.cmdk { width: min(620px, 94vw); background: rgba(22,23,35,.98); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(139,108,255,.15); overflow: hidden; }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input { flex: 1; background: none; border: 0; outline: none; font-size: 15px; color: var(--text); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.cmdk-item .ico { color: var(--muted); width: 16px; }
.cmdk-item.on { background: linear-gradient(90deg, rgba(139,108,255,.28), rgba(139,108,255,.08)); }
.cmdk-item.on .ico { color: #fff; }
.cmdk-label { flex: 1; } .cmdk-group { color: var(--dim); font-size: 11.5px; }

/* ---------- modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; background: rgba(5,6,10,.6); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .14s; }
.overlay.closing { opacity: 0; transition: opacity .14s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(28,29,44,.98), rgba(20,21,32,.98)); border: 1px solid var(--line2); border-radius: 20px; box-shadow: 0 30px 90px rgba(0,0,0,.6); animation: rise .18s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(900px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px 20px; }
.modal-head .ico { color: var(--acc); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 8px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px 16px 20px; border-top: 1px solid var(--line); }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.x { color: var(--dim); margin-top: 14px; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; }
.dimprev { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 200px; border-radius: 16px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.dimbox { border: 2px solid var(--acc); border-radius: 3px; background: repeating-conic-gradient(#2a2b3a 0 25%, #33354a 0 50%) 0 0 / 12px 12px; box-shadow: 0 0 30px rgba(139,108,255,.3); transition: all .2s; }
.anchor { display: grid; grid-template-columns: repeat(3, 22px); gap: 3px; }
.anchor button { width: 22px; height: 22px; border-radius: 5px; background: rgba(255,255,255,.06); border: 1px solid var(--line2); }
.anchor button.on { background: var(--acc); border-color: var(--acc); }
.csdlg { display: grid; gap: 12px; }
.csdlg > p { margin: 0; }
.cs-cols { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 18px; align-items: start; }
.cs-left { display: grid; gap: 8px; min-width: 0; }
.cs-left .presets { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-prev { display: grid; gap: 8px; justify-items: center; }
.cs-stage { position: relative; background: repeating-conic-gradient(rgba(255,255,255,.05) 0 25%, transparent 0 50%) 0 0 / 12px 12px; border-radius: 6px; }
.cs-stage > div { position: absolute; box-sizing: border-box; border-radius: 2px; }
.cs-new { background: rgba(139,108,255,.22); border: 2px solid var(--acc); }
.cs-old { border: 2px dashed rgba(255,255,255,.75); }
.cs-legend { display: grid; gap: 3px; font: 11px var(--mono); color: var(--muted, #a8b7ca); }
.cs-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cs-k { width: 12px; height: 10px; border-radius: 2px; display: inline-block; }
.cs-k.old { border: 2px dashed rgba(255,255,255,.75); } .cs-k.new { background: rgba(139,108,255,.4); border: 2px solid var(--acc); }
.cs-info { margin: 0; }
@media (max-width: 560px) { .cs-cols { grid-template-columns: minmax(0, 1fr); } }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { color: #fff; background: rgba(255,255,255,.04); }
.tab.on { color: #fff; background: rgba(139,108,255,.18); box-shadow: inset 0 0 0 1px rgba(139,108,255,.45); }
.ex-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.ex-prevwrap { display: flex; align-items: center; justify-content: center; min-height: 320px; border-radius: 14px; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); overflow: auto; padding: 10px; }
.ex-prev { image-rendering: pixelated; max-width: 100%; }
.ex-side .seg { flex-wrap: wrap; }
.ex-side > * { margin-bottom: 4px; }
.ex-line { font-family: var(--mono); font-size: 12px; color: var(--acc2); margin: 10px 0 4px; }
.slice-stage { max-height: 62vh; overflow: auto; border-radius: 12px; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: center; padding: 8px; }
.slice-cv { image-rendering: pixelated; }
.slice-ctl { display: flex; flex-direction: column; gap: 8px; }
.slice-ctl .num { width: 70px; }
.histlist, .versions { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.hist { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 8px; text-align: left; }
.hist:hover { background: rgba(255,255,255,.05); }
.hist.on { background: rgba(139,108,255,.2); }
.hist.undone { opacity: .45; }
.version { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); }
.version img { width: 48px; height: 48px; image-rendering: pixelated; object-fit: contain; background: #1d1e2b; border-radius: 6px; }
.shortcuts { max-height: 55vh; overflow-y: auto; margin-top: 10px; columns: 2; column-gap: 24px; }
.sc-group { break-inside: avoid; margin-bottom: 12px; }
.sc-group h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); }
.sc-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12.5px; }
.prefs .chip { margin: 0 6px 6px 0; }
.ramp-prev { display: flex; height: 28px; border-radius: 8px; overflow: hidden; margin: 10px 0; border: 1px solid var(--line2); }
.ramp-prev span { flex: 1; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255,255,255,.03); font-weight: 600; }
.choice:hover { border-color: var(--acc); background: rgba(139,108,255,.12); }
.about { text-align: center; } .about h3 { margin: 6px 0; }
.tour h3 { margin: 6px 0; font-size: 18px; } .tour p { color: #c9cadb; line-height: 1.6; } .tour-step { color: var(--acc2); font: 600 11px var(--mono); }
.gen { display: grid; grid-template-columns: 200px minmax(0, 1fr) 260px; gap: 16px; min-height: 340px; }
.gen-list { display: flex; flex-direction: column; gap: 3px; max-height: 60vh; overflow-y: auto; }
.gen-item { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px; border-radius: 10px; text-align: left; }
.gen-item:hover { background: rgba(255,255,255,.05); }
.gen-item.on { background: rgba(139,108,255,.2); box-shadow: inset 0 0 0 1px rgba(139,108,255,.45); }
.gen-stage { display: flex; align-items: center; justify-content: center; border-radius: 14px; background: #111219; border: 1px solid var(--line); }
.gen-prev { image-rendering: pixelated; max-width: 100%; }
.gen-side { display: flex; flex-direction: column; gap: 8px; }
.gen-side .sl input[type=range] { width: 120px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(var(--tl-h) + 18px); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(24,25,38,.96); border: 1px solid var(--line2); padding: 9px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: rise .18s; transition: opacity .4s, transform .4s; max-width: 80vw; }
.toast.warn { border-color: rgba(255,181,71,.5); } .toast.error { border-color: rgba(255,93,115,.6); color: #ffc2cb; }
.toast.out { opacity: 0; transform: translateY(6px); }
.drophint { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; background: rgba(11,12,18,.75); backdrop-filter: blur(6px); pointer-events: none; }
.drophint > div { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 60px; border: 2px dashed var(--acc); border-radius: 24px; font-size: 16px; background: rgba(139,108,255,.08); }
.bootfail { position: fixed; inset: 20px; color: #ff9aa9; white-space: pre-wrap; z-index: 999; background: #111; padding: 20px; border-radius: 12px; }

/* ---------- home ---------- */
.home { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background:
  radial-gradient(900px 500px at 15% 0%, rgba(139,108,255,.18), transparent 60%),
  radial-gradient(700px 500px at 100% 30%, rgba(34,211,238,.1), transparent 60%), var(--bg); animation: fade .2s; }
.home.out { opacity: 0; transition: opacity .18s; }
.home-inner { max-width: 1120px; margin: 0 auto; padding: 28px 24px 40px; }
.home-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.home-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.03em; background: linear-gradient(90deg, #fff, #c9bcff 60%, #8fe9f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-head p { margin: 0; }
.home h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 12px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.quickcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); transition: all .15s; text-align: left; }
.quickcard:hover { border-color: rgba(139,108,255,.6); background: rgba(139,108,255,.08); transform: translateY(-2px); }
.qc-box { width: 100%; height: 64px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; color: var(--acc); }
.qc-box > div { max-height: 64px; max-width: 64px; border: 2px solid rgba(139,108,255,.7); border-radius: 4px; background: repeating-conic-gradient(#2a2b3a 0 25%, #33354a 0 50%) 0 0 / 8px 8px; }
.home-row { margin-top: 26px; } .home-row h2 { margin: 0; }
.home-search { max-width: 260px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.projcard { position: relative; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); overflow: hidden; transition: all .15s; }
.projcard:hover { border-color: rgba(139,108,255,.55); transform: translateY(-2px); }
.projcard.current { border-color: var(--acc2); }
.pc-thumb { display: block; width: 100%; aspect-ratio: 4/3; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 14px 14px; }
.pc-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; padding: 12px; }
.pc-meta { display: flex; flex-direction: column; padding: 10px 40px 12px 12px; min-width: 0; }
.pc-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-more { position: absolute; right: 6px; bottom: 10px; }
.home-foot { display: flex; align-items: center; margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- narrow desktop windows ---------- */
.mobilebar { display: none; }
.only-touchui { display: none !important; }
.tb-undo { display: contents; }
/* a collapsed timeline gives its height back to the canvas */
body.tl-min .app { grid-template-rows: 52px 46px minmax(0, 1fr) auto 0; }
@media (max-width: 1100px) { .menubar { display: none; } .only-phone { display: inline-flex !important; } .workspace { grid-template-columns: 60px minmax(0,1fr) 260px; } }
@media (max-width: 900px) { .searchbtn > span:not(.ico), .searchbtn kbd { display: none; } .searchbtn { padding: 6px 8px; } .only-wide { display: none; } }
@media (pointer: coarse) {
  .only-touch { display: flex !important; }
  .ibtn { width: 40px; height: 40px; } .ibtn.sm { width: 34px; height: 34px; }
  .chip { height: 34px; } .seg button { height: 32px; }
  .lbtn { width: 32px; height: 32px; } .lbtn.more { opacity: 1; }
  .menu-item { padding: 11px 12px 11px 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* short screens: two-column dock so every tool and the colour swatches fit */
/* desktop: the tool column is always two tools wide (2026-10-23: owner — room for the new tools; it used to switch
   only on windows under 1020 px tall, so tall monitors got one long column) */
@media (min-width: 761px) {
  .workspace { grid-template-columns: 90px minmax(0, 1fr) 296px; }
  body.focus .workspace { grid-template-columns: 90px minmax(0, 1fr) 0; }
  .dockgroup { display: grid; grid-template-columns: 36px 36px; gap: 2px; }
  .toolbtn { width: 36px; height: 36px; border-radius: 10px; }
  .tooldock { gap: 6px; padding: 8px 0; }
}
@media (min-width: 761px) and (max-width: 1100px) { .workspace { grid-template-columns: 90px minmax(0, 1fr) 260px; } }

/* ============================================================
   TOUCH LAYOUTS — everything below is scoped to body.touchui / body.L-tablet / body.L-phone,
   so the desktop layout above is untouched. (ui.applyLayout picks the layout.)
   ============================================================ */
body.touchui { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.touchui input, body.touchui textarea, body.touchui [contenteditable] { -webkit-user-select: text; user-select: text; }
body.touchui button, body.touchui .lrow, body.touchui .palsw, body.touchui .tl-head, body.touchui .tl-grid, body.touchui .menu-item, body.touchui .cmdk-item { touch-action: manipulation; }
body.touchui .only-touchui { display: inline-flex !important; }
body.touchui .sidebtn.on, body.side-open .sidebtn { color: #fff; background: rgba(139,108,255,.22); }
body.touchui .optionsbar, body.touchui .tl-bar { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent); padding-right: 30px; }
body.touchui .home-inner { padding-top: calc(18px + var(--safe-t)); }
body.touchui .cmdk-overlay { padding-top: calc(10vh + var(--safe-t)); }
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } }
body.touchui .tl-resize { top: -11px; height: 22px; }
body.touchui .tl-resize::after { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line2); }
body.tl-min .tl-resize { display: none; }

/* ---------- tablet (iPad): touch-sized dock, drawer side panel, roomy timeline ---------- */
body.L-tablet .app { grid-template-rows: calc(56px + var(--safe-t)) 52px minmax(0, 1fr) var(--tl-h) 0; padding-left: var(--safe-l); padding-right: var(--safe-r); }
body.L-tablet.no-timeline .app { grid-template-rows: calc(56px + var(--safe-t)) 52px minmax(0, 1fr) 0 0; }
body.L-tablet.tl-min .app { grid-template-rows: calc(56px + var(--safe-t)) 52px minmax(0, 1fr) auto 0; }
body.L-tablet.focus .app { grid-template-rows: calc(56px + var(--safe-t)) 0 minmax(0, 1fr) 0 0; }
body.L-tablet .topbar { padding-top: var(--safe-t); gap: 4px; }
body.L-tablet .menubtn { padding: 9px 10px; }
body.L-tablet .searchbtn > span:not(.ico), body.L-tablet .searchbtn kbd, body.L-tablet .savestate > span { display: none; }
body.L-tablet .searchbtn { padding: 8px 10px; }
body.L-tablet .projname { width: 150px; }
/* undo / redo live in the floating pill next to the canvas (closer to the hand than the top bar) */
body.L-tablet .tb-undo { display: none; }
body.L-tablet .optionsbar { gap: 10px; }
body.L-tablet .sl input[type=range] { width: 130px; }
body.L-tablet input[type=range] { height: 6px; }
body.L-tablet input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; }
body.L-tablet .workspace, body.L-tablet.focus .workspace { grid-template-columns: 112px minmax(0, 1fr) 0; }
body.L-tablet.landscape.side-open .workspace { grid-template-columns: 112px minmax(0, 1fr) 300px; }
body.L-tablet.focus .sidepanel, body.L-tablet.landscape:not(.side-open) .sidepanel { display: none; }
/* the swatches sit at the top of the dock so they never scroll away */
body.L-tablet .tooldock { gap: 8px; padding: 10px 0 16px; }
body.L-tablet .tooldock > .swatches { order: -1; margin: 0 0 4px; width: 60px; height: 60px; }
body.L-tablet .tooldock > .grow { display: none; }
body.L-tablet .dockgroup { display: grid; grid-template-columns: 46px 46px; gap: 3px; padding: 4px; border-radius: 16px; }
body.L-tablet .toolbtn { width: 46px; height: 46px; border-radius: 13px; }
body.L-tablet .swatches .sw { width: 38px; height: 38px; border-radius: 11px; }
body.L-tablet .swapbtn { width: 22px; height: 22px; }
/* portrait: the side panel slides in over the canvas instead of taking a column */
body.L-tablet.portrait .sidepanel { position: fixed; right: 0; top: calc(108px + var(--safe-t)); bottom: 0; width: min(340px, 86vw); z-index: 40; border: 1px solid var(--line2); border-right: 0; border-radius: 20px 0 0 0; background: rgba(18,19,29,.97); backdrop-filter: blur(16px); box-shadow: -20px 0 60px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .25s cubic-bezier(.2,.9,.3,1); padding-bottom: var(--safe-b); }
body.L-tablet.portrait.side-open .sidepanel { transform: none; }
body.L-tablet .pnl-head { padding: 14px 16px; }
body.L-tablet .cp-sv { height: 180px; }
body.L-tablet .cp-hue, body.L-tablet .cp-alpha { height: 22px; border-radius: 11px; }
body.L-tablet .palgrid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 5px; }
body.L-tablet .mini-sw { width: 28px; height: 28px; }
body.L-tablet .tl-bar { padding: 8px 12px; gap: 8px; }
body.L-tablet .ibtn.play { width: 44px; height: 38px; }
body.L-tablet .lgrip { padding: 0 8px; font-size: 13px; }
body.L-tablet .num { height: 34px; }
body.L-tablet .sel { height: 36px; }
body.L-tablet .floatpill { padding: 5px; border-radius: 14px; }
body.L-tablet .zoompill .ibtn.sm { width: 40px; height: 40px; }
body.L-tablet #toasts { bottom: calc(var(--tl-h) + 24px); }
body.L-tablet.tl-min #toasts { bottom: 90px; }

/* ---------- phone ---------- */
body.L-phone .app { grid-template-rows: calc(48px + var(--safe-t)) 44px minmax(0, 1fr) var(--tl-h) calc(58px + var(--safe-b)); }
body.L-phone.no-timeline .app { grid-template-rows: calc(48px + var(--safe-t)) 44px minmax(0,1fr) 0 calc(58px + var(--safe-b)); }
body.L-phone.tl-min .app { grid-template-rows: calc(48px + var(--safe-t)) 44px minmax(0,1fr) auto calc(58px + var(--safe-b)); }
body.L-phone.focus .app { grid-template-rows: calc(48px + var(--safe-t)) 0 minmax(0,1fr) 0 calc(58px + var(--safe-b)); }
body.L-phone .topbar { padding: var(--safe-t) calc(6px + var(--safe-r)) 0 calc(6px + var(--safe-l)); gap: 2px; }
body.L-phone .logo-word, body.L-phone .savestate > span, body.L-phone .tb-sep, body.L-phone .tb-undo, body.L-phone .menubar, body.L-phone .sidebtn { display: none !important; }
body.L-phone .only-phone { display: inline-flex !important; }
body.L-phone .searchbtn > span:not(.ico), body.L-phone .searchbtn kbd { display: none; }
body.L-phone .searchbtn { padding: 6px 8px; }
body.L-phone .projname { width: auto; flex: 1 1 90px; min-width: 60px; }
body.L-phone .exportbtn > span:not(.ico) { display: none; }
body.L-phone .exportbtn { width: 38px; padding: 0; }
body.L-phone .readout { display: none; }
body.L-phone .optionsbar { padding-left: calc(10px + var(--safe-l)); }
body.L-phone .workspace, body.L-phone.focus .workspace { grid-template-columns: minmax(0,1fr); }
body.L-phone .tooldock { display: none; }
body.L-phone .sidepanel { position: fixed; left: 0; right: 0; bottom: 0; max-height: 72dvh; z-index: 65; border: 1px solid var(--line2); border-radius: 22px 22px 0 0; background: rgba(18,19,29,.98); transform: translateY(105%); transition: transform .25s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -20px 60px rgba(0,0,0,.5); padding-bottom: var(--safe-b); }
body.L-phone .sidepanel.open { transform: none; }
body.L-phone .sidepanel::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line2); margin: 8px auto 0; }
body.L-phone.focus .sidepanel { display: block; }
.sheet-scrim { position: fixed; inset: 0; z-index: 64; background: rgba(0,0,0,.4); }
body.L-phone .mobilebar { display: flex; align-items: center; gap: 4px; padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l)); border-top: 1px solid var(--line); background: rgba(13,14,21,.96); overflow: hidden; }
body.L-phone .mb-tools { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
body.L-phone .mb-tools::-webkit-scrollbar { display: none; }
body.L-phone .mobilebar .toolbtn { width: 44px; height: 44px; }
body.L-phone .mobilebar .swatches { width: 44px; height: 44px; margin: 0 4px; }
body.L-phone .mb-sep { width: 1px; height: 30px; background: var(--line2); flex: none; }
body.L-phone .mobilebar .toolbtn.on-tl { color: #fff; background: rgba(139,108,255,.22); }
body.L-phone .mb-side { display: flex; align-items: center; gap: 2px; flex: none; }
body.L-phone .mb-land { display: none; }
body.L-phone .tl-corner, body.L-phone .tl-layers { width: 148px; }
body.L-phone .lgrip, body.L-phone .lbadge { display: none; }
/* names need the room more than an always-visible lock (it stays in the Layer menu) */
body.L-phone .lrow .lbtn.off[title="Lock"] { display: none; }
body.L-phone .ex-prevwrap { min-height: 150px; max-height: 34dvh; }
body.L-phone .ex-prev { max-height: 30dvh; }
body.L-phone .tl-bar .only-wide, body.L-phone .tl-zoom { display: none; }
body.L-phone .zoompill { bottom: 8px; left: 8px; }
/* thumb-reachable undo / redo */
body.L-phone .quickundo { top: auto; bottom: 8px; right: 8px; }
body.L-phone .cols2, body.L-phone .ex-main, body.L-phone .gen, body.L-phone .tpl-use { grid-template-columns: minmax(0, 1fr); }
body.L-phone .tpl-prev { width: 192px; height: 192px; }
body.L-phone .shortcuts { columns: 1; }
body.L-phone #toasts { bottom: calc(var(--tl-h) + 80px); }
body.L-phone.tl-min #toasts, body.L-phone.no-timeline #toasts { bottom: calc(130px + var(--safe-b)); }
body.L-phone .home-inner { padding: calc(18px + var(--safe-t)) 14px 30px; }
/* modals, menus and popovers become bottom sheets */
body.L-phone .overlay { align-items: flex-end; padding: 0; }
body.L-phone .modal, body.L-phone .modal.wide { width: 100%; max-height: calc(100dvh - var(--safe-t) - 10px); border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); animation: sheetup .22s cubic-bezier(.2,.9,.3,1); }
body.L-phone .popover { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-height: 80dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding-bottom: calc(10px + var(--safe-b)); animation: sheetup .2s cubic-bezier(.2,.9,.3,1); }
body.L-phone .menu { min-width: 0; max-height: 80dvh; }
body.L-phone .colorpop, body.L-phone .layerpop { width: auto; }
body.L-phone .cp-sv { height: 170px; }
body.L-phone .cp-hue, body.L-phone .cp-alpha { height: 22px; border-radius: 11px; }
body.L-phone .palgrid { grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 5px; }

/* phone landscape: the top bar and tool options share one row; tools become a two-column left
   rail and colours / timeline / undo a right rail — both under the thumbs; the sheet is a drawer */
body.L-phone.landscape .app { grid-template-columns: calc(100px + var(--safe-l)) 116px minmax(0, 1fr) calc(56px + var(--safe-r)); grid-template-rows: 46px minmax(0, 1fr) min(var(--tl-h), 46dvh); grid-template-areas: "top top opt opt" "rail ws ws side" "tl tl tl tl"; }
body.L-phone.landscape.tl-min .app { grid-template-rows: 46px minmax(0, 1fr) auto; }
body.L-phone.landscape.no-timeline .app { grid-template-rows: 46px minmax(0, 1fr) 0; }
body.L-phone.landscape.focus .app { grid-template-rows: 46px minmax(0, 1fr) 0; }
body.L-phone.landscape .topbar { grid-area: top; padding: 0 4px 0 calc(6px + var(--safe-l)); border-right: 1px solid var(--line); }
body.L-phone.landscape .projname, body.L-phone.landscape .savestate { display: none; }
body.L-phone.landscape .optionsbar { grid-area: opt; border-bottom: 1px solid var(--line); padding-right: calc(30px + var(--safe-r)); }
body.L-phone.landscape.focus .optionsbar { display: flex; }
body.L-phone.landscape .workspace { grid-area: ws; }
body.L-phone.landscape .timeline { grid-area: tl; padding: 0 var(--safe-r) var(--safe-b) var(--safe-l); }
body.L-phone.landscape .mobilebar { display: contents; }
body.L-phone.landscape .mb-sep { display: none; }
body.L-phone.landscape .mb-tools { grid-area: rail; display: grid; grid-template-columns: 44px 44px; align-content: start; justify-content: center; gap: 3px; padding: 6px 4px 8px calc(4px + var(--safe-l)); overflow-x: hidden; overflow-y: auto; border-right: 1px solid var(--line); background: rgba(13,14,21,.96); }
body.L-phone.landscape .mb-side { grid-area: side; flex-direction: column; justify-content: flex-start; padding: 6px calc(4px + var(--safe-r)) 8px 4px; gap: 3px; border-left: 1px solid var(--line); background: rgba(13,14,21,.96); overflow-y: auto; }
body.L-phone.landscape .mobilebar .toolbtn { width: 44px; height: 42px; }
body.L-phone.landscape .mobilebar .swatches { margin: 2px 0 4px; }
body.L-phone.landscape .mb-land { display: inline-flex; }
body.L-phone.landscape span.mb-land { display: block; }
body.L-phone.landscape .quickundo { display: none !important; }
body.L-phone.landscape .sidepanel { left: auto; top: 0; width: min(380px, 70vw); max-height: none; border-radius: 22px 0 0 22px; transform: translateX(105%); padding-right: var(--safe-r); }
body.L-phone.landscape .sidepanel.open { transform: none; }
body.L-phone.landscape .sidepanel::before { display: none; }
body.L-phone.landscape .popover, body.L-phone.landscape .modal { max-width: 640px; margin: 0 auto; }
body.L-phone.landscape .popover { left: 50% !important; transform: translateX(-50%); width: min(640px, 100vw); animation: none; }

/* ---------- v0.2: layer tree, masks, tilemaps, audio ---------- */
.lrow.grp .lname { font-weight: 700; }
.lrow.grp { background: rgba(255,255,255,.018); }
.ltype { display: inline-flex; color: var(--acc2); margin: 0 2px; flex: none; }
.lclip { color: var(--acc2); font-weight: 800; margin: 0 2px 0 1px; flex: none; }
.lbtn.fold { width: 20px; }
.lbadge.maskb { cursor: pointer; border: 1px solid rgba(34,211,238,.35); background: rgba(34,211,238,.08); }
.lbadge.maskb.on { background: var(--acc2); color: #06222a; }
.lbadge.maskb.off { opacity: .45; text-decoration: line-through; }
.lrow.drop-above { box-shadow: inset 0 3px 0 var(--acc2); }
.lrow.drop-below { box-shadow: inset 0 -3px 0 var(--acc2); }
.lrow.drop-into { background: rgba(34,211,238,.18); box-shadow: inset 0 0 0 2px var(--acc2); }
.lrow.audio { color: var(--acc2); background: rgba(34,211,238,.05); padding-left: 10px; }
.lrow.audio .ltype { font-size: 15px; width: 18px; justify-content: center; }
.mode-badge { font: 700 10.5px var(--mono); padding: 3px 8px; border-radius: 999px; background: rgba(255,181,71,.14); color: #ffcf85; border: 1px solid rgba(255,181,71,.35); cursor: pointer; white-space: nowrap; }
.mask-badge { background: rgba(34,211,238,.15); color: var(--acc2); border-color: rgba(34,211,238,.45); }
.tiles-pnl .tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.tilesw { aspect-ratio: 1; border-radius: 6px; background: repeating-conic-gradient(#2a2b3a 0 25%, #33354a 0 50%) 0 0 / 8px 8px; border: 1px solid var(--line2); position: relative; padding: 2px; display: flex; }
.tilesw canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.tilesw.on { box-shadow: 0 0 0 2px var(--acc2); }
.tilesw .tnum { position: absolute; left: 2px; top: 1px; font: 600 8px var(--mono); color: #fff; text-shadow: 0 0 2px #000; }
.tilesw .tcol { position: absolute; right: 2px; bottom: 2px; width: 6px; height: 6px; border-radius: 2px; background: var(--bad); }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* ---------- cloud account ---------- */
.savestate.syncing .dot { background: var(--acc2); box-shadow: 0 0 8px var(--acc2); animation: pulse 1s ease-in-out infinite alternate; }
.savestate.synced .dot { background: var(--acc2); box-shadow: 0 0 8px var(--acc2); }
.savestate.syncerror .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes pulse { to { opacity: .35; } }
.account-dlg .modal { width: min(460px, 100%); }
.account .tabs { margin-bottom: 10px; }
.account-form { display: flex; flex-direction: column; gap: 2px; }
.account-form .btn.primary { align-self: flex-start; margin-top: 4px; }
.account-form .btn.busy { opacity: .6; pointer-events: none; }
.account-msg { font-size: 12.5px; min-height: 0; margin: 2px 0 6px; }
.account-msg:empty { display: none; }
.account-msg.bad { color: #ff9aa9; } .account-msg.good { color: var(--good); }
.account-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 0; }
.account-done .ico { color: var(--good); }
.account-done h3 { margin: 4px 0; }
.account-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.account-avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); flex: none; }
.account-usage { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.account-usage .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.account-usage .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); }
.account-adv { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.account-adv summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 4px 0; }
.account-adv[open] summary { color: var(--text); margin-bottom: 6px; }
.account-adv .text.sm { flex: 1; min-width: 0; }
.danger-zone summary { color: #ff9aa9; }
.account-btn span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
/* top bar, right of the logo: New project + account */
.newproj-btn { margin: 0 0 0 2px; flex: none; }
.signin-btn { margin: 0 4px 0 2px; flex: none; }
/* make room for them: the name field shrinks, the search button keeps its icon + shortcut */
.projname { flex: 0 1 180px; }
.searchbtn > span:not(.ico) { white-space: nowrap; }
@media (max-width: 1560px) { .searchbtn > span:not(.ico) { display: none; } .searchbtn { padding: 6px 8px; gap: 6px; } }
@media (max-width: 1360px) { .savestate > span { display: none; } }
body.touchui .newproj-label { display: none; }
body.touchui .newproj-btn { width: 36px; height: 36px; padding: 0; }
body.L-phone.landscape .newproj-btn { width: 32px; height: 32px; }
.signin-btn.signed-in { background: rgba(255,255,255,.04); border-color: var(--line2); color: #dcdcea; padding: 0 10px 0 4px; }
.signin-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.signin-avatar { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); }
/* touch layouts: icon-sized, so the top bar never overflows */
body.touchui .signin-label { display: none; }
body.touchui .signin-btn { width: 36px; height: 36px; padding: 0; }
body.touchui .signin-btn.signed-in { padding: 0; }
body.L-phone.landscape .signin-btn { width: 32px; height: 32px; }

/* ---------- importers ---------- */
.pix-orig { max-width: 160px; max-height: 120px; border-radius: 8px; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 12px 12px; border: 1px solid var(--line); }
.pix-pal { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; }
.pix-pal span { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); }
.importer .ex-side .seg { flex-wrap: wrap; }
.importer .sl input[type=range] { width: 150px; }

/* ---------- plugins ---------- */
.plugin-list { display: flex; flex-direction: column; gap: 6px; }
.plugin { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.plugin.on { border-color: rgba(139,108,255,.4); background: rgba(139,108,255,.07); }
.plugin-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(139,108,255,.15); color: var(--acc); flex: none; }
.plugin-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.plugin-meta .warn { margin: 4px 0 0; }
.plugin-form .sl input[type=range] { width: 160px; }
.plugin-form > * { margin-bottom: 8px; }

/* ---------- template library ---------- */
.tpl-bar { margin-bottom: 14px; }
.tpl-bar .seg { flex-wrap: wrap; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-height: 62vh; overflow-y: auto; padding: 2px; }
.tpl-card { display: flex; flex-direction: column; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); overflow: hidden; transition: all .15s; }
.tpl-card:hover { border-color: rgba(139,108,255,.55); transform: translateY(-2px); }
.tpl-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 14px 14px; }
.tpl-thumb img { max-width: 80%; max-height: 80%; image-rendering: pixelated; }
.tpl-meta { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 4px; min-width: 0; }
.tpl-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--acc); background: rgba(139,108,255,.14); border-radius: 6px; padding: 2px 6px; }
.tpl-cat.bi { color: var(--acc2); background: rgba(34,211,238,.12); }
.tpl-actions { display: flex; align-items: center; gap: 6px; padding: 6px 12px 12px; }
.tpl-add { align-items: center; justify-content: center; gap: 6px; min-height: 230px; color: var(--muted); border-style: dashed; }
.tpl-add .ico { color: var(--acc); }
.tpl-source .tabs { margin-bottom: 8px; }
.tpl-src { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.tpl-srcimg { display: flex; justify-content: center; max-height: 310px; overflow: auto; border-radius: 12px; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 14px 14px; border: 1px solid var(--line); padding: 6px; }
.tpl-srcimg canvas { image-rendering: pixelated; }
.tpl-names { margin-top: 6px; }
.tpl-rows { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow-y: auto; margin-top: 6px; }
.tpl-rowhead { margin: 4px 0; }
.tpl-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 10px; background: rgba(255,255,255,.025); }
.tpl-row.off { opacity: .45; }
.tpl-row .text { flex: 1; min-width: 80px; }
.tpl-rthumb { width: 40px; height: 40px; image-rendering: pixelated; background: repeating-conic-gradient(#2a2b3a 0 25%, #33354a 0 50%) 0 0 / 8px 8px; border-radius: 6px; flex: none; }
.tpl-use { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.tpl-prevwrap { display: flex; justify-content: center; border-radius: 14px; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 14px 14px; border: 1px solid var(--line); padding: 8px; }
.tpl-prev { width: 256px; height: 256px; image-rendering: pixelated; }
.tpl-pick { display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow-y: auto; margin: 8px 0; }
.tpl-pickrow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; }
.tpl-pickrow:hover, .tpl-pickrow.on { background: rgba(139,108,255,.14); }
.tpl-pickrow span:nth-child(2) { flex: 1; }
.qc-img img { max-width: 64px; max-height: 64px; image-rendering: pixelated; }
@media (max-width: 760px) { .tpl-use { grid-template-columns: minmax(0, 1fr); } .tpl-prev { width: 192px; height: 192px; } }
/* Top bar between 1101 and 1500 px: New project goes icon-only and the search key hint hides, so Export always fits
   next to the suite's "Apps" launcher (Export was clipped at 1280 since New project + Sign in to sync landed). */
@media (max-width: 1720px) and (min-width: 1101px) { .newproj-label, .searchbtn kbd { display: none; } .newproj-btn { padding-left: 9px; padding-right: 9px; } }
@media (max-width: 1350px) and (min-width: 1101px) { .menubar { display: none; } .only-phone { display: inline-flex !important; } }
/* Send to App (suite library hand-off) next to Export; icon-only under 1500px */
.sendbtn, .cloudbtn, .libbtn { flex: none; margin-right: 6px; }
.cloudbtn, .libbtn { margin-right: 4px; }
@media (max-width: 1860px) { .sendbtn-label, .cloudbtn-label, .libbtn-label { display: none; } .sendbtn, .cloudbtn, .libbtn { padding-left: 9px; padding-right: 9px; } }
body.L-phone .sendbtn, body.L-phone .cloudbtn, body.L-phone .libbtn { display: none; }
@media (max-width: 1400px) and (min-width: 1101px) { .signin-btn .signin-label { display: none; } }
/* 2026-10-18: Cloud + Library joined Send to App in the top bar (suite-wide consistency) — keep the bar from overflowing 1024–1920 */
@media (max-width: 1999px) { .cloudbtn-label, .libbtn-label { display: none; } .cloudbtn, .libbtn { padding-left: 9px; padding-right: 9px; } }
@media (max-width: 1560px) and (min-width: 1101px) { .signin-btn .signin-label { display: none; } }
@media (max-width: 1400px) and (min-width: 1351px) { .menubar .menubtn { padding-left: 6px; padding-right: 6px; } }
@media (max-width: 1100px) { .cloudbtn, .libbtn, .sendbtn { margin-right: 2px; } }
@media (max-width: 1660px) and (min-width: 1101px) { .signin-btn .signin-label { display: none; } }
@media (max-width: 1780px) and (min-width: 1101px) { .newproj-label { display: none; } .newproj-btn { padding-left: 9px; padding-right: 9px; } }

/* ---------- Simplified workspace (Pixx Suite Apps menu → Workspace; <html>.pxs-simple, owner 2026-10-22) ----------
   Pixxivi keeps its own stylesheet, so the shared .pxs-app touch rules don't reach it: these give every visible control
   a 44 px target (palette swatches + layer buttons 40). Everything is scoped to html.pxs-simple: Full is untouched.
   The .adv items (extra tools, dither / alpha lock / tiled, tags, speed, slices…) hide via shared/pixx.css. */
html.pxs-simple .app { grid-template-rows: 56px 54px minmax(0, 1fr) var(--tl-h) 0; }
html.pxs-simple body.no-timeline .app { grid-template-rows: 56px 54px minmax(0,1fr) 0 0; }
html.pxs-simple body.focus .app { grid-template-rows: 56px 0 minmax(0,1fr) 0 0; }
html.pxs-simple body.tl-min .app { grid-template-rows: 56px 54px minmax(0, 1fr) auto 0; }
html.pxs-simple body.L-tablet .app { grid-template-rows: calc(58px + var(--safe-t)) 56px minmax(0, 1fr) var(--tl-h) 0; }
html.pxs-simple body.L-tablet.no-timeline .app { grid-template-rows: calc(58px + var(--safe-t)) 56px minmax(0, 1fr) 0 0; }
html.pxs-simple body.L-tablet.tl-min .app { grid-template-rows: calc(58px + var(--safe-t)) 56px minmax(0, 1fr) auto 0; }
html.pxs-simple body.L-tablet.focus .app { grid-template-rows: calc(58px + var(--safe-t)) 0 minmax(0, 1fr) 0 0; }
html.pxs-simple body.L-phone .app { grid-template-rows: calc(52px + var(--safe-t)) 52px minmax(0, 1fr) var(--tl-h) calc(60px + var(--safe-b)); }
html.pxs-simple body.L-phone.no-timeline .app { grid-template-rows: calc(52px + var(--safe-t)) 52px minmax(0,1fr) 0 calc(60px + var(--safe-b)); }
html.pxs-simple body.L-phone.tl-min .app { grid-template-rows: calc(52px + var(--safe-t)) 52px minmax(0,1fr) auto calc(60px + var(--safe-b)); }
html.pxs-simple body.L-phone.focus .app { grid-template-rows: calc(52px + var(--safe-t)) 0 minmax(0,1fr) 0 calc(60px + var(--safe-b)); }
html.pxs-simple body.L-phone.landscape .app { grid-template-rows: 52px minmax(0, 1fr) min(var(--tl-h), 46dvh); }
html.pxs-simple body.L-phone.landscape.tl-min .app { grid-template-rows: 52px minmax(0, 1fr) auto; }
html.pxs-simple body.L-phone.landscape.no-timeline .app, html.pxs-simple body.L-phone.landscape.focus .app { grid-template-rows: 52px minmax(0, 1fr) 0; }
html.pxs-simple .ibtn, html.pxs-simple .ibtn.sm, html.pxs-simple .toolbtn, html.pxs-simple body .mobilebar .toolbtn { min-width: 44px; min-height: 44px; }
html.pxs-simple .btn, html.pxs-simple .btn.sm { height: 44px; min-width: 44px; }
html.pxs-simple .chip, html.pxs-simple .chip.sm, html.pxs-simple .seg button { height: 44px; min-width: 44px; justify-content: center; }
html.pxs-simple .sel, html.pxs-simple .sel.sm, html.pxs-simple .num, html.pxs-simple .text, html.pxs-simple .projname { height: 44px; font-size: 16px; }
html.pxs-simple .logo, html.pxs-simple .zoomlbl { min-height: 44px; min-width: 44px; justify-content: center; }
html.pxs-simple .ibtn.play, html.pxs-simple body.L-tablet .ibtn.play { width: 52px; height: 44px; }
html.pxs-simple .lbtn, html.pxs-simple body .lbtn { min-width: 40px; min-height: 40px; }
html.pxs-simple .menu-item { min-height: 44px; }
html.pxs-simple input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; }
html.pxs-simple .palgrid, html.pxs-simple body.L-tablet .palgrid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
html.pxs-simple .swatches, html.pxs-simple body .tooldock > .swatches, html.pxs-simple body .mobilebar .swatches { width: 54px; height: 54px; }
html.pxs-simple .swatches .sw, html.pxs-simple body.L-tablet .swatches .sw { width: 40px; height: 40px; border-radius: 11px; }
html.pxs-simple .optionsbar > *, html.pxs-simple .tl-bar > *, html.pxs-simple .topbar > button { flex-shrink: 0; }
/* tight top bars: the size chip keeps its numbers, drops its icon */
@media (max-width: 1560px) { .sizechip > svg, .sizechip > .ico { display: none; } .sizechip { padding: 0 8px; } }
/* the size chip took its room from the save-state text: the dot stays (hover for the status), the words show on very wide screens */
@media (max-width: 2099px) { .savestate > span { display: none; } }
/* 761–1100 px (small laptops, tablets with a mouse): icon-only New project + Sign in, or the bar overflows (found 2026-10-23) */
@media (max-width: 1100px) and (min-width: 761px) { .newproj-label, .signin-btn .signin-label { display: none; } .newproj-btn { padding-left: 9px; padding-right: 9px; } }
@media (max-width: 960px) and (min-width: 761px) { .topbar .pxs-launch-txt, .topbar .logo-word, .topbar .searchbtn { display: none; } }
body.L-phone .topbar .searchbtn { display: none; }
body.L-phone .projname { min-width: 72px; }
body.L-phone .sizechip { height: 26px; padding: 0 7px; font-size: 11px; }
/* the dock holds 27 tools since 2026-10-23: three-wide on shorter windows, four-wide on laptop-height screens */
@media (min-width: 761px) and (max-height: 940px) {
  .dockgroup { grid-template-columns: repeat(3, 32px); padding: 3px; }
  .toolbtn { width: 32px; height: 32px; border-radius: 9px; }
  .tooldock { gap: 4px; padding: 6px 0; }
  .workspace { grid-template-columns: 118px minmax(0, 1fr) 296px; }
  body.focus .workspace { grid-template-columns: 118px minmax(0, 1fr) 0; }
}
@media (min-width: 761px) and (max-height: 800px) {
  .dockgroup { grid-template-columns: repeat(4, 30px); }
  .toolbtn { width: 30px; height: 30px; border-radius: 8px; }
  .workspace { grid-template-columns: 146px minmax(0, 1fr) 296px; }
  body.focus .workspace { grid-template-columns: 146px minmax(0, 1fr) 0; }
}
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 940px) { .workspace { grid-template-columns: 118px minmax(0, 1fr) 260px; } }
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 800px) { .workspace { grid-template-columns: 146px minmax(0, 1fr) 260px; } }
@media (min-width: 761px) and (max-height: 740px) { .dockgroup { grid-template-columns: repeat(4, 28px); padding: 2px; } .toolbtn { width: 28px; height: 28px; } .tooldock { gap: 3px; padding: 4px 0; } }
.optionsbar select.sel { width: auto; max-width: 180px; flex: none; }
