/* 棉球小猫表情库样式 (static/style.css) */
:root {
  --bg-primary: #faf7f2;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f4eee6;
  --border-color: #ebdcd0;
  --text-main: #2b2523;
  --text-muted: #7d726b;
  --brand-accent: #f07167;
  --brand-accent-hover: #df584e;
  --brand-warm: #fed9b7;
  --brand-soft: #fff1e6;
  --shadow-sm: 0 2px 6px rgba(43, 37, 35, 0.05);
  --shadow-md: 0 8px 20px rgba(43, 37, 35, 0.08);
  --shadow-lg: 0 16px 36px rgba(43, 37, 35, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #191615;
    --bg-surface: #24201e;
    --bg-surface-subtle: #2d2825;
    --border-color: #3d3632;
    --text-main: #f0eae4;
    --text-muted: #a69c94;
    --brand-accent: #f07167;
    --brand-accent-hover: #fa8279;
    --brand-warm: #4a3830;
    --brand-soft: #302722;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-size: 28px;
  background-color: var(--brand-soft);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.attribution-badge {
  font-size: 13px;
  color: var(--text-muted);
  background-color: var(--bg-surface-subtle);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.attribution-badge a {
  color: var(--brand-accent);
  text-decoration: none;
  font-weight: 500;
}

.attribution-badge a:hover {
  text-decoration: underline;
}

.attribution-badge .sep {
  color: var(--border-color);
}

/* 核心容器 */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  width: 100%;
}

/* 工具栏 */
.toolbar {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 12px 44px 12px 18px;
  font-size: 15px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--brand-accent);
  background-color: var(--bg-surface);
}

.btn-icon {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-group {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.filter-btn {
  background-color: var(--bg-surface);
  border: none;
  border-right: 1px solid var(--border-color);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.filter-btn:last-child {
  border-right: none;
}

.filter-btn.active {
  background-color: var(--brand-accent);
  color: #fff;
  font-weight: 600;
}

.select-box {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--brand-accent);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--brand-accent-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--brand-soft);
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  font-size: 12px;
  padding: 4px 10px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.tag-chip:hover, .tag-chip.active {
  background-color: var(--brand-soft);
  color: var(--brand-accent);
  border-color: var(--brand-accent);
}

/* 状态条 */
.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.license-tip {
  font-size: 12px;
}

/* 表情网格 (虚拟瀑布流 / 响应式) */
.meme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .meme-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }
}

.meme-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.meme-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-accent);
}

.meme-card.selected {
  border: 2px solid var(--brand-accent);
  background-color: var(--brand-soft);
}

.meme-img-container {
  aspect-ratio: 1 / 1;
  background-color: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.meme-img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  transition: transform 0.2s;
}

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

.meme-badge-animated {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(43, 37, 35, 0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.select-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  accent-color: var(--brand-accent);
  cursor: pointer;
  z-index: 10;
}

.meme-meta {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meme-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.meme-series {
  font-size: 11px;
  color: var(--text-muted);
}

/* 触底哨兵 */
.scroll-sentinel {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* 灯箱与弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  z-index: 10;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.lightbox-body {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.lightbox-img-wrap {
  flex: 1;
  min-width: 240px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.lightbox-info {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  align-items: center;
  font-size: 13px;
  gap: 8px;
}

.info-row .label {
  color: var(--text-muted);
  width: 72px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* API 文档弹窗 */
.api-doc-item {
  margin: 16px 0;
  padding: 12px 16px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.api-method {
  background-color: var(--brand-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
}

.footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
