/* Голосование Rureef.ru — в стиле tools.rureef.ru */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #4a6fa5;
  --primary-light: #6b8cbe;
  --accent: #7eb8da;
  --aqua: #5ba3b0;
  --bg: #f4f5f6;
  --card: #fafbfc;
  --text: #374151;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #4caf50;
  --warning: #d97706;
  --danger: #dc2626;
  --coral: #e07a7a;
  --coral-pink: #e07a7a;
  --text-medium: var(--text-light);
  --bubble: rgba(74, 111, 165, 0.08);
  --transition: all 0.3s ease;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --touch-min: 44px;
}

[data-theme="dark"] {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --border: #334155;
  --bubble: rgba(30, 58, 138, 0.2);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --coral: #f87171;
}

html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
}

.bubbles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.bubble {
  position: absolute;
  bottom: -100px;
  border-radius: 50%;
  background: var(--bubble);
  box-shadow: 0 0 8px var(--aqua);
  animation: rise 15s infinite ease-in;
}
@keyframes rise {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-100vh) scale(1.2); opacity: 0; }
}
.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 40px;
  background: radial-gradient(circle at 10% 50%, transparent 45%, var(--aqua) 50%),
    radial-gradient(circle at 30% 50%, transparent 45%, var(--aqua) 50%),
    radial-gradient(circle at 50% 50%, transparent 45%, var(--aqua) 50%),
    radial-gradient(circle at 70% 50%, transparent 45%, var(--aqua) 50%),
    radial-gradient(circle at 90% 50%, transparent 45%, var(--aqua) 50%);
  background-size: 20% 100%;
  animation: wave 8s linear infinite;
  opacity: 0.12;
}
[data-theme="dark"] .wave { opacity: 0.2; }
@keyframes wave {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-switchers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.switchers-lang {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-switchers .nav-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 4px 0;
}
.page-switchers .nav-link:hover { text-decoration: underline; }
[data-theme="dark"] .page-switchers .nav-link { color: var(--aqua); }
.lang-link { padding: 4px 8px; border-radius: 8px; }
.lang-link.is-active { color: var(--primary); font-weight: 700; }
[data-theme="dark"] .lang-link.is-active { color: var(--aqua); }
.lang-sep { color: var(--border); user-select: none; margin: 0 2px; }

.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.theme-icon {
  font-size: 1rem;
  color: var(--text-light);
  pointer-events: none;
}
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: inline-block; color: var(--aqua); }

.theme-toggle {
  background: var(--card);
  border: 1px solid var(--border);
  width: 52px;
  height: 26px;
  border-radius: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.3s;
}
[data-theme="dark"] .toggle-thumb {
  transform: translateX(26px);
  background: #94a3b8;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header {
  text-align: center;
  padding: 12px 0 14px;
  position: relative;
  flex-shrink: 0;
}
.logo { font-size: 1.85rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
[data-theme="dark"] .logo { color: var(--aqua); }
.subtitle { font-size: 1rem; color: var(--text-light); max-width: 560px; margin: 0 auto; line-height: 1.35; }
.protection-badge {
  display: inline-block;
  background: var(--accent);
  color: #2c5282;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 6px;
}
[data-theme="dark"] .protection-badge { color: #e3f2fd; }

/* ——— Вкладки ——— */
.tabs {
  display: flex;
  gap: 8px;
  background: var(--card);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  min-height: var(--touch-min);
  padding: 12px 14px;
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.tab:hover { color: var(--primary); background: var(--border); }
[data-theme="dark"] .tab:hover { color: var(--aqua); }
.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
[data-theme="dark"] .tab.active { background: var(--aqua); border-color: var(--aqua); color: #0f172a; }
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ——— Контент: карточки и голосование ——— */
.golos-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.card:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
[data-theme="dark"] .card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.card.intro {
  background: linear-gradient(135deg, rgba(74, 111, 165, 0.06) 0%, rgba(91, 163, 176, 0.04) 100%);
  border-left: 4px solid var(--coral);
}
[data-theme="dark"] .card.intro { background: linear-gradient(135deg, rgba(30, 58, 138, 0.15) 0%, rgba(59, 130, 246, 0.08) 100%); border-left-color: var(--coral); }
.intro-note { color: var(--coral); font-weight: 600; }
.submit-count { margin-top: 14px; color: var(--text-light); }
.selected-num { color: var(--coral); font-weight: 700; }
.submit-note { font-size: 0.9rem; color: var(--text-light); margin-top: 10px; }

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-icon {
  width: 40px;
  height: 40px;
  margin-right: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
[data-theme="dark"] .section-icon { background: var(--aqua); color: #0f172a; }
.section-header h2 { font-size: 1.25rem; color: var(--primary); font-weight: 700; }
[data-theme="dark"] .section-header h2 { color: var(--aqua); }
.section-description { font-size: 0.95rem; color: var(--text-light); line-height: 1.5; margin-bottom: 14px; }

.category {
  background: rgba(74, 111, 165, 0.04);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
[data-theme="dark"] .category { background: rgba(30, 58, 138, 0.1); }
.category-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
[data-theme="dark"] .category-title { color: var(--aqua); }

.vote-item {
  margin-bottom: 10px;
  padding: 12px 14px;
  min-height: var(--touch-min);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}
.vote-item:hover { border-color: var(--primary); }
[data-theme="dark"] .vote-item:hover { border-color: var(--aqua); }
.vote-item.selected {
  border-color: var(--coral);
  background: rgba(224, 122, 122, 0.08);
}
.vote-item input[type="checkbox"] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--coral);
  cursor: pointer;
  flex-shrink: 0;
}
.vote-item label {
  flex-grow: 1;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  font-size: 1rem;
  margin: 0;
  user-select: text;
}
.vote-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
  padding-left: 34px;
  font-style: italic;
  line-height: 1.4;
}
.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}
[data-theme="dark"] .counter { background: var(--aqua); color: #0f172a; }

.submit-section {
  text-align: center;
  margin: 24px 0;
  padding: 20px;
  border-radius: 14px;
  background: rgba(74, 111, 165, 0.05);
  border: 2px dashed var(--border);
}
#submitBtn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 32px;
  min-height: var(--touch-min);
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow);
}
#submitBtn:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-2px);
}
[data-theme="dark"] #submitBtn { background: var(--aqua); color: #0f172a; }
[data-theme="dark"] #submitBtn:hover:not(:disabled) { background: #7eb8da; }
#submitBtn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

.total-votes {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text);
  margin: 14px 0 18px;
  padding: 14px;
  background: rgba(74, 111, 165, 0.06);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 600;
}
.total-votes span { color: var(--coral); font-size: 1.3rem; font-weight: 700; }
.results-container { margin-top: 12px; }
.result-item {
  margin-bottom: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.result-item:hover { border-color: var(--primary); }
.result-bar-container {
  flex-grow: 1;
  min-width: 60px;
  margin-left: 10px;
  height: 28px;
  background: var(--bg);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.result-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--primary));
  border-radius: 14px;
  min-width: 32px;
  transition: width 1s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
[data-theme="dark"] .result-bar { background: linear-gradient(90deg, var(--coral), var(--aqua)); }
.result-count { min-width: 44px; text-align: right; font-weight: 700; color: var(--primary); font-size: 1.1rem; }
[data-theme="dark"] .result-count { color: var(--aqua); }
.result-percentage { min-width: 48px; text-align: right; font-weight: 700; color: var(--coral); font-size: 1rem; }

.chart-container { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 16px; }
.chart-box {
  flex: 1;
  min-width: 260px;
  padding: 18px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.chart-title {
  text-align: center;
  color: var(--primary);
  margin-bottom: 14px;
  font-size: 1.15rem;
  font-weight: 700;
}
[data-theme="dark"] .chart-title { color: var(--aqua); }
.top-list { list-style: none; padding: 0; margin: 0; }
.top-list li {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg);
  border-left: 4px solid var(--coral);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  transition: var(--transition);
}
.top-list li:hover { border-color: var(--primary); }
.top-list .rank { font-weight: 700; color: var(--primary); font-size: 1rem; min-width: 32px; }
[data-theme="dark"] .top-list .rank { color: var(--aqua); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.stat-card {
  background: rgba(74, 111, 165, 0.06);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
[data-theme="dark"] .stat-card { background: rgba(30, 58, 138, 0.15); }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--coral); margin: 6px 0; text-align: center; }
.stat-label { color: var(--text-light); font-size: 0.85rem; text-align: center; }

.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  background: var(--success);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
  z-index: 1000;
  animation: notifIn 0.3s ease;
  max-width: min(380px, calc(100vw - 24px));
  font-weight: 600;
  font-size: 0.95rem;
}
.notification.error { background: var(--danger); }
.notification.warning { background: var(--warning); }
@keyframes notifIn {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

footer {
  position: relative;
  z-index: 10001;
  text-align: center;
  padding: 12px 16px;
  padding-bottom: calc(14px + var(--safe-bottom));
  font-size: 0.85rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  margin-top: auto;
  flex-shrink: 0;
  line-height: 1.5;
}
footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
}
footer a:hover { text-decoration: underline; }
[data-theme="dark"] footer a { color: var(--aqua); }
.footer-line {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: break-word;
}
.footer-social-btn {
  display: inline;
  padding: 2px 6px;
  background: transparent;
  color: var(--primary) !important;
  font-weight: 600;
  font-size: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  border-radius: 4px;
  pointer-events: auto;
  white-space: nowrap;
  vertical-align: baseline;
}
.footer-social-btn:hover {
  text-decoration: underline;
  background: rgba(0, 136, 204, 0.1);
}
.footer-social-btn .fab {
  margin-right: 4px;
  font-size: 1em;
  vertical-align: -0.1em;
}
[data-theme="dark"] .footer-social-btn { color: var(--aqua) !important; }
[data-theme="dark"] .footer-social-btn:hover { background: rgba(0, 136, 204, 0.15); }
.footer-main-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
}
.footer-main-link:hover { text-decoration: underline; }
[data-theme="dark"] .footer-main-link { color: var(--aqua); }

#protection-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 9998;
  pointer-events: none;
}
#protection-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--danger);
  color: #fff;
  padding: 20px 36px;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  z-index: 10000;
  display: none;
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.4);
  animation: pulse 0.5s;
  text-align: center;
  max-width: 90%;
}
@keyframes pulse {
  from { transform: translate(-50%, -50%) scale(0.95); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Мобильная версия */
@media (max-width: 768px) {
  .container { padding: 0 14px; }
  header { padding: 8px 0 10px; }
  .logo { font-size: 1.5rem; }
  .subtitle { font-size: 0.9rem; }
  .page-switchers { padding-top: calc(8px + var(--safe-top)); padding-bottom: 6px; }
  .switchers-lang { gap: 6px; }
  .footer-line { font-size: 0.8rem; }
  .tab { padding: 10px 12px; font-size: 0.9rem; }
  .card { padding: 14px 12px; }
  .vote-item { padding: 10px 12px; }
  .vote-desc { padding-left: 0; margin-left: 34px; }
  .result-item { flex-direction: column; align-items: stretch; }
  .result-bar-container { margin-left: 0; width: 100%; }
  .result-count, .result-percentage { align-self: flex-end; }
  #submitBtn { width: 100%; max-width: 280px; padding: 12px 24px; font-size: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .logo { font-size: 1.35rem; }
  .protection-badge { font-size: 0.75rem; padding: 3px 8px; }
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] button:focus-visible {
  outline-color: var(--aqua);
}
