/* Палитра «графит + янтарь»: нейтральные графитовые поверхности без
   синего оттенка и один акцент без градиентов. Акцент как ЗАЛИВКА —
   --accent с текстом --on-accent; акцент как ЦВЕТ ТЕКСТА — --accent-text
   (в светлой теме он темнее, иначе янтарь на белом не читается). */
:root {
  --bg-0: #121214;
  --bg-1: #161619;
  --bg-2: #1b1b1f;
  --bg-3: #232328;
  --bg-4: #2c2c31;
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --surface-active: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --text-primary: #eeeef0;
  --text-secondary: #a1a1a8;
  --text-muted: #75757d;
  --accent: #f5a524;
  --accent-hover: #f7b348;
  --accent-rgb: 245, 165, 36;
  --accent-text: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --accent-line: rgba(245, 165, 36, 0.4);
  --on-accent: #1d1405;
  --focus-ring: 0 0 0 3px rgba(245, 165, 36, 0.25);
  --success: #22c55e;
  /* Не жёлтый: иначе warning-тосты не отличить от акцента. */
  --warning: #fb923c;
  --danger: #ef4444;
  --info: #3b82f6;
  --font-body: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: var(--font-body);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  /* Spacing scale — components should prefer these over hard-coded pixels
     so density-slider and future rescaling stay coherent. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  /* Тени только функциональные (поповеры, модалки) — без цветного свечения. */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  /* Semi-opaque scrim used by card badges / floating overlays so buttons
     stay readable regardless of the underlying image. Одинаковый в обеих
     темах: подложка лежит на фото, а не на фоне страницы, а иконки и текст
     на ней всегда белые. */
  --overlay-scrim: rgba(0,0,0,0.5);
  --overlay-scrim-strong: rgba(0,0,0,0.7);
  --overlay-hairline: rgba(255,255,255,0.1);
  /* Явный список свойств вместо `all`: иначе анимировались размеры,
     font-size и прочее (подписи таб-бара «перетекали» при ресайзе). */
  --transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  --transition-slow: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, opacity 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
  --control-height: 40px;
}

/* Light theme overrides — only the variables that need to change. Anything
   that uses rgba() against a hard-coded dark color has to be re-declared
   here. The `data-theme="light"` attribute is set on <html> by the inline
   script in header.ejs before paint, so there's no FOUC. */
:root[data-theme="light"] {
  --bg-0: #f6f6f4;
  --bg-1: #ffffff;
  --bg-2: #efefec;
  --bg-3: #e6e6e2;
  --bg-4: #dadad5;
  --surface: rgba(0,0,0,0.03);
  --surface-hover: rgba(0,0,0,0.05);
  --surface-active: rgba(0,0,0,0.08);
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.16);
  --text-primary: #18181b;
  --text-secondary: #5c5c63;
  --text-muted: #8a8a91;
  --accent-hover: #e89611;
  --accent-text: #a15f00;
  --accent-soft: rgba(245, 165, 36, 0.18);
  --accent-line: rgba(200, 130, 10, 0.45);
  --focus-ring: 0 0 0 3px rgba(245, 165, 36, 0.35);
  --warning: #ea580c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

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

html {
  scroll-behavior: smooth;
}

/* Атрибут hidden должен побеждать display: flex/grid у компонентов. */
[hidden] {
  display: none !important;
}

/* Текст только для скринридеров. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

