/* 确保盒子模型一致 */
.recom-wrapper, .recom-wrapper * {
  box-sizing: border-box !important;
}

.recom-wrapper {
  width: 100% !important;
  margin: 2rem 0 !important;
  position: relative;
  clear: both;
}

/* --- Grid 布局：强制三列等宽 --- */
.recom-container {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
  width: 100% !important;
  overflow: hidden;
  transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* --- 核心修改：高度设为 380px 左右只显示第一行 --- */
.recom-container.collapsed {
  max-height: 380px !important; 
}

/* 折叠时的渐变遮罩 */
.recom-container.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 1));
  pointer-events: none;
  z-index: 5;
}

/* 暗黑模式遮罩适配 */
[data-user-color-scheme='dark'] .recom-container.collapsed::after {
  background: linear-gradient(to bottom, transparent, #1a0631);
}

/* --- 卡片基础样式 --- */
.recom-card {
  width: 100% !important;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.recom-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.recom-img {
  width: 100% !important;
  aspect-ratio: 16 / 10 !important;
  object-fit: cover !important;
  display: block;
}

.recom-info {
  padding: 12px !important;
  flex-grow: 1;
}

.recom-title {
  color: #3c4858;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 6px;
  display: block;
}

.recom-tags {
  color: #727272;
  font-size: 0.8rem;
}

/* --- 展开按钮：浅蓝色风格 --- */
.recom-toggle-btn {
  display: block !important;
  width: 140px !important;
  margin: 25px auto 0 !important;
  padding: 8px 0 !important;
  background: transparent;
  color: #70c1ff; /* 浅蓝色文字 */
  border: 1.5px solid #70c1ff; /* 浅蓝色边框 */
  border-radius: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.3s;
}

.recom-toggle-btn:hover {
  background: #70c1ff;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(112, 193, 255, 0.4);
}

/* --- 暗黑模式适配 --- */
[data-user-color-scheme='dark'] .recom-card {
  background-color: #252d3d;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-user-color-scheme='dark'] .recom-title { color: #70c1ff; }

/* --- 响应式适配 --- */
@media (max-width: 992px) {
  .recom-container { grid-template-columns: repeat(2, 1fr) !important; }
  .recom-container.collapsed { max-height: 420px !important; } /* 平板模式高度微调 */
}

@media (max-width: 576px) {
  .recom-container { grid-template-columns: 1fr !important; }
  .recom-container.collapsed { max-height: 400px !important; } /* 手机模式只显一个 */
}