:root {
  --bg: #f1f5f9; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --moto: #e11d48; --pos: #16a34a; --accent: var(--moto);
  --sheet: #ffffff; --bar: #ffffff; --chip: #e2e8f0; --chip-on: #0f172a; --chip-on-text: #ffffff;
  --top-h: 52px; --tabs-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --card: #141c2e; --text: #e8edf6; --muted: #93a1b8; --line: #243049;
    --sheet: #111a2c; --bar: #0f172a; --chip: #1e2a42; --chip-on: #e8edf6; --chip-on-text: #0b1220;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-top: calc(var(--top-h) + var(--safe-t));
  padding-bottom: calc(var(--tabs-h) + var(--safe-b));
  overscroll-behavior-y: contain;
}
body.drawer-open { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Horní lišta */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar); border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 20px; font-weight: 700; }
.top h1::before { content: ""; display: inline-block; width: 8px; height: 20px; margin-right: 10px;
  border-radius: 3px; background: var(--accent); vertical-align: -3px; }
.actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 20px; }
.icon-btn[aria-pressed="true"] { background: var(--chip); }
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: #fef3c7; color: #78350f; }
.banner[hidden] { display: none; }

/* Filtr */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 6px 14px; font-size: 14px; background: var(--chip); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-text); }

/* Feed */
#feed { padding: 10px 12px 16px; display: grid; gap: 12px; max-width: 720px; margin: 0 auto; }
.card {
  display: block; background: var(--card); border-radius: 14px; overflow: hidden;
  border-left: 5px solid var(--c, var(--moto)); box-shadow: 0 1px 3px rgba(0,0,0,.08);
  cursor: pointer; text-align: left; width: 100%; padding: 0; border-top: 0; border-right: 0; border-bottom: 0;
}
.card:active { transform: scale(.995); }
.card.cat-positive { --c: var(--pos); }
.card.is-read { opacity: .55; }
.card img { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--line); }
.card-body { padding: 12px 14px 14px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.tag { color: var(--c, var(--moto)); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: 11.5px; }
.card h2 { margin: 6px 0 4px; font-size: 17px; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .btn { margin-top: 14px; }

/* Spodní navigace */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--bar); border-top: 1px solid var(--line);
}
.tabs button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; font-size: 12px; color: var(--muted); }
.tabs .ti { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs button[aria-current="page"] { color: var(--text); font-weight: 700; }
.tabs button[aria-current="page"] .ti { filter: none; opacity: 1; }

/* Okno s článkem (zespodu) */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(2, 6, 23, .55); opacity: 0; transition: opacity .25s; }
.backdrop.show { opacity: 1; }
.backdrop[hidden], .drawer[hidden] { display: none; }
.drawer {
  position: fixed; inset: auto 0 0 0; z-index: 30; max-width: 720px; margin: 0 auto;
  height: 92dvh; display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  --c: var(--moto);
}
.drawer.cat-positive { --c: var(--pos); }
.drawer.show { transform: translateY(0); }
.drawer-bar { flex: none; display: flex; justify-content: center; border-radius: 18px 18px 0 0; border-top: 4px solid var(--c); }
.grab { border: 0; background: transparent; padding: 10px 40px; }
.grab span { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.drawer-scroll { flex: 1; overflow-y: auto; padding: 4px 18px 24px; -webkit-overflow-scrolling: touch; }
.d-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.d-img[hidden] { display: none; }
.d-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; }
.drawer h2 { font-size: 22px; line-height: 1.25; margin: 8px 0 8px; }
.d-tldr { font-weight: 600; margin: 0 0 12px; }
.d-bullets { margin: 0 0 16px; padding: 12px 14px 12px 32px; background: var(--bg); border-left: 4px solid var(--c); border-radius: 10px; }
.d-bullets li { margin: 4px 0; }
.d-body p { margin: 0 0 14px; font-size: 17px; line-height: 1.65; }
.d-link { display: inline-block; margin: 6px 0 0; color: var(--c); font-weight: 600; text-decoration: none; }
.drawer-actions { flex: none; display: flex; gap: 10px; padding: 10px 14px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--sheet); }
.btn { flex: 1; border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 12px; font-weight: 600; }
.btn.primary { background: var(--c, var(--text)); border-color: transparent; color: #fff; }
.btn[aria-pressed="true"] { background: var(--chip); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .backdrop, .icon-btn.spin { transition: none; animation: none; }
}
