:root {
  --bg: #0f1115; --panel: #171a21; --line: #2a2f3a; --text: #e7e9ee; --muted: #9aa3b2;
  --accent: #ff7a45; --accent2: #ffb38f; --ok: #3ccf91; --err: #ff5d6c;
  font-family: "Be Vietnam Pro", system-ui, sans-serif; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.row, .row { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; display: flex; }
input, select, textarea { background: #0d0f13; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; font-size: 14px; }
textarea { resize: vertical; width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; padding: 12px; }
legend { color: var(--accent2); font-size: 13px; padding: 0 6px; }
details { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
summary { cursor: pointer; color: var(--accent2); margin-bottom: 8px; }
button, .button { background: var(--accent); color: #111; border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button.ghost, .ghost.button { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button:disabled { opacity: .45; cursor: not-allowed; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: var(--ok); } .pill.err { color: var(--err); border-color: var(--err); }
.hint { color: var(--muted); font-size: 13px; }
code { background: #0d0f13; padding: 1px 5px; border-radius: 4px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; cursor: pointer; align-items: center; }
.drop.over { border-color: var(--accent); }
.progress { height: 8px; background: #0d0f13; border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
#bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
#log { max-height: 180px; overflow: auto; background: #0d0f13; border-radius: 8px; padding: 8px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.chapter h3 { font-size: 14px; margin: 16px 0 8px; color: var(--accent2); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb { position: relative; background: #0d0f13; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 2/3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb .tag { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: #000a; padding: 2px 6px; border-radius: 4px; }
.thumb .st { position: absolute; right: 4px; top: 4px; font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #000a; }
.st.done { color: var(--ok); } .st.err { color: var(--err); } .st.work { color: var(--accent2); }
dialog { width: min(1400px, 96vw); height: 92vh; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; }
dialog::backdrop { background: #000c; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.editor-body { display: grid; grid-template-columns: 1.3fr 1fr; height: calc(92vh - 56px); }
.ed-canvas { overflow: auto; background: #08090c; display: flex; justify-content: center; }
.ed-canvas canvas { max-width: 100%; height: auto; align-self: flex-start; }
.ed-side { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.blk { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.blk .src { font-size: 13px; color: var(--muted); }
.blk .meta { font-size: 11px; color: var(--accent2); display: flex; gap: 8px; align-items: center; }
@media (max-width: 800px) { .editor-body, .grid2 { grid-template-columns: 1fr; } }
