:root {
  --bg: #0f1115;
  --bg-2: #1a1d24;
  --fg: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #ffb020;
  --gap: 4px;
  --tab-h: 46px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior-y: none;
}

/* ---------- Horní lišta ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #23262f;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.topbar h1 span { color: var(--muted); font-weight: 500; }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 14px 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  border: 1px solid #2c303a;
  background: var(--bg-2);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
}
.tab small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.tab.active { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 700; }
.tab.active small { color: #5b4310; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--fg);
  font-size: 20px;
  text-decoration: none;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.92); }

/* ---------- Mřížka náhledů ---------- */
.status {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 15px;
}
.report {
  padding: 14px 16px 4px;
  max-width: 720px;
  margin: 0 auto;
}
.report h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
}
.report p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.55;
  color: #d7dce5;
}
.report-body { position: relative; }
.report.collapsed .report-body {
  max-height: 4.7em; /* ~3 řádky */
  overflow: hidden;
}
.report.collapsed .report-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.2em;
  background: linear-gradient(transparent, var(--bg));
}
.report-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 0 6px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--gap);
  padding: var(--gap);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-2);
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}
.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cell img.loaded { opacity: 1; }
.cell:active { transform: scale(0.97); }

/* ---------- Prohlížeč fotek ---------- */
/* Tlačítko Stáhnout v liště PhotoSwipe. */
.pswp__button--download .pswp__icn { color: #fff; }
/* Skryjeme tlačítko lupy – zoom je gesty (čistý vzhled jako Apple/Google Photos). */
.pswp__button--zoom { display: none !important; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  pointer-events: none;
}
.viewer-bar .icon-btn { pointer-events: auto; background: rgba(40,40,46,0.7); }
.viewer-actions { display: flex; gap: 10px; }
.counter {
  font-size: 15px;
  font-weight: 600;
  background: rgba(0,0,0,0.35);
  padding: 6px 12px;
  border-radius: 999px;
}

.track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x; /* jednoprstý swipe = přechod na další fotku */
}
.track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%;
  width: 100vw;
  height: 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-x; /* i v černých okrajích: žádný zoom celé stránky, gesto jde do JS */
}
.slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
  /* žádné touch-action: pinch-zoom – blokovalo by swipe. Zoom řešíme dvojím ťuknutím. */
  touch-action: pan-x;
  user-select: none;
  -webkit-user-drag: none;
}
.slide img.zoomed { transform: scale(2.3); transition: transform 0.25s ease; }

.viewer-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 56px;
  padding: 16px 0 calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}
.nav-btn {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(40, 40, 46, 0.7);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-btn:active { transform: scale(0.92); }
.nav-btn:disabled { opacity: 0.3; }
