:root {
  --bg: #f4f7fb;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #7c3aed;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --header-h: 72px;
}

.theme-dark,
html[data-scheme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --card: #111827;
  --text: #f8fafc;
  --text-soft: #e2e8f0;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-dark: #0284c7;
  --primary-soft: rgba(56, 189, 248, 0.12);
  --border: #243244;
  --border-soft: #1e293b;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

html[data-scheme="dark"] body.theme-green {
  --primary-soft: rgba(5, 150, 105, 0.18);
}

html[data-scheme="light"] {
  color-scheme: light;
}

.theme-green {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-soft: #ecfdf5;
  --accent: #0d9488;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

.container {
  width: min(1140px, 92%);
  margin-inline: auto;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.section { padding: 5rem 0; }
.section.compact-top { padding-top: 0; }
.section.compact-y { padding-top: 0; padding-bottom: 0; }

.section-head {
  max-width: 640px;
  margin-bottom: 2.5rem;
}

.section-head.centered {
  margin-inline: auto;
  text-align: center;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.section-head h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-soft);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-toggle:active:not(:disabled) {
  transform: scale(0.94);
}

.theme-toggle:disabled {
  cursor: wait;
  opacity: 0.85;
}

.theme-toggle.is-animating svg {
  animation: theme-icon-spin 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes theme-icon-spin {
  0% { transform: rotate(0deg) scale(1); }
  45% { transform: rotate(200deg) scale(0.85); }
  100% { transform: rotate(360deg) scale(1); }
}

html.theme-transitioning :not(.theme-transition-overlay):not(.theme-transition-overlay *) {
  transition:
    background-color 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    fill 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    stroke 0.75s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.theme-transition-overlay {
  position: fixed;
  z-index: 9999;
  width: 200vmax;
  height: 200vmax;
  margin-left: -100vmax;
  margin-top: -100vmax;
  left: var(--theme-x, 50vw);
  top: var(--theme-y, 50vh);
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease;
}

.theme-transition-overlay.is-expanding {
  transform: scale(1);
  opacity: var(--theme-overlay-opacity, 0.32);
}

.theme-transition-overlay.is-fading {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle.is-animating svg {
    animation: none;
  }

  .theme-transition-overlay {
    display: none !important;
  }
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon {
  fill: currentColor;
  stroke: none;
}

.theme-toggle .icon-sun {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-scheme="light"] .theme-toggle .icon-sun { display: none; }
html[data-scheme="light"] .theme-toggle .icon-moon { display: block; }
html[data-scheme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-scheme="dark"] .theme-toggle .icon-moon { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff !important;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn.outline { background: transparent; color: var(--primary) !important; border: 1px solid var(--primary); }
.btn.outline:hover { background: var(--primary-soft); transform: none; }
.btn.small { font-size: 0.85rem; padding: 8px 12px; }
.btn.danger { background: var(--danger); }

label { display: grid; gap: 6px; margin: 10px 0; font-weight: 700; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}

.alert.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

html[data-scheme="dark"] .alert,
.theme-dark .alert {
  background: rgba(220, 38, 38, 0.14);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

html[data-scheme="dark"] .alert.success,
.theme-dark .alert.success {
  background: rgba(22, 163, 74, 0.16);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
}

.preview-banner, .flash-banner {
  padding: 10px 16px;
  text-align: center;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
}

.preview-back {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.flash-banner { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flash-banner.success, .preview-banner.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

html[data-scheme="dark"] .preview-banner,
html[data-scheme="dark"] .flash-banner,
.theme-dark .preview-banner,
.theme-dark .flash-banner {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
}

html[data-scheme="dark"] .flash-banner.success,
html[data-scheme="dark"] .preview-banner.success,
.theme-dark .flash-banner.success,
.theme-dark .preview-banner.success {
  background: rgba(22, 163, 74, 0.16);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
}

.hp-field { position: absolute; left: -9999px; height: 0; width: 0; opacity: 0; }
.turnstile-wrap { margin: 4px 0 8px; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.error-page {
  min-height: 50vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.error-page img { max-width: 320px; margin: 0 auto 1.5rem; opacity: 0.9; }

.pagination { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.pagination .btn.active { background: var(--primary-dark); }

.grid-2 { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 32px; align-items: center; }

.panel,
.auth-card,
.stats article,
.card-modern {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}


.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hidden { display: none !important; }
