/* Hallmark · checked: 2026-12-02 · genre: modern-minimal (inferred, app screen)
 * floor: 0 FAIL · fixed: 9 (7a, 19, 20, 33, 34, 39a, 48, 67, 75) · structural: 0
 * built: the project · redesign: polish · v2.0.0 */

:root{
  --bg:#16181d; --bg2:#1e2128; --bg3:#272b34; --line:#333845;
  --text:#e9ecf3; --muted:#a3aab9; --accent:#2f6fd0; --accent2:#275fbf; --accent-text:#8ab0f5;
  --ink-paper:#f4f7ff; --stage:#0f1115; --hud:#1b1f27e6; --thumb:#0b0d11;
  --shadow-dialog:rgba(0,0,0,.55); --shadow-pop:rgba(0,0,0,.5);
  --danger:#e5534b; --radius:6px;
}
*{box-sizing:border-box}
html,body{height:100%; overflow-x:clip}
@supports (height:100dvh){body{height:100dvh}}
body{
  margin:0; background:var(--bg); color:var(--text); overflow-y:hidden; overflow-x:clip;
  font:13px/1.4 "Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  display:grid; grid-template-rows:44px 40px minmax(0,1fr) 26px;
  user-select:none;
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px;outline-color:var(--ink-paper)}
.sprite{display:none}
svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

.topbar{display:flex;align-items:center;gap:8px;padding:0 10px;background:var(--bg2);border-bottom:1px solid var(--line)}
.brand{font-weight:700;letter-spacing:.3px;padding-right:10px}
.brand span{color:var(--accent-text)}
.menu{display:flex;gap:2px}
.menu button{padding:6px 10px;border-radius:var(--radius);color:var(--muted)}
.menu button:hover,.menu button[aria-expanded="true"]{background:var(--bg3);color:var(--text)}
.spacer{flex:1}
.iconbtn{display:grid;place-items:center;width:30px;height:30px;border-radius:var(--radius);color:var(--muted)}
.iconbtn:hover{background:var(--bg3);color:var(--text)}
.iconbtn:disabled{opacity:.4;color:var(--muted);background:transparent;cursor:not-allowed}
.primary{display:inline-flex;align-items:center;gap:6px;background:var(--accent);color:var(--ink-paper);padding:6px 12px;border-radius:var(--radius);font-weight:600}
.primary:hover{background:var(--accent2)}
.primary svg{width:15px;height:15px}
.ghost{background:var(--bg3);padding:6px 12px;border-radius:var(--radius)}
.ghost:hover{background:var(--line)}

.options{display:flex;align-items:center;gap:10px;padding:0 12px;background:var(--bg2);border-bottom:1px solid var(--line);overflow:hidden;white-space:nowrap}
.options .title{font-weight:600;color:var(--muted);min-width:96px}
.options label{display:flex;align-items:center;gap:6px;color:var(--muted)}
.options input[type=range]{width:96px}
.options input[type=number]{width:60px}
.options input[type=text]{width:130px}
.options select,.options input[type=number],.options input[type=text]{
  background:var(--bg);border:1px solid var(--line);color:var(--text);border-radius:4px;padding:3px 6px;font:inherit
}
.options .check{display:flex;align-items:center;gap:5px}
.options .grow{flex:1}

.workspace{display:grid;grid-template-columns:46px minmax(0,1fr) 286px;min-height:0}
.toolrail{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 0;background:var(--bg2);border-right:1px solid var(--line);overflow-y:auto}
.toolrail button{display:grid;place-items:center;width:34px;height:34px;border-radius:var(--radius);color:var(--muted)}
.toolrail button:hover{background:var(--bg3);color:var(--text)}
.toolrail button.active{background:var(--accent);color:var(--ink-paper)}
.toolrail .sep{width:24px;height:1px;background:var(--line);margin:5px 0}
.toolrail .colors{position:relative;margin-top:8px;width:38px;height:44px}
.toolrail .swatch{position:absolute;display:block;width:22px;height:22px;border:2px solid var(--bg2);border-radius:4px;overflow:hidden;cursor:pointer}
.toolrail .swatch span{display:block;width:100%;height:100%;background:var(--c,var(--ink-paper))}
.toolrail .swatch input{position:absolute;inset:0;opacity:0;cursor:pointer}
.toolrail .fg{left:0;top:0;z-index:2;box-shadow:0 0 0 1px var(--line)}
.toolrail .bg{right:0;bottom:0;box-shadow:0 0 0 1px var(--line)}
.toolrail #swap-colors{position:absolute;right:26px;top:0;color:var(--muted);font-size:12px}

.stage{position:relative;overflow:hidden;background:var(--stage);display:grid;place-items:center;padding:12px}
.stage canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
#view{cursor:default}
#overlay{pointer-events:none}
.zoom-hud{position:absolute;right:14px;bottom:14px;display:flex;gap:6px;z-index:5}
.zoom-hud button{width:40px;height:40px;border-radius:10px;background:var(--hud);border:1px solid var(--line);color:var(--text);font-size:18px;line-height:1;display:grid;place-items:center;backdrop-filter:blur(4px)}
.zoom-hud button:active{background:var(--accent);border-color:var(--accent)}
.dropzone{position:absolute;inset:16px;border:2px dashed var(--line);border-radius:12px;display:grid;place-items:center;color:var(--muted);pointer-events:none;opacity:0;transition:opacity .15s}
.stage.dragging .dropzone{opacity:1;border-color:var(--accent-text);color:var(--accent-text)}

.panels{display:flex;flex-direction:column;background:var(--bg2);color:var(--text);border-left:1px solid var(--line);min-height:0}
.tabs{display:flex;border-bottom:1px solid var(--line)}
.tabs button{flex:1;padding:9px 4px;color:var(--muted);font-weight:600;font-size:12px}
.tabs button.active{color:var(--text);box-shadow:inset 0 -2px 0 var(--accent)}
.panel{display:flex;flex-direction:column;min-height:0;flex:1;padding:10px;gap:10px}
.panel.hidden{display:none}
.layer-props{display:grid;gap:8px;padding-bottom:8px;border-bottom:1px solid var(--line)}
.layer-props label{display:grid;grid-template-columns:70px 1fr;align-items:center;gap:6px;color:var(--muted)}
.layer-props output{color:var(--text);justify-self:end;font-variant-numeric:tabular-nums}
.layer-props select,.layer-props input{width:100%;background:var(--bg);border:1px solid var(--line);color:var(--text);border-radius:4px;padding:3px 4px}
.layer-props input[type=range]{padding:0}

.layers{list-style:none;margin:0;padding:0;overflow-y:auto;flex:1;display:flex;flex-direction:column-reverse;gap:4px}
.layers li{display:grid;grid-template-columns:24px 40px 1fr auto;gap:8px;align-items:center;padding:5px;border:1px solid transparent;border-radius:var(--radius);cursor:pointer}
.layers li:hover{background:var(--bg3)}
.layers li.active{border-color:var(--accent);background:var(--bg3)}
.layers .eye{color:var(--muted);display:grid;place-items:center;width:24px;height:24px}
.layers .eye svg{width:16px;height:16px}
.layers .thumb{width:40px;height:32px;background:var(--thumb);border:1px solid var(--line);border-radius:3px;object-fit:contain}
.layers .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.layers .name small{display:block;color:var(--muted);font-size:11px}
.layers .badge{font-size:11px;color:var(--muted)}
.layer-actions{display:flex;gap:4px;padding-top:8px;border-top:1px solid var(--line)}
.layer-actions button{flex:1;display:grid;place-items:center;height:28px;border-radius:4px;color:var(--muted)}
.layer-actions button:hover{background:var(--bg3);color:var(--text)}
.layer-actions button:disabled{opacity:.4;color:var(--muted);background:transparent;cursor:not-allowed}

.adjust-list{display:grid;gap:12px;overflow-y:auto;flex:1}
.adjust-list label{display:grid;gap:4px;color:var(--muted)}
.adjust-list .head{display:flex;justify-content:space-between;color:var(--text)}
.adjust-list input[type=checkbox]{justify-self:start;width:16px;height:16px;accent-color:var(--accent)}
.adjust-list output{color:var(--muted);font-variant-numeric:tabular-nums}
.adjust-actions{display:flex;gap:8px}
.adjust-actions button{flex:1}
.hint{margin:0;color:var(--muted);font-size:12px}

.history{list-style:none;margin:0;padding:0;overflow-y:auto;flex:1;display:flex;flex-direction:column;gap:2px}
.history li{padding:6px 8px;border-radius:4px;color:var(--muted);cursor:pointer}
.history li:hover{background:var(--bg3);color:var(--text)}
.history li.current{background:var(--bg3);color:var(--text);box-shadow:inset 2px 0 0 var(--accent)}
.history li.future{opacity:.45}

.statusbar{display:flex;align-items:center;gap:16px;padding:0 10px;background:var(--bg2);border-top:1px solid var(--line);color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums}
.statusbar #stat-hint{margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

dialog{border:1px solid var(--line);border-radius:10px;background:var(--bg2);color:var(--text);padding:0;box-shadow:none;max-width:min(520px,92vw)}
dialog::backdrop{background:var(--shadow-dialog)}
.dlg{padding:18px;display:grid;gap:14px;min-width:340px}
.dlg h2{margin:0;font-size:15px;text-wrap:balance}
.dlg .row{display:flex;gap:12px;align-items:center}
.dlg .row label{display:flex;align-items:center;gap:6px;color:var(--muted)}
.dlg input[type=number],.dlg input[type=text],.dlg select{background:var(--bg);border:1px solid var(--line);color:var(--text);border-radius:5px;padding:5px 7px;font:inherit;width:100%}
.dlg input[type=number]{width:88px}
.dlg menu{display:flex;justify-content:flex-end;gap:8px;margin:0;padding:0}
.dlg .shortcuts{display:grid;grid-template-columns:1fr auto;gap:6px 14px;font-size:12px;color:var(--muted)}
.dlg .shortcuts span:nth-child(odd){color:var(--text)}
.dlg .shortcuts span:nth-child(even){font-variant-numeric:tabular-nums;white-space:nowrap}

.menu-pop{position:fixed;z-index:50;min-width:220px;background:var(--bg2);border:1px solid var(--line);border-radius:8px;padding:6px;box-shadow:none}
.menu-pop button{display:flex;justify-content:space-between;gap:20px;width:100%;text-align:left;padding:6px 8px;border-radius:4px;color:var(--text)}
.menu-pop button span{color:var(--muted);font-size:11px}
.menu-pop button:hover{background:var(--bg3)}
.menu-pop hr{border:0;border-top:1px solid var(--line);margin:4px 2px}
.menu-pop button:disabled{opacity:.4;color:var(--muted);background:transparent;cursor:not-allowed}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{transition:none !important;animation:none !important}
}
