:root {
  --ink: #1f2a37;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f7f5;
  --card: #ffffff;
  --accent: #1f2a37;
  --accent-2: #b45309;
  --ok: #15803d;
  --err: #b91c1c;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 20px 120px; }
a { color: var(--ink); }
h1, h2, h3 { line-height: 1.2; }
[hidden] { display: none !important; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.site-header nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; color: var(--ink-2); }
.site-header nav a:hover { color: var(--ink); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 18px 20px; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }

.hero { max-width: 760px; margin: 12px auto 24px; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 0 0 12px; }
.lead { font-size: 1.1rem; color: var(--ink-2); margin: 0 0 12px; }
.privacy-note { display: inline-block; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; padding: 8px 14px; border-radius: 12px; font-size: .95rem; margin: 0; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; max-width: 760px; margin: 0 auto; min-height: 180px; border: 2px dashed #cbd5e1; border-radius: 14px; background: var(--card); cursor: pointer; transition: border-color .15s, background .15s; text-align: center; padding: 20px; }
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--ink); background: #fafaf9; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-title { font-size: 1.25rem; font-weight: 600; }
.dz-sub { color: var(--muted); }
.options { max-width: 760px; margin: 14px auto 0; font-size: .95rem; }
.hint { color: var(--muted); font-size: .9rem; }
.steps { max-width: 760px; margin: 28px auto 0; padding-left: 22px; color: var(--ink-2); }
.steps li { margin-bottom: 8px; }
.error { max-width: 760px; margin: 12px auto; color: var(--err); background: #fef2f2; border: 1px solid #fecaca; padding: 10px 14px; border-radius: var(--radius); }
.warning { background: #fffbeb; border: 1px solid #fde68a; padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; }

.progress-box { max-width: 560px; margin: 80px auto; text-align: center; background: var(--card); padding: 32px; border-radius: 14px; border: 1px solid var(--line); }
.progress-box progress { width: 100%; height: 12px; accent-color: var(--ink); }
#progress-text { font-weight: 600; }

.btn { font: inherit; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn.secondary { background: var(--card); border-color: #cbd5e1; color: var(--ink); }
.btn.secondary[aria-pressed="true"] { background: var(--ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.link { background: none; border: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.small { font-size: .85rem; }
.icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); line-height: 1; padding: 0 4px; }

.review-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.sidebar { position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.sidebar h2 { margin: 0 0 4px; font-size: 1.15rem; }
.tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 12px 0 16px; }
.tools > .btn { width: 100%; }
.term-form .row .btn { flex: none; }
.term-form label { font-size: .9rem; font-weight: 600; }
.term-form .row { display: flex; gap: 6px; margin-top: 4px; }
.term-form input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; }
.findings .group { border-top: 1px solid var(--line); padding: 8px 0; }
.findings summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.findings summary::-webkit-details-marker { display: none; }
.swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--c); flex: none; }
.findings ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 18px; }
.findings li { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: .92rem; }
.findings li label { flex: 1; display: flex; gap: 6px; align-items: center; min-width: 0; }
.findings li.is-off .f-text { color: var(--muted); text-decoration: line-through; }
.f-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pages-col { min-width: 0; }
.page { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 20px; }
.page-head { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-2); margin: 0 4px 8px; }
.badge { background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 1px 7px; font-size: .78rem; font-weight: 600; }
.page-canvas { position: relative; width: 100%; max-width: 900px; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.12); background: #fff; }
.page-canvas img { display: block; width: 100%; height: 100%; user-select: none; }
.overlay { position: absolute; inset: 0; }
body.drawing .overlay { cursor: crosshair; touch-action: none; }
.draw-hint { display: none; }
body.drawing .draw-hint { display: block; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; color: var(--ink); }
.box { position: absolute; border: 2px solid var(--c, #000); border-radius: 2px; padding: 0; cursor: pointer; }
.box.on { background: rgba(0,0,0,.82); }
.box.off { background: transparent; border-style: dashed; opacity: .75; }
.box:hover, .box:focus-visible { outline: 2px solid #f59e0b; outline-offset: 1px; }
.box.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 50% { outline: 4px solid #f59e0b; outline-offset: 3px; } 100% { outline: 0 solid transparent; } }
.drawing-box { background: rgba(0,0,0,.35); border: 2px dashed #000; pointer-events: none; }
.ocr-text .hl { background: #111827; color: #fff; border-bottom: 2px solid var(--c, #000); border-radius: 2px; padding: 0 1px; }
.ocr-legend { display: inline-block; font-family: system-ui, sans-serif; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.ocr-text { white-space: pre-wrap; background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: .85rem; overflow: auto; margin: 0; box-sizing: border-box; }
.ocr-resizer { height: 14px; margin: 0 0 10px; cursor: ns-resize; touch-action: none; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.ocr-resizer::before { content: ''; width: 56px; height: 5px; border-radius: 3px; background: #cbd5e1; }
.ocr-resizer:hover::before, .ocr-resizer.active::before, .ocr-resizer:focus-visible::before { background: var(--ink); }
.ocr-resizer:focus-visible { outline: 2px solid #f59e0b; }

.export-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.06); padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; z-index: 10; }
.consent { font-size: .9rem; max-width: 760px; display: flex; gap: 8px; align-items: flex-start; }
.consent input { margin-top: 4px; flex: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.result-box { max-width: 720px; margin: 40px auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.result-box h2 { margin-top: 0; }

/* Informační stránky */
.prose { max-width: 760px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 32px; }
.prose h1 { margin-top: 0; }
.prose h2 { margin-top: 28px; font-size: 1.2rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.donate { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.donate .qr { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.donate .qr img { width: 100%; height: auto; display: block; }
.amounts { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.amounts button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.amounts input { width: 10em; font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; }

@media (max-width: 900px) {
  .review-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .export-bar { flex-direction: column; align-items: stretch; }
  .donate { grid-template-columns: 1fr; }
  .prose { padding: 20px; }
}
@media (max-width: 600px) {
  .site-header { flex-wrap: wrap; gap: 8px; }
  .site-header nav { gap: 12px; font-size: .95rem; }
}

/* Výraznější ovládání */
.btn { font-weight: 600; padding: 10px 18px; }
.btn.secondary { border: 2px solid var(--ink); }
.btn.secondary:hover { background: #f3f4f6; }
.btn.primary:not(:disabled):hover { background: #111827; }
.btn.draw { background: #f59e0b; color: #111827; border: 2px solid #d97706; font-size: 1.02rem; }
.btn.draw:hover { background: #fbbf24; }
.btn.draw[aria-pressed="true"] { background: #111827; color: #fff; border-color: #111827; }
.export-bar .btn.primary { padding: 12px 24px; font-size: 1.05rem; }
.tip { margin: -4px 0 0; font-size: .82rem; }
.page-head .link, .findings li .link { text-decoration: none; border: 1.5px solid #cbd5e1; border-radius: 999px; padding: 2px 10px; background: #fff; color: var(--ink); font-weight: 600; }
.page-head .link:hover, .findings li .link:hover { border-color: var(--ink); background: #f3f4f6; }
.findings li .icon { color: #b91c1c; font-size: 1.3rem; font-weight: 700; }
.box.off { background: rgba(255, 255, 255, .15); border-width: 2px; border-style: dashed; opacity: 1; }

/* Vybraná oblast: posun, změna velikosti, lišta */
.box.selected { outline: 2px solid #f59e0b; outline-offset: 2px; cursor: move; z-index: 3; touch-action: none; }
.handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid #f59e0b; border-radius: 3px; z-index: 4; }
.h-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.h-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.h-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.h-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.h-n { left: calc(50% - 6px); top: -8px; cursor: ns-resize; }
.h-s { left: calc(50% - 6px); bottom: -8px; cursor: ns-resize; }
.h-w { top: calc(50% - 6px); left: -8px; cursor: ew-resize; }
.h-e { top: calc(50% - 6px); right: -8px; cursor: ew-resize; }
.box-tools { position: absolute; transform: translateY(calc(-100% - 10px)); display: flex; gap: 6px; background: #111827; padding: 5px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 6; white-space: nowrap; }
.box-tools.below { transform: translateY(10px); }
.box-tools button { font: inherit; font-size: .85rem; font-weight: 600; background: #fff; color: #111827; border: 0; border-radius: 7px; padding: 5px 11px; cursor: pointer; }
.box-tools button.danger { background: #dc2626; color: #fff; }
.box-tools button.ghost { background: transparent; color: #fff; padding: 5px 8px; }
.overlay.dragging .box-tools { display: none; }
#term-hint { margin-top: 8px; }

/* Výraznější barvy kategorií */
.box.on { background: rgba(0,0,0,.8); background: color-mix(in srgb, var(--c) 45%, #000); opacity: .9; border: 3px solid var(--c); }
.box.off { background: color-mix(in srgb, var(--c) 12%, transparent); border: 2px dashed var(--c); }
.ocr-text .hl { background: #111827; background: color-mix(in srgb, var(--c) 75%, #000); color: #fff; border-bottom: 0; padding: 0 2px; }
.findings .group { border-left: 4px solid var(--c); padding-left: 10px; margin-top: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }
.warning li { margin: 6px 0; }
.small-btn { padding: 3px 10px; font-size: .85rem; margin-left: 6px; }
.update-bar { background: #fffbeb; border-bottom: 1px solid #fde68a; padding: 10px 20px; text-align: center; font-size: .95rem; }
.findings li.region.is-off .f-text { text-decoration: none; color: var(--ink-2); }

/* Volba OCR na všech stránkách: krátká nápověda a rozbalovací vysvětlení */
.opt-hint { margin: 4px 0 0 26px; }
.opt-more { margin: 6px 0 0 26px; font-size: .9rem; color: var(--muted); }
.opt-more summary { cursor: pointer; color: var(--ink-2); text-decoration: underline dotted; text-underline-offset: 3px; width: max-content; }
.opt-more summary:hover { color: var(--ink); }
.opt-more p, .opt-more ul { margin: 8px 0; }
.opt-more ul { padding-left: 1.2em; }
.opt-more li { margin: 4px 0; }
.opt-more strong { color: var(--ink); }

/* Volba v postranním panelu kontroly */
.side-opt { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--card, #fff); }
.side-opt label { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; line-height: 1.35; }
.side-opt input { margin-top: 3px; flex: none; }
.side-opt .opt-hint, .side-opt .opt-more { margin-left: 24px; }

/* Náhled textu: slova z razítek a podpisů, která se do textové vrstvy nedostanou */
.ocr-text .skip { color: var(--muted, #6b7280); text-decoration: line-through; text-decoration-color: #9ca3af; background: #f3f4f6; border-radius: 2px; padding: 0 1px; }
.side-opt p { margin: 0 0 8px; font-size: .9rem; }
.more-settings summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; }
.more-settings[open] summary { margin-bottom: 8px; }
.more-settings .opt-hint { margin-left: 24px; }
.region-note { flex: 1 0 100%; margin: 0; font-size: .9rem; padding: 6px 10px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.region-note .btn { margin-left: 6px; }
body:has(#review:not([hidden]) #region-note:not([hidden])) main { padding-bottom: 190px; }
