*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
}

/* ── Header ─────────────────────────────────────────── */
header {
  background: #16213e;
  color: #fff;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.header-inner { max-width: 1400px; margin: 0 auto; position: relative; }
.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}
.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-left: auto;
}
.auth-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.auth-user {
  font-size: .82rem;
  color: rgba(255,255,255,.85);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-feed-hint {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
}
.auth-btn {
  background: #e94560;
  border: 1px solid #e94560;
  color: #fff;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: .78rem;
  cursor: pointer;
  font-family: inherit;
}
.auth-btn.ghost {
  background: transparent;
  border-color: rgba(255,255,255,.35);
}
.auth-btn:hover { opacity: .9; }
.hidden { display: none !important; }

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.auth-modal-panel {
  position: relative;
  background: #fff;
  color: #1a1a2e;
  border-radius: 12px;
  padding: 24px;
  width: min(400px, 100%);
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}
.auth-modal-panel h2 { margin-bottom: 12px; font-size: 1.2rem; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  background: #f8f9fb;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.auth-tab.active {
  background: #16213e;
  color: #fff;
  border-color: #16213e;
}
.auth-form label {
  display: block;
  margin-bottom: 12px;
  font-size: .88rem;
}
.auth-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
}
.auth-error {
  color: #c0392b;
  font-size: .85rem;
  margin-bottom: 10px;
}
.auth-submit {
  width: 100%;
  padding: 10px;
  background: #16213e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
}
.auth-submit:hover { background: #0f3460; }
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  line-height: 1.35;
  cursor: pointer;
}
.auth-consent input { width: auto; margin-top: 3px; flex-shrink: 0; }
.auth-consent a { color: #0f3460; }
.auth-oauth { margin-top: 14px; }
.auth-oauth-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-size: .82rem;
  margin-bottom: 12px;
}
.auth-oauth-sep::before,
.auth-oauth-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #ddd;
}
.auth-yandex-btn {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  background: #fc3f1d;
  color: #fff;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
}
.auth-yandex-btn:hover { opacity: .92; }
.auth-yandex-btn.disabled {
  pointer-events: none;
  opacity: .45;
}
.auth-yandex-hint {
  margin-top: 8px;
  font-size: .78rem;
  color: #888;
  line-height: 1.35;
}
.site-footer {
  max-width: 1400px;
  margin: 0 auto 24px;
  padding: 0 16px;
  font-size: .82rem;
  color: #666;
}
.site-footer a { color: #0f3460; }
.legal-page { background: #f4f6f9; min-height: 100vh; }
.legal-header {
  background: #16213e;
  color: #fff;
  padding: 20px 16px;
  margin-bottom: 24px;
}
.legal-wrap { max-width: 760px; margin: 0 auto; }
.legal-back { color: rgba(255,255,255,.8); text-decoration: none; font-size: .88rem; }
.legal-header h1 { margin: 12px 0 6px; font-size: 1.5rem; }
.legal-meta { color: rgba(255,255,255,.65); font-size: .85rem; }
.legal-content section { margin-bottom: 24px; }
.legal-content h2 { font-size: 1.05rem; margin-bottom: 8px; color: #16213e; }
.legal-content p,
.legal-content li { line-height: 1.55; margin-bottom: 8px; font-size: .95rem; }
.legal-content ul { padding-left: 1.2rem; }
header h1 { font-size: 1.4rem; margin: 0; }
.update-timers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: rgba(255,255,255,.72);
  font-variant-numeric: tabular-nums;
}
.update-timers .timer-sep { opacity: .45; }
.update-timers strong { color: #fff; font-weight: 600; }
.subscribe-updates-btn {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255,255,255,.85);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.subscribe-updates-btn:hover { color: #fff; }

#tags-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tags-more { display: inline-flex; align-items: center; }
.tags-select {
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: 20px;
  padding: 4px 28px 4px 14px;
  cursor: pointer;
  font-size: .82rem;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: background-color .2s, border-color .2s;
  min-width: 140px;
}
.tags-select:hover,
.tags-select:focus {
  background-color: #0f3460;
  border-color: #e94560;
  outline: none;
}
.tags-select option {
  background: #16213e;
  color: #fff;
}
.tag-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: 20px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: .82rem;
  transition: background .2s, border-color .2s;
}
.tag-btn:hover, .tag-btn.active {
  background: #0f3460;
  border-color: #e94560;
}

/* ── Layout ──────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  main { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  .mobile-only { display: flex; }
  #filters { flex-direction: column; align-items: stretch; }
  .country-select select { width: 100%; }
  #search-input { width: 100%; flex: none; }
  #filters button { flex: 1; }
  .lang-select { width: 100%; }
  .lang-select select { flex: 1; }
}

/* ── Sidebar ─────────────────────────────────────────── */
#sidebar section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
#sidebar h3 { font-size: .9rem; color: #555; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }
#sidebar ul { list-style: none; }
#sidebar li { padding: 5px 0; font-size: .88rem; }
#sidebar li a {
  color: #0f3460;
  text-decoration: none;
  cursor: pointer;
}
#sidebar li a:hover { text-decoration: underline; }
#sidebar li a.active { font-weight: 700; color: #e94560; }
#sidebar li.sidebar-region {
  padding: 10px 0 4px;
  font-size: .72rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .06em;
  list-style: none;
  pointer-events: none;
}
#sidebar li.sidebar-region:first-child { padding-top: 0; }

/* ── Filters ─────────────────────────────────────────── */
#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.mobile-only { display: none; }

.lang-select,
.country-select {
  display: flex;
  align-items: center;
  gap: 6px;
}
.country-select select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: .88rem;
  cursor: pointer;
  background: #fff;
  min-width: 0;
  flex: 1;
}
.lang-label { font-size: .88rem; color: #555; }
.lang-select select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: .88rem;
  cursor: pointer;
  background: #fff;
}
#search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: .9rem;
}
#filters button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .88rem;
}
#search-btn { background: #0f3460; color: #fff; }
#reset-btn  { background: #e0e0e0; color: #333; }

/* ── News cards ───────────────────────────────────────── */
#news-list { display: flex; flex-direction: column; gap: 12px; }

.news-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: box-shadow .2s;
}
.news-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }

.news-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: .78rem;
  color: #888;
}
.news-card-meta .agency { font-weight: 600; color: #0f3460; }
.news-card-meta .country {
  color: #5a6a7a;
  font-weight: 500;
}
.news-card-meta .country::before {
  content: '·';
  margin-right: 8px;
  color: #c5cdd6;
}
.news-card-meta .date   { margin-left: auto; }

.news-card-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #eef0f4;
}
.favorite-action-btn {
  background: none;
  border: none;
  color: #0f3460;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  font-family: inherit;
}
.favorite-action-btn:hover { color: #e94560; }
.favorite-action-btn.active {
  color: #e94560;
  font-weight: 600;
  text-decoration: none;
}

.auth-btn.pay {
  background: #e94560;
  color: #fff;
}
.auth-btn.pay:hover { background: #d63850; }

.news-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}
.news-card h2 a { color: #1a1a2e; text-decoration: none; }
.news-card h2 a:hover { color: #e94560; }

.news-summary {
  font-size: .9rem;
  line-height: 1.5;
  color: #555;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  background: #eef2ff;
  color: #3b4fd8;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 500;
}
.badge.translated {
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge.science {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge.extremist {
  background: #ffebee;
  color: #c62828;
  font-weight: 700;
  letter-spacing: .04em;
}
.extremist-warn {
  font-size: .82rem;
  line-height: 1.35;
  color: #b71c1c;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 0 0 10px;
}
.news-card.is-translated {
  border-left: 3px solid #66bb6a;
}
.news-card.is-science {
  border-left: 3px solid #42a5f5;
}
.news-card.is-extremist {
  border-left: 3px solid #e65100;
  background: #fffaf7;
}
.news-card.is-extremist.is-science {
  border-left: 3px solid #e65100;
}
.news-card.is-translated.is-science {
  border-image: linear-gradient(#66bb6a, #42a5f5) 1;
}
.news-card.is-extremist.is-translated {
  border-left: 3px solid #e65100;
}

/* ── Pagination ───────────────────────────────────────── */
#pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.page-btn {
  width: 36px; height: 36px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: .88rem;
}
.page-btn.active { background: #0f3460; color: #fff; border-color: #0f3460; }
.page-btn:hover:not(.active) { background: #f0f0f0; }

/* ── Empty / loading ─────────────────────────────────── */
.msg { text-align: center; padding: 40px; color: #888; font-size: .95rem; }

/* ── Cabinet / favorites ─────────────────────────────── */
.cabinet-page .header-inner { max-width: 900px; }
.cabinet-home-link { color: inherit; text-decoration: none; }
.cabinet-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
.cabinet-head { margin-bottom: 20px; }
.cabinet-head h2 { margin: 0 0 8px; font-size: 1.5rem; }
.cabinet-hint { margin: 0; color: #666; font-size: .9rem; line-height: 1.45; }
.cabinet-legal {
  margin: 10px 0 0;
  font-size: .82rem;
  color: #888;
  line-height: 1.45;
}
.cabinet-legal a { color: #0f3460; }
.cabinet-footer { margin-top: 32px; }
.favorite-source-link {
  display: inline-block;
  margin: 8px 0 0;
  font-size: .85rem;
  color: #0f3460;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.favorite-source-link:hover { color: #e94560; }
.cabinet-pay-banner {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff8f0;
  border: 1px solid #ffd8a8;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.cabinet-pay-banner.hidden { display: none; }
.cabinet-pay-text { margin: 0; flex: 1; font-size: .9rem; color: #5c4a32; }
.cabinet-pay-error {
  width: 100%;
  margin: 0;
  font-size: .85rem;
  color: #c0392b;
}
.cabinet-pay-error.hidden { display: none; }
.btn.pay { background: #e94560; color: #fff; border: none; }
.btn.pay:hover { filter: brightness(1.05); }
.favorites-list { display: flex; flex-direction: column; gap: 16px; }
.favorite-card {
  background: #fff;
  border: 1px solid #e8e8ee;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.favorite-card.is-translated { border-color: #c5d4f7; }
.favorite-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .82rem; color: #777; }
.favorite-remove-btn {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: #aaa;
  cursor: pointer;
}
.favorite-remove-btn:hover { color: #c0392b; }
.favorite-card h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.4; }
.favorite-card h3 a { color: #1a1a2e; text-decoration: none; }
.favorite-card h3 a:hover { color: #e94560; }
.favorite-body { font-size: .9rem; line-height: 1.5; color: #444; margin: 0 0 10px; white-space: pre-wrap; }
.favorite-original-label { font-size: .75rem; color: #999; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.favorite-original { font-size: .85rem; color: #777; margin: 0; }
.favorite-original a { color: #0f3460; text-decoration: underline; }
.favorite-actions { margin-top: 10px; }
.favorite-error { color: #c0392b; font-size: .85rem; margin: 8px 0 0; }
