/* ===== ПЕРЕМЕННЫЕ ТЁМЫ ===== */
:root {
  --bg: #F8FAFC;
  --surface: #ffffff;
  --surface2: #F4F7FB;
  --border: #E2E8F0;
  --text: #1E293B;
  --muted: #64748B;
  --muted2: #94A3B8;
  --accent: #0039A6;
  --accent-dark: #002266;
  --accent2: #10B981;
  --accent2-dark: #047857;
  --shadow: rgba(0, 0, 0, 0.06);
  --hero-from: #001a5c;
  --hero-to: #1350c8;
}

body.dark {
  --bg: #0B0F19;
  --surface: #111827;
  --surface2: #1E293B;
  --border: rgba(255, 255, 255, 0.08);
  --text: #F1F5F9;
  --muted: #94A3B8;
  --muted2: #64748B;
  --accent: #60A5FA;
  --accent-dark: #93C5FD;
  --accent2: #34D399;
  --accent2-dark: #6EE7B7;
  --shadow: rgba(0, 0, 0, 0.4);
  --hero-from: #091224;
  --hero-to: #0f2042;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
button, a { -webkit-tap-highlight-color: transparent; outline: none; }

/* ===== HERO ===== */
.hero {
  position: relative;
  padding: 5.5rem 2rem 5rem;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(145deg, var(--hero-from) 0%, #0039A6 50%, var(--hero-to) 100%);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 70% at 70% 30%, rgba(100, 170, 255, 0.15) 0%, transparent 60%), radial-gradient(ellipse 40% 50% at 20% 80%, rgba(0, 20, 100, 0.3) 0%, transparent 60%);
  pointer-events: none;
}
.hero-badge {
  display: inline-block; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.28); color: rgba(255, 255, 255, 0.9); padding: .38rem 1.1rem; border-radius: 100px; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1.8rem;
}
.hero h1 { font-family: 'Unbounded', sans-serif; font-size: clamp(2rem, 6vw, 3.8rem); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; color: #ffffff; margin-bottom: 1.2rem; }
.hero-sub { color: rgba(255, 255, 255, 0.75); font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 0 auto; }

/* ===== BUTTONS (THEME, LANG, UP, ARCHIVE) ===== */
.theme-toggle, .scroll-to-top {
  position: fixed; right: 1.5rem; z-index: 9999; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px var(--shadow); transition: transform .2s, box-shadow .2s, background .3s;
}
.theme-toggle { bottom: 1.5rem; }
.theme-toggle:hover { transform: scale(1.1); box-shadow: 0 8px 30px var(--shadow); color: var(--accent); }
.scroll-to-top { bottom: 5.5rem; opacity: 0; pointer-events: none; transform: translateY(20px); }
.scroll-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-to-top:hover { color: var(--accent); transform: scale(1.1); }
body.dark .scroll-to-top { background: var(--surface2); }
.lang-toggle, .home-btn {
  position: absolute !important; pointer-events: auto !important; top: 1.5rem !important; z-index: 101 !important; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; padding: 0.4rem 0.8rem; border-radius: 8px; font-weight: 700; font-size: 0.8rem; text-decoration: none; transition: all 0.2s; backdrop-filter: blur(5px);
}
.lang-toggle { right: 1.5rem !important; }
.home-btn { left: 1.5rem !important; display: inline-flex; align-items: center; gap: 6px; }
.lang-toggle:hover, .home-btn:hover { background: #fff; color: var(--accent); }

/* ===== NAV ===== */
.nav-wrap { position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border); padding: 0 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04); transition: background .3s, border-color .3s; }
body.dark .nav-wrap { background: rgba(11, 15, 25, 0.97); }
.nav-tabs { display: flex; max-width: 1200px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; justify-content: center; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { padding: 1.2rem 1.4rem; font-size: .88rem; font-weight: 700; font-family: 'Montserrat', sans-serif; color: var(--muted); cursor: pointer; border: none; background: none; border-bottom: 3px solid transparent; transition: all .2s; white-space: nowrap; position: relative; top: 1px; display: flex; align-items: center; gap: 6px; }
.nav-tab:hover { color: var(--accent); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== LAYOUT & SECTION ===== */
.tab-section { display: none; max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.tab-section.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: translateY(0) } }

.section-intro { background: linear-gradient(135deg, #0039A6 0%, #1a5fd6 100%); border-radius: 18px; padding: 2rem 2.2rem; margin-bottom: 1.75rem; color: #fff; position: relative; overflow: hidden; transition: background 0.3s, border 0.3s; }
body.dark .section-intro { background: linear-gradient(135deg, #111827 0%, #1E293B 100%); border: 1px solid rgba(96, 165, 250, 0.2) !important; }
.section-intro-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, 0.65); margin-bottom: .55rem; position: relative; z-index: 1; }
.section-intro h2 { font-family: 'Unbounded', sans-serif; font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: .85rem; line-height: 1.3; position: relative; z-index: 1; }
.section-intro p { font-size: .88rem; color: rgba(255, 255, 255, 0.82); line-height: 1.75; font-weight: 500; position: relative; z-index: 1; }

.section-title { font-family: 'Unbounded', sans-serif; font-size: 1.2rem; font-weight: 700; margin-bottom: .35rem; color: var(--text); }
.dcard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem; margin-bottom: 1.5rem; box-shadow: 0 4px 15px var(--shadow); transition: background .3s, border-color .3s; }
.dcard h3 { font-family: 'Unbounded', sans-serif; font-size: .85rem; font-weight: 700; margin-bottom: 1.4rem; color: var(--text); text-transform: uppercase; letter-spacing: .06em; }

.grid-responsive { display: grid; gap: 1.5rem; }
.grid-cols-2 { grid-template-columns: 1fr 1fr; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ===== RID STATS ===== */
.rid-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.rid-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; text-align: center; transition: transform 0.2s; box-shadow: 0 4px 15px var(--shadow); }
.rid-stat-card:hover { transform: translateY(-5px); }
.rid-stat-icon { color: var(--accent); display: flex; justify-content: center; margin-bottom: 0.8rem; }
.rid-stat-val { font-family: 'Unbounded', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--text); display: block; line-height: 1.1; }
.rid-stat-lbl { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem; line-height: 1.3; display: block; }
.badge-pct { padding: 3px 8px; border-radius: 100px; font-size: .7rem; font-weight: 700; border: 1px solid var(--border); white-space: nowrap; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .8rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface2); color: var(--muted); font-weight: 700; font-size: .68rem; text-transform: uppercase; }
tr:hover td { background: rgba(0, 57, 166, 0.03); }
body.dark tr:hover td { background: rgba(79, 142, 247, 0.04); }

/* ===== CIT LINKS NEW DESIGN ===== */
.cit-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow);
}

.cit-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 15px rgba(0, 57, 166, 0.1);
  transform: translateY(-2px);
}

body.dark .cit-card:hover {
  background: rgba(96, 165, 250, 0.05);
}

.cit-content {
  flex-grow: 1;
  padding-right: 1.5rem;
}

.cit-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.cit-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.cit-authors {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.cit-desc {
  font-size: 0.8rem;
  color: var(--muted2);
  line-height: 1.5;
}

.cit-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 0;
  width: 130px; /* Фиксированная ширина для ровных плашек */
  flex-shrink: 0;
  background: var(--surface2);
}

.cit-stats-val {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.cit-stats-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== FOOTER ===== */
footer { text-align: center; padding: 3rem 1.5rem; background-color: #0F172A; color: var(--muted2); font-size: .8rem; margin: 0; line-height: 1.6; }
body.dark footer { background-color: #04070E; }

/* ===== MOBILE ===== */
@media(max-width:800px) {
  .grid-responsive.grid-cols-2, .grid-responsive.grid-cols-3 { grid-template-columns: 1fr !important; }
  .hero { padding: 3.5rem 1.2rem 3rem; }
  .hero h1 { white-space: nowrap !important; font-size: 6vw !important; letter-spacing: -0.03em !important; }
  .tab-section { padding: 1.5rem 0.75rem; }
  .nav-wrap { position: static; padding: 1rem; border-bottom: none; background: transparent !important; box-shadow: none; }
  .nav-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
  .nav-tab { padding: 0.85rem 0.5rem; font-size: 0.75rem; border: 1px solid var(--border) !important; border-radius: 10px; background: var(--surface); text-align: center; flex: 1 1 calc(33% - 0.5rem); justify-content: center; }
  .nav-tab.active { background: rgba(0, 57, 166, 0.05); border-color: var(--accent) !important; color: var(--accent); }
  body.dark .nav-tab.active { background: rgba(79, 142, 247, 0.06); }
  .rid-stats-grid { grid-template-columns: 1fr 1fr; }
  
  .cit-card { flex-direction: column; align-items: stretch; padding: 1.2rem; }
  .cit-content { padding-right: 0; margin-bottom: 1.5rem; }
  .cit-stats { flex-direction: row; justify-content: space-between; padding: 0.8rem 1.2rem; width: 100%; }
  .cit-stats-val { font-size: 1.4rem; margin-bottom: 0; }
  
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem 1rem; box-shadow: 0 2px 8px var(--shadow); }
  td { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid var(--border); text-align: right !important; gap: 1rem; }
  td:last-child { border-bottom: none; }
  
  .theme-toggle, .scroll-to-top { width: 44px; height: 44px; }
  .theme-toggle { bottom: 1rem; right: 1rem; }
  .scroll-to-top { bottom: 4.5rem; right: 1rem; }
  .lang-toggle, .home-btn { top: 1rem !important; padding: 0.3rem 0.6rem; font-size: 0.75rem; }
  .home-btn { left: 1rem !important; }
  .lang-toggle { right: 1rem !important; }
}
@media(max-width: 400px) { .hero h1 { font-size: 5.3vw !important; } }