/* ============================================================
   PIXXANI — Pixx Suite look (Pixxivi's dark, glassy, rounded UI) in Pixxani magenta.
   Tokens come from ../shared/pixx.css ([data-app=pixxani]: --acc #E879F9, surface #351B3C, …).
   Layout: library | preview | properties; phones/narrow tablets: drawers + bottom bar.
   (Formerly spindle.css — every selector the JS relies on is kept.)
   ============================================================ */
:root {
  --panel: #14151f; --panel2: #1a1b28; --panel3: #222336; --bg: #0b0c12;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12); --text: #ebebf5; --dim: #8e8fa8; --muted: #8e8fa8;
  /* the old gold names now mean "accent", so every rule (and any inline use) follows the app colour */
  --gold: var(--acc); --gold2: #f6c2fc; --accent: var(--acc); --danger: #ff5d73;
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --cond: var(--font); --title: var(--font);
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  --tint: rgba(var(--acc-rgb), .16); --tint2: rgba(var(--acc-rgb), .28);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 12.5px/1.4 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
body { background:
  radial-gradient(1200px 600px at 20% -10%, rgba(var(--acc-rgb), .10), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(var(--acc2-rgb), .07), transparent 60%), var(--bg); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, select, input, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- buttons: Pixxivi's .btn.sm everywhere ---------- */
button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--panel3); border: 1px solid var(--line2); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 12px; transition: background .12s, border-color .12s, transform .08s, box-shadow .15s; }
button:hover { background: #2a2b42; border-color: rgba(var(--acc-rgb), .45); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.on { background: var(--tint2); border-color: var(--acc); color: #fff; box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .25); }
button.accent { background: linear-gradient(135deg, var(--acc), var(--acc-deep) 60%, var(--acc2)); border-color: transparent; color: var(--on-acc); box-shadow: 0 6px 18px rgba(var(--acc-rgb), .3); }
button.accent:hover { filter: brightness(1.1); background: linear-gradient(135deg, var(--acc), var(--acc-deep) 60%, var(--acc2)); }
button.gold { background: rgba(var(--acc-rgb), .14); border-color: rgba(var(--acc-rgb), .55); color: #fff; }
button.gold:hover { background: var(--tint2); }
button.gold.on { background: var(--acc); color: var(--on-acc); }
button.small { height: 22px; padding: 0 7px; font-size: 11px; border-radius: 7px; }
button.danger:hover { border-color: var(--danger); color: #ff9aa9; background: rgba(255,93,115,.12); }
button.icon { width: 30px; padding: 0; font-size: 15px; }
select, input[type=number], input[type=text], input:not([type]) { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; height: 28px; padding: 0 7px; }
select:focus, input:focus { border-color: var(--acc); outline: none; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--acc), var(--acc2)); width: 100%; opacity: .9; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .45); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .45); }
input[type=color] { width: 30px; height: 26px; padding: 2px; border: 1px solid var(--line2); background: var(--panel2); border-radius: 7px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--acc); }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-thumb { background: #33344a; border-radius: 5px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar (Pixxivi's) ---------- */
#top { height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: rgba(13,14,21,.8); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: relative; z-index: 5; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; height: auto; padding: 4px 8px 4px 2px; border-radius: 10px; background: none; border: 0; flex: none; }
.brand:hover { background: rgba(255,255,255,.04); border: 0; }
.logo { display: inline-flex; filter: drop-shadow(0 2px 10px rgba(var(--acc-rgb), .45)); }
.brandword { font-weight: 800; font-size: 16px; letter-spacing: -.02em; background: linear-gradient(90deg, #fff, var(--acc) 70%, var(--acc2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brandsub { color: var(--dim); font-weight: 500; font-size: 11.5px; }
.tbsep { width: 1px; height: 22px; background: var(--line2); margin: 0 6px; flex: none; }
.projname { flex: 0 1 220px; min-width: 70px; height: 32px !important; background: transparent !important; border: 1px solid transparent !important; border-radius: 8px; padding: 0 8px !important; font-weight: 600 !important; font-size: 13px !important; color: var(--text) !important; }
.projname:hover { border-color: var(--line) !important; } .projname:focus { border-color: var(--acc) !important; background: var(--panel) !important; }
.topbtns { display: flex; align-items: center; gap: 5px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbtns::-webkit-scrollbar { display: none; }
.topbtns > * { flex-shrink: 0; }
.topbtns > button { height: 32px; border-radius: 10px; }
.cloudbtn { color: #fff; }
.topbtns button.pxicon { display: inline-flex; align-items: center; gap: 6px; }
.topbtns button.pxicon .ico { opacity: .9; }

/* ---------- workspace ---------- */
#app { display: grid; grid-template-columns: 420px minmax(0, 1fr) 420px; height: calc(100% - 52px); }
aside { background: rgba(14,15,23,.65); display: flex; flex-direction: column; min-height: 0; }
#library { border-right: 1px solid var(--line); }
#props { border-left: 1px solid var(--line); }
.tabs { display: flex; gap: 3px; padding: 8px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; height: 30px; border-radius: 9px; background: none; border: 1px solid transparent; color: var(--dim); font-weight: 600; font-size: 12.5px; padding: 0 8px; }
.tabs button:hover { color: #fff; background: rgba(255,255,255,.04); border-color: transparent; }
.tabs button.on { color: #fff; background: rgba(var(--acc-rgb), .18); box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .45); border-color: transparent; }
.libbar { display: flex; gap: 6px; padding: 8px 10px; }
.libbar select { flex: 1; } .libbar input { flex: 1; }
.hint { padding: 0 12px 6px; color: var(--dim); font-size: 11.5px; }
.liblist { overflow: auto; flex: 1; padding: 0 8px 12px; }

.famhead { position: sticky; top: 0; background: rgba(18,19,29,.97); backdrop-filter: blur(8px); padding: 9px 4px 5px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #c9cadb; display: flex; align-items: center; gap: 6px; z-index: 1; }
.spell { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.spell:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.spell .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--dim); }
.tag.ult { color: #ffb35c; } .tag.boon { color: #9fe08a; } .tag.heal { color: #7fe3c0; } .tag.stance { color: #ff9fd0; }
.palstrip { display: inline-flex; height: 10px; border-radius: 3px; overflow: hidden; flex: none; border: 1px solid #0006; }
.palstrip i { width: 6px; height: 100%; }
.addbtn { opacity: 0; }
.spell:hover .addbtn { opacity: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; padding-top: 4px; }
.card { position: relative; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 5px; cursor: pointer; text-align: center; transition: border-color .12s, transform .12s, background .12s; }
.card:hover { border-color: rgba(var(--acc-rgb), .6); background: rgba(var(--acc-rgb), .06); transform: translateY(-1px); }
.card canvas { width: 100%; image-rendering: pixelated; background: #0b0a12; border-radius: 8px; display: block; }
.card .cn { font-weight: 700; font-size: 12px; color: #fff; margin-top: 4px; line-height: 1.15; }
.card .cv { font-size: 10.5px; color: var(--dim); }
.card .addbtn { position: absolute; top: 8px; right: 8px; }
.grouphead { grid-column: 1/-1; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--acc); margin-top: 8px; }

.fam { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin: 6px 0; cursor: pointer; }
.fam:hover { border-color: rgba(var(--acc-rgb), .6); }
.fam h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.fam p { margin: 3px 0 6px; color: var(--dim); font-size: 11.5px; }
.fam .palstrip { height: 14px; width: 100%; } .fam .palstrip i { flex: 1; }

/* ---------- preview ---------- */
#stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stagebar { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: rgba(16,17,26,.75); flex-wrap: wrap; }
.stagebar label { display: flex; align-items: center; gap: 5px; color: var(--dim); }
#viewport { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; position: relative; }
#canvasWrap { position: relative; line-height: 0; border-radius: 4px; box-shadow: 0 0 0 1px var(--line2), 0 10px 40px rgba(0,0,0,.5), 0 0 60px rgba(var(--acc-rgb), .08); }
#canvasWrap.checker { background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 16px 16px; }
#canvasWrap.dark { background: #08070c; }
#canvasWrap.night { background: linear-gradient(#0b1030, #241a4a 70%, #2b2b1a); }
#canvasWrap.day { background: linear-gradient(#7ec4f2, #c9ecff 70%, #6f9a43); }
#canvasWrap.white { background: #fff; }
#view, #overlay { image-rendering: pixelated; display: block; }
#overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
#view.painting { cursor: crosshair; }
#paintbar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--line); background: rgba(var(--acc-rgb), .05); flex-wrap: wrap; }
.swatches { display: inline-flex; gap: 2px; flex-wrap: wrap; max-width: 360px; }
.swatches i { width: 15px; height: 15px; border-radius: 4px; cursor: pointer; border: 1px solid #0008; }
#hueTrackWrap { padding: 8px 12px 6px; border-top: 1px solid var(--line); background: rgba(12,13,20,.6); }
.trackhead { display: flex; gap: 10px; align-items: center; margin-bottom: 5px; }
.trackhead b { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #c9cadb; }
.trackhead select { margin-left: auto; }
#hueTrack { width: 100%; display: block; cursor: pointer; border-radius: 6px; }
.keyedit { display: flex; gap: 10px; align-items: center; padding-top: 5px; min-height: 26px; }
.keyedit label { display: flex; gap: 4px; align-items: center; flex: 1; color: var(--dim); }
#strip { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: rgba(12,13,20,.92); border-top: 1px solid var(--line); min-height: 66px; }
#strip canvas { height: 48px; image-rendering: pixelated; border: 1px solid var(--line2); border-radius: 6px; cursor: pointer; flex: none; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 8px 8px; }
#strip canvas.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), 0 0 12px rgba(var(--acc-rgb), .4); }

/* ---------- properties ---------- */
#propBody { overflow: auto; flex: 1; padding: 6px 12px 30px; }
.sec { margin: 14px 0 6px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #c9cadb; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.sec .dim { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.row { display: grid; grid-template-columns: 128px 1fr 52px; align-items: center; gap: 6px; margin: 4px 0; }
.row > label { color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .val { font: 11px var(--mono); text-align: right; color: var(--text); }
.row.wide { grid-template-columns: 128px 1fr; }
.row > * { min-width: 0; } .row select, .row input[type=text], .row input:not([type]) { max-width: 100%; }
.pivwrap { display: flex; gap: 10px; align-items: center; }
.pivgrid { display: grid; grid-template-columns: repeat(3, 22px); grid-template-rows: repeat(3, 22px); gap: 3px; padding: 4px; border: 1px dashed var(--line2); border-radius: 8px; }
.pivgrid button { padding: 0; height: 22px; min-width: 0; border-radius: 6px; }
.pivgrid button i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.pivgrid button.on { border-color: var(--acc); }
.pivgrid button.on i { background: var(--acc); width: 8px; height: 8px; }
.pivside { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.pivside button { height: 24px; padding: 0 8px; }
.pivside button.on { border-color: var(--acc); color: #fff; }
.btnrow { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.note { color: var(--dim); font-size: 11.5px; margin: 5px 0; line-height: 1.45; }
.warn { color: #ffcf85; font-size: 11.5px; margin: 5px 0; }

.layers { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.lay { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); cursor: pointer; position: relative; }
.lay:hover { background: rgba(255,255,255,.045); }
.lay.on { border-color: rgba(var(--acc-rgb), .7); background: linear-gradient(90deg, rgba(var(--acc-rgb), .22), rgba(var(--acc-rgb), .06)); }
.lay .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.lay .ic { width: 20px; text-align: center; cursor: pointer; color: var(--dim); }
.lay .ic.act { color: var(--acc); }
.lay canvas { width: 28px; height: 28px; image-rendering: pixelated; background: #0b0a12; border-radius: 6px; }
.palEdit { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.palEdit i { width: 19px; height: 19px; border-radius: 5px; border: 1px solid #0009; cursor: pointer; position: relative; }
.palEdit i:hover { outline: 2px solid var(--acc); }
.dirbtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.dirbtns button { padding: 0; }
textarea { width: 100%; height: 120px; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; font: 11px var(--mono); padding: 6px 8px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(6px); background: rgba(24,25,38,.96); border: 1px solid rgba(var(--acc-rgb), .5); color: var(--text); padding: 9px 16px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.45); font-weight: 500; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 90; max-width: 80vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- v2 features ---------- */
#propTabs button { flex: 1 1 0; min-width: 0; font-size: 11.5px; padding: 0 3px; overflow: hidden; text-overflow: ellipsis; }
.row.keyrow label { display: flex; align-items: center; gap: 3px; }
.kf { cursor: pointer; color: #5d5878; font-size: 11px; width: 11px; flex: none; }
.kf.on { color: rgba(var(--acc-rgb), .7); } .kf.here { color: var(--acc); }
.kf:hover { color: #fff; }
.keychips { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.chip { display: inline-flex; gap: 3px; align-items: center; background: rgba(255,255,255,.05); border: 1px solid var(--line2); border-radius: 999px; font: 10.5px var(--mono); padding: 1px 7px; }
.chip.on { border-color: var(--acc); color: #fff; background: var(--tint); }
.chip b { font-weight: 400; cursor: pointer; } .chip i { font-style: normal; cursor: pointer; color: var(--dim); } .chip i:hover { color: var(--danger); }
#strip canvas.hit { border-bottom: 3px solid var(--danger); }
.hitlabel { color: var(--danger); }
#refCanvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; pointer-events: none; }
#sceneWrap { display: none; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
#sceneCanvas { max-width: 100%; max-height: calc(100% - 44px); image-rendering: pixelated; border-radius: 6px; box-shadow: 0 0 0 1px var(--line2), 0 10px 40px rgba(0,0,0,.5); cursor: crosshair; }
#sceneBar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--dim); }
#sceneBar label { display: flex; gap: 4px; align-items: center; }
#sceneBar input[type=range] { width: 90px; }
body.scene #canvasWrap { display: none; }
body.scene #sceneWrap { display: flex; }
#waveWrap { margin-top: 5px; }
#waveTrack { width: 100%; display: block; border-radius: 6px; background: var(--panel2); cursor: pointer; }
#modal { position: fixed; inset: 0; background: rgba(5,6,10,.6); backdrop-filter: blur(5px); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
#modal.hidden { display: none; }
.modalbox { background: linear-gradient(180deg, rgba(28,29,44,.98), rgba(20,21,32,.98)); border: 1px solid var(--line2); border-radius: 20px; width: min(1100px, 94vw); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 0 1px rgba(var(--acc-rgb), .1); }
.modalhead { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 700; color: #fff; }
.modalhead button { width: 30px; padding: 0; background: none; border-color: transparent; color: var(--dim); }
.modalhead button:hover { color: #fff; background: rgba(255,255,255,.07); }
#modalBody { overflow: auto; padding: 12px 20px 18px; }
.iostrip { display: flex; height: 16px; border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; font-size: 10px; width: 100%; }
.iostrip .ioseg { display: flex; align-items: center; justify-content: center; color: #1a1424; font-style: normal; white-space: nowrap; overflow: hidden; }
.ioseg.in { background: #7fe3c0; } .ioseg.hold { background: var(--acc); } .ioseg.out { background: #ff8f6b; } .ioseg.gone { background: #2c2840; color: var(--dim); }
.note.warn { color: #ff8f6b; }
.blendchips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 5px 0; }
.blendchips b { margin-right: 4px; font-weight: 700; font-size: 11.5px; }
.blendchips .chip { cursor: pointer; padding: 2px 9px; font: 11.5px var(--font); user-select: none; }
.blendchips .chip.on { background: var(--acc); color: var(--on-acc); border-color: var(--acc); }
.vargrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.varcard { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 6px; cursor: pointer; text-align: center; transition: border-color .12s, transform .12s; }
.varcard:hover { border-color: rgba(var(--acc-rgb), .6); transform: translateY(-1px); }
.varcard canvas { width: 100%; image-rendering: pixelated; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 12px 12px; border-radius: 8px; }
.varcard .cv { font-size: 11px; color: var(--dim); }
.refitem { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 7px; margin: 6px 0; }
.refitem.on { border-color: var(--acc); }
.refitem canvas { max-width: 100%; image-rendering: pixelated; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 12px 12px; display: block; margin: 4px 0; border-radius: 6px; }
.mine { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin: 5px 0; cursor: pointer; }
.mine:hover { border-color: rgba(var(--acc-rgb), .6); }
.mine img { width: 48px; height: 48px; image-rendering: pixelated; background: #0b0a12; border-radius: 8px; }
.mine .nm { flex: 1; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 5px 0; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); width: 0; }
.iconprev { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 6px 0; }
.iconprev canvas { image-rendering: pixelated; background: repeating-conic-gradient(#1d1e2b 0 25%, #242536 0 50%) 0 0 / 8px 8px; border: 1px solid var(--line2); border-radius: 6px; }
.checklist { max-height: 160px; overflow: auto; border: 1px solid var(--line2); border-radius: 8px; padding: 5px; background: var(--panel2); }
.checklist label { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--text); }
/* stacking: reference (under) < frame < reference (over) < overlay */
#view { position: relative; z-index: 1; }
#refCanvas { z-index: 0; }
#refCanvas.over { z-index: 2; }
#overlay { z-index: 3; }
.lightwrap { display: flex; justify-content: center; margin: 6px 0; }
.lightdial { border: 1px solid var(--line2); border-radius: 8px; cursor: crosshair; width: 150px; }
.seamlist { margin: 4px 0 6px 16px; padding: 0; font-size: 11px; color: var(--dim); }
.seamlist b { color: var(--text); }
.curvewrap { display: flex; gap: 10px; align-items: flex-start; }
.curveed { border: 1px solid var(--line2); border-radius: 8px; cursor: crosshair; }
/* fixed-width readouts so the preview toolbar never shifts as numbers grow */
#frameLabel { display: inline-block; min-width: 15ch; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
#renderStat { display: inline-block; min-width: 44ch; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btnRepeat { min-width: 8ch; }
.histlist { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow: auto; min-width: 520px; }
.histrow { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 5px 7px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.03); }
.histrow canvas { width: 48px; height: 48px; image-rendering: pixelated; background: #0b0a12; border-radius: 6px; }
.histrow.on { border-color: var(--acc); background: var(--tint); } .histrow.future { opacity: .55; }
.histtxt { display: flex; flex-direction: column; font-size: 12px; }
#abBar { display: inline-flex; gap: 6px; align-items: center; padding: 0 6px; border: 1px solid var(--acc); border-radius: 8px; height: 28px; }
#abBar.hidden { display: none; }
#abBar .abl { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 4px 0 8px; }
.smrow { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--dim); }
.smrow select { width: 100%; }
.palkey { display: flex; gap: 6px; align-items: center; margin: 2px 0 2px 128px; font-size: 11px; }
.budget { display: grid; grid-template-columns: 90px 1fr 110px; gap: 8px; align-items: center; font-size: 11px; margin: 3px 0; }
.budget .bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.budget .bar i { display: block; height: 100%; }
.budget i.good { background: #7fe3c0; } .budget i.warn { background: #ffdf8a; } .budget i.bad { background: #ff6b6b; }
.alignbtns { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.alignbtns button { padding: 0; font-size: 14px; }
.lay .del { color: var(--dim); cursor: pointer; padding: 0 4px; font-size: 12px; line-height: 1; border-radius: 5px; }
.lay .del:hover { color: #fff; background: #c0394a; }

/* ---------- responsive ---------- */
#mobileBar { display: none; }
@media (max-width: 1500px) { #app { grid-template-columns: 400px minmax(0, 1fr) 400px; } .brandsub { display: none; } }
@media (max-width: 1250px) { #app { grid-template-columns: 320px minmax(0, 1fr) 320px; } .row { grid-template-columns: 104px 1fr 46px; } .row.wide { grid-template-columns: 104px 1fr; } .palkey { margin-left: 104px; } .topbtns > button { padding: 0 8px; } }
@media (pointer: coarse) {
  button { height: 34px; } button.small { height: 28px; } .tabs button { height: 36px; }
  select, input[type=number], input[type=text], input:not([type]) { height: 34px; }
  input[type=range] { height: 6px; } input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; }
}
/* narrow tablets + phones: the preview fills the screen; library / properties are drawers */
@media (max-width: 980px) {
  #top { gap: 4px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
  #top::-webkit-scrollbar { display: none; }
  .brandword { display: none; } .tbsep { display: none; }
  .projname { flex: 1 0 90px; }
  .topbtns { flex: none; }
  #app { grid-template-columns: minmax(0, 1fr); height: calc(100% - 52px - 58px - env(safe-area-inset-bottom, 0px)); }
  #library, #props { position: fixed; top: 52px; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); width: min(420px, 92vw); z-index: 40; background: rgba(18,19,29,.98); backdrop-filter: blur(16px); box-shadow: 0 0 60px rgba(0,0,0,.55); transition: transform .25s cubic-bezier(.2,.9,.3,1); }
  #library { left: 0; transform: translateX(-105%); border-radius: 0 20px 20px 0; }
  #props { right: 0; transform: translateX(105%); border-radius: 20px 0 0 20px; }
  body.drawer-library #library, body.drawer-props #props { transform: none; }
  #mobileBar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(58px + env(safe-area-inset-bottom, 0px)); padding: 6px 10px env(safe-area-inset-bottom, 0px); gap: 6px; background: rgba(13,14,21,.96); border-top: 1px solid var(--line); z-index: 45; }
  #mobileBar button { flex: 1; height: 44px; border-radius: 12px; background: none; border: 0; color: var(--dim); font-size: 13px; }
  #mobileBar button.on { color: #fff; background: rgba(var(--acc-rgb), .22); }
  .stagebar { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .stagebar::-webkit-scrollbar { display: none; }
  #renderStat { display: none; }
  #hueTrackWrap .trackhead .dim { display: none; }
  .histlist { min-width: 0; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) {
  #btnHistory, #btnRedo, #btnExportSheet, #btnLibrary, #btnSend { display: none; }
  .row { grid-template-columns: 96px 1fr 42px; } .row.wide { grid-template-columns: 96px 1fr; } .palkey { margin-left: 96px; }
  #modal { padding: 0; align-items: flex-end; } .modalbox { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Simplified workspace (PIXX.workspace, html.pxs-simple) ----------
   Pixxani has its own top bar and controls (not the shared .pxs-app ones), so it carries its own touch sizing here.
   The [data-adv] tabs / stage tools hide via shared pixx.css. Full is untouched. */
html.pxs-simple { --top-h: 60px; }
html.pxs-simple #top { height: var(--top-h); }
html.pxs-simple #app { height: calc(100% - var(--top-h)); }
html.pxs-simple :is(#top, #app, #mobileBar, #modal) :is(button, select, input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color])) { min-height: var(--touch); }
html.pxs-simple :is(#top, #app, #modal) button { min-width: var(--touch); }
html.pxs-simple :is(#top, #app, #modal) :is(select, input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color])) { font-size: 16px; }
html.pxs-simple #app input[type=color] { min-width: var(--touch); min-height: var(--touch); }
html.pxs-simple #app input[type=checkbox] { width: 20px; height: 20px; }
html.pxs-simple #propBody .row > div > input[type=checkbox]:only-child { width: 40px; height: 40px; margin: 0; } /* a bare checkbox (no label to tap): the box itself is the target */
html.pxs-simple #app label:has(> input[type=checkbox]) { min-height: var(--touch); }
html.pxs-simple #app input[type=range] { height: 8px; margin: 18px 0; }
html.pxs-simple #app input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; }
html.pxs-simple #app input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
html.pxs-simple .brand { min-height: var(--touch); }
html.pxs-simple .topbtns > button { height: var(--touch); }
html.pxs-simple .spell { min-height: var(--touch); }
html.pxs-simple .addbtn { opacity: 1; }
html.pxs-simple .swatches i { width: 28px; height: 28px; border-radius: 7px; }
html.pxs-simple #strip canvas { height: 56px; }
html.pxs-simple .libbar > * { min-width: 0; }
html.pxs-simple .moretools { margin: 8px 12px 14px; }
@media (max-width: 980px) {
  html.pxs-simple #app { height: calc(100% - var(--top-h) - 58px - env(safe-area-inset-bottom, 0px)); }
  html.pxs-simple #library, html.pxs-simple #props { top: var(--top-h); }
}
