:root { --bg:#14161a; --panel:#1b1e24; --panel2:#22262d; --line:#2f343d; --text:#e8eaee; --dim:#9aa1ad; --accent:#ff6a3d; --accent2:#e8542a; --ok:#3ecf8e; --warn:#f5b84b; --bad:#ff5d5d; --radius:10px; }
@media (prefers-color-scheme: light) { :root { --bg:#f4f5f7; --panel:#fff; --panel2:#f0f1f4; --line:#d9dce3; --text:#1b1e24; --dim:#5d6572; } }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); }
button.quiet { background: none; border: none; color: var(--dim); padding: 4px 8px; }
button.wide { width: 100%; margin-top: 6px; padding: 10px; }
button[aria-pressed=true] { background: var(--accent2); border-color: var(--accent2); color: #fff; }
input[type=text], input:not([type]), select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; }
#top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
#brand { display: flex; align-items: center; gap: 9px; font-size: 16px; } #brand i { color: var(--accent); font-style: normal; }
#privacy { margin-left: auto; font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
#privacy .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
#net { font-size: 12px; color: var(--dim); }
#app { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; }
#files, #panel { background: var(--panel); overflow: auto; }
#files { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
#panel { border-left: 1px solid var(--line); padding: 4px 14px 24px; }
#panel h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.row { display: flex; gap: 8px; align-items: center; padding: 3px 0; } .row.sub { padding-left: 24px; color: var(--dim); font-size: 13px; }
.field { display: block; margin: 8px 0; color: var(--dim); font-size: 13px; } .field > * { margin-top: 4px; color: var(--text); }
.btns { display: flex; gap: 8px; margin-top: 10px; } .btns button { flex: 1; }
.hint { color: var(--dim); padding: 12px; } .hint.small { font-size: 12px; padding: 4px 0; }
#file-list { list-style: none; margin: 0; padding: 6px; flex: 1; overflow: auto; }
#file-list li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 7px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; align-items: center; }
#file-list li.on { background: var(--panel2); border-color: var(--accent); }
#file-list canvas { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: #000; }
#file-list .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#file-list .st { font-size: 11px; color: var(--dim); display: flex; gap: 6px; align-items: center; }
.chip { padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; } .chip.ok { color: var(--ok); border-color: var(--ok); } .chip.warn { color: var(--warn); border-color: var(--warn); }
#files .foot { padding: 8px; border-top: 1px solid var(--line); text-align: center; }
#stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#toolbar { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#toolbar[hidden] { display: none; } #toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; } #toolbar .grow { flex: 1; } .lbl { color: var(--dim); font-size: 12px; }
.rev { display: flex; gap: 7px; align-items: center; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; }
.rev:has(input:checked) { border-color: var(--ok); color: var(--ok); }
#viewport { flex: 1; min-height: 0; overflow: auto; position: relative; background: repeating-conic-gradient(#0000 0 25%, #ffffff08 0 50%) 0 0 / 24px 24px; }
#canvas-wrap { position: relative; margin: 18px auto; width: max-content; }
#canvas-wrap[hidden] { display: none; }
#canvas { display: block; box-shadow: 0 6px 30px #0008; } #overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; overflow: visible; }
#overlay.preview { display: none; }
#overlay .box { fill: rgba(255,60,60,.28); stroke: #ff3b3b; stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; cursor: move; }
#overlay .box.text { fill: rgba(255,170,0,.28); stroke: #ffaa00; } #overlay .box.manual { fill: rgba(80,160,255,.28); stroke: #50a0ff; }
#overlay .box.off { fill: none; opacity: .5; } #overlay .box.sel { stroke-dasharray: none; stroke-width: 3; }
#overlay .grip { fill: #fff; stroke: #333; stroke-width: 1; vector-effect: non-scaling-stroke; }
#overlay .tag { font: 600 12px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: #000a; stroke-width: 3px; pointer-events: none; }
#drop.empty { max-width: 560px; margin: 8vh auto 0; text-align: center; padding: 0 20px; } #drop .big { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
#drop p { color: var(--dim); } #drop .note { color: var(--warn); } .big-btn { padding: 12px 22px; font-size: 15px; margin-top: 10px; }
#drop.drag { outline: 3px dashed var(--accent); outline-offset: -10px; }
#status { padding: 6px 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); display: flex; gap: 12px; align-items: center; }
#bar { flex: 0 0 160px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; visibility: hidden; } #bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; } #bar.on { visibility: visible; }
#box-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; } #box-list li { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; } #box-list li .k { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #box-list li.sel { color: var(--accent); }
#box-list button { padding: 0 8px; }
#results { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; } #results li { display: flex; gap: 6px; padding: 3px 0; align-items: baseline; } #results .good { color: var(--ok); } #results .bad { color: var(--bad); }
@media (max-width: 900px) { #app { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; overflow: auto; } #files { flex-direction: row; } #file-list { display: flex; overflow-x: auto; } }
