/* 基础重置，统一默认样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.5;
}

/* 容器：移动端全屏宽度，桌面端限制宽度居中 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* 标题：适配移动端字号 */
h1 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 24px;
  color: #222;
}

/* 卡片列表：移动端单列，桌面端自动多列 */
.card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* 单个卡片：圆角阴影，适配移动端触摸 */
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:active {
  transform: scale(0.98);
}

/* 卡片图片：宽度100%，固定比例避免跳动 */
.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* 卡片内容区域：内边距适配 */
.card-body {
  padding: 16px;
}

.card-body h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #222;
  /* 超出两行自动省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body p {
  font-size: 15px;
  color: #666;
  margin-bottom: 16px;
}

/* 按钮：移动端友好的点击尺寸，铺满宽度更易点击 */
.btn {
  display: block;
  width: 100%;
  text-align: center;
  background-color: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 0;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn:hover,
.btn:active {
  background-color: #1d4ed8;
}

/* 平板适配：中等屏幕双列布局 */
@media screen and (min-width: 640px) {
  .card-list {
    grid-template-columns: repeat(2, 1fr);
  }
  h1 {
    font-size: 26px;
  }
}

/* 桌面端适配：大屏幕三列布局 */
@media screen and (min-width: 1024px) {
  .card-list {
    grid-template-columns: repeat(3, 1fr);
  }
  .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  }
  .container {
    padding: 24px 16px;
  }
}
