/* Co nás pálí? – vzhled. Nejdřív mobil, od 900 px širší rozložení. */
:root {
  --ink: #14213D;
  --ink-soft: #5A6478;
  --line: #E2E6EC;
  --surface: #F4F5F8;
  --bg: #fff;
  --brand: #E5482D;
  --brand-dark: #C63A22;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 33, 61, .16), 0 1px 3px rgba(20, 33, 61, .1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab: calc(64px + var(--safe-b));
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: #eceff3;
}
body.adding { --tab: 0px; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, textarea:focus-visible, .btn:focus-within { outline: 3px solid #7AA7FF; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ic { flex: none; display: block; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; }
.maplibregl-ctrl-bottom-left { bottom: calc(var(--tab) + 4px); }
.maplibregl-ctrl-attrib { font-size: 11px; }
.user-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563EB; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }

/* --- horní lišta --- */
#top {
  position: fixed; z-index: 5; top: calc(8px + var(--safe-t)); left: 8px; right: 8px;
  display: grid; gap: 8px; pointer-events: none;
}
#top > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow);
}
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #FF7A45; flex: none; }
.brand-text { min-width: 0; flex: 1; }
.brand h1 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.brand p { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-demo { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: #FFF1C2; color: #7A5200; padding: 2px 6px; border-radius: 6px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; flex: none;
  background: var(--surface); border-radius: 12px; font-weight: 600; font-size: 15px;
}
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; }

.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; margin: -2px -2px -6px; }
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px;
  background: var(--bg); border-radius: 20px; font-weight: 600; font-size: 15px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(20, 33, 61, .14);
}
.chip.on { background: var(--ink); color: #fff; }
.chips.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.wrap .chip { box-shadow: none; background: var(--surface); border: 1.5px solid transparent; }
.chip b { font-weight: 700; opacity: .6; font-size: 13px; }
.chip.toggle.on { background: color-mix(in srgb, var(--c, var(--ink)) 12%, #fff); border-color: var(--c, var(--ink)); color: var(--ink); }
.chip.toggle.on .ic { color: var(--c, var(--ink)); }
.chip.static { min-height: 34px; cursor: default; }

/* --- nástroje na mapě --- */
#tools { position: fixed; z-index: 4; right: 8px; bottom: calc(var(--tab) + 16px); display: grid; gap: 8px; }
.tool { width: 48px; height: 48px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); display: grid; place-items: center; }
body.adding #tools { display: none; }

#legend { position: fixed; z-index: 4; left: 8px; bottom: calc(var(--tab) + 16px); max-width: 210px; }
#legend button { display: grid; gap: 6px; width: 100%; padding: 10px 12px; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); text-align: left; font-size: 12px; }
.ramp i { display: block; height: 10px; border-radius: 5px; }
.ramp-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
body:has(#sheet:not([hidden])) #legend, body:has(#sheet:not([hidden])) #tools { display: none; }

#crosshair { position: fixed; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -100%); pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }

/* --- spodní navigace --- */
#tabbar {
  position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; height: var(--tab); padding: 0 6px var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
  background: var(--bg); box-shadow: 0 -2px 16px rgba(20, 33, 61, .12);
}
body.adding #tabbar { display: none; }
.tab { display: grid; justify-items: center; gap: 2px; height: 56px; align-content: center; color: var(--ink-soft); font-size: 12px; font-weight: 600; border-radius: 12px; }
.tab.on { color: var(--brand-dark); }
.fab {
  justify-self: center; display: grid; justify-items: center; align-content: center; width: 68px; height: 68px; margin-top: -26px;
  border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(229, 72, 45, .5), 0 0 0 5px #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.fab:active { background: var(--brand-dark); transform: scale(.96); }

/* --- panel --- */
#sheet {
  position: fixed; z-index: 7; left: 0; right: 0; bottom: var(--tab);
  display: flex; flex-direction: column; max-height: min(78dvh, calc(100dvh - 120px));
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(20, 33, 61, .22);
  padding-bottom: 0;
}
body.adding #sheet { padding-bottom: var(--safe-b); }
#sheet.in { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-in { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
#sheet[data-size="peek"] { max-height: 46dvh; }
#sheet[data-size="full"] { max-height: calc(100dvh - var(--tab) - 70px - var(--safe-t)); }
.sheet-handle { height: 20px; display: grid; place-items: center; flex: none; width: 100%; }
.sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: #CDD3DC; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 0 8px 8px 16px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
#sheet-back:not([hidden]) { margin-left: -10px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; flex: none; color: var(--ink-soft); }
.icon-btn:active { background: var(--surface); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 36px; display: grid; gap: 14px; align-content: start; -webkit-overflow-scrolling: touch; }
.sheet-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; margin-top: 4px; }
.h3-row { display: flex; justify-content: space-between; align-items: end; }
.text { font-size: 16px; }
.lead { color: var(--ink-soft); font-size: 14px; }
.hint, .small { font-size: 13px; color: var(--ink-soft); }
.empty { color: var(--ink-soft); padding: 16px 0; text-align: center; }
.link { color: #1D4ED8; font-weight: 600; font-size: 14px; padding: 6px 2px; }

/* --- tlačítka --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  border-radius: 14px; font-weight: 700; font-size: 16px; cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--surface); }
.btn.ghost.danger { color: #B42318; }
.btn.big { width: 100%; min-height: 54px; }
.btn.square { width: 52px; padding: 0; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 auto; font-size: 15px; font-weight: 600; }
.sticky-actions { position: sticky; bottom: -36px; display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 14px 0 34px; margin-bottom: -36px; background: linear-gradient(transparent, #fff 14px); }
.sticky-actions.one { grid-template-columns: 1fr; }
body.adding .sticky-actions { padding-bottom: 16px; }
body.adding .sheet-body { padding-bottom: 20px; }
body.adding .sticky-actions { bottom: -20px; margin-bottom: -20px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface); border-radius: 14px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-soft); padding: 0 4px; }
.seg button.on { background: #fff; color: var(--c, var(--ink)); box-shadow: 0 1px 4px rgba(20, 33, 61, .18); }

/* --- seznamy --- */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 0; text-align: left; border-bottom: 1px solid var(--line); min-height: 64px; }
.rows > .row:last-child { border-bottom: 0; }
.rank { width: 22px; text-align: center; font-weight: 800; color: var(--ink-soft); font-size: 15px; flex: none; }
.dot { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c, var(--ink)); color: #fff; flex: none; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-main strong { font-size: 15px; line-height: 1.3; }
.row-main span { font-size: 14px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-main small { font-size: 12px; color: var(--ink-soft); }
.row-votes { display: flex; align-items: center; gap: 4px; color: var(--c); font-size: 17px; flex: none; padding-left: 4px; }
.dup { border-bottom: 1px solid var(--line); padding-bottom: 12px; display: grid; }
.dup .row { border: 0; }

.bars { display: grid; gap: 2px; }
.bar { display: grid; grid-template-columns: minmax(0, 46%) 1fr 34px; align-items: center; gap: 8px; min-height: 40px; text-align: left; font-size: 14px; }
.bar-label { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label .ic { color: var(--ink-soft); }
.bar-track { height: 12px; background: var(--surface); border-radius: 6px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 6px; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis div { background: var(--surface); border-radius: 14px; padding: 10px 12px; }
.kpis b { display: block; font-size: 24px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpis span { font-size: 13px; color: var(--ink-soft); }
.status-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.status-row div { border-top: 4px solid var(--c); background: var(--surface); border-radius: 0 0 10px 10px; padding: 8px; }
.status-row b { display: block; font-size: 20px; }
.status-row span { font-size: 12px; color: var(--ink-soft); line-height: 1.2; display: block; }
.legend-box { display: grid; gap: 6px; padding: 12px; background: var(--surface); border-radius: 14px; font-size: 14px; }
.legend-box small { color: var(--ink-soft); font-size: 13px; }

/* --- detail --- */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-type, .badge-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge-type { background: var(--c); color: #fff; }
.badge-status { background: color-mix(in srgb, var(--c) 13%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink-soft); font-size: 14px; }
.heat { display: flex; align-items: center; gap: 2px; color: var(--brand); font-size: 14px; font-weight: 600; }
.heat span { margin-left: 6px; color: var(--ink); }
.photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; }
.btn.vote { width: 100%; min-height: 58px; font-size: 17px; background: var(--c); color: #fff; justify-content: flex-start; padding: 0 18px; }
.btn.vote span { flex: 1; text-align: left; }
.btn.vote b { font-size: 20px; background: rgba(255, 255, 255, .22); padding: 3px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.btn.vote.on { background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 85%, #000); box-shadow: inset 0 0 0 2px var(--c); }
.btn.vote.on b { background: color-mix(in srgb, var(--c) 18%, #fff); }
.btn.vote:disabled { opacity: 1; }

.reply { padding: 12px; border-radius: 14px; background: #EAF2FF; font-size: 15px; }
.reply b { display: block; font-size: 13px; color: #1D4ED8; margin-bottom: 2px; }
.admin-box { display: grid; gap: 10px; padding: 12px; border-radius: 14px; border: 1.5px dashed #B9C2D0; }
a.btn { text-decoration: none; color: inherit; }
.notice a { color: inherit; font-weight: 700; }

/* --- přidání --- */
.type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-card { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; background: var(--surface); border: 2px solid transparent; text-align: center; color: var(--ink-soft); }
.type-card .ic { color: var(--c); }
.type-card b { font-size: 15px; color: var(--ink); line-height: 1.2; }
.type-card small { font-size: 12px; line-height: 1.25; }
.type-card.on { background: color-mix(in srgb, var(--c) 10%, #fff); border-color: var(--c); }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 12px 4px 10px; border-radius: 16px; background: var(--surface); font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; min-height: 92px; }
.cat .dot { width: 46px; height: 46px; }
.cat:active { background: color-mix(in srgb, var(--c) 14%, #fff); }

#placebar {
  position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; display: grid; gap: 10px;
  padding: 10px 12px calc(12px + var(--safe-b)); background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(20, 33, 61, .22);
}
.place-head { display: flex; align-items: center; gap: 4px; }
.place-head > div { flex: 1; min-width: 0; display: grid; }
.place-head strong { font-size: 18px; font-weight: 800; }
.place-head em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-left: 6px; }
.place-head span { font-size: 13px; color: var(--ink-soft); line-height: 1.3; }
.place-actions { display: flex; gap: 8px; }
.place-actions .btn { flex: 1; min-height: 54px; }
.place-actions .btn.square { flex: none; width: 54px; }
.warn { background: #FFF1C2; color: #6B4700; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
.add-summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 14px; }
.add-summary > div { flex: 1; display: grid; min-width: 0; }
.add-summary small { color: var(--ink-soft); font-size: 13px; }
.field-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; margin-bottom: -6px; }
.field-label em { text-transform: none; letter-spacing: 0; font-weight: 500; font-style: normal; }
textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; resize: vertical; min-height: 84px; background: #fff; }
textarea:focus { border-color: var(--ink); outline: none; }
.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }

/* --- ostatní --- */
.notice { display: flex; gap: 10px; padding: 12px; background: #FFF6D6; color: #5C4300; border-radius: 14px; font-size: 14px; }
.notice .ic { margin-top: 2px; }
.steps { display: grid; gap: 10px; }
.steps div { display: flex; gap: 12px; align-items: flex-start; }
.steps span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; flex: none; }
.steps p { font-size: 15px; padding-top: 3px; }
.welcome-types { display: grid; gap: 10px; }
.welcome-types div { display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; align-items: center; }
.welcome-types .dot { grid-row: span 2; }
.welcome-types b { font-size: 16px; line-height: 1.2; }
.welcome-types small { font-size: 14px; color: var(--ink-soft); }

#toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(var(--tab) + 24px); transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 14px;
  font-size: 15px; font-weight: 600; text-align: center; opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
body:has(#sheet:not([hidden])) #toast, body:has(#placebar:not([hidden])) #toast { bottom: auto; top: calc(14px + var(--safe-t)); }
.fatal { position: fixed; inset: 0; display: grid; place-items: center; background: #fff; padding: 24px; text-align: center; z-index: 50; }

/* --- širší obrazovky --- */
@media (min-width: 900px) {
  #top { left: 16px; right: auto; top: 16px; width: 410px; }
  #sheet { left: 16px; right: auto; width: 410px; top: 140px; bottom: auto; max-height: calc(100dvh - 156px) !important; border-radius: 22px; box-shadow: var(--shadow); }
  .sheet-body { padding-bottom: 20px; }
  .sticky-actions { bottom: -20px; margin-bottom: -20px; padding-bottom: 16px; }
  .sheet-handle { visibility: hidden; height: 12px; }
  #tabbar { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); width: 460px; border-radius: 22px; box-shadow: var(--shadow); --safe-b: 0px; height: 64px; }
  body:has(#sheet:not([hidden])) #tabbar { left: calc(50% + 213px); }
  #placebar { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); width: 460px; border-radius: 22px; }
  #tools { right: 16px; bottom: 96px; }
  body:has(#sheet:not([hidden])) #tools, body:has(#sheet:not([hidden])) #legend { display: grid; }
  #legend { left: auto; right: 76px; bottom: 96px; }
  .maplibregl-ctrl-bottom-left { bottom: 0; left: auto; right: 0; }
  #toast { bottom: 100px !important; top: auto !important; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
