/**
 * Premium ambient ASMR — кнопка в шапке главных ЕГЭ/ОГЭ
 */

.home-ambient-widget {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  z-index: 120;
}

.home-ambient-widget--header {
  align-self: center;
}

.home-ambient-widget--footer {
  align-self: center;
}

.home-ambient-widget--footer .home-ambient-panel {
  top: auto;
  bottom: calc(100% + 0.45rem);
  animation: home-ambient-panel-up 0.28s ease-out;
}

@keyframes home-ambient-panel-up {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.footer-home-bar {
  position: relative;
  z-index: 15;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  background: transparent;
  border-top: none;
}

.page--home .footer-home-bar {
  height: var(--home-footer-bar-height);
  min-height: var(--home-footer-bar-height);
  max-height: var(--home-footer-bar-height);
}

[data-theme="light"] .footer-home-bar {
  background: transparent;
}

.footer-home-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 42rem;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}

/* Единый премиальный pill-бар: Ритмы мозга · Вход · Регистрация · VK · TG */
.footer-home-bar__cluster {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.22rem;
  padding: 0.22rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 16, 22, 0.58);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[data-theme="light"] .footer-home-bar__cluster {
  border-color: rgba(5, 184, 125, 0.16);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(248, 252, 250, 0.9) 100%
  );
  box-shadow:
    0 6px 22px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.footer-home-bar__sep {
  flex-shrink: 0;
  width: 1px;
  height: 1.35rem;
  margin: 0 0.08rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 100%
  );
}

[data-theme="light"] .footer-home-bar__sep {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(15, 23, 42, 0.12) 50%,
    transparent 100%
  );
}

.footer-home-bar__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 1.85rem;
  padding: 0.42rem 0.82rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  color: var(--white);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}

.footer-home-bar__chip:hover {
  transform: translateY(-1px);
}

.footer-home-bar__chip--ghost {
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.footer-home-bar__chip--ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .footer-home-bar__chip--ghost {
  color: rgba(15, 23, 42, 0.78);
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.03);
}

[data-theme="light"] .footer-home-bar__chip--ghost:hover {
  color: var(--text-color, #0f172a);
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.06);
}

.footer-home-bar__chip--primary {
  color: #ecfdf5;
  border-color: rgba(110, 231, 183, 0.72);
  background: linear-gradient(
    165deg,
    rgba(5, 184, 125, 0.62) 0%,
    rgba(16, 185, 129, 0.42) 52%,
    rgba(5, 184, 125, 0.24) 100%
  );
  box-shadow:
    0 4px 16px rgba(5, 184, 125, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.footer-home-bar__chip--primary:hover {
  border-color: rgba(110, 231, 183, 0.88);
  box-shadow:
    0 6px 20px rgba(5, 184, 125, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

[data-theme="light"] .footer-home-bar__chip--primary {
  color: #064e3b;
  border-color: rgba(5, 184, 125, 0.45);
  background: linear-gradient(165deg, #05b87d 0%, #04a070 100%);
  box-shadow: 0 4px 14px rgba(5, 184, 125, 0.22);
}

.footer-home-bar__chip--icon {
  width: 1.85rem;
  min-width: 1.85rem;
  padding: 0.42rem;
}

.footer-home-bar__chip-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}

.footer-home-bar__chip--vk {
  border-color: rgba(76, 139, 245, 0.28);
  background: rgba(76, 139, 245, 0.08);
}

.footer-home-bar__chip--vk:hover {
  border-color: rgba(76, 139, 245, 0.5);
  background: rgba(76, 139, 245, 0.16);
  box-shadow: 0 4px 14px rgba(76, 139, 245, 0.2);
}

.footer-home-bar__chip--tg {
  border-color: rgba(42, 171, 238, 0.28);
  background: rgba(42, 171, 238, 0.08);
}

.footer-home-bar__chip--tg:hover {
  border-color: rgba(42, 171, 238, 0.5);
  background: rgba(42, 171, 238, 0.16);
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.2);
}

/* «Ритмы мозга» — тот же chip внутри кластера */
.footer-home-bar .home-ambient-widget {
  position: relative;
  display: inline-flex;
  align-self: center;
}

.footer-home-bar .home-ambient {
  gap: 0.35rem;
  padding: 0.42rem 0.82rem 0.42rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(5, 184, 125, 0.38);
  background: rgba(5, 184, 125, 0.1);
  color: rgba(236, 253, 245, 0.95);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

[data-theme="light"] .footer-home-bar .home-ambient {
  color: #065f46;
  border-color: rgba(5, 184, 125, 0.28);
  background: rgba(5, 184, 125, 0.08);
  box-shadow: none;
}

.footer-home-bar .home-ambient:hover {
  transform: translateY(-1px);
  border-color: rgba(5, 184, 125, 0.52);
  background: rgba(5, 184, 125, 0.16);
  box-shadow: 0 4px 14px rgba(5, 184, 125, 0.18);
}

.footer-home-bar .home-ambient[aria-expanded="true"] {
  border-color: rgba(110, 231, 183, 0.72);
  background: linear-gradient(
    165deg,
    rgba(5, 184, 125, 0.5) 0%,
    rgba(16, 185, 129, 0.32) 100%
  );
  box-shadow:
    0 4px 16px rgba(5, 184, 125, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.footer-home-bar .home-ambient--sea,
.footer-home-bar .home-ambient--rain,
.footer-home-bar .home-ambient--forest,
.footer-home-bar .home-ambient--music {
  border-color: rgba(5, 184, 125, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.footer-home-bar .home-ambient__icon {
  font-size: 0.95rem;
}

.footer-home-bar .home-ambient-panel {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.home-ambient {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.42rem 0.72rem 0.42rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(5, 184, 125, 0.32);
  background: linear-gradient(
    165deg,
    rgba(22, 28, 36, 0.9) 0%,
    rgba(14, 18, 24, 0.94) 100%
  );
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.18s ease,
    background 0.22s ease;
}

[data-theme="light"] .home-ambient {
  border-color: rgba(5, 184, 125, 0.24);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(245, 252, 249, 0.92) 100%
  );
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.home-ambient:hover {
  transform: translateY(-2px);
  border-color: rgba(5, 184, 125, 0.52);
  box-shadow: 0 10px 28px rgba(5, 184, 125, 0.16);
}

.home-ambient[aria-expanded="true"] {
  border-color: rgba(5, 184, 125, 0.55);
  box-shadow:
    0 10px 28px rgba(5, 184, 125, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.home-ambient__icon {
  display: none;
  font-size: 1rem;
  line-height: 1;
}

.home-ambient--off .home-ambient__icon--off,
.home-ambient--sea .home-ambient__icon--sea,
.home-ambient--rain .home-ambient__icon--rain,
.home-ambient--forest .home-ambient__icon--forest,
.home-ambient--music .home-ambient__icon--music {
  display: block;
}

.home-ambient--sea {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.2);
}

.home-ambient--rain {
  border-color: rgba(148, 163, 184, 0.5);
  box-shadow: 0 8px 24px rgba(100, 116, 139, 0.18);
}

.home-ambient--forest {
  border-color: rgba(74, 222, 128, 0.42);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.16);
}

.home-ambient--music {
  border-color: rgba(192, 132, 252, 0.45);
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.2);
}

.home-ambient-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(17.5rem, calc(100vw - 1.5rem));
  padding: 0.85rem 0.85rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(
    165deg,
    rgba(18, 24, 32, 0.96) 0%,
    rgba(10, 14, 20, 0.98) 100%
  );
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: home-ambient-panel-in 0.28s ease-out;
}

[data-theme="light"] .home-ambient-panel {
  border-color: rgba(15, 23, 42, 0.08);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.97) 0%,
    rgba(248, 250, 252, 0.95) 100%
  );
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

@keyframes home-ambient-panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.home-ambient-panel__title {
  margin: 0 0 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

[data-theme="light"] .home-ambient-panel__title {
  color: rgba(15, 23, 42, 0.45);
}

.home-ambient-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.home-ambient-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-height: 4.1rem;
  padding: 0.55rem 0.4rem;
  border-radius: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--white);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}

[data-theme="light"] .home-ambient-scene {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.03);
  color: var(--text-color, #0f172a);
}

.home-ambient-scene:hover {
  transform: translateY(-1px);
}

.home-ambient-scene__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.home-ambient-scene__name {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.home-ambient-scene--sea:hover,
.home-ambient-scene--sea[aria-pressed="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.18);
}

.home-ambient-scene--rain:hover,
.home-ambient-scene--rain[aria-pressed="true"] {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(100, 116, 139, 0.14);
  box-shadow: 0 6px 18px rgba(100, 116, 139, 0.16);
}

.home-ambient-scene--forest:hover,
.home-ambient-scene--forest[aria-pressed="true"] {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.14);
}

.home-ambient-scene--music:hover,
.home-ambient-scene--music[aria-pressed="true"] {
  border-color: rgba(192, 132, 252, 0.55);
  background: rgba(168, 85, 247, 0.12);
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.18);
}

.home-ambient-panel__off {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.48rem 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

[data-theme="light"] .home-ambient-panel__off {
  border-color: rgba(15, 23, 42, 0.1);
  color: rgba(15, 23, 42, 0.55);
}

.home-ambient-panel__off:hover {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .home-ambient-panel__off:hover {
  color: var(--text-color, #0f172a);
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.04);
}

.page--oge-home .home-ambient--sea {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.18);
}

.page--oge-home .home-ambient-scene--sea[aria-pressed="true"],
.page--oge-home .home-ambient-scene--sea:hover {
  border-color: rgba(45, 212, 191, 0.55);
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.16);
}

[data-palette="pink"] .page--home .page-home-bottom {
  border-top-color: var(--accent-border);
}

[data-palette="pink"] .footer-home-bar__cluster {
  border-color: var(--accent-border);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-palette="pink"] .footer-home-bar__chip--primary,
[data-palette="pink"] .footer-home-bar .home-ambient[aria-expanded="true"] {
  border-color: var(--accent-border-strong);
  box-shadow: 0 4px 16px var(--accent-glow);
}

[data-palette="pink"] .home-ambient,
[data-palette="pink"] .home-ambient-panel {
  border-color: var(--accent-border);
}

[data-palette="pink"] .home-ambient--sea,
[data-palette="pink"] .home-ambient--rain,
[data-palette="pink"] .home-ambient--forest,
[data-palette="pink"] .home-ambient--music {
  border-color: var(--accent-border-strong);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.header--home .home-ambient {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .header--home .home-ambient {
  border-color: rgba(5, 184, 125, 0.18);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.header--home .home-ambient:hover {
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .header--home .home-ambient__label,
  .home-ambient-widget--header .home-ambient__label {
    display: none;
  }

  .header--home .home-ambient,
  .home-ambient-widget--header .home-ambient {
    padding: 0.44rem;
    min-width: 2.35rem;
    justify-content: center;
  }

  .footer-home-bar__cluster {
    gap: 0.18rem;
    padding: 0.18rem;
  }

  .footer-home-bar__chip,
  .footer-home-bar .home-ambient {
    font-size: 0.7rem;
    padding: 0.38rem 0.68rem;
  }

  .footer-home-bar__chip--icon {
    width: 1.75rem;
    min-width: 1.75rem;
    padding: 0.38rem;
  }

  .home-ambient-panel {
    width: min(16.5rem, calc(100vw - 1.25rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-ambient-widget {
    display: none !important;
  }
}
