/* Rastera v2 frontend, vizuální styl podle docs/frontend.md §2 a maket v docs/frontend/mockups/.
   CSP nepovoluje inline styly: všechno je tady, JavaScript mění jen třídy, `hidden`
   a šířku ukazatele průběhu přes CSSOM. */

@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/fonts/inter-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/fonts/inter-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/inter-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/fonts/inter-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/fonts/inter-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/fonts/inter-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/inter-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/inter-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/space-grotesk-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/fonts/space-grotesk-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* barvy: světlý základ, tmavý podle systému (bez ruční volby) nebo ručně */
:root {
  color-scheme: light;
  --bg: #f1f4f9; --surface: #ffffff; --border: #cfd6e2; --dash: #7b879c;
  --text: #0d1320; --muted: #465166; --accent: #1d4ed8; --on-accent: #ffffff;
  --link: #1d4ed8; --danger: #b91c1c; --danger-bg: #fee2e2; --info-bg: #dbeafe;
  --track: #dde3ee;
  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0e17; --surface: #121a2a; --border: #27344d; --dash: #52648a;
    --text: #f2f5fa; --muted: #a2aec2; --accent: #60a5fa; --on-accent: #0a0e17;
    --link: #93c5fd; --danger: #fca5a5; --danger-bg: #3b1518; --info-bg: #10264a;
    --track: #27344d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e17; --surface: #121a2a; --border: #27344d; --dash: #52648a;
  --text: #f2f5fa; --muted: #a2aec2; --accent: #60a5fa; --on-accent: #0a0e17;
  --link: #93c5fd; --danger: #fca5a5; --danger-bg: #3b1518; --info-bg: #10264a;
  --track: #27344d;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
}
[hidden] { display: none !important; }
a { color: var(--link); }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
/* nadpis a main dostávají fokus programově při změně stavu (čtečky), obrys tam neruší */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 16px; top: -60px; z-index: 10; padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; }
.skip:focus { top: 12px; }

/* hlavička */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand-mark { color: var(--text); }
.brand-pixels { fill: var(--accent); }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.topbar-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 44px; height: 44px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
:root .icon-moon { display: none; }
:root[data-active-theme="light"] .icon-sun { display: none; }
:root[data-active-theme="light"] .icon-moon { display: block; }
.lang { display: flex; gap: 4px; }
.lang-btn {
  min-width: 44px; min-height: 44px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.lang-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* obsah */
/* obsah nejvýš 760 px (§1); border-box započítává i boční odsazení 2 × 16 px */
.page { max-width: 792px; margin: 0 auto; padding: 40px 16px 72px; outline: none; }
.view { display: flex; flex-direction: column; gap: 20px; }
.intro { display: flex; flex-direction: column; gap: 8px; }
h1 {
  margin: 0; font-family: var(--font-display); font-size: 44px; line-height: 1.05;
  letter-spacing: -1.5px; font-weight: 700; outline: none;
}
h2 { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 1.2; }
.lead { margin: 0; font-size: 18px; color: var(--muted); }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.hint-strong { color: var(--muted); }
.muted { margin: 0; color: var(--muted); }
.center { text-align: center; }
.strong { font-weight: 700; }
.note { color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px;
  display: flex; flex-direction: column; gap: 24px;
}
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-radius: 12px; margin: 0; }
.banner svg { flex: none; margin-top: 2px; }
.banner-info { border: 2px solid var(--accent); border-radius: 14px; background: var(--info-bg); color: var(--text); }
.banner-danger { background: var(--danger-bg); color: var(--text); }
.accent-stroke { stroke: var(--accent); flex: none; }
.danger-stroke { stroke: var(--danger); }

/* nahrávací zóna */
.dropzone {
  border: 2px dashed var(--dash); border-radius: 14px; padding: 28px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.dropzone.is-over { border-color: var(--accent); background: var(--info-bg); }
.dropzone-prompt { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.dropzone-title { font-size: 18px; font-weight: 600; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }

.link-btn {
  min-height: 44px; border: 0; background: none; padding: 0; font-weight: 600; color: var(--link);
  text-decoration: underline; cursor: pointer; display: inline-flex; align-items: center;
}
.link-danger { color: var(--danger); }

/* volby */
.group { display: flex; flex-direction: column; gap: 8px; }
.group-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.segments { display: flex; flex-wrap: wrap; gap: 8px; }
.seg {
  min-height: 48px; padding: 0 18px; border-radius: 10px; font-size: 15px; font-weight: 600;
  border: 2px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
}
.seg[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* tlačítka */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.btn {
  min-height: 52px; padding: 10px 28px; border-radius: 12px; font-size: 17px; font-weight: 700; line-height: 1.25;
  text-align: center;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
}
.btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.btn-secondary { border: 2px solid var(--border); background: transparent; color: var(--text); }
.btn-danger { border: 0; background: var(--danger); color: var(--bg); }
.btn:disabled { cursor: not-allowed; border: 2px solid var(--border); background: transparent; color: var(--muted); }

/* průběh */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); color: var(--muted);
  font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none;
}
.steps li.is-done { color: var(--text); }
.steps li.is-done .step-dot { border: 0; background: var(--accent); color: var(--on-accent); }
.steps li.is-done .step-dot::before {
  content: ""; width: 14px; height: 8px; margin-top: -3px;
  border-left: 3.5px solid currentColor; border-bottom: 3.5px solid currentColor; transform: rotate(-45deg);
}
.steps li.is-active { color: var(--text); font-weight: 700; }
.steps li.is-active .step-dot { border: 3px solid var(--accent); color: var(--text); font-weight: 700; }
.step-state { font-weight: 400; }
.meter { display: flex; flex-direction: column; gap: 10px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.big { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -1px; }
.track { height: 16px; border-radius: 8px; background: var(--track); overflow: hidden; }
.fill { width: 0; height: 16px; background: var(--accent); transition: width 0.4s ease; }
.track.is-indeterminate .fill { width: 30%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) {
  .fill { transition: none; }
  .track.is-indeterminate .fill { animation: none; width: 100%; opacity: 0.4; }
}

/* hotovo */
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.facts dt { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { margin: 0; font-weight: 600; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.previews figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.previews img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.previews figcaption { font-size: 13px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.tips { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* dialog smazání */
.dialog {
  max-width: min(520px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.6); }
.dialog p { margin: 12px 0 20px; }

@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 24px 16px 56px; }
  h1 { font-size: 32px; }
  .card { padding: 20px; }
  .dropzone { padding: 20px 16px; }
  .btn { width: 100%; }
}
