:root {
  --bg: #16181d; --panel: #1f2229; --panel2: #272b34; --line: #343946; --text: #e6e8ee; --dim: #8b92a3;
  --accent: #ff4f7b; --accent2: #3bb6ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 13px/1.35 system-ui, -apple-system, 'Segoe UI', sans-serif; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
button:hover { border-color: var(--dim); }
button:active, button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .4; cursor: default; }
select, input[type=number], input[type=text], input:not([type]) { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }
input[type=number] { width: 64px; }
input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); background: none; }
label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.grow { flex: 1; }
.row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.row.wrap { flex-wrap: wrap; }

#menubar, #optbar { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#optbar { background: var(--panel2); color: var(--dim); }
#optbar label { color: var(--text); }
.brand { color: var(--accent); letter-spacing: .5px; margin-right: 8px; font-size: 15px; }
#status { color: var(--dim); min-width: 120px; text-align: right; }
#status.warn { color: #ffb347; }
#coords { margin-left: auto; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }

#workspace { flex: 1; display: flex; min-height: 0; }
#tools { width: 104px; padding: 6px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
#tools button { display: flex; justify-content: space-between; align-items: center; padding: 5px 6px; font-size: 12px; }
#tools kbd { color: var(--dim); font-size: 10px; }
#tools button.active kbd { color: #fff; }
#stagewrap { flex: 1; min-width: 0; position: relative; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; outline: none; }
#side { width: 270px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.panel { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.panel h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); }

#swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.swatch { aspect-ratio: 1; border: 1px solid #0006; border-radius: 2px; padding: 0; }
.swatch.sel { outline: 2px solid #fff; outline-offset: 1px; z-index: 1; }

#layers { display: flex; flex-direction: column; gap: 2px; }
.layer { display: flex; align-items: center; gap: 4px; padding: 3px 5px; background: var(--panel2); border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.layer.sel { border-color: var(--accent); }
.layer .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .tog { padding: 0 5px; font-size: 11px; }
.layer .tog.off { opacity: .35; }

#preview-box { background: repeating-conic-gradient(#3a3d46 0 25%, #2f323a 0 50%) 0 0 / 16px 16px; display: flex; align-items: center; justify-content: center; min-height: 80px; padding: 8px; overflow: auto; border-radius: 4px; }
#preview { image-rendering: pixelated; }

#timeline { background: var(--panel); border-top: 1px solid var(--line); padding: 6px 10px; }
#timeline .row { margin: 0 0 6px; }
#frames { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.frame { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px; background: var(--panel2); border: 2px solid transparent; border-radius: 4px; cursor: pointer; color: var(--dim); font-size: 11px; }
.frame.sel { border-color: var(--accent); color: var(--text); }
.frame canvas { image-rendering: pixelated; background: repeating-conic-gradient(#3a3d46 0 25%, #2f323a 0 50%) 0 0 / 8px 8px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--accent2); color: #002; border-radius: 10px; padding: 0 4px 0 8px; margin-right: 4px; font-size: 12px; }
.tag button { background: none; border: 0; padding: 0 3px; color: inherit; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; min-width: 360px; max-width: 560px; }
dialog::backdrop { background: #000a; }
dialog h2 { margin: 0 0 12px; font-size: 16px; }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 6px 0 0; padding: 0; }
dialog fieldset { border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.err { color: #ff7a7a; margin: 0; min-height: 1em; }
small { color: var(--dim); }
.help { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 14px; }
.help kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; font-size: 12px; justify-self: start; }
#side { overflow-x: hidden; } #layer-props { flex-wrap: wrap; }
