:root {
  --bg: #10141f;
  --bg-raised: #181e2e;
  --bg-card: #1c2338;
  --border: #2a3350;
  --text: #e8ecf6;
  --text-dim: #97a2bd;
  --accent: #78e08f;
  --accent-2: #f6b93b;
  --danger: #e55039;
  --rare: #3f8efc;
  --epic: #b070f0;
  --legendary: #f6a13b;
  --mythic: #ffd32a;
  --radius: 14px;
  font-size: 16px;
}

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

body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, #1d2b3f 0%, transparent 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  padding: 0 clamp(12px, 4vw, 48px) 48px;
}

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 26px 0 18px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; filter: drop-shadow(0 4px 12px rgba(120, 224, 143, .35)); }
.brand h1 {
  font-size: 1.9rem; letter-spacing: .5px;
  background: linear-gradient(100deg, var(--accent), #4fd1c5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-transform: uppercase; font-weight: 800;
}
.tagline { color: var(--text-dim); font-size: .85rem; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  padding: 10px 16px; font-weight: 600; font-size: .9rem; text-decoration: none;
}
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.auth { display: flex; align-items: center; gap: 10px; }
.auth .avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--accent); }
.auth .uname { font-weight: 600; }
.sync-note { font-size: .75rem; color: var(--text-dim); }

/* ---------- new banner ---------- */
.new-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, rgba(246, 185, 59, .16), rgba(120, 224, 143, .10));
  border: 1px solid rgba(246, 185, 59, .45);
  border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 18px;
  font-weight: 600; font-size: .95rem;
}
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2); flex-shrink: 0;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(246, 185, 59, .6); }
  100% { box-shadow: 0 0 0 12px rgba(246, 185, 59, 0); }
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.stat-tile {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-dim); }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-value.dust { color: var(--accent-2); }
.stat-note { font-size: .7rem; color: var(--text-dim); }
.hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--border); color: var(--text); font-size: .65rem; cursor: help;
}
.meter { height: 7px; background: #0c101a; border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #4fd1c5, var(--accent)); transition: width .4s; }
.meter-fill.gold { background: linear-gradient(90deg, var(--accent-2), #ffd76e); }

.rarity-tiles { flex-direction: row; flex-wrap: wrap; gap: 10px; align-items: center; }
.rarity-mini { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.rarity-mini .rm-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .8px; }
.rarity-mini .rm-count { font-size: .95rem; font-weight: 700; }
.rm-rare .rm-label { color: var(--rare); }
.rm-epic .rm-label { color: var(--epic); }
.rm-legendary .rm-label { color: var(--legendary); }
.rm-mythic .rm-label { color: var(--mythic); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 22px;
}
#search {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 10px 14px; font-size: .9rem; min-width: 200px; flex: 1 1 200px; max-width: 320px;
}
#search:focus { outline: 2px solid var(--accent); border-color: transparent; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-dim); padding: 7px 14px; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #0c101a; }
.chip.r-rare.active { background: var(--rare); border-color: var(--rare); color: #fff; }
.chip.r-epic.active { background: var(--epic); border-color: var(--epic); color: #fff; }
.chip.r-legendary.active { background: var(--legendary); border-color: var(--legendary); color: #10141f; }
.chip.r-mythic.active { background: var(--mythic); border-color: var(--mythic); color: #10141f; }

/* ---------- grid / cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: #3c4a75; }
.card.complete { border-color: var(--accent); box-shadow: 0 0 18px rgba(120, 224, 143, .12); }
.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-icon {
  width: 64px; height: 64px; flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .45));
}
.card-name { font-size: 1.05rem; font-weight: 700; }
.badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.badge {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  padding: 3px 8px; border-radius: 6px;
}
.badge.rare { background: rgba(63, 142, 252, .18); color: var(--rare); }
.badge.epic { background: rgba(176, 112, 240, .18); color: var(--epic); }
.badge.legendary { background: rgba(246, 161, 59, .18); color: var(--legendary); }
.badge.mythic { background: rgba(255, 211, 42, .18); color: var(--mythic); }
.badge.new { background: var(--accent-2); color: #10141f; animation: newGlow 2s ease-in-out infinite; }
@keyframes newGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(246, 185, 59, .5); }
  50% { box-shadow: 0 0 14px rgba(246, 185, 59, .9); }
}

.variants { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.vslot {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 2px solid var(--border);
  background: #141a2b;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1px;
  cursor: pointer; position: relative;
  font-size: .55rem; font-weight: 800; letter-spacing: .3px;
  color: var(--text-dim);
  transition: transform .1s, border-color .15s, opacity .15s;
  padding: 0; font-family: inherit;
}
.vslot:hover:not(:disabled) { transform: scale(1.1); z-index: 2; }
.vslot:disabled { opacity: .22; cursor: default; }
.vslot .vg { width: 60%; height: 34%; border-radius: 4px; }

.vg-normal   { background: #6d7a99; }
.vg-gold     { background: linear-gradient(135deg, #f9d976, #b8860b); }
.vg-gummy    { background: linear-gradient(135deg, #ff8ab5, #d94f8e); }
.vg-galaxy   { background: radial-gradient(circle at 30% 30%, #b39ddb 1px, transparent 1.4px), linear-gradient(135deg, #4527a0, #7b1fa2); background-size: 7px 7px, 100% 100%; }
.vg-gem      { background: conic-gradient(from 45deg, #4dd0e1, #26a69a, #80deea, #00acc1, #4dd0e1); }
.vg-holofoil { background: linear-gradient(115deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff); }
.vg-cube     { background: linear-gradient(135deg, #7c4dff, #311b92); }
.vg-quack    { background: linear-gradient(135deg, #ffe36e, #ffb02e); }

.vimg {
  position: absolute; inset: 2px;
  width: calc(100% - 4px); height: calc(100% - 4px);
  object-fit: contain; border-radius: 7px;
  background: #0c101a;
}
.vslot:disabled .vimg { display: none; }
.card-icon img { width: 100%; height: 100%; object-fit: contain; }
.card-icon svg { width: 100%; height: 100%; }

.vslot.owned { border-color: var(--accent); color: var(--text); background: rgba(120, 224, 143, .10); }
.vslot.mastered {
  border-color: var(--accent-2); color: #ffe8b5;
  background: rgba(246, 185, 59, .14);
  box-shadow: 0 0 10px rgba(246, 185, 59, .35);
}
.vslot.mastered::after {
  content: "★";
  position: absolute; top: -7px; right: -5px;
  font-size: .75rem; color: var(--accent-2);
  text-shadow: 0 0 5px rgba(0, 0, 0, .8);
}

/* ---------- legend & footer ---------- */
.legend { margin: 34px 0 0; color: var(--text-dim); font-size: .9rem; max-width: 760px; }
.legend h2 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.lg { padding: 2px 9px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.lg-missing { border: 1.5px solid var(--border); color: var(--text-dim); }
.lg-owned { border: 1.5px solid var(--accent); color: var(--accent); }
.lg-mastered { border: 1.5px solid var(--accent-2); color: var(--accent-2); }

.site-footer {
  margin-top: 44px; padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim); font-size: .75rem; line-height: 1.6;
  max-width: 860px;
}

.empty-msg { color: var(--text-dim); padding: 40px 0; text-align: center; grid-column: 1 / -1; }

@media (max-width: 560px) {
  .brand h1 { font-size: 1.4rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .variants { gap: 4px; }
}
