/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

:root {
  --primary: #FF6B6B;
  --accent: #FF8E53;
  --bg: #F0F2F5;
  --card-bg: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #555555;
  --text-muted: #999999;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.13);
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* ==================== 顶部导航 ==================== */
.header {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  padding: 20px 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(255, 107, 107, 0.3);
}

.header-inner {
  text-align: center;
  padding-bottom: 14px;
}

.logo {
  font-size: 21px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 3px;
}

.header-tags {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 14px;
  scrollbar-width: none;
}

.header-tags::-webkit-scrollbar { display: none; }

.tag {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}

.tag.active {
  background: #FFFFFF;
  color: var(--primary);
  border-color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
}

.tag:not(.active):hover { background: rgba(255, 255, 255, 0.35); }

/* ==================== 瀑布流布局 ==================== */
.card-list {
  padding: 16px 14px;
  display: grid;
  gap: 14px;
  align-items: start;
}

/* 响应式列数 */
@media (max-width: 500px) {
  .card-list { grid-template-columns: 1fr; }
}
@media (min-width: 501px) and (max-width: 800px) {
  .card-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 801px) and (max-width: 1200px) {
  .card-list { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1201px) and (max-width: 1600px) {
  .card-list { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1601px) and (max-width: 2000px) {
  .card-list { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 2001px) and (max-width: 2400px) {
  .card-list { grid-template-columns: repeat(6, 1fr); }
}
@media (min-width: 2401px) and (max-width: 2800px) {
  .card-list { grid-template-columns: repeat(7, 1fr); }
}
@media (min-width: 2801px) {
  .card-list { grid-template-columns: repeat(8, 1fr); }
}

/* ==================== 卡片（3:4竖图拍立得风格） ==================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  /* 内部统一按3:4控制 */
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 133.33%; /* 3:4 */
  overflow: hidden;
  background: #F0F0F5;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  /* 防右键 */
  pointer-events: none;
  -webkit-touch-callout: none;
}

.card:hover .card-img { transform: scale(1.03); }

.card-info {
  padding: 10px 12px 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.35;
  /* 单行截断，15字以内 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  /* 2行截断 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tag-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 7px;
  overflow: hidden;
}

.card-tag-item {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  background: #FFF0F0;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
}

/* ==================== 加载 & 到底 ==================== */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
  display: none;
}
.loading.show { display: block; }

.end-tip {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 12px;
  display: none;
}
.end-tip.show { display: block; }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0, 0, 0, 0.72);
  color: #FFF;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.28s ease;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 详情展开层 ==================== */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.detail-overlay.show { display: flex; }

.detail-card {
  background: var(--card-bg);
  border-radius: 18px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: modalIn 0.28s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.detail-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  font-size: 17px;
  cursor: pointer;
  z-index: 510;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  color: #333;
  line-height: 1;
}

.detail-img-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background: #F0F0F5;
}

.detail-img {
  width: 100%;
  height: auto;
  display: block;
  /* 自然高度，宽度撑满，比例不变 */
  max-height: 80vh;
  object-fit: contain;
  /* 防右键防拖拽 */
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.detail-body {
  padding: 18px 20px 24px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.detail-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 10px;
  background: #FFF0F0;
  color: var(--primary);
  font-weight: 500;
}

.detail-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.35;
}

.detail-content {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

.detail-reactions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 24px;
  border: 2px solid #EEE;
  background: #FFF;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.reaction-btn:active { transform: scale(0.94); }

.reaction-btn.liked {
  border-color: var(--primary);
  color: var(--primary);
  background: #FFF0F0;
}

.reaction-btn.disliked {
  border-color: #CCC;
  color: #999;
}

.reaction-btn .icon { font-size: 18px; }
