:root {
  --cosmo-bg: #050816;
  --cosmo-surface: rgba(12, 16, 38, 0.78);
  --cosmo-surface-strong: rgba(17, 20, 46, 0.94);
  --cosmo-line: rgba(210, 200, 255, 0.14);
  --cosmo-line-strong: rgba(210, 200, 255, 0.24);
  --cosmo-text: rgba(248, 246, 255, 0.96);
  --cosmo-muted: rgba(218, 215, 238, 0.68);
  --cosmo-purple: #a99cff;
  --cosmo-pink: #f0a9ca;
  --cosmo-cyan: #aee8f5;
  --cosmo-gold: #f4d49b;
  --cosmo-radius-lg: 24px;
  --cosmo-radius-md: 18px;
  --cosmo-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

html,
body {
  background: var(--cosmo-bg) !important;
  color-scheme: dark;
}

body::before {
  background:
    radial-gradient(circle at 82% 8%, rgba(122, 101, 215, 0.2), transparent 30%),
    radial-gradient(circle at 18% 82%, rgba(215, 113, 164, 0.12), transparent 32%),
    radial-gradient(circle at 52% 42%, rgba(85, 158, 190, 0.08), transparent 36%),
    linear-gradient(180deg, #080b1c 0%, #050816 62%, #07091a 100%) !important;
  opacity: 1 !important;
}

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--cosmo-cyan) !important;
  outline-offset: 3px;
}

.huhu-desktop-rail {
  display: none;
}

.huhu-mobile-locale {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--cosmo-line);
  border-radius: 999px;
  background: rgba(5, 8, 22, 0.38);
}

.huhu-mobile-locale a {
  min-width: 32px;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--cosmo-muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.huhu-mobile-locale a.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cosmo-text);
}

.mobile-topbar,
.mobile-content,
.mobile-tabbar {
  position: relative;
  z-index: 2;
}

.mobile-brand,
.mobile-sheet-panel,
.sheet-card {
  border-color: var(--cosmo-line) !important;
  box-shadow: var(--cosmo-shadow);
}

.mobile-tabbar-inner {
  background: rgba(10, 13, 31, 0.88) !important;
  border-color: var(--cosmo-line) !important;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(22px) saturate(130%);
}

.mobile-tab {
  color: var(--cosmo-muted) !important;
}

.mobile-tab.active {
  color: var(--cosmo-text) !important;
}

.mobile-tab.active::before {
  background: linear-gradient(90deg, var(--cosmo-pink), var(--cosmo-purple), var(--cosmo-cyan)) !important;
}

@media (min-width: 1100px) {
  body.has-desktop-rail {
    --desktop-rail-width: 244px;
    --desktop-content-left: 280px;
  }

  body.has-desktop-rail .huhu-desktop-rail {
    position: fixed;
    inset: 18px auto 18px 18px;
    z-index: 80;
    display: flex;
    width: var(--desktop-rail-width);
    padding: 20px 14px 14px;
    flex-direction: column;
    border: 1px solid var(--cosmo-line);
    border-radius: 28px;
    background:
      radial-gradient(circle at 20% 0%, rgba(169, 156, 255, 0.15), transparent 30%),
      linear-gradient(180deg, rgba(18, 20, 47, 0.92), rgba(8, 11, 28, 0.9));
    box-shadow: var(--cosmo-shadow);
    backdrop-filter: blur(28px) saturate(125%);
  }

  .huhu-desktop-brand {
    padding: 4px 10px 20px;
    border-bottom: 1px solid var(--cosmo-line);
  }

  .huhu-desktop-brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--cosmo-text);
    font-size: 14px;
    font-weight: 760;
    letter-spacing: 0.08em;
  }

  .huhu-desktop-brand-mark::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cosmo-pink), var(--cosmo-purple), var(--cosmo-cyan));
    box-shadow: 0 0 18px rgba(169, 156, 255, 0.7);
  }

  .huhu-desktop-brand p {
    margin: 8px 0 0;
    color: var(--cosmo-muted);
    font-size: 12px;
    line-height: 1.55;
  }

  .huhu-desktop-nav {
    display: grid;
    gap: 7px;
    padding: 18px 0;
  }

  .huhu-desktop-nav a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 46px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 15px;
    color: var(--cosmo-muted);
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  }

  .huhu-desktop-nav a:hover {
    transform: translateX(2px);
    border-color: var(--cosmo-line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--cosmo-text);
  }

  .huhu-desktop-nav a.active {
    border-color: var(--cosmo-line-strong);
    background: linear-gradient(100deg, rgba(240, 169, 202, 0.13), rgba(169, 156, 255, 0.16));
    color: var(--cosmo-text);
  }

  .huhu-desktop-nav-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--cosmo-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--cosmo-cyan);
  }

  .huhu-desktop-nav small {
    display: block;
    margin-top: 2px;
    color: rgba(218, 215, 238, 0.46);
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .huhu-desktop-meta {
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding: 14px 8px 4px;
    border-top: 1px solid var(--cosmo-line);
  }

  .huhu-locale-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--cosmo-line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.18);
  }

  .huhu-locale-switch a {
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--cosmo-muted);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }

  .huhu-locale-switch a.active {
    background: rgba(255, 255, 255, 0.09);
    color: var(--cosmo-text);
  }

  body.has-desktop-rail .mobile-app {
    width: calc(100% - var(--desktop-rail-width) - 54px);
    max-width: 1320px;
    margin-left: calc(var(--desktop-rail-width) + 44px);
    padding-right: 18px;
  }

  body.has-desktop-rail .mobile-topbar {
    padding-top: 18px;
  }

  body.has-desktop-rail .mobile-content {
    border: 1px solid rgba(210, 200, 255, 0.08);
    border-radius: 28px 28px 0 0;
    background: rgba(7, 10, 27, 0.44);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    overflow: hidden;
  }

  body.has-desktop-rail > .mobile-tabbar {
    display: none;
  }

  body.has-desktop-rail.mobile-shell-minimal .ask-topbar,
  body.has-desktop-rail.mobile-shell-minimal .ask-bg-star-layer {
    left: var(--desktop-content-left) !important;
    right: 0 !important;
    width: auto !important;
  }

  body.has-desktop-rail.mobile-shell-minimal .ask-aff-bar-row,
  body.has-desktop-rail.mobile-shell-minimal .ask-composer {
    left: calc(var(--desktop-content-left) + 10px) !important;
  }

  body.has-desktop-rail.mobile-shell-minimal .ask-guide-overlay {
    margin-left: calc(var(--desktop-content-left) / 2) !important;
  }

  body.has-desktop-rail.mobile-shell-minimal #drawer-toggle {
    display: none !important;
  }

  .huhu-mobile-locale {
    display: none;
  }
}

@media (max-width: 1099px) {
  .mobile-brand {
    background: rgba(11, 14, 34, 0.72) !important;
    backdrop-filter: blur(20px) saturate(125%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
