@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light dark;
  --font: "Rubik", Inter, system-ui, sans-serif;
  --font-display: "Rubik", system-ui, sans-serif;
  --radius-control: 16px;
  --radius-pill: 999px;
  --radius-card: 20px;
  --radius-card-lg: 28px;
  --radius-badge: 8px;
  --page-padding: 24px;
  --header-height: 76px;
  --accent: #007cff;
  --accent-hover: #0066d6;
  --accent-text: #ffffff;
  --accent-negative: #fa8a64;
  --accent-pro: #ffe100;
  --accent-pro-text: #000000;
  --accent-promo: #27a44c;
  --accent-red: #ff0032;
}

@media (min-width: 768px) {
  :root {
    --page-padding: 34px;
  }
}

[data-theme="light"],
:root:not([data-theme="dark"]) {
  --bg-primary: #ffffff;
  --bg-elevated: #ffffff;
  --bg-lower: #eef1f5;
  --bg-toolbar: rgba(255, 255, 255, 0.92);
  --bg-secondary: rgba(127, 140, 153, 0.12);
  --text-primary: #12131a;
  --text-secondary: #626c77;
  --text-tertiary: #969fa8;
  --text-muted: var(--text-tertiary);
  --control-tertiary: rgba(127, 140, 153, 0.16);
  --control-tertiary-hover: rgba(127, 140, 153, 0.24);
  --border-subtle: rgba(127, 140, 153, 0.2);
  --card-bg: #ffffff;
  --card-bg-hover: #eef1f5;
  --search-bg: rgba(127, 140, 153, 0.12);
  --shadow-soft: 0 12px 37.9px rgba(41, 41, 41, 0.08);
  --shadow-header: 0 8px 28px rgba(18, 22, 26, 0.06);
  --logo-filter: none;
}

[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-elevated: #1a1b21;
  --bg-lower: #16171c;
  --bg-toolbar: rgba(26, 27, 33, 0.94);
  --bg-secondary: rgba(98, 108, 119, 0.25);
  --text-primary: #fafafa;
  --text-secondary: #969fa8;
  --text-tertiary: #626c77;
  --text-muted: var(--text-tertiary);
  --control-tertiary: rgba(127, 140, 153, 0.35);
  --control-tertiary-hover: rgba(127, 140, 153, 0.48);
  --border-subtle: rgba(127, 140, 153, 0.35);
  --card-bg: #1a1b21;
  --card-bg-hover: #252730;
  --search-bg: rgba(98, 108, 119, 0.25);
  --shadow-soft: 0 12px 37.9px rgba(41, 41, 41, 0.08);
  --shadow-header: 0 8px 24px rgba(0, 0, 0, 0.32);
  --logo-filter: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg-primary: #000000;
    --bg-elevated: #1a1b21;
    --bg-lower: #16171c;
    --bg-toolbar: rgba(26, 27, 33, 0.94);
    --bg-secondary: rgba(98, 108, 119, 0.25);
    --text-primary: #fafafa;
    --text-secondary: #969fa8;
    --text-tertiary: #626c77;
    --control-tertiary: rgba(127, 140, 153, 0.35);
    --control-tertiary-hover: rgba(127, 140, 153, 0.48);
    --border-subtle: rgba(127, 140, 153, 0.35);
    --card-bg: #1a1b21;
    --card-bg-hover: #252730;
    --search-bg: rgba(98, 108, 119, 0.25);
    --shadow-soft: 0 12px 37.9px rgba(41, 41, 41, 0.08);
    --shadow-header: 0 8px 24px rgba(0, 0, 0, 0.32);
  }
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 0 0 48px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-header);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
  padding: 12px var(--page-padding);
}

.topbar__cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__cluster--left {
  justify-content: flex-start;
}

.topbar__cluster--right {
  justify-content: flex-end;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 0;
}

.topbar__brand-logo {
  display: block;
  height: 60px;
  width: auto;
  max-width: min(194px, 42vw);
  object-fit: contain;
}

.topbar__brand-logo--light {
  display: none;
}

[data-theme="light"] .topbar__brand-logo--dark,
:root:not([data-theme="dark"]) .topbar__brand-logo--dark {
  display: none;
}

[data-theme="light"] .topbar__brand-logo--light,
:root:not([data-theme="dark"]) .topbar__brand-logo--light {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .topbar__brand-logo--dark {
    display: none;
  }

  :root:not([data-theme="dark"]) .topbar__brand-logo--light {
    display: block;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar__brand-logo--dark {
    display: block;
  }

  :root:not([data-theme="light"]) .topbar__brand-logo--light {
    display: none;
  }
}

[data-theme="dark"] .topbar__brand-logo--dark {
  display: block;
}

[data-theme="dark"] .topbar__brand-logo--light {
  display: none;
}

.topbar__icon-btn,
.topbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--control-tertiary);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.topbar__icon-btn {
  width: 44px;
  min-width: 44px;
  padding: 10px;
}

.topbar__icon-btn svg,
.topbar__icon-svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.topbar__icon-svg path[fill="currentColor"] {
  fill: currentColor;
  stroke: none;
}

.topbar__icon-btn img,
.topbar__btn-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
}

.topbar__btn-icon--brand,
.lang-switcher__flag {
  filter: none !important;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.topbar__btn--whats-new {
  gap: 8px;
  padding-inline: 10px 14px;
}

.topbar__btn--whats-new .topbar__btn-icon--brand {
  display: block;
}

.topbar__btn:hover,
.topbar__icon-btn:hover {
  background: var(--control-tertiary-hover);
}

.topbar__btn--accent {
  background: var(--accent);
  color: var(--accent-text);
}

.topbar__btn--accent:hover {
  background: var(--accent-hover);
}

.topbar__btn--ghost {
  background: var(--control-tertiary);
}

.topbar__btn--pro {
  background: var(--accent-pro);
  color: var(--accent-pro-text);
}

.topbar__btn--pro:hover {
  filter: brightness(0.96);
}

.topbar__brand-logo {
  height: 60px;
}

.topbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: var(--page-padding);
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}

.topbar-menu.is-open {
  display: flex;
}

.topbar-menu .topbar__btn {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
}

.topbar__cluster--left {
  position: relative;
}

.header-toolbar {
  display: grid;
  gap: 12px;
  padding: 0 var(--page-padding) 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-toolbar);
  backdrop-filter: blur(16px);
}

.header-toolbar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1 1 280px;
  min-width: 0;
}

.search input {
  width: 100%;
  height: 52px;
  padding: 0 20px 0 48px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--search-bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(69, 182, 252, 0.18);
}

.search::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 999px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  top: calc(50% + 5px);
  left: 31px;
  width: 8px;
  height: 2px;
  background: var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.site-nav {
  overflow: hidden;
}

.line__items {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.line__items::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.is-active {
  background: var(--control-tertiary);
  color: var(--text-primary);
}

.platform-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 32px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}

.platform-switcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.platform-switcher__btn img {
  width: 32px;
  height: 32px;
}

.platform-switcher__btn.is-active {
  background: var(--accent);
  color: var(--accent-text);
}

.platform-switcher__btn.is-active img {
  filter: brightness(0) invert(1);
}

.platform-switcher__btn[data-platform="all"] {
  width: auto;
  min-width: 56px;
  padding-inline: 16px;
  font-size: 14px;
  font-weight: 500;
}

/* Убран глобальный filter — он ломал флаг и иконку огня */

#themeToggle svg,
#themeToggle svg * {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#themeToggle .topbar__icon-svg--theme {
  width: 24px;
  height: 24px;
}

.toast {
  position: fixed;
  top: calc(var(--gallery-header-stack, 132px) + 16px);
  right: 24px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 48px));
  padding: 12px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.app {
  width: 100%;
  margin: 24px 0 0;
  padding: 0 var(--page-padding);
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding-inline: 16px;
  }

  .topbar__btn-text--long {
    display: none;
  }

  .topbar__btn--whats-new .topbar__btn-icon {
    margin: 0;
  }

  .header-toolbar.is-collapsed {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar__btn--accent .topbar__btn-text--long {
    display: none;
  }

  .topbar__btn--accent .topbar__btn-text:not(.topbar__btn-text--long) {
    display: inline;
  }

  .topbar__btn--accent {
    min-width: 52px;
    padding-inline: 14px;
  }
}

.topbar__btn--accent .topbar__btn-text:not(.topbar__btn-text--long) {
  display: none;
}
