:root {
  --bg: #f3f6f6; --panel: #fff; --border: #d3dede; --text: #172425;
  --muted: #607173; --accent: #0b736d; --accent-soft: #dcefed; --danger: #a73a3a;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 21px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: end; gap: 16px; }
.top-actions label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 13px; }
.top-actions a { color: var(--accent); text-decoration: none; font-size: 14px; }
.workspace { max-width: 1320px; margin: 0 auto; padding: 16px 16px 70px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 15px; box-shadow: 0 1px 2px rgba(20,40,40,.03); }
.card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 18px; }
.section-help { margin: -5px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.section-help a { color: var(--accent); white-space: nowrap; }
.step { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; }
.drop-zone { min-height: 110px; padding: 18px 22px; border: 2px dashed #9fbdbc; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #f8fbfb; transition: .15s; }
.drop-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone h2 { margin: 0 0 5px; font-size: 17px; }
.drop-zone p { margin: 2px 0; color: var(--muted); font-size: 14px; }
.drop-zone .privacy { color: var(--accent); }
button { padding: 7px 13px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 650; }
button.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: default; }
.status { min-height: 20px; margin: 8px 2px 0; color: var(--muted); font-size: 14px; }
.status.error { color: var(--danger); }
.inline-error { color: var(--danger); border-left: 4px solid var(--danger); padding: .55rem .75rem; background: #fff2f0; }
.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 13px; }
.controls label, .preview-toolbar label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.controls label[title] > span:first-child { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.controls label.grow { flex: 1; min-width: 180px; }
.controls input, .controls select, .preview-toolbar select, .top-actions select { min-height: 32px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); }
.controls input[type=number] { width: 86px; }
.controls label.check, .preview-toolbar label.check { flex-direction: row; align-items: center; min-height: 32px; }
.controls label.check input, .preview-toolbar label.check input { min-height: auto; }
.additional-settings { margin-top: 14px; }
.additional-settings h3 { margin: 0; color: var(--accent); font-size: 15px; }
.advanced-controls { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.work-grid { display: grid; grid-template-columns: minmax(270px, 350px) 1fr; gap: 14px; align-items: start; }
.image-panel { padding-bottom: 8px; }
.image-list { list-style: none; margin: 0 -8px; padding: 0; max-height: 620px; overflow: auto; }
.image-row { display: grid; grid-template-columns: 24px 50px 1fr auto; gap: 9px; align-items: center; padding: 7px 9px; border-left: 3px solid transparent; cursor: pointer; }
.image-index { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.image-row:hover { background: #f2f7f7; }
.image-row.selected { background: var(--accent-soft); border-left-color: var(--accent); }
.thumb { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; border: 1px solid var(--border); border-radius: 5px; background: repeating-conic-gradient(#e8eeee 0 25%, #fff 0 50%) 0/12px 12px; }
.image-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.image-meta, .image-format { color: var(--muted); font-size: 13px; }
.image-size { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.empty { padding: 16px 4px; color: var(--muted); font-size: 14px; }
.result-summary { margin-bottom: 12px; padding: 11px 13px; border: 1px solid #87bcb7; border-radius: 7px; background: #edf8f7; }
.result-summary strong { color: var(--accent); font-size: 16px; }
.result-summary ul { margin: 6px 0 0; padding-left: 1.3rem; font-size: 14px; }
.source-key-row { display: flex; align-items: center; gap: 6px; }
.source-key-row input[type=color] { width: 42px; padding: 2px; }
.effective-settings { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding: 10px; border: 1px solid #bfd8d5; border-radius: 7px; background: #f3fafa; }
.effective-settings::before { content: attr(data-label); width: 100%; color: var(--accent); font-size: 13px; font-weight: 700; }
.effective-value { padding: 3px 7px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13px; }
.override-controls { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.preview-toolbar { display: flex; gap: 12px; align-items: end; margin: 11px 0; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.selected-downloads { margin-top: 12px; }
figure { min-width: 0; margin: 0; }
figcaption { margin-bottom: 5px; color: var(--muted); font-size: 14px; }
.canvas-wrap { min-height: 180px; max-height: 470px; overflow: auto; border: 1px solid var(--border); border-radius: 7px; }
.checker { background-color: #fff; background-image: linear-gradient(45deg,#e2e8e8 25%,transparent 25%),linear-gradient(-45deg,#e2e8e8 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e2e8e8 75%),linear-gradient(-45deg,transparent 75%,#e2e8e8 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.preview-white { background: #fff; }
.preview-black { background: #000; }
.preview-magenta { background: #f0f; }
.preview-green { background: #00a060; }
.preview-blink { animation: preview-background-blink 1.2s steps(1, end) infinite; }
@keyframes preview-background-blink { 0%, 49% { background: #f0f; } 50%, 100% { background: #00d8d8; } }
.picking-color { cursor: crosshair; outline: 3px solid #f0f; outline-offset: -3px; }
canvas { display: block; image-rendering: pixelated; }
.report-summary { margin: 0 0 10px; font-weight: 650; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.candidates { white-space: normal; color: var(--muted); font-size: 12px; }
.note { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.export-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 13px; }
.export-tab { margin-bottom: -1px; border-radius: 7px 7px 0 0; border-bottom-color: var(--border); color: var(--muted); }
.export-tab.active { color: var(--accent); border-color: var(--border); border-bottom-color: var(--panel); font-weight: 700; }
.export-primary { margin-bottom: 14px; }
.file-browser { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(0, 1.25fr); gap: 14px; }
.file-browser > div { min-width: 0; }
.file-browser h3 { margin: 0 0 7px; color: var(--muted); font-size: 13px; }
.file-tree { min-height: 190px; margin: 0; padding: 8px; list-style: none; border: 1px solid var(--border); border-radius: 7px; background: #f8fbfb; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.file-tree li { margin: 1px 0; }
.file-tree button { width: 100%; padding: 3px 5px; border: 0; background: transparent; border-radius: 4px; text-align: left; font: inherit; }
.file-tree button:hover, .file-tree button.active { background: var(--accent-soft); }
.tree-folder { padding: 3px 5px; color: var(--muted); font-weight: 700; }
.tree-depth-1 { padding-left: 17px !important; }
.tree-depth-2 { padding-left: 31px !important; }
.source-preview { min-height: 190px; max-height: 360px; margin: 0; overflow: auto; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: #172425; color: #e7f3f2; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }
dialog { max-width: 430px; padding: 18px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); box-shadow: 0 18px 60px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(10,25,25,.45); }
dialog h2 { margin: 0 0 8px; font-size: 17px; }
dialog p { color: var(--muted); }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
@media (max-width: 850px) {
  .topbar { align-items: flex-start; }
  .work-grid, .preview-grid, .file-browser { grid-template-columns: 1fr; }
  .image-list { max-height: 330px; }
}
@media (max-width: 560px) {
  .topbar { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .workspace { padding: 10px 8px 50px; }
  .drop-zone { align-items: stretch; flex-direction: column; }
  .project-controls > label { width: calc(50% - 8px); }
  .project-controls input, .project-controls select { width: 100% !important; }
}
