/* Sidebar widgets — spacing + symmetrical tag grid */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

/* Article page: ad stack sticks while reading */
.sidebar-roll-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 64px;
  z-index: 30;
  width: 100%;
}

@media (max-width: 900px) {
  .sidebar-roll-stack {
    position: static;
    top: auto;
  }
}

.sidebar .widget {
  margin: 0;
  padding: 0;
  background: var(--fs-surface);
  border: 1px solid var(--fs-line);
  border-radius: var(--fs-radius);
  overflow: hidden;
}

/* Keep space even if a parent resets flex gap */
.sidebar > .widget + .widget,
.sidebar > section.widget + section.widget,
.sidebar > .widget_ui_orbui + .widget,
.sidebar > .widget + .widget_ui_orbui {
  margin-top: 0;
}

.sidebar .widget-title,
.sidebar .widget h3 {
  position: relative;
  margin: 0;
  padding: 14px 16px 14px 28px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fs-text);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--fs-line);
}

.sidebar .widget-title::before,
.sidebar .widget h3::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 14px;
  width: 3px;
  height: 14px;
  margin-top: -7px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f7e5a3, #c19549);
}

/* Ads */
.widget_ui_orbui {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.widget_ui_orbui .item {
  position: relative;
  overflow: hidden;
  border-radius: var(--fs-radius);
  border: 1px solid var(--fs-line);
  background: var(--fs-surface);
}
.widget_ui_orbui .item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Posts / sticky list */
.widget_ui_posts ul {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.widget_ui_posts li {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}
.widget_ui_posts li:last-child {
  border-bottom: none;
}
.widget_ui_posts li a {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 5px;
  align-items: start;
  position: relative;
  overflow: hidden;
  padding: 12px 14px;
  min-height: 0;
  color: var(--fs-text);
  transition: background .15s ease;
}
.widget_ui_posts li.noimg a,
.widget_ui_posts ul.nopic li a {
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 16px;
}
.widget_ui_posts li a:hover {
  background: rgba(232, 201, 106, 0.06);
}
.widget_ui_posts li a:hover .text {
  color: var(--fs-accent-soft);
}
.widget_ui_posts .thumbnail {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: static;
  width: 84px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(232, 201, 106, 0.28);
  background: #0e1219;
}
.widget_ui_posts .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.widget_ui_posts .text {
  grid-column: 2;
  grid-row: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}
.widget_ui_posts li.noimg a .text,
.widget_ui_posts ul.nopic li a .text {
  grid-column: 1;
}
.widget_ui_posts .muted {
  grid-column: 2;
  grid-row: 2;
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  color: var(--fs-muted);
  font-weight: 400;
}
.widget_ui_posts li.noimg a .muted,
.widget_ui_posts ul.nopic li a .muted {
  grid-column: 1;
}
.widget_ui_posts li a .muted + .muted {
  grid-row: 3;
}

/* Tags — equal 3-column grid for symmetry */
.widget_ui_tags .items {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  margin: 0 !important;
  overflow: visible;
  float: none;
}
.widget_ui_tags .items a {
  float: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  min-height: 34px;
  margin: 0 !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
  font-weight: 600;
  text-align: center;
  color: var(--fs-text) !important;
  border: 1px solid var(--fs-line) !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget_ui_tags .items a:hover {
  color: #1a1408 !important;
  border-color: rgba(232, 201, 106, 0.75) !important;
  background: linear-gradient(180deg, #f7e5a3 0%, #e8c96a 55%, #c19549 100%) !important;
}
.widget_ui_tags .items a span {
  display: none; /* keep cells equal width; counts clutter symmetry */
}

/* Text promo */
.widget_ui_textorbui {
  padding: 0 !important;
  overflow: hidden;
}
.widget_ui_textorbui > a {
  display: block;
  padding: 16px 16px 18px;
  color: #fff !important;
  text-decoration: none !important;
  border: none !important;
  border-radius: var(--fs-radius);
  background: linear-gradient(135deg, #c19549, #e8c96a) !important;
}
.widget_ui_textorbui > a.style01 { background: linear-gradient(135deg, #2f6fed, #5b9dff) !important; }
.widget_ui_textorbui > a.style02 { background: linear-gradient(135deg, #c45a2c, #e8a35a) !important; }
.widget_ui_textorbui > a.style03 { background: linear-gradient(135deg, #1f8a5b, #3ecf8e) !important; }
.widget_ui_textorbui > a.style04 { background: linear-gradient(135deg, #6b3fa0, #a56bdb) !important; }
.widget_ui_textorbui > a.style05 { background: linear-gradient(135deg, #0f8a8a, #2ec4c4) !important; }
.widget_ui_textorbui strong {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}
.widget_ui_textorbui h2 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.4;
  color: #fff;
}
.widget_ui_textorbui p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}

/* Coupon widget sits flush in card shell */
.widget_ui_coupon_tool {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

/* “在手机端显示” must not hide widgets on desktop (ads/coupon were missing).
   All sidebar widgets show on desktop and mobile. */
@media (max-width: 900px) {
  .sidebar {
    gap: 12px;
  }
  .widget_ui_tags .items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }
}
