/* ===========================
   Balatro Gilding Tracker
   暗黑主题 + Balatro 风格
   =========================== */

/* --- 广告位 --- */
.ad-slot {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  min-height: 0;
  /* 无广告时不占空间 */
  text-align: center;
}

/* --- CSS 变量 --- */
:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #131a24;
  --bg-card: #1a2332;
  --bg-card-hover: #223044;
  --bg-surface: #0f1620;

  --text-primary: #e8edf4;
  --text-secondary: #8899aa;
  --text-muted: #5a6a7a;

  --gold: #f5c842;
  --gold-dim: #c09a20;
  --gold-glow: rgba(245, 200, 66, 0.3);

  --common: #4a9eff;
  --uncommon: #4ade80;
  --rare: #f43f5e;
  --legendary: #a855f7;

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- 全局样式 --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* --- 顶部标题 --- */
.header {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.gold-text {
  background: linear-gradient(135deg, var(--gold), #ffd700, var(--gold-dim));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  margin-top: 0.3rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* --- 进度条 --- */
.progress-section {
  padding: 1.5rem;
}

.progress-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.progress-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.progress-count {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), #ffd700);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--gold-glow);
}

.progress-percentage {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* --- 工具栏 --- */
.toolbar {
  padding: 0 1.5rem 1rem;
}

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

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-icon {
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #1a3a5c, #1e4573);
  color: var(--text-primary);
  border-color: rgba(74, 158, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e4573, #2558a0);
  border-color: var(--common);
  box-shadow: 0 0 12px rgba(74, 158, 255, 0.2);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-gold {
  background: linear-gradient(135deg, #3d2e0a, #5c4415);
  color: var(--gold);
  border-color: rgba(245, 200, 66, 0.35);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #5c4415, #7a5c1e);
  border-color: var(--gold);
  box-shadow: 0 0 14px var(--gold-glow);
}

/* --- Modal 弹窗 --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.3rem;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  overflow: auto;
  padding: 1rem;
  display: flex;
  justify-content: center;
}

.modal-body canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.modal-footer {
  padding: 0.8rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* --- Section 通用 --- */
.dashboard,
.collection {
  padding: 1rem 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.section-icon {
  font-size: 1.5rem;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.dashboard-count {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
}

/* --- 稀有度分栏 --- */
.rarity-section {
  margin-bottom: 1.5rem;
}

.rarity-section:empty {
  display: none;
}

.rarity-header {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.rarity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.rarity-dot.common {
  background: var(--common);
  box-shadow: 0 0 6px var(--common);
}

.rarity-dot.uncommon {
  background: var(--uncommon);
  box-shadow: 0 0 6px var(--uncommon);
}

.rarity-dot.rare {
  background: var(--rare);
  box-shadow: 0 0 6px var(--rare);
}

.rarity-dot.legendary {
  background: var(--legendary);
  box-shadow: 0 0 6px var(--legendary);
}

.rarity-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rarity-section.hidden {
  display: none;
}

/* --- 卡片网格 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
}

/* --- 卡片样式 --- */
.joker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.joker-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* 稀有度边框颜色 */
.joker-card.rarity-common {
  border-left: 3px solid var(--common);
}

.joker-card.rarity-uncommon {
  border-left: 3px solid var(--uncommon);
}

.joker-card.rarity-rare {
  border-left: 3px solid var(--rare);
}

.joker-card.rarity-legendary {
  border-left: 3px solid var(--legendary);
}

/* 已贴金标记 */
.joker-card.gilded {
  opacity: 0.4;
  border-left-color: var(--gold) !important;
}

.joker-card.gilded:hover {
  opacity: 0.7;
}

.joker-card.gilded::after {
  content: '✅ GILDED';
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(245, 200, 66, 0.2);
  color: var(--gold);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* 在提示板中的标记 */
.joker-card.on-board::before {
  content: '🎯';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.9rem;
}

/* 卡片图片 */
.joker-img {
  width: 80px;
  height: 112px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  transition: transform var(--transition);
  image-rendering: auto;
}

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

/* 卡片名称 */
.joker-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

/* 卡片效果 */
.joker-effect {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.4;
  max-height: 3.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* 稀有度标签 */
.joker-rarity {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.4rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.joker-rarity.common {
  color: var(--common);
  background: rgba(74, 158, 255, 0.1);
}

.joker-rarity.uncommon {
  color: var(--uncommon);
  background: rgba(74, 222, 128, 0.1);
}

.joker-rarity.rare {
  color: var(--rare);
  background: rgba(244, 63, 94, 0.1);
}

.joker-rarity.legendary {
  color: var(--legendary);
  background: rgba(168, 85, 247, 0.1);
}

/* 提示板里的卡片 - 点击移除按钮 */
.dashboard .joker-card:hover::after {
  content: '✨ Click to mark GILDED';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(245, 200, 66, 0.15));
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1.5rem 0.5rem 0.5rem;
  text-align: center;
}

/* --- 空状态 --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-hint {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* --- 搜索和筛选 --- */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.5;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.8rem 0.6rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--common);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.filter-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: linear-gradient(135deg, #1a3a5c, #1e4573);
  border-color: var(--common);
  color: var(--text-primary);
}

/* --- 页脚 --- */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--common);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.btn-coffee {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.8rem 0 0.3rem;
  padding: 0.55rem 1.3rem;
  background: linear-gradient(135deg, #ff813f, #ffdd00);
  color: #1a1a2e;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(255, 129, 63, 0.25);
}

.btn-coffee:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(255, 129, 63, 0.4);
  text-decoration: none;
  color: #1a1a2e;
}

.btn-coffee span {
  font-size: 1.1rem;
}

/* --- 动画 --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.joker-card {
  animation: fadeIn 0.3s ease forwards;
}

/* 贴金成功闪光动画 */
@keyframes gildFlash {
  0% {
    box-shadow: 0 0 0 0 var(--gold-glow);
  }

  50% {
    box-shadow: 0 0 20px 8px var(--gold-glow);
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.gild-flash {
  animation: gildFlash 0.6s ease;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .logo {
    font-size: 1.4rem;
  }

  .logo-icon {
    font-size: 1.8rem;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
  }

  .joker-img {
    width: 60px;
    height: 84px;
  }

  .toolbar-content {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    justify-content: center;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-buttons {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .joker-img {
    width: 50px;
    height: 70px;
  }

  .joker-name {
    font-size: 0.75rem;
  }

  .joker-effect {
    display: none;
  }
}

/* --- 滚动条美化 --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}