:root {
  --bg: #0d1a12;
  --bg-card: #14251a;
  --bg-card-hover: #1a2f21;
  --border: #24402e;
  --text: #e8f5ec;
  --text-dim: #9db8a6;
  --green: #34d399;
  --green-dark: #059669;
  --yellow: #fbbf24;
  --red: #f87171;
  --common: #9ca3af;
  --uncommon: #4ade80;
  --rare: #38bdf8;
  --epic: #a78bfa;
  --legendary: #fbbf24;
  --mythic: #fb7185;
  --mythical: #fb7185;
  --super: #f0abfc;
  --divine: #f0abfc;
  --prismatic: #f472b6;
  --transcendent: #fca5a5;
  --accent: #34d399;
  --accent-dark: #059669;
}

/* GAG1 recolours the accent to a warm sunflower-gold theme */
body.is-gag1 {
  --accent: #fbbf24;
  --accent-dark: #b45309;
  --bg: #1a140a;
  --bg-card: #251c0f;
  --bg-card-hover: #2f2413;
  --border: #40331c;
  --text: #f5edde;
  --text-dim: #b8a882;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- alert banner ---------- */
.alert-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(90deg, var(--accent-dark), #10b981);
  color: #fff;
  font-weight: 700;
  padding: 14px 48px 14px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(16, 185, 129, .45);
  animation: bannerIn .3s ease;
}
.alert-banner.heads-up { background: linear-gradient(90deg, #b45309, #d97706); box-shadow: 0 4px 20px rgba(217, 119, 6, .45); }
@keyframes bannerIn { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.alert-banner button {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; opacity: .8;
}
.hidden { display: none !important; }

/* ---------- header ---------- */
.site-header {
  background: linear-gradient(180deg, #10241701, #10241766), var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-emoji { font-size: 38px; }
.brand h1 { font-size: 22px; letter-spacing: .3px; }
.tagline { color: var(--text-dim); font-size: 13px; }
.header-right { display: flex; align-items: center; gap: 14px; }
.mode-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim);
}
.mode-pill.exact { color: #052e16; background: var(--accent); border-color: var(--accent); }
.mode-pill.estimated { color: #451a03; background: var(--yellow); border-color: var(--yellow); }
.countdown-box {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px 18px;
}
.countdown-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.countdown { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }

/* ---------- main ---------- */
main { max-width: 960px; margin: 0 auto; padding: 18px 20px 40px; }

.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: transform .1s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #052e16; }
.btn-primary.enabled { background: var(--bg-card); color: var(--accent); border: 1px solid var(--accent); cursor: default; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-bg { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-bg.enabled { background: var(--accent); color: #052e16; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-dim); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.perm-status { font-size: 12px; color: var(--text-dim); }

.stale-notice {
  background: #422006; border: 1px solid #a16207; color: #fde68a;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; line-height: 1.5;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #052e16; }

.track-shortcuts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #1a140a; }
.chip-clear:hover { border-color: var(--red); color: var(--red); }

/* ---------- game switch ---------- */
.game-switch {
  max-width: 960px; margin: 14px auto 0;
  display: flex; gap: 8px; background: var(--bg); padding: 5px; border-radius: 12px;
  border: 1px solid var(--border); width: fit-content;
}
.game-btn {
  background: transparent; border: none; color: var(--text-dim);
  padding: 8px 18px; border-radius: 9px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s;
}
.game-btn b { font-weight: 800; }
.game-btn:hover { color: var(--text); }
.game-btn.active { background: var(--accent); color: #1a140a; }

/* weather event tag */
.w-tag {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.w-effect { font-size: 12px; color: var(--text-dim); margin-left: 6px; }
.weather-row.common { opacity: .82; }

/* out-of-stock catalog cards (GAG1 full-catalog view) */
.card.out-stock { opacity: .62; }
.card.out-stock:hover { opacity: 1; }
.card.out-stock.tracked-card { opacity: 1; }

/* ---------- grid / cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; position: relative; transition: border-color .15s, background .15s;
}
.card:hover { background: var(--bg-card-hover); }
.card.in-stock { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(52, 211, 153, .15); }
.card.tracked-card { outline: 1px dashed rgba(251, 191, 36, .4); outline-offset: 2px; }

.card-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.card-icon {
  width: 46px; height: 46px; border-radius: 10px; background: #0a140e;
  display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0;
}
.card-icon img { width: 40px; height: 40px; object-fit: contain; }
.card-name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.card-price { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.rarity {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; margin-top: 4px; color: #0b0f0c;
}
.r-Common { background: var(--common); }
.r-Uncommon { background: var(--uncommon); }
.r-Rare { background: var(--rare); }
.r-Epic { background: var(--epic); }
.r-Legendary { background: var(--legendary); }
.r-Mythic { background: var(--mythic); }
.r-Mythical { background: var(--mythical); }
.r-Super { background: var(--super); }
.r-Divine { background: var(--divine); }
.r-Prismatic { background: linear-gradient(90deg,#f472b6,#a78bfa,#38bdf8,#4ade80,#fbbf24); }
.r-Transcendent { background: var(--transcendent); }

.card-status { font-size: 13px; font-weight: 600; min-height: 20px; }
.g1-when { font-weight: 500; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.g1-when.in { color: var(--accent); opacity: .85; }
.g1-stats { font-size: 12px; font-weight: 500; color: var(--text-dim); margin-top: 5px; opacity: .9; }
.status-in { color: var(--accent); }
.status-next { color: var(--text-dim); font-weight: 500; }
.status-none { color: #6b7280; font-weight: 500; }

.bell {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; font-size: 18px; cursor: pointer;
  filter: grayscale(1); opacity: .45; transition: transform .1s, opacity .15s, filter .15s;
}
.bell:hover { transform: scale(1.15); opacity: .8; }
.bell.on { filter: none; opacity: 1; }

/* ---------- weather rows ---------- */
.weather-row {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px;
}
.weather-row.now { border-color: var(--accent); }
.weather-row .w-icon { font-size: 26px; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; }
.weather-row .w-icon img { width: 40px; height: 40px; }
.weather-row .w-name { font-weight: 700; flex: 1; }
.weather-row .w-when { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.weather-note { grid-column: 1 / -1; color: var(--text-dim); font-size: 13px; padding: 4px 2px; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  max-width: 960px; margin: 0 auto; padding: 18px 20px 30px;
  color: var(--text-dim); font-size: 12px; line-height: 1.7;
}
.site-footer a { color: var(--accent); }

@media (max-width: 560px) {
  .header-inner { justify-content: center; text-align: center; }
  .brand { flex-direction: column; }
  .countdown { font-size: 22px; }
}
