/* Místopis – styly
   Rozvržení: na mobilu seznam s lepicím vyhledáváním, od 900 px boční filtry a mřížka karet.
   Okna (detail, formulář) na mobilu vyjíždějí zdola, na počítači jsou uprostřed. */
:root {
  --bg: #F4F6F3; --surface: #FFFFFF; --surface-2: #F0F3F1; --fg: #17201C; --muted: #56615C;
  --line: #E1E7E3; --field: #C9D2CD; --accent: #1F6F5C; --accent-fg: #FFFFFF; --accent-soft: #E2F0EB; --accent-ink: #16503F;
  --star: #D99A16; --star-off: #D3D9D6; --danger: #B3261E; --danger-soft: #FBE7E5; --scrim: rgba(18, 26, 23, .45); --shadow: rgba(23, 32, 28, .14);
  --want: #244E8C; --want-bg: #E4ECF8; --visited: #1B6640; --visited-bg: #E1F1E7; --again: #984A0C; --again-bg: #FAE9DA;
  --c-green: #3E7C3A; --t-green: #E6F0E3; --c-red: #B5452B; --t-red: #F7E4DE; --c-brown: #8A5A2B; --t-brown: #F2E8DD;
  --c-violet: #6B4FA0; --t-violet: #ECE6F6; --c-blue: #2C5AA0; --t-blue: #E4ECF8; --c-teal: #0F7C8C; --t-teal: #DDF0F2;
  --c-pink: #A8386F; --t-pink: #F7E3ED; --c-olive: #6F6A1C; --t-olive: #EFEEDA;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #121815; --surface: #1B2420; --surface-2: #232E29; --fg: #E8EEEA; --muted: #9DABA4;
  --line: #2C3833; --field: #3B4943; --accent: #4FB394; --accent-fg: #0C1A15; --accent-soft: #1E3A31; --accent-ink: #8ED8BF;
  --star: #E8B03A; --star-off: #3E4A45; --danger: #F08A80; --danger-soft: #3A1E1C; --scrim: rgba(0, 0, 0, .6); --shadow: rgba(0, 0, 0, .4);
  --want: #9DBDF0; --want-bg: #1E2E47; --visited: #8FD3A9; --visited-bg: #1A3526; --again: #F2B27A; --again-bg: #3D2714;
  --c-green: #8CC486; --t-green: #22331F; --c-red: #EE9580; --t-red: #3A231D; --c-brown: #D6A877; --t-brown: #33281D;
  --c-violet: #B9A4E6; --t-violet: #2B2440; --c-blue: #9DBDF0; --t-blue: #1E2E47; --c-teal: #6FCFDC; --t-teal: #15343A;
  --c-pink: #EB96BF; --t-pink: #3A1E2C; --c-olive: #CFC777; --t-olive: #302F17;
  color-scheme: dark;
} }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* Načítání a přihlášení */
.splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); background: var(--bg); z-index: 100; }
.splash p { margin: 0; font-weight: 600; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.login-card h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 10px; color: var(--muted); max-width: 30ch; }
.btn.big { height: 52px; padding: 0 22px; font-size: 16px; width: 100%; }

/* Hlavička */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); }
.top .wrap { padding-block: 16px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.brand { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; flex: 1 0 auto; display: flex; align-items: center; gap: 10px; }
.search { order: 3; flex: 1 1 100%; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 16px; color: var(--fg); }
.round-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 0; }
.btn { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: default; }
.add-top { display: none; }
.banner { padding: 12px 14px; border-radius: 12px; background: var(--again-bg); color: var(--again); margin-bottom: 10px; font-size: 14px; }

/* Filtry */
.layout { display: flex; flex-direction: column; gap: 4px; padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.filters { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.filter-title { display: none; }
.statuses { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.statuses button { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.statuses button .n { font-weight: 500; opacity: .7; font-variant-numeric: tabular-nums; }
.statuses button[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.statuses .long { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chip { height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--cc); display: inline-block; flex-shrink: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 10px; }
.count { margin: 0; color: var(--muted); font-size: 14px; }
.toolbar select { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; }

/* Karty */
.list { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-align: left; width: 100%; }
.thumb { width: 72px; height: 72px; border-radius: 10px; flex-shrink: 0; background: var(--ct); color: var(--cc); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card .name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.want { color: var(--want); background: var(--want-bg); }
.pill.visited { color: var(--visited); background: var(--visited-bg); }
.pill.again { color: var(--again); background: var(--again-bg); }
.stars-s { display: inline-flex; gap: 1px; }
.stars-s svg { width: 13px; height: 13px; }

.empty { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); }
.empty h2 { margin: 0; font-size: 19px; color: var(--fg); text-wrap: balance; }
.empty p { margin: 0; max-width: 34ch; }
.empty .art { width: 72px; height: 72px; border-radius: 36px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty .art svg { width: 32px; height: 32px; }

.fab { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 60px; height: 60px; border-radius: 30px; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 8px 22px var(--shadow); z-index: 6; }
.fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

/* Okna */
dialog.sheet { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--fg); display: none; flex-direction: column; overflow: hidden; }
dialog.sheet[open] { display: flex; animation: up .22s ease-out; }
dialog::backdrop { background: var(--scrim); }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; text-align: center; }
.sheet-body { overflow-y: auto; padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 20px; }

/* Detail */
.gallery { position: relative; height: 260px; background: var(--ct); color: var(--cc); flex-shrink: 0; }
.gallery .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery .track button { flex: 0 0 100%; height: 100%; scroll-snap-align: start; border: 0; padding: 0; background: none; color: inherit; display: grid; place-items: center; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .ph { height: 100%; display: grid; place-items: center; }
.gallery .ph svg, .gallery .track svg { width: 44px; height: 44px; stroke-width: 1.4; }
.gallery .float { position: absolute; top: 12px; width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--surface); color: var(--fg); display: grid; place-items: center; box-shadow: 0 2px 8px var(--shadow); }
.gallery .float.l { left: 12px; } .gallery .float.r { right: 12px; }
.gallery .dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.gallery .dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--surface); opacity: .6; transition: width .2s; }
.gallery .dots span.on { width: 18px; opacity: 1; }
.d-cat { font-size: 13px; font-weight: 600; color: var(--cc); display: flex; align-items: center; gap: 6px; }
.d-title { margin: 4px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.d-desc { margin: 6px 0 0; opacity: .85; white-space: pre-line; overflow-wrap: anywhere; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.seg button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px; line-height: 1.2; }
.seg button[aria-pressed="true"] { font-weight: 700; box-shadow: 0 1px 3px var(--shadow); }
.seg button[aria-pressed="true"][data-s="want"] { background: var(--want-bg); color: var(--want); }
.seg button[aria-pressed="true"][data-s="visited"] { background: var(--visited-bg); color: var(--visited); }
.seg button[aria-pressed="true"][data-s="again"] { background: var(--again-bg); color: var(--again); }
.box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stars { display: inline-flex; }
.stars button { width: 40px; height: 40px; border: 0; background: transparent; padding: 0; display: grid; place-items: center; }
.stars svg { width: 26px; height: 26px; }
.note { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.small { font-size: 12px; color: var(--muted); }
.addr { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); }
.addr > div { color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.addr .links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; font-weight: 600; margin-top: 4px; }
.addr a { color: var(--accent); }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--danger-soft); }
.confirm span { flex: 1 1 180px; font-weight: 600; }
.del-link { align-self: flex-start; border: 0; background: none; color: var(--danger); font-weight: 600; padding: 10px 0; display: inline-flex; gap: 6px; align-items: center; }

/* Formulář */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
.field legend { margin-bottom: 8px; }
.input { height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: 12px; background: var(--surface); font-size: 16px; width: 100%; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input.err { border-color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); }
.err-text { font-size: 13px; color: var(--danger); font-weight: 600; margin: 0; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick button { height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.cat-pick button[aria-pressed="true"] { background: var(--cc); border-color: var(--cc); color: var(--surface); }
.cat-pick button[aria-pressed="true"] .dot { background: var(--surface); }
.cat-pick .new { border-style: dashed; border-color: var(--muted); color: var(--accent); }
.cat-pick .new svg { width: 16px; height: 16px; }
.newcat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.newcat .input { flex: 1 1 160px; height: 42px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 16px; border: 2px solid transparent; background: var(--surface); display: grid; place-items: center; padding: 0; }
.swatches button span { width: 18px; height: 18px; border-radius: 9px; background: var(--cc); }
.swatches button[aria-pressed="true"] { border-color: var(--fg); }
.rate-box { background: var(--surface-2); border-color: transparent; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 15px; border: 0; background: rgba(0,0,0,.62); color: #FFFFFF; display: grid; place-items: center; padding: 0; }
.photo .x svg { width: 15px; height: 15px; stroke-width: 2.4; }
.photo.loading { display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.photo-add { aspect-ratio: 1; max-width: 100%; border-radius: 12px; border: 1.5px dashed var(--muted); background: transparent; color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; cursor: pointer; }
.photo-add input { display: none; }

/* Nastavení */
.cat-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); min-height: 54px; }
.cat-row:last-child { border-bottom: 0; }
.cat-row .dot { width: 12px; height: 12px; border-radius: 6px; }
.cat-row input { flex: 1; min-width: 0; height: 40px; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 0 8px; font-size: 15px; font-weight: 500; }
.cat-row input:hover, .cat-row input:focus { border-color: var(--field); background: var(--surface); outline: none; }
.cat-row .n { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; color: var(--muted); border-radius: 10px; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.account { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border: 1px solid var(--line); border-radius: var(--r); }
.account .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account .who span:last-child { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Prohlížeč fotek */
dialog.viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; background: #000000; display: none; }
dialog.viewer[open] { display: grid; place-items: center; }
dialog.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
dialog.viewer .float { position: absolute; width: 48px; height: 48px; border-radius: 24px; border: 0; background: rgba(255,255,255,.16); color: #FFFFFF; display: grid; place-items: center; }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Počítač */
@media (min-width: 900px) {
  .top { background: var(--surface); border-bottom: 1px solid var(--line); }
  body::before { background: var(--surface); }
  .top .wrap { flex-wrap: nowrap; padding-block: 14px; gap: 16px; }
  .brand { flex: 0 0 auto; font-size: 22px; margin-right: 16px; }
  .search { order: 0; flex: 1 1 auto; max-width: 520px; background: var(--bg); height: 44px; }
  .add-top { display: inline-flex; margin-left: auto; }
  .fab { display: none; }
  .wrap > .banner:first-child { margin-top: 20px; }
  .layout { flex-direction: row; gap: 32px; padding-top: 24px; align-items: flex-start; }
  .filters { flex: 0 0 220px; gap: 24px; position: sticky; top: 100px; }
  .filter-title { display: block; margin: 0 0 6px 10px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .statuses, .chips { flex-direction: column; gap: 2px; overflow: visible; }
  .statuses button, .chip { height: 40px; border: 0; border-radius: 10px; background: transparent; justify-content: space-between; padding: 0 10px; font-size: 14px; font-weight: 500; width: 100%; }
  .chip { justify-content: flex-start; }
  .chip .n { margin-left: auto; }
  .statuses button[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border: 0; font-weight: 700; }
  .statuses .long { display: inline; } .statuses .short { display: none; }
  .content { flex: 1; min-width: 0; }
  .toolbar { padding-top: 0; }
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .card { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; gap: 0; border-radius: 16px; transition: box-shadow .15s, transform .15s; }
  .card:hover { box-shadow: 0 6px 18px var(--shadow); transform: translateY(-1px); }
  .card .thumb { width: 100%; height: 150px; border-radius: 0; }
  .card .body { padding: 14px 16px 16px; gap: 5px; }
  .card .name { font-size: 17px; order: 2; }
  .card .meta { order: 1; }
  .card .row { order: 3; justify-content: space-between; }
  dialog.sheet { margin: auto; width: min(620px, calc(100vw - 48px)); max-height: 88vh; border-radius: 20px; }
  .gallery { height: 320px; }
}
