:root {
  --site-header-text: #1f2937;
  --site-header-muted: #62728b;
  --site-header-line: #e2e5ef;
  --site-header-control: rgba(249, 250, 251, 0.82);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #ddd;
}

.aichizi-site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  height: 65px;
  border-bottom: 1px solid var(--site-header-line);
  background: linear-gradient(110deg, #eaf8ff 0%, #f0edff 53%, #fff5e9 100%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

.site-header-container {
  width: 100%;
  max-width: 1280px;
  height: 64px;
  margin: 0 auto;
  padding: 0 32px;
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 64px;
}

.site-header-brand-group,
.site-header-actions,
.site-header-brand,
.site-header-brand-copy,
.site-header-nav,
.site-header-nav a,
.site-header-search,
.site-header-mobile-menu a {
  display: flex;
  align-items: center;
}

.site-header-brand-group,
.site-header-brand,
.site-header-actions {
  flex-shrink: 0;
}

.site-header-brand-group,
.site-header-brand {
  gap: 10px;
}

.site-header-brand {
  height: 36px;
  color: #111827;
  text-decoration: none;
}

.site-header-logo {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  box-shadow: none;
}

.site-header-brand-copy {
  align-items: flex-start;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  white-space: nowrap;
}

.site-header-brand-copy strong {
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
}

.site-header-brand-copy small {
  margin-top: 3px;
  color: var(--site-header-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 13px;
}

.site-header-nav {
  justify-content: center;
  gap: 2px;
  margin-left: auto;
  font-size: 14px;
  line-height: 20px;
}

.site-header-nav a {
  gap: 4px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--site-header-text);
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.site-header-nav a:hover,
.site-header-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.58);
}

.site-header-nav a.nav-active {
  color: #1a1a1a;
  font-weight: 400;
  background: #f5f5f0;
}

.site-header-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  font-size: 16px;
  font-style: normal;
  line-height: 20px;
}

.site-header-nav-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.site-header-nav-icon--boxed {
  border-radius: 6px;
  color: #fff;
}

.site-header-nav-icon--boxed svg {
  width: 76%;
  height: 76%;
}

.site-header-nav-icon--ai {
  background: #2875dd;
  box-shadow: 0 2px 4px rgba(40, 99, 181, 0.11);
}

.site-header-nav-icon--skill {
  background: #7b55cc;
}

.site-header-nav-skill {
  margin-left: 4px;
  padding-left: 10px !important;
  border-left: 1px solid #e5e7eb;
}

.site-header-actions {
  gap: 12px;
  margin-left: 45.5px;
}

.site-header-search {
  position: relative;
  width: 192px;
  height: 38px;
}

.site-header-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: #9ca3af;
  pointer-events: none;
  transform: translateY(-50%);
}

.site-header-search input {
  width: 100%;
  height: 38px;
  padding: 8px 16px 8px 36px;
  border: 1px solid transparent;
  border-radius: 9999px;
  outline: none;
  color: #000;
  background: #f9fafb;
  font: inherit;
  font-size: 14px !important;
  line-height: 20px !important;
}

.site-header-search input::placeholder {
  color: #9ca3af;
  font-size: 14px;
}

.site-header-search input:focus {
  border-color: rgba(59, 130, 246, 0.35);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.09);
}

.site-header-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
}

.site-header-icon-button:hover,
.site-header-icon-button:focus-visible {
  color: #334155;
  background: rgba(255, 255, 255, 0.58);
}

.site-header-icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
}

.site-header-menu-button,
.site-header-search-button,
.site-header-mobile-menu {
  display: none;
}

/* Freeze the homepage and every channel to the same desktop geometry.
   Active state may change only color/background, never weight or dimensions. */
@media (min-width: 1200px) {
  .site-header-brand-copy {
    height: 36px;
    justify-content: flex-end;
  }

  .site-header-brand-copy strong {
    line-height: 24px;
  }

  .site-header-brand-copy small {
    line-height: 15.4px;
  }

  .site-header-container,
  .channel-header-fixed-container {
    width: min(1280px, 100vw) !important;
    max-width: none !important;
    margin-left: max(0px, calc((100vw - 1280px) / 2)) !important;
    margin-right: 0 !important;
  }

  .site-header-row,
  .channel-header-fixed-row {
    position: relative;
  }

  .site-header-nav,
  .channel-header-fixed-nav {
    position: absolute !important;
    top: 14px;
    left: 204px;
    margin-left: 0 !important;
    display: grid !important;
    grid-template-columns: 72px 90px 106px 100px 106px 125px 102px;
    column-gap: 2px;
    align-items: center;
    justify-content: start;
    width: 713px;
    min-width: 713px;
    max-width: 713px;
    height: 36px;
    flex: 0 0 713px;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 20px;
  }

  .site-header-nav > a,
  .channel-header-fixed-nav > a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    margin-left: 0 !important;
    padding: 6px 10px !important;
    box-sizing: border-box;
    white-space: nowrap;
    transition-property: color, background-color, border-color, box-shadow, opacity !important;
  }

  .site-header-nav > a {
    color: var(--site-header-text) !important;
  }

  .site-header-nav > a.nav-active,
  .channel-header-fixed-nav > a.nav-active {
    color: #1a1a1a !important;
    font-weight: 400 !important;
  }

  .site-header-nav > a > span:first-child,
  .channel-header-fixed-nav > a > span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    font-size: 16px;
    line-height: 20px;
  }

  .site-header-nav > a > span:first-child svg,
  .channel-header-fixed-nav > a > span:first-child svg {
    display: block;
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
  }

  .site-header-nav-skill,
  .channel-header-fixed-nav > a.skill-download-nav {
    border-left-color: #e5e7eb !important;
  }
}

@media (min-width: 1024px) {
  body > .shell,
  body.workflow-channel-page .channel-hero,
  body.workflow-channel-page .channel-ticker,
  body.workflow-channel-page .channel-layout {
    width: min(1216px, calc(100% - 64px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body.workflow-channel-page .channel-hero {
    height: 450px !important;
  }

  body > .shell.news,
  body.workflow-channel-page .channel-ticker {
    min-height: 36px !important;
    height: 36px !important;
    padding: 10px 16px !important;
    gap: 12px !important;
  }

  body > .shell.layout,
  body.workflow-channel-page .channel-layout {
    margin-top: 24px !important;
  }
}

.site-header-mobile-menu {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 49;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px 14px;
  border-bottom: 1px solid var(--site-header-line);
  background: linear-gradient(110deg, #eaf8ff 0%, #f0edff 53%, #fff5e9 100%);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.site-header-mobile-menu a {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--site-header-text);
  font-size: 14px;
  text-decoration: none;
}

.site-header-mobile-menu a.nav-active {
  color: #1a1a1a;
  font-weight: 600;
  background: #f5f5f0;
}

html.dark .aichizi-site-header,
html.channel-dark .aichizi-site-header {
  --site-header-text: #e5e7eb;
  --site-header-muted: #a8b4c5;
  --site-header-line: rgba(255, 255, 255, 0.11);
  --site-header-control: rgba(255, 255, 255, 0.08);
  background: linear-gradient(110deg, #192637 0%, #28243b 56%, #302938 100%);
}

html.dark .site-header-brand,
html.dark .site-header-brand-copy strong,
html.channel-dark .site-header-brand,
html.channel-dark .site-header-brand-copy strong {
  color: #f8fafc;
}

html.dark .site-header-nav a.nav-active,
html.dark .site-header-mobile-menu a.nav-active,
html.channel-dark .site-header-nav a.nav-active,
html.channel-dark .site-header-mobile-menu a.nav-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

html.dark .site-header-search input,
html.channel-dark .site-header-search input {
  color: #f8fafc;
}

html.dark .site-header-mobile-menu,
html.channel-dark .site-header-mobile-menu {
  background: linear-gradient(110deg, #192637 0%, #28243b 56%, #302938 100%);
}

@media (max-width: 1199px) {
  .site-header-container,
  .channel-header-fixed-container {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 16px !important;
    box-sizing: border-box;
  }

  .site-header-row,
  .channel-header-fixed-row {
    position: relative;
    width: 100%;
  }

  .site-header-menu-button,
  .channel-header-fixed-menu {
    position: absolute !important;
    top: 10px;
    left: 0;
    margin: 0 !important;
  }

  .site-header-brand,
  .channel-header-fixed-brand {
    position: absolute !important;
    top: 10px;
    left: 46px;
    width: 139px;
    height: 36px;
    margin: 0 !important;
  }

  .site-header-actions,
  .channel-header-fixed-actions {
    position: absolute !important;
    top: 10px;
    right: 0;
    display: flex !important;
    width: 80px;
    height: 36px;
    margin: 0 !important;
    gap: 8px !important;
  }

  .site-header-actions {
    margin-left: 20px;
  }
}

@media (max-width: 1023px) {
  .aichizi-site-header {
    height: 65px;
  }

  .site-header-container {
    padding: 0 16px;
  }

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

  .site-header-menu-button {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.79);
    border-radius: 12px;
  }

  .site-header-actions {
    margin-left: auto;
  }

  .site-header-search {
    width: 160px;
  }

  .site-header-mobile-menu:not([hidden]) {
    display: flex;
  }
}

@media (max-width: 639px) {
  html {
    scrollbar-width: none;
  }

  ::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .aichizi-site-header {
    height: 57px;
  }

  .site-header-container,
  .site-header-row {
    height: 56px;
  }

  .site-header-brand-group,
  .site-header-brand {
    gap: 10px;
  }

  .site-header-logo {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }

  .site-header-brand-copy strong {
    font-size: 14px;
    line-height: 18px;
  }

  .site-header-brand-copy small {
    margin-top: 1px;
    font-size: 10px;
  }

  .site-header-search {
    display: none;
  }

  .site-header-search-button {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.79);
    border-radius: 12px;
  }

  .site-header-actions {
    gap: 8px;
  }
}

@media (max-width: 374px) {
  .site-header-brand-copy small {
    display: none;
  }

  .site-header-brand-copy strong {
    font-size: 13px;
  }
}
