body.catalog-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.window {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin: 16px; border-radius: 14px; overflow: hidden;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--border-strong), 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.toolbar h1 { font-size: 19px; margin: 0 auto 0 4px; font-weight: 700; white-space: nowrap; }
.segmented { display: flex; background: var(--raised); border-radius: 7px; padding: 2px; }
.segmented button {
  border: 0; background: none; padding: 3px 12px; border-radius: 5px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.segmented button.on { background: var(--accent); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 12px; border-radius: 7px; cursor: pointer;
  background: var(--raised); border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 500; color: var(--text);
}
.pill.active { border-color: var(--accent); background: var(--accent-soft); }
.pill .count { background: var(--accent); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; }
.pill.select { padding: 0 4px 0 8px; }
.pill select {
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer; outline: none;
  max-width: 180px;
}
.pill select option { background: var(--panel); }
.country-select { display: none; }

/* ---------- body ---------- */
.body { flex: 1; min-height: 0; display: flex; }
.sidebar {
  width: 240px; flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.search { position: relative; padding: 10px; }
.search input {
  width: 100%; height: 34px; padding: 0 12px 0 34px;
  background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='M9.5 9.5 13 13'/%3E%3C/svg%3E") no-repeat 12px center;
  border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.shown { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-3); pointer-events: none; }

.countries { list-style: none; margin: 0; padding: 0 0 10px; overflow-y: auto; flex: 1; }
.countries li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 5px 20px; cursor: pointer; font-size: 14px;
}
.countries li:hover { background: rgba(255, 255, 255, 0.04); }
.countries li.on { background: var(--accent-soft); }
.countries li.zero { color: var(--text-3); }
.countries li span:last-child { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.countries li.all { font-weight: 600; }

/* ---------- virtual list ---------- */
.list { flex: 1; overflow-y: auto; position: relative; outline: none; }
.spacer { width: 1px; }
.row {
  position: absolute; left: 0; right: 0; height: 72px;
  padding: 7px 24px 7px 34px; cursor: pointer; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.row:hover { background: rgba(255, 255, 255, 0.03); }
.row.on { background: var(--accent-soft); }
.row .l1 { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.row .host { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font-size: 10px; font-weight: 600; color: var(--text-2);
  background: var(--raised); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.02em;
}
.feeds { font-size: 11.5px; color: var(--text-2); }
.feeds::before { content: "◉ "; font-size: 9px; color: var(--text-3); }
.row .sum { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .l2 { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 40px; text-align: center; color: var(--text-3); }

/* Pick toggle: "+" on hover at the left, a check at the right once picked (as in the app). */
/* The button is the whole left gutter (full row height) so a near miss still hits it. */
.row .pick {
  position: absolute; left: 0; top: 0; bottom: 0; width: 34px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer;
  opacity: 0;
}
.row:hover .pick, .row .pick:focus-visible { opacity: 1; }
.row .pick::before {
  content: "+"; width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 300; line-height: 1;
}
.row .pick:hover::before { background: var(--accent-soft); }
.row.picked .pick::before { content: "−"; }
.row .check {
  display: none; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 8.2 2.3 2.3 4.7-4.9'/%3E%3C/svg%3E");
}
.row.picked .check { display: block; }
.row.picked .l1, .row.picked .l2 { opacity: 0.6; }
.row.picked { padding-right: 44px; }
@media (hover: none) { .row .pick { opacity: 1; } }

.float-actions {
  position: absolute; right: 22px; bottom: 16px; z-index: 2;
  display: flex; gap: 8px;
}
.float-actions .btn {
  padding: 7px 16px; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.float-actions .btn[hidden] { display: none; }
.float-actions .btn:disabled { opacity: 0.5; cursor: default; }

.statusbar {
  padding: 8px 14px; font-size: 12px; color: var(--text-2);
  border-top: 1px solid var(--border); background: var(--panel-2);
}

/* ---------- export dialog ---------- */
.export-dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; margin: auto;
  background: rgba(36, 36, 38, 0.92); color: var(--text);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65); overflow: hidden;
}
.export-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.export-dialog > header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.export-dialog .close {
  width: 14px; height: 14px; flex: none; border-radius: 50%; border: 0; padding: 0;
  background: var(--red); cursor: pointer;
}
.export-dialog .close:hover { filter: brightness(1.2); }
.export-dialog h2 { font-size: 18px; margin: 0; white-space: nowrap; }
.export-info { margin-left: auto; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.formats { padding: 6px 8px; }
.format {
  display: grid; grid-template-columns: 22px 1fr; column-gap: 12px; align-items: center;
  width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: none; color: var(--text); font: inherit; text-align: left;
}
.format:hover, .format:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }
.format i { grid-row: span 2; font-style: normal; font-size: 16px; color: var(--text-2); text-align: center; }
.format b { font-size: 14.5px; font-weight: 650; }
.format span { font-size: 12.5px; color: var(--text-2); }
@media (max-width: 420px) { .export-info { display: none; } }

/* ---------- dropdown menus ---------- */
.menu {
  position: fixed; z-index: 100; min-width: 220px; max-height: 60vh; overflow-y: auto;
  background: var(--raised); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.menu input[type=search] {
  width: 100%; margin-bottom: 4px; padding: 6px 9px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.menu label {
  display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 6px;
  font-size: 13.5px; cursor: pointer;
}
.menu label:hover { background: rgba(255, 255, 255, 0.06); }
.menu label small { margin-left: auto; color: var(--text-3); }
.menu input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.menu .reset {
  width: 100%; margin-top: 4px; padding: 6px; border: 0; border-top: 1px solid var(--border);
  background: none; color: var(--accent); cursor: pointer; font-size: 13px;
}

/* ---------- floating panels ---------- */
.panel {
  position: fixed; z-index: 60; top: 76px; bottom: 24px;
  display: flex; flex-direction: column;
  background: rgba(36, 36, 38, 0.92);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}
.panel[hidden] { display: none; }
.panel > header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.panel .close {
  width: 14px; height: 14px; flex: none; border-radius: 50%; border: 0; padding: 0;
  background: var(--red); cursor: pointer;
}
.panel .close:hover { filter: brightness(1.2); }
.preview { right: 24px; width: min(460px, calc(100vw - 32px)); }
.preview h2 { font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feeds-toggle { border: 0; background: none; color: var(--text-2); font-size: 12px; cursor: pointer; white-space: nowrap; }
.feeds-toggle:hover { color: var(--text); }
.icon-btn {
  margin-left: auto; width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--raised); cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.feed-list {
  list-style: none; margin: 0; padding: 8px 16px; max-height: 30%; overflow-y: auto;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.feed-list li { padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.feed-list li a { overflow-wrap: anywhere; }
.feed-list .st { flex: none; width: 10px; color: var(--text-3); }
.feed-list .st.ok { color: #5ac26a; }
.feed-list .st.err { color: var(--red); }
.feed-list .cat { color: var(--text-3); margin-left: auto; white-space: nowrap; }

.items { flex: 1; overflow-y: auto; padding: 4px 8px; }
.item { padding: 10px 10px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.item:hover { background: rgba(255, 255, 255, 0.04); }
.item.on { background: var(--accent-soft); }
.item.on .t { color: #8fa3ff; }
.item .t { font-weight: 650; font-size: 14.5px; line-height: 1.3; margin-bottom: 4px; }
.item .d {
  font-size: 12.5px; color: var(--text-2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.item .m { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.panel-status { padding: 8px 16px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }

.article { right: 500px; width: min(460px, calc(100vw - 540px)); }
.article .meta { margin-left: auto; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 90px; }
.article-scroll h2 { font-size: 20px; line-height: 1.3; margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.article-body { font-size: 15px; line-height: 1.6; color: #dcdce0; overflow-wrap: anywhere; }
.article-body img, .article-body video { max-width: 100%; height: auto; border-radius: 8px; }
.article-body audio { width: 100%; margin: 8px 0; }
.article-body blockquote { margin: 10px 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.article-body pre { white-space: pre-wrap; }
.article-nav {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
  padding: 6px; border-radius: 999px;
  background: rgba(50, 50, 52, 0.9); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.article-nav button {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--raised); cursor: pointer; font-size: 20px; line-height: 1;
}
.article-nav button:disabled { opacity: 0.35; cursor: default; }
.article-nav .btn { padding: 6px 14px; font-size: 13px; }

/* ---------- narrow screens ---------- */
@media (max-width: 1020px) {
  .article { right: 24px; width: min(560px, calc(100vw - 32px)); z-index: 61; }
}
@media (max-width: 760px) {
  .window { margin: 0; border-radius: 0; box-shadow: none; }
  .toolbar h1 { display: none; }
  .sidebar { display: none; }
  .country-select { display: inline-flex; }
  .row { padding: 7px 16px 7px 34px; }
  .float-actions { right: 16px; }
  .panel { top: 60px; bottom: 8px; right: 8px !important; left: 8px; width: auto !important; }
}
