:root {
  --site-header-height: 66px;
  --site-header-gold: #ffbf27;
  --site-header-pink: #ef36ff;
  --site-header-violet: #a47aff;
  --site-header-text: #f6f3fb;
  --site-header-muted: #9da4ba;
}

.header.site-header,
.header.site-header *,
.community-chat,
.community-chat * {
  box-sizing: border-box;
}

/* A quiet glass surface keeps the navigation legible over every page. */
.header.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: var(--site-header-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.2vw, 20px);
  padding: 0 max(20px, calc((100vw - 1560px) / 2));
  border-bottom: 1px solid rgba(186, 131, 255, .17);
  background:
    radial-gradient(ellipse at 14% 0, rgba(141, 67, 192, .15), transparent 46%),
    linear-gradient(110deg, rgba(9, 8, 23, .97), rgba(5, 7, 19, .95));
  box-shadow: 0 12px 36px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 255, 255, .035);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  font-family: "Outfit", Inter, Montserrat, Arial, sans-serif;
  transition: background .25s ease;
}

.header.site-header::before {
  content: none;
}

/* Only this one-pixel accent moves; the text and hit areas stay still. */
.header.site-header::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 3%, #9874e9 25%, #e68cd4 43%, #f6cb78 52%, #9874e9 70%, transparent 94%);
  background-size: 220% 100%;
  opacity: .65;
  animation: site-nav-aurora 16s ease-in-out infinite alternate;
}

@keyframes site-nav-aurora {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

.site-header .brand {
  position: relative;
  z-index: 1100;
  width: fit-content;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #bd9aff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.55rem;
  font-style: italic;
  line-height: 1;
  letter-spacing: .04em;
  text-decoration: none;
  text-shadow: 0 0 22px rgba(151, 71, 255, .44);
  white-space: nowrap;
}

.site-header .brand-logo {
  width: 38px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 191, 39, .4));
}

.site-header .nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(176, 133, 225, .15);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(165, 103, 231, .055), rgba(255, 255, 255, .012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 4px 18px rgba(0, 0, 0, .12);
  /* Long account names and browser zoom must not push actions off screen. */
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #66417e transparent;
}

.site-header .nav a,
.site-header .site-nav-logout {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 clamp(6px, .65vw, 11px);
  border: 1px solid transparent;
  border-radius: 11px;
  color: #d4cde3;
  background: transparent;
  font: inherit;
  font-size: .67rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .025em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color .22s ease, background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.site-header .nav a::after,
.site-header .site-nav-logout::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #bc83ff, #f1b2df, #f9d493);
  box-shadow: 0 0 9px rgba(207, 138, 245, .5);
  opacity: 0;
  transform: translateX(-50%) scaleX(.4);
  transition: opacity .25s ease, transform .25s ease;
}

.site-header .nav a:hover,
.site-header .site-nav-logout:hover {
  color: #fff;
  border-color: rgba(197, 141, 246, .23);
  background-color: rgba(172, 109, 235, .11);
}

.site-header .nav a.active {
  color: #fff5dc;
  border-color: rgba(219, 174, 239, .36);
  background: linear-gradient(120deg, rgba(147, 81, 202, .26), rgba(176, 89, 155, .15));
  box-shadow: inset 0 1px rgba(255, 228, 252, .12), 0 0 16px rgba(163, 71, 223, .1);
}

.site-header .nav a:hover::after,
.site-header .nav a:focus-visible::after,
.site-header .nav a.active::after,
.site-header .site-nav-logout:hover::after,
.site-header .site-nav-logout:focus-visible::after {
  width: 20px;
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.site-header a:focus-visible,
.site-header button:focus-visible {
  outline: 2px solid #f6ce83;
  outline-offset: -3px;
}

.site-header .nav [data-account-link] {
  max-width: 130px;
  display: block;
  line-height: 36px;
  overflow: hidden;
  color: #e5c48e;
  text-overflow: ellipsis;
}

.site-header .nav .btn-register {
  border-color: rgba(225, 158, 249, .43);
  color: #f6e3ff;
  background: linear-gradient(120deg, rgba(123, 58, 178, .34), rgba(176, 53, 151, .2));
}

.site-header .nav .btn-register::after {
  display: none;
}

.site-header .site-nav-logout {
  color: #e7a5ba;
}

.site-header .nav [hidden],
.site-header .chat-launch[hidden],
.community-chat[hidden] {
  display: none !important;
}

.site-header .menu-button {
  display: none;
  justify-self: end;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(184, 126, 240, .5);
  border-radius: 14px;
  color: #eadbff;
  background: linear-gradient(145deg, rgba(141, 75, 193, .2), rgba(15, 13, 31, .9));
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .25s ease, background-color .25s ease, box-shadow .25s ease;
}

.site-header .menu-button:hover,
.site-header .menu-button[aria-expanded="true"] {
  border-color: #d3a6f1;
  background-color: #44275c;
  box-shadow: inset 0 1px rgba(255, 255, 255, .13), 0 0 20px rgba(171, 91, 221, .18);
}

.site-header .chat-launch {
  position: relative;
  z-index: 1100;
  min-width: 82px;
  height: 40px;
  padding: 0 16px;
  overflow: hidden;
  border: 1px solid rgba(230, 150, 255, .72);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(120deg, #692489, #9a2fa6 65%, #75328f);
  box-shadow: inset 0 1px rgba(255, 255, 255, .2), 0 4px 18px rgba(152, 41, 179, .2);
  font-family: "Outfit", Inter, Montserrat, Arial, sans-serif;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
  cursor: pointer;
  transition: border-color .25s ease, box-shadow .25s ease;
}

.site-header .chat-launch::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 237, 255, .13) 50%, transparent 75%);
  transform: translateX(-130%);
  animation: site-chat-sheen 12s ease-in-out infinite;
}

.site-header .chat-launch:hover {
  border-color: #f0c7ff;
  box-shadow: inset 0 1px rgba(255, 255, 255, .25), 0 4px 22px rgba(185, 69, 207, .32);
}

@keyframes site-chat-sheen {
  0%, 55% { transform: translateX(-130%); }
  85%, 100% { transform: translateX(130%); }
}

.community-chat {
  position: relative;
  min-width: 0;
  min-height: 430px;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(181, 76, 255, .58);
  border-radius: 18px;
  color: #f6f3fb;
  background:
    radial-gradient(circle at 84% 8%, rgba(187, 53, 255, .2), transparent 38%),
    linear-gradient(145deg, rgba(14, 8, 34, .98), rgba(4, 8, 22, .99));
  box-shadow: inset 0 0 32px rgba(95, 27, 156, .18), 0 20px 70px rgba(0, 0, 0, .3);
  font-family: "Outfit", Inter, Montserrat, Arial, sans-serif;
}

.community-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: radial-gradient(circle, rgba(255, 255, 255, .65) 0 1px, transparent 1.5px);
  background-size: 47px 47px;
}

.community-chat--floating {
  position: fixed;
  z-index: 1300;
  right: 22px;
  bottom: 22px;
  width: min(620px, calc(100vw - 28px));
  height: min(720px, calc(100vh - 96px));
  min-height: 0;
  overflow: hidden;
  box-shadow: 0 25px 90px rgba(0, 0, 0, .72), 0 0 35px rgba(177, 45, 224, .28);
}

.community-chat__head,
.community-chat__form,
.community-chat__locked,
.community-chat__messages {
  position: relative;
  z-index: 1;
}

.community-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 62px 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  background: rgba(4, 5, 18, .55);
}

.community-chat__head .eyebrow {
  margin: 0 0 3px;
  color: var(--site-header-gold);
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.community-chat__head h3 {
  margin: 0;
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.35rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.community-chat__connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #aeb4c8;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .09em;
}

.community-chat__connection::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.community-chat__connection[data-state="online"] { color: #68ffbd; }
.community-chat__connection[data-state="locked"] { color: var(--site-header-gold); }
.community-chat__connection[data-state="reconnecting"] { color: #ff7e9a; }

.community-chat__messages {
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 18px;
  scrollbar-color: rgba(187, 80, 255, .65) transparent;
}

.community-chat__message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.community-chat__avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(189, 80, 255, .7);
  border-radius: 50%;
  color: #efceff;
  background: rgba(122, 34, 196, .24);
  font-size: .7rem;
  font-weight: 900;
}

.community-chat__meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.community-chat__meta strong {
  overflow: hidden;
  color: #fff;
  font-size: .76rem;
  text-overflow: ellipsis;
}

.community-chat__meta time {
  margin-left: auto;
  color: #777f98;
  font-size: .58rem;
}

.community-chat__role {
  padding: 2px 6px;
  border: 1px solid rgba(116, 217, 255, .35);
  border-radius: 999px;
  color: #8edfff;
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.community-chat__role--master { border-color: rgba(255, 191, 39, .65); color: var(--site-header-gold); }
.community-chat__role--administration { border-color: rgba(255, 83, 139, .6); color: #ff8db2; }
.community-chat__role--moderators { border-color: rgba(194, 111, 255, .65); color: #d9a2ff; }
.community-chat__role--editors { border-color: rgba(77, 235, 177, .55); color: #7ff1c6; }

.community-chat__message p {
  margin: 5px 0 0;
  color: #c9ccda;
  font-size: .74rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.community-chat__empty {
  position: absolute;
  z-index: 2;
  inset: 49% 20px auto;
  margin: 0;
  color: #737b94;
  font-size: .7rem;
  text-align: center;
}

.community-chat__locked {
  align-self: stretch;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 34px;
  text-align: center;
}

.community-chat__locked[hidden],
.community-chat__form[hidden] {
  display: none;
}

.community-chat__locked > span {
  color: #cc71ff;
  font-size: 2.6rem;
  text-shadow: 0 0 24px rgba(204, 113, 255, .7);
}

.community-chat__locked strong {
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: .06em;
}

.community-chat__locked p {
  max-width: 370px;
  margin: 10px auto 18px;
  color: var(--site-header-muted);
  font-size: .76rem;
  line-height: 1.5;
}

.community-chat__locked div {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.community-chat .button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid rgba(183, 101, 255, .55);
  border-radius: 9px;
  color: #fff;
  background: rgba(92, 24, 137, .42);
  font: inherit;
  font-size: .6rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.community-chat .button-pink {
  border-color: rgba(233, 92, 255, .75);
  background: linear-gradient(90deg, #6b147f, #a421bd);
}

.community-chat__form {
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, .09);
  background: rgba(3, 5, 16, .72);
}

.community-chat__form > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.community-chat__form textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid rgba(171, 75, 238, .42);
  border-radius: 10px;
  outline: 0;
  color: #fff;
  background: rgba(4, 7, 22, .86);
  font: inherit;
  font-size: .73rem;
  line-height: 1.45;
}

.community-chat__form textarea:focus {
  border-color: #c75cff;
  box-shadow: 0 0 0 3px rgba(187, 65, 255, .12);
}

.community-chat__send {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.community-chat__send > span {
  color: #767e96;
  font-size: .53rem;
}

.community-chat__send .button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: .56rem;
}

.community-chat__close {
  position: absolute;
  z-index: 5;
  top: 13px;
  right: 13px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  color: #fff;
  background: #080914;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.secret-context-nav {
  grid-template-columns: 1fr auto;
}

.secret-context-nav .access-pill {
  justify-self: start;
}

.site-header + #root {
  height: calc(100% - var(--site-header-height));
  min-height: calc(100% - var(--site-header-height));
  margin-top: var(--site-header-height);
}

.site-header + .secret-hero {
  margin-top: var(--site-header-height);
}

@media (max-width: 1400px) {
  .header.site-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .site-header .nav {
    gap: 1px;
  }

  .site-header .nav a,
  .site-header .site-nav-logout {
    padding-right: 5px;
    padding-left: 5px;
    font-size: .67rem;
  }
}

@media (max-width: 1280px) {
  :root {
    --site-header-height: calc(64px + env(safe-area-inset-top));
  }

  body.menu-open {
    overflow: hidden;
  }

  .header.site-header {
    height: var(--site-header-height);
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: 64px;
    gap: 8px;
    padding: env(safe-area-inset-top) 12px 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-header .brand {
    grid-column: 1;
    grid-row: 1;
    gap: 7px;
    font-size: 1.22rem;
  }

  .site-header .brand-logo {
    width: 34px;
    height: 28px;
  }

  .site-header .chat-launch {
    grid-column: 2;
    grid-row: 1;
    min-width: 68px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    letter-spacing: .1em;
  }

  .site-header .menu-button {
    position: relative;
    z-index: 1100;
    grid-column: 3;
    grid-row: 1;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
  }

  .site-header .nav {
    position: fixed;
    inset: var(--site-header-height) 0 0;
    z-index: 1050;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 24px max(20px, calc((100vw - 640px) / 2)) max(28px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background:
      radial-gradient(ellipse at 0 0, rgba(128, 66, 186, .23), transparent 55%),
      radial-gradient(ellipse at 100% 80%, rgba(159, 69, 122, .13), transparent 50%),
      #070815;
    transition: opacity .25s ease, visibility .25s ease;
  }

  .site-header .nav::before {
    content: "НАВИГАЦИЯ · MEDIA";
    flex: 0 0 auto;
    margin: 2px 4px 10px;
    color: #b89aca;
    font-size: .63rem;
    font-weight: 700;
    letter-spacing: .2em;
  }

  .site-header .nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-header .nav a,
  .site-header .site-nav-logout {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 42px 0 18px;
    border: 1px solid rgba(190, 147, 232, .17);
    border-radius: 14px;
    color: #eee7f7;
    background: linear-gradient(110deg, rgba(168, 113, 221, .08), rgba(255, 255, 255, .02));
    box-shadow: inset 0 1px rgba(255, 255, 255, .035);
    font-size: .88rem;
    text-align: left;
  }

  .site-header .nav a::after,
  .site-header .nav a:hover::after,
  .site-header .nav a:focus-visible::after,
  .site-header .nav a.active::after {
    display: block;
    inset: 50% 19px auto auto;
    width: 7px;
    height: 7px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    border-radius: 0;
    background: none;
    box-shadow: none;
    opacity: .5;
    transform: translateY(-50%) rotate(45deg);
  }

  .site-header .site-nav-logout::after {
    display: none;
  }

  .site-header .nav a.active {
    border-color: rgba(218, 175, 239, .5);
    color: #fff0d1;
    background: linear-gradient(110deg, rgba(153, 86, 212, .3), rgba(171, 82, 153, .12));
    box-shadow: inset 3px 0 #dab074, inset 0 1px rgba(255, 238, 250, .09), 0 5px 20px rgba(105, 49, 136, .12);
  }

  .site-header .nav [data-account-link] {
    max-width: none;
    line-height: 48px;
    margin-top: 10px;
    border-color: rgba(221, 180, 108, .28);
    color: #e9cb96;
    background: linear-gradient(110deg, rgba(180, 132, 51, .11), rgba(163, 97, 195, .04));
  }

  .site-header .nav .btn-register {
    padding: 0 42px 0 18px;
  }

  .site-header .site-nav-logout {
    color: #e7a5ba;
    background: rgba(199, 83, 115, .055);
    border-color: rgba(213, 112, 140, .2);
  }

  .dashboard-page .dashboard-container {
    padding-top: calc(var(--site-header-height) + 24px);
  }

  .community-chat--floating {
    inset: calc(var(--site-header-height) + 8px) 8px max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    border-radius: 18px;
  }
}

@media (max-width: 620px) {
  .community-chat {
    min-height: 470px;
  }

  .community-chat__head {
    align-items: flex-start;
    padding: 16px 58px 16px 16px;
  }

  .community-chat__connection {
    margin-top: 4px;
  }

  .community-chat__send {
    grid-template-columns: 1fr auto;
  }

  .community-chat__send > span:first-child {
    grid-column: 1 / -1;
  }

  .community-chat__locked {
    padding: 26px 18px;
  }
}

@media (max-width: 390px) {
  .header.site-header {
    gap: 6px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .site-header .brand {
    font-size: 1.08rem;
  }

  .site-header .brand-logo {
    width: 31px;
    height: 25px;
  }

  .site-header .chat-launch {
    min-width: 62px;
    padding: 0 9px;
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header.site-header,
  .site-header *,
  .site-header *::before,
  .site-header *::after,
  .header.site-header::after {
    animation: none !important;
    transition: none !important;
  }
}
