@font-face { font-family: 'Silkscreen'; font-weight: 400; font-display: swap; src: url(fonts/silkscreen-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Silkscreen'; font-weight: 400; font-display: swap; src: url(fonts/silkscreen-400-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F; }
@font-face { font-family: 'Silkscreen'; font-weight: 700; font-display: swap; src: url(fonts/silkscreen-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Silkscreen'; font-weight: 700; font-display: swap; src: url(fonts/silkscreen-700-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F; }
@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap; src: url(fonts/spacegrotesk-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap; src: url(fonts/spacegrotesk-400-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F; }

:root {
  --bg: #05071a;
  --bg-2: #0b1033;
  --ink: #eef1ff;
  --ink-2: #aab3d6;
  --ink-3: #6f7aa6;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.22);
  --accent: #5b8cff;
  --accent-2: #a26bff;
  --accent-ink: #061036;
  --ok: #3ddc97;
  --warn: #ffb547;
  --bad: #ff5c7a;
  --dup: #c08bff;
  --mute: #4b5580;
  --radius: 20px;
  --radius-s: 12px;
  --pad: 16px;
  --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pixel: 'Silkscreen', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#sky {
  position: fixed; inset: 0; width: 100vw; height: 100lvh; z-index: 0;
  image-rendering: pixelated; image-rendering: crisp-edges;
  opacity: 0.9;
}
.veil {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, transparent 0%, rgba(5, 7, 26, 0.35) 60%, rgba(5, 7, 26, 0.85) 100%),
    linear-gradient(180deg, rgba(5, 7, 26, 0) 40%, rgba(5, 7, 26, 0.75) 100%);
}

.app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 0 var(--pad) calc(var(--tab-h) + var(--safe-b) + 96px); }

/* hlavička */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 10px;
}
.mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font: 700 13px/1 var(--pixel); color: #fff; letter-spacing: 0.5px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset, 0 8px 24px -6px rgba(91, 140, 255, 0.7);
}
.brand { font: 700 15px/1 var(--pixel); letter-spacing: 1px; }
.brand small { display: block; font: 500 11px/1.2 var(--font); color: var(--ink-3); letter-spacing: 0.2px; margin-top: 3px; }
.pill {
  margin-left: auto; font: 500 12px/1 var(--font); color: var(--ink-2);
  padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* hero */
.hero { padding: 26px 0 18px; }
.eyebrow { font: 700 11px/1 var(--pixel); letter-spacing: 1.5px; color: var(--accent); text-transform: uppercase; }
h1 {
  font: 700 clamp(28px, 8.4vw, 46px)/1.04 var(--pixel); letter-spacing: -0.5px; margin: 12px 0 12px;
  text-transform: uppercase;
  text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, #b9c6ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { color: var(--ink-2); margin: 0; max-width: 34em; text-wrap: pretty; }

h2 { font: 700 13px/1.2 var(--pixel); letter-spacing: 1px; text-transform: uppercase; margin: 0; color: var(--ink); }
.muted { color: var(--ink-3); font-size: 13px; }

/* skleněné karty */
.card {
  position: relative; margin: 14px 0; padding: 16px;
  border-radius: var(--radius); background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h .muted { margin-left: auto; }

/* tlačítka */
button { font: inherit; color: inherit; }
.btn {
  appearance: none; border: 1px solid var(--line-2); background: var(--glass-2);
  border-radius: 14px; min-height: 48px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 10px 30px -10px rgba(122, 110, 255, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(255, 92, 122, 0.4); }
.btn[disabled] { pointer-events: none; color: var(--ink-3); }
.btn.primary[disabled] { background: #141a44; box-shadow: 0 0 0 1px var(--line) inset; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }

/* segment */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.seg button {
  appearance: none; border: 0; background: transparent; border-radius: 10px; min-height: 44px;
  font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button[aria-pressed='true'] { background: var(--glass-2); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2) inset; }
.field + .field { margin-top: 14px; }
.field label, .field .lbl { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; }

/* fotky */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb {
  position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .no {
  position: absolute; left: 6px; top: 6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 8px;
  display: grid; place-items: center; font: 700 11px/1 var(--pixel); color: #fff;
  background: rgba(5, 7, 26, 0.75); border: 1px solid var(--line-2);
}
.thumb .st { position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--mute); border: 2px solid rgba(5, 7, 26, 0.8); }
.thumb .st.done { background: var(--ok); }
.thumb .ctl { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(0deg, rgba(5, 7, 26, 0.85), transparent); }
.thumb .ctl button {
  appearance: none; border: 0; width: 34px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, 0.1);
  display: grid; place-items: center; cursor: pointer;
}
.thumb .ctl svg { width: 16px; height: 16px; }
.empty {
  border: 1.5px dashed var(--line-2); border-radius: 16px; padding: 26px 16px; text-align: center; color: var(--ink-2);
}
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.adds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* průběh */
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.25s ease; }
.plog { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.plog li { display: flex; gap: 8px; padding: 3px 0; }
.plog li b { color: var(--ink); font-weight: 600; }

/* plovoucí akce */
.cta {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); z-index: 5;
  padding: 0 var(--pad); max-width: 760px; margin: 0 auto;
}
.cta .btn { width: 100%; min-height: 54px; font-size: 16px; }

/* souhrn */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
.stat b { display: block; font: 700 22px/1.1 var(--pixel); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-3); }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); }

/* mřížka */
.gridwrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
table.grid { border-collapse: separate; border-spacing: 4px; margin-left: -4px; }
.grid th { font: 700 11px/1 var(--pixel); color: var(--ink-2); padding: 6px 0; text-align: center; letter-spacing: 0.5px; }
.grid th.lv { position: sticky; left: 0; z-index: 2; background: var(--bg-2); border-radius: 8px; padding: 0 8px; min-width: 38px; box-shadow: 4px 0 8px -2px rgba(0,0,0,0.4); }
.grid td { padding: 0; }
.cell {
  appearance: none; width: 66px; height: 46px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  font: 600 13px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--ink);
  display: grid; place-items: center; position: relative; padding: 0;
}
.cell.jiste { background: rgba(61, 220, 151, 0.14); border-color: rgba(61, 220, 151, 0.45); }
.cell.rucne { background: rgba(91, 140, 255, 0.18); border-color: rgba(91, 140, 255, 0.6); }
.cell.nejiste { background: rgba(255, 181, 71, 0.16); border-color: rgba(255, 181, 71, 0.6); color: #ffd9a0; }
.cell.necitelne { background: rgba(255, 92, 122, 0.16); border-color: rgba(255, 92, 122, 0.6); color: #ffb3c1; font-size: 10px; }
.cell.chybi { color: var(--ink-3); border-style: dashed; }
.cell.dup::after { content: ''; position: absolute; inset: -3px; border-radius: 12px; border: 2px solid var(--dup); pointer-events: none; }
.cell.edited::before { content: ''; position: absolute; right: 5px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line-2); }

.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.issues li:first-child { border-top: 0; }
.issues .pos { font: 700 11px/1.6 var(--pixel); color: var(--warn); white-space: nowrap; min-width: 62px; }
.issues button.pos { appearance: none; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; text-decoration: underline dotted; }

/* snímky s překryvem */
.shot { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.shot img { display: block; width: 100%; height: auto; }
.shot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.shot-h { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.shot-h .lvl { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.mini { appearance: none; border: 1px solid var(--line-2); background: var(--glass-2); border-radius: 10px; min-width: 40px; height: 36px; cursor: pointer; font-weight: 700; }

/* spodní navigace */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(8, 10, 32, 0.72); border-top: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
}
.tabbar .in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tab {
  appearance: none; border: 0; background: transparent; border-radius: 14px; min-height: 52px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); font: 600 11px/1 var(--font); position: relative;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current='page'] { color: var(--ink); background: var(--glass-2); }
.tab .badge { position: absolute; top: 6px; right: calc(50% - 22px); min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--warn); color: #241400; font: 700 10px/16px var(--font); }

.view { display: none; animation: rise 0.35s ease both; }
.view.on { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* list buňky */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88vh;
  background: transparent; color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(2, 3, 12, 0.6); backdrop-filter: blur(3px); }
.sheet .in {
  border-radius: 24px 24px 0 0; padding: 10px 16px calc(18px + var(--safe-b));
  background: rgba(14, 18, 52, 0.96); border: 1px solid var(--line-2); border-bottom: 0;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.8);
  overflow-y: auto; max-height: 88vh;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
.sheet h3 { font: 700 16px/1.2 var(--pixel); margin: 0 0 4px; }
.crops { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; }
.crops img { height: 128px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; }
.cands { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.cands button { appearance: none; border: 1px solid var(--line-2); background: var(--glass-2); border-radius: 10px; padding: 10px 14px; font: 700 15px/1 var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
input.num {
  width: 100%; height: 54px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3);
  color: var(--ink); font: 700 24px/1 var(--font); letter-spacing: 4px; text-align: center; font-variant-numeric: tabular-nums;
}
input.num:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sheet .actions .primary { grid-column: 1 / -1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 80px); transform: translate(-50%, 20px);
  z-index: 20; padding: 12px 16px; border-radius: 14px; max-width: calc(100vw - 32px);
  background: rgba(14, 18, 52, 0.95); border: 1px solid var(--line-2); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.map { font-size: 14px; color: var(--ink-2); }
.map b { color: var(--ink); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--ink-2); }
.kv span:nth-child(even) { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 640px) {
  .thumbs { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(6, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { transition: none !important; }
}
