:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #d5dae2;
  --accent: #2563eb;
  --good: #15803d;
  --bad: #b91c1c;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* A class that sets `display` beats the browser's own [hidden] rule, and the
 * boot overlay is display:grid - without this it never goes away. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 20px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}

main {
  max-width: 900px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px 22px;
}

h1 { font-size: 20px; margin: 0 0 2px; }
h1 .sub { font-size: 14px; font-weight: normal; color: var(--muted); margin-left: 8px; }
header { margin-bottom: 14px; }

.privacy { color: var(--good); font-size: 13px; margin: 2px 0 0; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 13px; }

/* --- boot overlay --- */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 10;
}
.boot-card {
  width: min(460px, 90vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}
.boot-stage { color: var(--muted); margin: 6px 0 12px; }
.boot-error { color: var(--bad); text-align: left; white-space: pre-wrap; }

/* --- drop zone --- */
.drop {
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f2f4f7;
  color: #334155;
  text-align: center;
  padding: 26px 12px;
  font-size: 16px;
  transition: background .12s, border-color .12s;
}
.drop.hot { border-color: var(--accent); background: #e6efff; }

/* --- list --- */
.list {
  list-style: none;
  margin: 10px 0;
  padding: 6px 8px;
  height: 128px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  background: #fbfcfd;
}
.list li { padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- rows --- */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.row.buttons { margin-top: 10px; }
.spacer { flex: 1; }
.edge { color: var(--muted); font-size: 13px; }
label { font-size: 14px; }
.check { display: flex; align-items: center; gap: 6px; }

input[type=range] { flex: 1; min-width: 140px; }
input[type=text], input[type=number], select {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: inherit;
}
input[type=number] { width: 5.5em; }

button {
  font: inherit;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #1d4ed8; color: #fff; }
button.ghost { color: var(--muted); }

/* --- preview --- */
/* Two canvases: the whole photo with the crop frame drawn on it, and the crop
 * itself at 4:5. Both are redrawn from a pre-computed box table on every tick
 * of the Záběr slider, so they must stay cheap to paint. */
.preview {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}
.preview-shots { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.preview figure { margin: 0; text-align: center; }
.preview canvas {
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef1f5;
}
.preview figcaption { color: var(--muted); font-size: 12px; margin-top: 4px; }
.preview-text { flex: 1; min-width: 180px; }
.preview-text p { margin: 0 0 4px; }
.preview-name { font-size: 13px; word-break: break-all; }
.preview .warn { color: #b45309; }
.preview .err { color: var(--bad); }

/* Clicking a name in the list previews that photo. */
.list li { cursor: pointer; }
.list li:hover { color: var(--accent); }
.list li.active { color: var(--accent); font-weight: 600; }
.list li.plain { cursor: default; color: var(--muted); font-weight: normal; }

/* --- log + progress --- */
.log {
  height: 190px;
  overflow: auto;
  margin: 12px 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.log .warn { color: #b45309; }
.log .err { color: var(--bad); }
.log .head { font-weight: bold; }

.bar {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .15s linear;
}

footer { margin-top: 12px; }
a { color: var(--accent); }
