﻿:root {
  /* --- Palette: Clean Technical Light --- */
  --bg: #FAFAFA; /* Чуть теплее белого, чтобы не резало глаз */
  --bg-dots: #E5E5E5;
  
  --text-main: #0a0a0a; /* Почти черный, максимальный контраст */
  --text-muted: #525252;
  --text-light: #A3A3A3;
  
  --accent: #111111;
  
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  
  --font-main: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spotlight Variables */
  --cursor-x: 0px;
  --cursor-y: 0px;

  /* Loading spinner */
  --loading-opacity: 0;
}

/* Dark Theme - Темний фон з білими точками (інверсія світлої теми) */
[data-theme="dark"] {
  --bg: #0F0F0F;
  --bg-dots: rgba(255, 255, 255, 0.15);
  --text-main: #EDEDED;
  --text-muted: #B0B0B0;
  --text-light: #6B6B6B;
  --accent: #F5F5F5;
  --card-bg: rgba(22, 22, 22, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg: #FAFAFA;
  --bg-dots: #E5E5E5;
  --text-main: #0a0a0a;
  --text-muted: #525252;
  --text-light: #A3A3A3;
  --accent: #111111;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

* { margin: 0; padding: 0; box-sizing: border-box; outline: none; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  /* Background Grid Pattern */
  background-image: 
    radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  transition: background-color 0.3s ease, color 0.3s ease, background-image 0.3s ease;
}

/* Додаткові стилі для темної теми - градієнт від темного до ще темнішого з білими точками */
[data-theme="dark"] body {
  background-image: 
    linear-gradient(135deg, #0F0F0F 0%, #080808 50%, #0F0F0F 100%),
    radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--text-main);
  color: var(--bg);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 0 0 4px 0;
}
.skip-link:focus {
  top: 0;
}

/* --- LAYOUT --- */
.page-wrapper {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 60px 20px 40px 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--card-border);
}

.logo {
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 60px;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-main);
}
.logo span { color: var(--text-light); font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex; justify-content: space-between; align-items: center;
  position: relative;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-main);
  background: var(--card-bg);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--card-border);
}
[data-theme="dark"] .nav-link.active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Active indicator dot */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px;
  background: var(--text-main);
  border-radius: 50%;
}

.badge {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600; 
  padding: 2px 6px; border-radius: 4px;
  background: var(--card-bg); 
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}
[data-theme="dark"] .badge {
  background: rgba(255, 255, 255, 0.05);
}

/* --- MAIN CONTENT --- */
.main { 
  flex: 1; 
  padding: 100px 60px 120px; 
  max-width: 900px; /* Немного шире для воздуха */
}

/* SECTIONS */
.section { margin-bottom: 140px; }
.section-head { margin-bottom: 32px; }

h1 {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--text-main);
  margin-bottom: 32px;
}

h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 8px; }

.subtitle { font-size: 16px; color: var(--text-muted); max-width: 500px; }

/* HERO */
.hero-text {
  font-size: 20px;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 40px;
  font-weight: 400;
}

.tags-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-pill {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
[data-theme="dark"] .tag-pill {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* --- CARDS (The Upgrade) --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 32px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s, opacity 0.6s ease, transform 0.6s ease;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(20px); /* Эффект матового стекла */
  -webkit-backdrop-filter: blur(20px);
  /* Initial state for animation */
  opacity: 0;
  transform: translateY(30px);
}

.card.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 32px rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.12);
  z-index: 10;
}
[data-theme="dark"] .card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 8px 16px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.12);
}

.card:active {
  transform: translateY(-4px) scale(1.01);
  transition: transform 0.1s;
}

/* Spotlight Glow */
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 24px;
  pointer-events: none;
  background: radial-gradient(600px circle at var(--cursor-x) var(--cursor-y), rgba(0,0,0,0.05), transparent 40%);
  opacity: 0; transition: opacity 0.3s;
  z-index: 1;
}
.card:hover::before { opacity: 1; }
[data-theme="dark"] .card::before {
  background: radial-gradient(600px circle at var(--cursor-x) var(--cursor-y), rgba(255,255,255,0.03), transparent 40%);
}

.card-inner { padding: 32px; position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; }

.card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }

/* Icons */
.icon-box {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden; /* Обмежує вихід іконок за межі */
  position: relative; /* Для позиціонування */
}
[data-theme="dark"] .icon-box {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Базові розміри іконок для світлої теми */
.icon-box img,
.icon-box svg {
  width: 96% !important;
  height: 96% !important;
  max-width: 96% !important;
  max-height: 96% !important;
  object-fit: contain;
  display: block;
}

/* Конкретні розміри для світлої теми - використовуємо alt атрибут для надійності */
.icon-box img[alt*="Currency Converter"] {
  width: 165% !important;
  height: 165% !important;
  max-width: 165% !important;
  max-height: 165% !important;
  object-fit: cover !important;
}

.icon-box img[alt*="Sudoku"] {
  width: 101% !important;
  height: 101% !important;
  max-width: 101% !important;
  max-height: 101% !important;
}

.icon-box img[alt*="3D Solar System"] {
  width: 102% !important;
  height: 102% !important;
  max-width: 102% !important;
  max-height: 102% !important;
}

/* Альтернативний селектор за src (на випадок) */
.icon-box img[src$="Currency Converter+.png"],
.icon-box img[src*="Currency Converter"] {
  width: 165% !important;
  height: 165% !important;
  max-width: 165% !important;
  max-height: 165% !important;
  object-fit: cover !important;
}

.icon-box img[src$="Sudoku.png"],
.icon-box img[src*="Sudoku.png"] {
  width: 101% !important;
  height: 101% !important;
  max-width: 101% !important;
  max-height: 101% !important;
}

.icon-box img[src$="SolarIcon.jpg"],
.icon-box img[src*="SolarIcon"] {
  width: 102% !important;
  height: 102% !important;
  max-width: 102% !important;
  max-height: 102% !important;
}

/* Збільшені іконки для темної теми - заповнюють простір */
[data-theme="dark"] .icon-box img[alt*="3D Solar System"] {
  width: 102% !important;
  height: 102% !important;
  max-width: 102% !important;
  max-height: 102% !important;
}

[data-theme="dark"] .icon-box img[alt*="Sudoku"] {
  width: 101% !important;
  height: 101% !important;
  max-width: 101% !important;
  max-height: 101% !important;
}

[data-theme="dark"] .icon-box img[alt*="Currency Converter"] {
  width: 165% !important;
  height: 165% !important;
  max-width: 165% !important;
  max-height: 165% !important;
  object-fit: cover !important;
}

/* Альтернативний селектор за src для темної теми */
[data-theme="dark"] .icon-box img[src$="SolarIcon.jpg"],
[data-theme="dark"] .icon-box img[src*="SolarIcon"] {
  width: 102% !important;
  height: 102% !important;
  max-width: 102% !important;
  max-height: 102% !important;
}

[data-theme="dark"] .icon-box img[src$="Sudoku.png"],
[data-theme="dark"] .icon-box img[src*="Sudoku.png"] {
  width: 101% !important;
  height: 101% !important;
  max-width: 101% !important;
  max-height: 101% !important;
}

[data-theme="dark"] .icon-box img[src$="Currency Converter+.png"],
[data-theme="dark"] .icon-box img[src*="Currency Converter"] {
  width: 165% !important;
  height: 165% !important;
  max-width: 165% !important;
  max-height: 165% !important;
  object-fit: cover !important;
}

.card:hover .icon-box {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}
[data-theme="dark"] .card:hover .icon-box {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.05);
}

/* Custom CSS Icons */
.ico-currency { font-weight: 800; font-family: var(--font-mono); font-size: 20px; color: #111; }
.ico-sudoku { 
  display: grid; grid-template-columns: 10px 10px; gap: 4px; 
}
.ico-sudoku div { width: 10px; height: 10px; background: #e5e5e5; border-radius: 2px;}
.ico-sudoku div.fill { background: #111; }

.ico-retro { font-weight: 800; letter-spacing: -1px; font-size: 18px; }

.card-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: var(--text-main); }
.card-desc { font-size: 15px; color: var(--text-muted); line-height: 1.5; margin-bottom: 24px; flex-grow: 1; }

.status-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 10px; border-radius: 100px;
  transition: all 0.3s ease;
}

.card:hover .status-badge {
  transform: scale(1.1);
}
.st-green { background: #ecfdf5; color: #047857; }
.st-gray { background: var(--card-bg); color: var(--text-muted); border: 1px solid var(--card-border); }
[data-theme="dark"] .st-green {
  background: rgba(16, 185, 129, 0.12);
  color: #5EEAD4;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-theme="dark"] .st-gray {
  background: rgba(255, 255, 255, 0.05);
  color: #B0B0B0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn-group { display: flex; gap: 12px; margin-top: auto; }

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

.btn-primary {
  background: var(--text-main); color: var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .btn-primary {
  background: #F0F0F0;
  color: #0F0F0F;
  box-shadow: 0 4px 16px rgba(240, 240, 240, 0.2);
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}
.btn-primary:hover:not(:disabled) { 
  transform: translateY(-2px) scale(1.05); 
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(240, 240, 240, 0.3);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(1);
  transition: transform 0.1s;
}
.btn-primary:disabled,
.btn-primary.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-ghost {
  background: var(--card-bg); color: var(--text-main);
  border: 1px solid var(--card-border);
  position: relative;
}
.btn-ghost:hover { 
  border-color: var(--text-main); 
  background: var(--card-bg);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-ghost:active {
  transform: translateY(0) scale(1);
  transition: transform 0.1s;
}

/* Social icons hover */
.social-icon {
  width: 40px; height: 40px; 
  display: flex; align-items: center; justify-content: center; 
  border-radius: 10px; background: var(--card-bg); 
  border: 1px solid var(--card-border); 
  transition: all 0.2s; 
  text-decoration: none;
  color: var(--text-main);
}
.social-icon:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--text-main);
  background: var(--card-bg);
}
[data-theme="dark"] .social-icon:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.06);
}

/* ABOUT UPGRADE */
.about-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px;
  position: relative;
}
.about-text { font-size: 18px; color: var(--text-main); margin-bottom: 24px; line-height: 1.7; }
.tech-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin-top: 32px; padding-top: 32px; border-top: 1px solid rgba(0,0,0,0.05);
}
.tech-item { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.tech-item span { font-weight: 700; color: var(--text-main); font-size: 14px; }

/* ROADMAP */
.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.roadmap-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.roadmap-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.02);
}
[data-theme="dark"] .roadmap-dot {
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.3);
}

.roadmap-content {
  flex: 1;
}

.roadmap-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.roadmap-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* GAME CONTAINER */
.game-container {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  position: relative;
}

.game-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 900px) {
  .game-container {
    height: 300px;
  }
}

/* PRIVACY MODAL */
.privacy-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.privacy-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Smooth overlay animation */
@media (prefers-reduced-motion: no-preference) {
  .privacy-modal-overlay {
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

.privacy-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9) translateY(10px);
  width: 90%;
  max-width: 800px;
  max-height: calc(90vh - 40px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease-out, top 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform, opacity;
}

.privacy-modal.active {
  transform: translate(-50%, -50%) scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Ensure modal stays within viewport */
@media (max-height: 600px) {
  .privacy-modal {
    top: 20px;
    transform: translate(-50%, 0) scale(0.9) translateY(10px);
    max-height: calc(100vh - 40px);
  }
  
  .privacy-modal.active {
    transform: translate(-50%, 0) scale(1) translateY(0);
  }
}

.privacy-modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.privacy-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.privacy-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.privacy-modal-close:hover {
  background: var(--card-border);
  transform: scale(1.1);
}

.privacy-modal-content {
  padding: 32px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  color: var(--text-main);
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}

/* Custom scrollbar for webkit browsers */
.privacy-modal-content::-webkit-scrollbar {
  width: 8px;
}

.privacy-modal-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

.privacy-modal-content::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.privacy-modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

[data-theme="dark"] .privacy-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .privacy-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .privacy-modal-content {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.privacy-modal-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.privacy-modal-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.privacy-modal-content p {
  margin-bottom: 16px;
  color: var(--text-muted);
}

.privacy-modal-content ul,
.privacy-modal-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-muted);
}

.privacy-modal-content li {
  margin-bottom: 8px;
}

.privacy-modal-content strong {
  color: var(--text-main);
  font-weight: 600;
}

.privacy-modal-content a {
  color: var(--text-main);
  text-decoration: underline;
}

.privacy-modal-content hr {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 24px 0;
}

@media (max-width: 900px) {
  .privacy-modal {
    width: calc(100% - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92) translateY(15px);
    margin: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  }
  
  .privacy-modal.active {
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
  
  .privacy-modal-header {
    padding: 18px 20px;
    flex-shrink: 0;
  }
  
  .privacy-modal-content {
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  .privacy-modal-title {
    font-size: 18px;
  }
  
  .privacy-modal-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
}

@media (max-width: 900px) and (max-height: 600px) {
  .privacy-modal {
    top: 10px;
    transform: translate(-50%, 0) scale(0.92) translateY(10px);
    max-height: calc(100vh - 20px);
  }
  
  .privacy-modal.active {
    transform: translate(-50%, 0) scale(1) translateY(0);
  }
}

@media (max-width: 480px) {
  .privacy-modal {
    width: calc(100% - 16px);
    max-width: calc(100vw - 16px);
    border-radius: 16px;
    margin: 8px;
  }
  
  .privacy-modal-header {
    padding: 16px 18px;
  }
  
  .privacy-modal-content {
    padding: 18px;
  }
  
  .privacy-modal-title {
    font-size: 16px;
  }
  
  .privacy-modal-content h1 {
    font-size: 22px;
  }
  
  .privacy-modal-content h2 {
    font-size: 18px;
  }
}

/* DONATE */
.donate-row {
  display: flex; flex-direction: column; gap: 12px;
  font-family: var(--font-mono); font-size: 13px;
}
.crypto-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 16px; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: all 0.2s;
  color: var(--text-main);
}
.crypto-box:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.crypto-box:active { transform: scale(0.98); }
.crypto-network {
  font-size: 11px; color: var(--text-muted); margin-left: 8px; font-weight: 400;
}

.copy-tooltip { font-size: 10px; font-weight: 700; color: #10b981; opacity: 0; transition: opacity 0.3s; }
.crypto-box.copied .copy-tooltip { opacity: 1; }

/* Theme Switcher - в правому нижньому куті */
.theme-switcher {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(10px);
  padding: 4px; border-radius: 100px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  display: flex; gap: 2px;
  transition: background 0.3s ease, border-color 0.3s ease;
}
[data-theme="dark"] .theme-switcher {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-color: var(--card-border);
}
.theme-btn {
  border: none; background: none; 
  font-size: 11px; font-weight: 700;
  padding: 8px 12px; border-radius: 20px; 
  color: var(--text-muted); cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  min-width: 32px;
}
.theme-btn:hover { 
  color: var(--text-main); 
}
.theme-btn.active { 
  background: var(--text-main); 
  color: var(--bg);
}

/* MOBILE MENU */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  position: relative;
}
.mobile-menu-toggle:hover {
  background: var(--card-border) !important;
}
[data-theme="dark"] .mobile-menu-toggle {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.mobile-menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-main) !important;
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
  margin: 2.5px 0;
  position: relative;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  padding: 80px 20px 40px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.mobile-nav.active {
  transform: translateX(0);
}

.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-nav .nav {
  flex-direction: column;
  gap: 8px;
}

.mobile-nav .nav-link {
  padding: 16px;
  font-size: 16px;
  border-radius: 12px;
}

/* Mobile Controls (Theme & Language in mobile menu) */
.mobile-controls {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-theme-switcher,
.mobile-lang-switcher {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 100px;
  border: 1px solid var(--card-border);
}
[data-theme="dark"] .mobile-theme-switcher,
[data-theme="dark"] .mobile-lang-switcher {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-theme-btn,
.mobile-lang-btn {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-theme-btn.active,
.mobile-lang-btn.active {
  background: var(--text-main);
  color: var(--bg);
}

.mobile-theme-btn:hover:not(.active),
.mobile-lang-btn:hover:not(.active) {
  color: var(--text-main);
}

/* LANG SWITCHER */
.lang-switcher {
  position: fixed; top: 24px; right: 24px; z-index: 100;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(10px);
  padding: 4px; border-radius: 100px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
}
[data-theme="dark"] .lang-switcher {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-color: var(--card-border);
}
.lang-btn {
  border: none; background: none; font-size: 11px; font-weight: 700;
  padding: 8px 16px; border-radius: 20px; color: var(--text-muted); cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-btn.active { 
  background: var(--text-main); 
  color: var(--bg);
}
[data-theme="dark"] .lang-btn.active {
  background: var(--text-main);
  color: var(--bg);
}

/* FOOTER */
.footer {
  padding-top: 40px; border-top: 1px solid var(--card-border);
  font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* RESPONSIVE */
/* Tablets */
@media (max-width: 1024px) {
  .page-wrapper { max-width: 100%; padding: 0 16px; }
  .sidebar { width: 220px; padding: 50px 16px 40px 0; }
  .main { padding: 80px 40px 100px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
}

/* Mobile and Small Tablets */
@media (max-width: 900px) {
  .page-wrapper { flex-direction: column; padding: 0; }
  .sidebar { 
    width: 100%; height: auto; position: sticky; top: 0; padding: 16px 20px; 
    border-right: none; border-bottom: 1px solid var(--card-border); 
    background: var(--card-bg); backdrop-filter: blur(10px); z-index: 50;
    flex-direction: row; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  [data-theme="dark"] .sidebar {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .logo { margin-bottom: 0; font-size: 18px; }
  .sidebar .nav { 
    display: none; 
  }
  .mobile-menu-toggle {
    display: flex;
  }
  .mobile-nav {
    display: block;
  }
  
  .main { padding: 30px 20px 60px; max-width: 100%; }
  h1 { font-size: 36px; line-height: 1.1; margin-bottom: 24px; }
  h2 { font-size: 24px; }
  .hero-text { font-size: 16px; margin-bottom: 24px; }
  .section { margin-bottom: 80px; }
  .section-head { margin-bottom: 24px; }
  .subtitle { font-size: 14px; }
  
  .grid { 
    grid-template-columns: 1fr; 
    gap: 20px; 
  }
  .card { border-radius: 20px; }
  .card-inner { padding: 24px; }
  .card-title { font-size: 18px; }
  .card-desc { font-size: 14px; margin-bottom: 20px; }
  
  .tags-row { gap: 6px; }
  .tag-pill { 
    font-size: 11px; 
    padding: 6px 10px; 
  }
  
  .about-card { padding: 28px 24px; border-radius: 20px; }
  .about-text { font-size: 16px; line-height: 1.6; }
  .tech-grid { 
    grid-template-columns: 1fr; 
    gap: 12px; 
    margin-top: 24px; 
    padding-top: 24px; 
  }
  
  .roadmap-item { gap: 12px; }
  .roadmap-title { font-size: 14px; }
  .roadmap-desc { font-size: 12px; }
  
  .btn-group { 
    flex-direction: column; 
    gap: 8px; 
    width: 100%; 
  }
  .btn { 
    width: 100%; 
    padding: 12px 18px; 
    font-size: 14px; 
  }
  
  .donate-row { gap: 10px; }
  .crypto-box { 
    padding: 14px; 
    font-size: 12px; 
  }
  
  .social-icon {
    width: 36px;
    height: 36px;
  }
  
  /* Mobile optimizations */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  
  /* Touch optimizations */
  .btn, .card, .privacy-modal-close, .mobile-menu-toggle {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
  }
  
  /* Prevent text size adjustment on iOS */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  /* Smooth scrolling on mobile */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Optimize animations for mobile */
  .card, .privacy-modal, .privacy-modal-overlay {
    will-change: transform, opacity;
  }
  
  /* CRITICAL: Hide desktop switchers on mobile - MUST be at the end of media query */
  html body .lang-switcher,
  html body .theme-switcher {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  /* CRITICAL: Ensure mobile menu toggle is visible and styled correctly */
  html body .mobile-menu-toggle {
    display: flex !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
  }
  html body .mobile-menu-toggle span {
    background: var(--text-main) !important;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  .main { padding: 20px 16px 50px; }
  .section { margin-bottom: 60px; }
  .card-inner { padding: 20px; }
  .about-card { padding: 24px 20px; }
  .icon-box { width: 48px; height: 48px; }
  .icon-box img { width: 36px !important; height: 36px !important; }
}
