:root {
  --bg: #16181d; --panel: #1e2128; --panel2: #23262e; --line: #2e323b; --text: #d8dbe2; --dim: #8a90a0;
  --accent: #5aa9ff; --sel: #ffd45a; --btn: #2a2e37; --btnLine: #3a3f4a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
       font: 13px/1.4 system-ui, "Malgun Gothic", sans-serif; }
.dim { color: var(--dim); }
.grow { flex: 1; }

/* top bar / status bar */
#top { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
#top .logo { font-size: 14px; }
#top input[type=text] { width: 140px; }
#statusbar { padding: 3px 10px; background: var(--panel); border-top: 1px solid var(--line); color: var(--sel); font-size: 12px; min-height: 22px; }
#body { flex: 1; display: flex; min-height: 0; }

/* controls */
input, button, select, .btn { background: var(--btn); color: var(--text); border: 1px solid var(--btnLine); border-radius: 4px;
  padding: 3px 8px; font: inherit; height: 26px; }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); }
button.on { background: var(--accent); color: #0b1220; border-color: var(--accent); }
.sm { height: 24px; padding: 2px 8px; font-size: 12px; }
.big { width: 100%; height: 34px; font-size: 14px; font-weight: 600; margin: 4px 0; }
.big.half { width: auto; flex: 1; margin: 0; }
.wide { width: 100%; margin: 3px 0; }
.primary { background: #2f6fb8; border-color: #2f6fb8; }
input[type=color] { padding: 1px; width: 32px; }
input[type=number] { width: 62px; }
input[type=range] { padding: 0; height: auto; }
.chk { display: flex; align-items: center; gap: 5px; margin: 3px 0; cursor: pointer; }
.chk input { height: auto; }

/* sidebar */
#side { width: 310px; flex: none; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
.step { border-bottom: 1px solid var(--line); }
.stepHead { margin: 0; padding: 9px 12px; font-size: 13px; cursor: pointer; user-select: none; display: flex; justify-content: space-between; }
.stepHead::after { content: '▸'; color: var(--dim); }
.step.open .stepHead { color: var(--accent); background: var(--panel2); }
.step.open .stepHead::after { content: '▾'; }
.stepBody { display: none; padding: 6px 12px 12px; }
.step.open .stepBody { display: block; }
h3 { font-size: 11px; color: var(--dim); margin: 10px 0 3px; font-weight: 600; text-transform: uppercase; }
details { margin-top: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px; }
summary { cursor: pointer; color: var(--dim); padding: 2px 0; }
details[open] summary { color: var(--text); margin-bottom: 4px; }
.row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.row > label:first-child:not(.chk):not(.btn) { width: 108px; flex: none; color: var(--dim); font-size: 12px; white-space: nowrap; }
.row.slider { display: grid; grid-template-columns: 108px minmax(0, 1fr) 32px; gap: 6px; }
.row.slider > label { width: auto; }
.row.slider input[type=range] { width: 100%; min-width: 0; }
.row output { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.row.even > * { flex: 1; }
.row > label { white-space: nowrap; }
.chips { flex-wrap: wrap; }
.chips button { height: 22px; font-size: 11px; padding: 0 6px; }
.iconrow { display: flex; gap: 4px; margin: 2px 0 6px; }
.iconrow button { flex: 1; height: 30px; font-size: 15px; }
.hint { color: var(--dim); font-size: 11px; margin: 4px 0; }

.headlist, .fxlist { margin: 4px 0; font-size: 12px; }
.headrow, .fxrow { padding: 2px 6px; border-radius: 3px; cursor: pointer; font-variant-numeric: tabular-nums; }
.headrow:hover, .fxrow:hover { background: var(--panel2); }
.headrow.cur { outline: 1px solid var(--line); }
.headrow.bad { color: #ff8a6a; }
.fxrow { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); margin: 3px 0; }
.fxrow.on { border-color: #7dffef; }
.fxrow button { height: 20px; padding: 0 6px; }
#fxEdit { border-left: 2px solid #7dffef; padding-left: 8px; margin: 6px 0; }
#fxJson { width: 100%; background: #14161b; color: var(--text); border: 1px solid var(--btnLine); border-radius: 4px;
  font: 11px/1.35 ui-monospace, Consolas, monospace; padding: 4px; resize: vertical; margin-top: 4px; }
.bad { color: #ff8a6a; }
#gallery { width: min(860px, 94vw); max-height: 90vh; overflow: auto; }
.galgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.galcard { border: 1px solid var(--line); border-radius: 6px; padding: 6px; text-align: center; cursor: pointer; font-size: 11px; color: var(--dim); }
.galcard:hover { border-color: var(--accent); color: var(--text); }
.galcard canvas { width: 64px; height: 64px; margin: 0 auto 4px; }

/* main */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar { padding: 4px 8px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 6px; align-items: center; color: var(--dim); min-height: 30px; }
.bar.sub { min-height: 22px; padding: 2px 8px; font-size: 12px; }
.toolbar { flex-wrap: wrap; }
.toolbar .tools { display: flex; gap: 2px; }
.toolbar .tools button, #btnUndo, #btnRedo { width: 28px; height: 26px; padding: 0; font-size: 14px; }
.toolbar input[type=range] { width: 90px; }
.sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.wrap { overflow: auto; padding: 6px; }
#srcPane { flex: none; max-height: 32vh; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
#srcWrap { flex: 1; }
#workPane { flex: 1; display: flex; min-height: 0; border-bottom: 1px solid var(--line); }
.panel { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
#workPane > .panel { flex: 1.3; }
.col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.col .panel { border-right: 0; border-bottom: 1px solid var(--line); }
.panel .wrap { flex: 1; }
#compareWrap { display: flex; gap: 8px; align-items: flex-start; }
canvas { image-rendering: pixelated; display: block; }
#editor { outline: none; }

/* film strip */
#strip { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--panel); }
.thumb { flex: none; padding: 4px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; text-align: center; }
.thumb.cur { border-color: var(--sel); }
.thumb .lbl { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--dim); margin-top: 2px; }
.thumb .ops { display: flex; gap: 2px; justify-content: center; margin-top: 2px; }
.thumb .ops button, .thumb .star { width: 22px; height: 20px; padding: 0; font-size: 11px; }
.thumb .star.on { color: var(--sel); border-color: var(--sel); }
.thumb input { width: 70px; height: 22px; margin-top: 2px; }

/* help popup */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h3 { margin-top: 0; font-size: 13px; color: var(--accent); text-transform: none; }
dialog td { padding: 3px 10px 3px 0; vertical-align: top; }
dialog td:first-child { color: var(--sel); white-space: nowrap; }
dialog form { text-align: right; margin-top: 10px; }
.autoinfo { font-size: 11px; color: var(--dim); line-height: 1.6; margin: 4px 0; }
.autoinfo .fast { color: var(--sel); font-weight: 600; }

/* 이펙트만 mode */
#fxMode { flex: 1; display: flex; min-height: 0; }
.fxmSide { width: 330px; flex: none; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 6px 12px 12px; }
.fxmSide .row > label:first-child:not(.chk):not(.btn) { width: 96px; }
.fxmSide .row.slider { grid-template-columns: 96px minmax(0, 1fr) 54px; }
input.mini { width: 54px; height: 22px; padding: 1px 4px; }
.fxmGal { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin: 4px 0 8px; }
.fxmGal .galcard { position: relative; padding: 4px; font-size: 10px; line-height: 1.25; }
.fxmGal .galcard canvas { width: 72px; height: 72px; }
.fxmGal .galcard.bad { color: #ff8a6a; }
.fxmGal .star { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; font-size: 12px; background: transparent; border: 0; color: var(--dim); }
.fxmGal .star.on { color: var(--sel); }
.fxmCats { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; }
.fxmCats button { height: 22px; font-size: 11px; padding: 0 6px; }
.fxmCats button.empty:not(.on) { opacity: 0.45; }
.fxmSec { margin: 4px 0; padding: 2px 6px; }
.fxmSec summary { font-size: 12px; }
#fxmSearch { min-width: 0; }
#fxmJson { width: 100%; background: #14161b; color: var(--text); border: 1px solid var(--btnLine); border-radius: 4px;
  font: 11px/1.35 ui-monospace, Consolas, monospace; padding: 4px; resize: vertical; }
.fxmMain { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fxmViews { flex: 1; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.fxmOut { width: 300px; }
#fxmStrip { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--panel); }
#fxmStrip .thumb.impact { border-color: #7dffef; }
#fxmStrip .thumb.cur { border-color: var(--sel); }

/* background settings changed: the red preview's apply / undo */
.keypending { border: 1px solid #ff6a5a; border-radius: 5px; padding: 4px 8px; margin: 4px 0; font-size: 12px; color: #ffb0a6; }
