/* 入口与站内既有元素（页头导航、手机侧栏、文章页右侧悬浮栏、文章图片）的改版样式只在 <html class="ds-entry-on"> 时生效：
 * 入口条件成立（前台开关开且页面都建好）时服务端给 <html> 加 ds-entry-on（XcCommunity::htmlClassAttr）；开关关着时站内既有版面与改版前逐像素相同（灯塔 03fb154f）。
 * 只作用于新元素（如 .ds-entry-account）的规则不受此限。 */
/* 仅补充原站首页、分类页与文章页的社区入口。 */
.ds-entry-account {
  position: relative;
  flex: 0 0 auto;
  margin-left: 16px;
}

.ds-entry-avatar {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.ds-entry-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 头像库图片：盖满圆形按钮；有图时默认图标藏起来（svg 的 display:block 会盖过 hidden 属性） */
.ds-entry-avatar svg[hidden] {
  display: none;
}

.ds-entry-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ds-entry-account-menu {
  position: absolute;
  z-index: 1025;
  top: calc(100% + 12px);
  right: 0;
  width: 180px;
  padding: 12px 8px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1f1f1f;
  color: #ddd;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

.ds-entry-account-menu[hidden] {
  display: none !important;
}

.ds-entry-account-identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 12px;
  border-bottom: 1px solid #363636;
}

.ds-entry-account-identity span {
  overflow: hidden;
  color: #d9b64e;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-entry-account-identity small {
  overflow: hidden;
  color: #888;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-entry-account-menu > a,
.ds-entry-account-menu > button {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ddd;
  font:
    400 14px/20px "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  text-align: center;
  cursor: pointer;
}

.ds-entry-account-menu > button {
  margin-top: 4px;
  border-top: 1px solid #363636;
  color: #cf5151;
}

.ds-entry-account-menu > button[hidden] {
  display: none;
}

.ds-entry-account-menu > a:hover,
.ds-entry-account-menu > button:hover {
  background: #2b2b2b;
}

.ds-entry-avatar:focus-visible,
.ds-entry-account-menu > a:focus-visible,
.ds-entry-account-menu > button:focus-visible,
.ds-entry-shortcut:focus-visible {
  outline: 2px solid #ffbb02;
  outline-offset: 3px;
}

.ds-entry-account--drawer {
  position: absolute;
  top: 40px;
  right: 24px;
  margin-left: 0;
  z-index: 6;
}

.ds-entry-account--drawer .ds-entry-avatar {
  width: 32px;
  height: 32px;
}

.ds-entry-account--drawer .ds-entry-account-menu {
  right: -6px;
  top: 46px;
}

html.ds-entry-on .fixed-to-right.ds-entry-rail {
  top: 240px;
  right: max(0px, calc((100vw - 880px) / 2));
  width: 56px;
  height: auto;
  padding: 8px 0;
  gap: 8px;
  border-radius: 16px 0 0 0;
  background: #1a1a1a;
  transition:
    opacity 180ms ease-out,
    transform 180ms ease-out;
}

html.ds-entry-on .fixed-to-right.ds-entry-rail .right-item {
  min-height: 40px;
  cursor: pointer;
}

html.ds-entry-on .fixed-to-right.ds-entry-rail .ds-entry-shortcut {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 48px;
  color: #ddd;
  font-size: 12px;
  line-height: 16px;
  text-decoration: none;
}

html.ds-entry-on .fixed-to-right.ds-entry-rail img,
html.ds-entry-on .fixed-to-right.ds-entry-rail .ds-entry-shortcut img {
  width: 24px;
  height: 24px;
  margin: 0;
  object-fit: contain;
}

.ds-entry-shortcut:hover {
  background: #292929;
}

.ds-entry-article-comments {
  margin-bottom: 24px;
}

.ds-entry-article-comments textarea {
  width: 100%;
  min-height: 160px;
  padding: 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: transparent;
  color: #ddd;
  font:
    400 14px/24px "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  resize: vertical;
  box-sizing: border-box;
}

@media (min-width: 769px) and (max-width: 1500px) {
  html.ds-entry-on .header_internal .Xc_total {
    gap: 0;
    padding-right: 16px;
    padding-left: 16px;
  }

  html.ds-entry-on .header_internal_nav .item {
    margin-right: 6px;
    padding-right: 3px;
    padding-left: 3px;
    font-size: 13px;
  }

  html.ds-entry-on .header_internal_nav .item .iconfont {
    display: none;
  }

  html.ds-entry-on .header_internal-logo {
    margin-right: 4px;
    padding-right: 4px;
  }

  html.ds-entry-on .header_internal-logo img {
    max-width: 88px;
    object-fit: contain;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  html.ds-entry-on .header_internal_nav .header_below .Xc_total > .item:nth-of-type(n + 7) {
    display: none;
  }
}

@media (max-width: 768px) {
  html.ds-entry-on .Xc_reads_article .defaultimg > [data-fancybox] {
    min-width: 0;
    max-width: 100%;
  }

  html.ds-entry-on .Xc_reads_article img:not(.owo_image) {
    max-width: 100%;
    height: auto;
  }

  html.ds-entry-on .ds-entry-account--desktop {
    display: none;
  }

  html.ds-entry-on .Xc_header .header_roll {
    width: 80%;
    min-width: 0;
    max-width: 320px;
    padding: 104px 18px 24px;
    background: #252525;
  }

  html.ds-entry-on .Xc_header .header_roll .header_roll-image {
    top: 32px;
    left: 18px;
    width: 120px;
    height: 50px;
    transform: none;
  }

  html.ds-entry-on .Xc_header .header-roll-menu-mobile .link {
    min-height: 40px;
  }

  html.ds-entry-on .Xc_header .header-roll-menu-mobile .slides li {
    margin-bottom: 0;
  }

  html.ds-entry-on .Xc_header .header-roll-menu-mobile .slides .link {
    min-height: 42px;
  }

  html.ds-entry-on .Xc_header .header-roll-menu-mobile .header-roll-app .link {
    min-height: 32px;
  }

  html.ds-entry-on .fixed-to-right.ds-entry-rail {
    top: 45%;
    right: 0;
    width: 40px;
    gap: 4px;
    padding: 8px 0;
  }

  html.ds-entry-on .fixed-to-right.ds-entry-rail .right-item {
    min-height: 32px;
  }

  html.ds-entry-on .fixed-to-right.ds-entry-rail .ds-entry-shortcut {
    min-height: 44px;
    font-size: 11px;
  }

  html.ds-entry-on .fixed-to-right.ds-entry-rail img,
  html.ds-entry-on .fixed-to-right.ds-entry-rail .ds-entry-shortcut img {
    width: 24px;
    height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.ds-entry-on .fixed-to-right.ds-entry-rail {
    transition: none;
  }
}

.ds-entry-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
