.top-panel {
  height: 42px;
  background: var(--primary-color);
}

.top-panel *:focus-visible {
  outline-color: var(--light-color);
}

.top-panel .container {
  display: grid;
  gap: 24px;
  grid-template-rows: 42px;
  grid-template-columns: min-content min-content min-content 1fr;
}

.top-panel__group {
  display: flex;
  align-items: center;
  justify-content: stretch;
}

.top-panel__group:last-of-type {
  margin-left: auto;
  grid-column: 4;
}

.portals {
  grid-column: 1;
}

.portals > .top-panel__button {
  width: 220px;
}

.portals > .top-panel__button:focus-visible {
  outline-offset: -6px;
}

.top-panel__group--social {
  align-items: center;
  justify-content: center;
  grid-column: 3;
}

.top-panel__button--lang-toggle {
  grid-column: 2;
}

.top-panel__label {
  margin-right: 6px;
  font-size: calc(14rem / var(--initial-font-multiplier));
  font-weight: bold;
}

.top-panel__age-rating {
  font-size: calc(12rem / var(--initial-font-multiplier));
  font-weight: bold;
  color: hsla(0, 0%, 100%, 0.5);
  padding: 0 10px;
}

.top-panel__button {
  color: hsl(0, 0%, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--grid-gap) / 2);
  font-size: calc(16rem / var(--initial-font-multiplier));
  border: none;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

.top-panel__button--circle {
  min-width: 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: hsla(0, 0%, 100%, 0.1);
  margin-left: 4px;
  margin-right: 4px;
  padding: 0;
  transition: all 0.15s ease-out;
}

.top-panel__button--no-bg {
  min-width: 28px;
  width: 28px;
  height: 28px;
  margin-left: 4px;
  margin-right: 4px;
  padding: 0;
}

@media (hover: hover) {
  .top-panel__button--circle:hover,
  .top-panel__button--circle:focus-visible {
    color: hsl(0, 0%, 100%);
    background: var(--primary-color-hover);
    border: none;
  }
  .top-panel__button--no-bg:hover,
  .top-panel__button--no-bg:focus-visible {
    color: hsl(0, 0%, 85%);
  }

  .top-panel__button--portals:hover,
  .top-panel__button--lang-toggle:hover,
  .top-panel__button--portals:focus-visible,
  .top-panel__button--lang-toggle:focus-visible {
    color: hsl(0, 0%, 85%);
  }
}

.top-panel--menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: hsl(0, 0%, 85%);
  justify-content: center;
  align-items: center;
  transition: background-color 0.15s ease-out;
  height: 42px;
  width: 43px;
  margin-left: calc(var(--grid-gap) / 2 - var(--grid-gap));
}

.top-panel--menu-toggle:hover,
.top-panel--menu-toggle:focus-visible {
  color: hsl(0, 0%, 85%);
  background: var(--primary-color-hover);
}

@media screen and (max-width: 1087px) {
  .top-panel--menu-toggle {
    display: flex;
  }

  .body--menu-expanded {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
  }

  .body--menu-expanded .top-panel {
    height: auto;
    overflow: visible;
  }

  .body--menu-expanded #panel {
    display: none !important;
  }

  .body--menu-expanded.body--sticky-top-menu .top-menu,
  .body--menu-expanded .top-menu {
    display: block;
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 10001;
  }

  .top-panel--menu-toggle .expand,
  .body--menu-expanded .top-panel--menu-toggle .collapse {
    display: flex;
  }

  .top-panel--menu-toggle .collapse,
  .body--menu-expanded .top-panel--menu-toggle .expand {
    display: none;
  }

  .top-menu {
    display: none;
    z-index: 1000;
  }

  .top-menu__root-items {
    flex-direction: column !important;
  }

  .top-menu__root-item-link {
    min-height: 45px !important;
  }

  .top-menu__items {
    height: auto !important;
    max-height: none !important;
    box-shadow: none !important;
    width: 100% !important;
    z-index: 0 !important;
  }

  .top-menu__item {
    margin: 6px 37px !important;
  }

  .top-menu__root-item-link {
    font-size: calc(17rem / var(--initial-font-multiplier)) !important;
  }

  .top-menu__root-item-link:after {
    height: 0 !important;
  }
}


@media screen and (max-width: 1087px) {
  .top-panel {
    overflow: hidden;
  }

  .top-panel .container {
    grid-template-columns: min-content min-content min-content min-content 1fr;
  }

  .top-panel__button--menu-toggle {
    display: flex;
    grid-row: 1;
    grid-column: 1;
    justify-self: left;
  }

  .portals {
    grid-column: 2;
  }

  .top-panel__group--social {
    grid-column: 4;
  }

  .top-panel__button--lang-toggle {
    grid-column: 3;
  }

  .top-panel__group:last-of-type {
    grid-column: 5;
  }
}

@media screen and (max-width: 735px) {
  .top-panel .container {
    grid-template-columns: min-content 1fr;
    gap: 0;
  }

  .portals {
    grid-column: 1/-1;
    grid-row: 2;
    margin: calc(var(--grid-gap) / 4) 0;
    min-height: 34px;
  }

  .portals > .top-panel__button {
    width: auto;
    padding: 0;
  }

  .top-panel__group--social {
    grid-column: 1/-1;
    grid-row: 3;
    justify-content: flex-start;
    margin: calc(var(--grid-gap) / 4) 0;
    min-height: 34px;
  }

  .top-panel__button--lang-toggle {
    grid-column: 1/-1;
    grid-row: 4;
    justify-content: flex-start;
    margin: calc(var(--grid-gap) / 4) 0;
    min-height: 34px;
  }

  .top-panel__group:last-of-type {
    grid-column: 2;
  }

  .top-panel__search.js-search--expanded {
    grid-column: span 9;
    width: 100%;
  }

  .top-panel__search.js-search--expanded .top-panel__search-input {
    flex: 1;
  }

  .js-search--expanded + div {
    display: none;
  }

  .body--menu-expanded.body--sticky-top-menu .top-menu,
  .body--menu-expanded .top-menu {
    top: calc(4 * 42px + 16px * 3);
  }
}

:root.root--special[data-special-color="white"] .top-panel__button--portals,
:root.root--special[data-special-color="blue"] .top-panel__button--portals {
  filter: invert(1) contrast(2);
}

:root.root--special .top-panel {
  background-color: var(--special-background-color);
}

:root.root--special .top-panel__button--circle:hover,
:root.root--special .top-panel__button--circle:focus-visible {
  background: hsla(0, 0%, 100%, 0.1);
}

:root.root--special .top-panel__group {
  color: var(--special-text-color);
}
