:root {
  --shell-bg: #0b1016;
  --shell-bg-2: #111923;
  --shell-text: #eef4ff;
  --shell-muted: #9fb0c4;
  --shell-line: rgba(226, 192, 126, 0.28);
  --shell-accent: #e2c07e;
  --site-announce-h: 0px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

/* Runtime config anti-flicker:
   hide shell regions until shell.js applies latest runtime config. */
html:not([data-runtime-ready="1"]) .shell-header,
html:not([data-runtime-ready="1"]) .site-topbar,
html:not([data-runtime-ready="1"]) .topbar,
html:not([data-runtime-ready="1"]) .shell-footer,
html:not([data-runtime-ready="1"]) .site-footer,
html:not([data-runtime-ready="1"]) .shell-main,
html:not([data-runtime-ready="1"]) .main-center,
html:not([data-runtime-ready="1"]) .main-content,
html:not([data-runtime-ready="1"]) .wrap,
html:not([data-runtime-ready="1"]) .layout {
  visibility: hidden !important;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", sans-serif !important;
  color: var(--shell-text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(226, 192, 126, 0.16), transparent 60%),
    radial-gradient(700px 400px at 8% 10%, rgba(140, 170, 205, 0.16), transparent 60%),
    linear-gradient(145deg, var(--shell-bg) 0%, var(--shell-bg-2) 100%) !important;
  background-color: var(--shell-bg) !important;
}

button,
input,
select,
textarea {
  font-family: inherit !important;
}

/* 广告位统一为文档流底部展示，禁止固定悬浮遮挡页面按钮 */
#ad-container,
.ad-container,
.ad-wrap,
[data-ad-wrapper] {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  z-index: auto !important;
  box-shadow: none !important;
  margin-top: 16px !important;
  margin-bottom: 0 !important;
}

.shell-header,
.site-topbar,
.topbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  border-bottom: 1px solid var(--shell-line) !important;
  background: rgba(8, 14, 22, 0.9) !important;
  backdrop-filter: blur(8px) !important;
}

.shell-inner,
.site-topbar-inner,
.topbar-inner {
  width: min(1160px, 92vw) !important;
  margin: 0 auto !important;
  min-height: 52px !important;
  height: 52px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.shell-brand,
.site-brand,
.brand {
  color: var(--shell-text) !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.shell-nav,
.site-nav,
.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto; /* 桌面：导航+语言靠右；品牌在左 */
}

.shell-nav a,
.site-nav a,
.topnav a {
  color: #ccdaeb !important;
  text-decoration: none !important;
  font-size: 0.82rem !important;
  border: 1px solid rgba(226, 192, 126, 0.3) !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  background: rgba(255, 255, 255, 0.02) !important;
}

/* 旧横排 CN/TC/EN 隐藏，由 .shell-lang 下拉替代 */
.shell-nav a.lang-switch,
.site-nav a.lang-switch,
.topnav a.lang-switch,
.shell-nav .lang-sep,
.site-nav .lang-sep,
.topnav .lang-sep {
  display: none !important;
}

/* ========== 语言切换：地球图标 + 下拉 ========== */
.shell-lang {
  position: relative;
  flex-shrink: 0;
  z-index: 1100;
}

.shell-lang-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin: 0 !important;
  padding: 5px 10px !important;
  border: 1px solid rgba(226, 192, 126, 0.4) !important;
  border-radius: 999px !important;
  background: rgba(226, 192, 126, 0.1) !important;
  color: #f0e0b8 !important;
  font-size: 0.78rem !important;
  font-weight: 650 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  font-family: inherit !important;
  box-shadow: 0 0 0 1px rgba(226, 192, 126, 0.08);
}

.shell-lang-btn:hover,
.shell-lang.is-open .shell-lang-btn {
  border-color: rgba(226, 192, 126, 0.65) !important;
  background: rgba(226, 192, 126, 0.18) !important;
  color: #fff6dc !important;
}

.shell-lang-icon {
  flex-shrink: 0;
  display: block;
}

.shell-lang-label {
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 桌面窄屏：语言名过长时只显示图标，避免顶栏换行 */
@media (max-width: 1100px) and (min-width: 769px) {
  .shell-lang-label {
    max-width: 5.5em;
  }
}

.shell-lang-caret {
  font-size: 0.65rem;
  opacity: 0.85;
  transform: translateY(-0.5px);
}

.shell-lang.is-open .shell-lang-caret {
  transform: rotate(180deg);
}

.shell-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  border: 1px solid rgba(226, 192, 126, 0.35);
  border-radius: 12px;
  background: rgba(10, 16, 24, 0.98);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 1200;
}

.shell-lang-menu[hidden] {
  display: none !important;
}

.shell-lang-option {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 9px 12px !important;
  border-radius: 8px !important;
  color: #dbe7f5 !important;
  text-decoration: none !important;
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  border: none !important;
  background: transparent !important;
  white-space: nowrap !important;
}

.shell-lang-option:hover {
  background: rgba(226, 192, 126, 0.12) !important;
  color: #fff !important;
}

.shell-lang-option.is-active {
  color: #f0d7a2 !important;
  background: rgba(226, 192, 126, 0.14) !important;
}

.shell-lang-option.is-active::before {
  content: "✓";
  font-size: 0.78rem;
  color: #e2c07e;
}

/* 桌面：登录在导航流内（与首页/关于同排），不另起一列挤布局 */
.shell-nav a.auth-link,
.site-nav a.auth-link,
.topnav a.auth-link,
.shell-nav a[data-auth-slot],
.site-nav a[data-auth-slot],
.topnav a[data-auth-slot] {
  color: #ffd7de !important;
  border-color: rgba(196, 92, 106, 0.5) !important;
  background: rgba(196, 92, 106, 0.12) !important;
  font-weight: 700 !important;
}

.shell-nav a.auth-me,
.site-nav a.auth-me,
.topnav a.auth-me {
  color: #f0d7a2 !important;
  border-color: rgba(226, 192, 126, 0.55) !important;
  background: rgba(226, 192, 126, 0.1) !important;
}

/* 外侧固定登录钮：桌面隐藏，仅移动端（nav 隐藏时）显示 */
.shell-auth-btn,
a.shell-auth-btn {
  display: none !important;
}

.shell-menu-btn {
  display: none;
  border: 1px solid rgba(226, 192, 126, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe7f5;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  font-size: 1rem;
  line-height: 1;
}

.shell-menu-panel {
  display: none;
}

.shell-main {
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding-top: calc(84px + var(--site-announce-h, 0px));
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}

.shell-footer,
.site-footer {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1000 !important;
  border-top: 1px solid var(--shell-line) !important;
  background: rgba(8, 14, 22, 0.9) !important;
}

.shell-footer-inner,
.site-footer-inner,
.footer-inner {
  width: min(1160px, 92vw) !important;
  margin: 0 auto !important;
  min-height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--shell-muted) !important;
  font-size: 0.82rem !important;
}

@media (max-width: 768px) {
  .shell-inner,
  .site-topbar-inner,
  .topbar-inner {
    width: 100% !important;
    max-width: none !important;
    min-height: 44px !important;
    padding: 0 10px !important;
  }

  .shell-main {
    width: 100%;
    padding-top: calc(62px + var(--site-announce-h, 0px));
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: calc(46px + env(safe-area-inset-bottom));
  }

  .shell-nav,
  .site-nav,
  .topnav {
    display: none !important;
  }

  /* 移动端：品牌 | 语言 | 登录 | 汉堡 */
  .shell-lang {
    margin-left: auto;
  }

  .shell-lang-label {
    max-width: 4.8em;
    font-size: 0.72rem;
  }

  .shell-lang-btn {
    padding: 5px 8px !important;
  }

  .shell-auth-btn,
  a.shell-auth-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-left: 0 !important;
    color: #ffd7de !important;
    text-decoration: none !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    border: 1px solid rgba(196, 92, 106, 0.5) !important;
    border-radius: 999px !important;
    padding: 5px 10px !important;
    background: rgba(196, 92, 106, 0.12) !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    max-width: 36vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shell-auth-btn.is-logged-in {
    color: #f0d7a2 !important;
    border-color: rgba(226, 192, 126, 0.55) !important;
    background: rgba(226, 192, 126, 0.1) !important;
  }

  .shell-menu-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 0 !important;
  }

  .shell-menu-panel a.auth-link,
  .shell-menu-panel a[data-auth-slot] {
    color: #ffd7de !important;
    border: 1px solid rgba(196, 92, 106, 0.45) !important;
    background: rgba(196, 92, 106, 0.1) !important;
    font-weight: 700 !important;
  }

  .shell-menu-panel {
    position: fixed;
    right: 10px;
    top: 52px;
    width: min(220px, calc(100vw - 20px));
    border: 1px solid rgba(226, 192, 126, 0.3);
    border-radius: 12px;
    background: rgba(8, 14, 22, 0.97);
    padding: 8px;
    z-index: 1200;
  }

  .shell-menu-panel.open {
    display: block;
  }

  .shell-menu-panel a {
    display: block;
    color: #dbe7f5;
    text-decoration: none;
    font-size: 0.86rem;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .shell-menu-panel a:hover {
    background: rgba(226, 192, 126, 0.12);
  }

  .shell-footer-inner,
  .site-footer-inner,
  .footer-inner {
    width: 100% !important;
    max-width: none !important;
    min-height: 34px !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0 8px !important;
  }
}

/* ========== 站内通告栏（首页 / 我的 · CMS 可配） ========== */
.site-announce {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 990;
  border-bottom: 1px solid rgba(226, 192, 126, 0.28);
  background:
    linear-gradient(90deg, rgba(226, 192, 126, 0.14), rgba(120, 160, 210, 0.1) 50%, rgba(226, 192, 126, 0.12));
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.site-announce.is-info {
  background:
    linear-gradient(90deg, rgba(90, 140, 200, 0.2), rgba(226, 192, 126, 0.1) 55%, rgba(90, 140, 200, 0.16));
  border-bottom-color: rgba(140, 180, 230, 0.35);
}

.site-announce.is-promo {
  background:
    linear-gradient(90deg, rgba(226, 192, 126, 0.22), rgba(196, 92, 106, 0.12) 50%, rgba(226, 192, 126, 0.18));
  border-bottom-color: rgba(226, 192, 126, 0.45);
}

.site-announce.is-warn {
  background:
    linear-gradient(90deg, rgba(210, 150, 60, 0.28), rgba(180, 100, 40, 0.14) 55%, rgba(210, 150, 60, 0.22));
  border-bottom-color: rgba(230, 170, 70, 0.5);
}

.site-announce.is-urgent {
  background:
    linear-gradient(90deg, rgba(200, 70, 90, 0.32), rgba(160, 40, 70, 0.18) 50%, rgba(200, 70, 90, 0.28));
  border-bottom-color: rgba(230, 100, 120, 0.55);
  animation: site-announce-pulse 2.4s ease-in-out infinite;
}

@keyframes site-announce-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); }
  50% { box-shadow: 0 0 0 1px rgba(255, 120, 140, 0.25), 0 8px 22px rgba(180, 40, 70, 0.35); }
}

.site-announce-inner {
  width: min(1160px, 92vw);
  margin: 0 auto;
  min-height: 34px;
  height: 34px; /* 固定单行高度，长语言文案不撑成两行 */
  padding: 0 4px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.site-announce-icon {
  flex: 0 0 auto;
  font-size: 0.9rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 220, 160, 0.35));
}

.site-announce-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.site-announce.is-scroll .site-announce-track {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
  width: max-content;
  max-height: 34px;
  padding-left: 8px;
  /* 单份内容：从视口右侧滚入，再滚出左侧（不再 DOM 复制两遍） */
  animation: site-announce-marquee 36s linear infinite;
}

.site-announce.is-scroll:hover .site-announce-track {
  animation-play-state: paused;
}

@keyframes site-announce-marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.site-announce.is-static .site-announce-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 16px;
  padding: 0;
  justify-content: flex-start;
  width: 100%;
  overflow: hidden;
}

.site-announce-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f3e8c8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

a.site-announce-item:hover .site-announce-text {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-announce-text {
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.site-announce-more {
  color: #ffd89a;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(255, 216, 154, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
  background: rgba(255, 216, 154, 0.08);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* 静态多条：德/西长句时压缩字号，保持单行 */
.site-announce.is-static .site-announce-item {
  flex: 1 1 auto;
}
.site-announce.is-static .site-announce-item + .site-announce-item {
  flex: 0 1 auto;
  max-width: 42%;
}

.site-announce-sep {
  color: rgba(240, 210, 150, 0.55);
  font-size: 0.75rem;
  user-select: none;
}

.site-announce-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: #dbe7f5;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.site-announce-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(226, 192, 126, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .site-announce.is-scroll .site-announce-track {
    animation: none;
    white-space: normal;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }
  .site-announce.is-urgent {
    animation: none;
  }
}

@media (max-width: 768px) {
  .site-announce {
    top: 44px;
  }

  .site-announce-inner {
    width: 100%;
    padding: 0 8px 0 10px;
    min-height: 32px;
    height: 32px;
  }

  .site-announce-text {
    font-size: 0.74rem;
  }

  .site-announce-more {
    display: none; /* 窄屏只保留主文案，避免挤成两行 */
  }

  .site-announce.is-scroll .site-announce-track {
    animation-duration: 28s;
  }

  .site-announce.is-static .site-announce-item + .site-announce-item {
    display: none; /* 移动端静态模式只显示第一条 */
  }
}
