:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --green: #3fb950;
  --green-bg: rgba(63, 185, 80, 0.1);
  --red: #f85149;
  --red-bg: rgba(248, 81, 73, 0.1);
  --yellow: #d29922;
  --yellow-bg: rgba(210, 153, 34, 0.12);
  --purple: #bc8cff;
  --purple-bg: rgba(188, 140, 255, 0.12);
  --orange: #f0883e;
  --orange-bg: rgba(240, 136, 62, 0.12);
  --humble-red: #cc2929;
  --humble-red-hover: #e63333;
  --radius: 8px;
}

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

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

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header h1 { font-size: 1.8rem; font-weight: 700; }
header .tagline { color: var(--text-muted); margin-top: 0.3rem; font-size: 0.95rem; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Inputs */
input[type="text"], textarea {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; resize: vertical; font-family: inherit; margin-bottom: 0.5rem; }

.input-row { display: flex; gap: 0.5rem; }

.hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.4rem; }
.hint code { background: var(--bg); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.8rem; }

/* Buttons */
.btn-primary, .btn-secondary {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-hover); }

/* View toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-btn:hover { background: var(--surface-hover); color: var(--text); }
.view-btn-active { background: var(--accent); color: #fff; }
.view-btn-active:hover { background: var(--accent-hover); }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* Banners */
.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.banner a { color: var(--accent); }
.banner-warning { background: var(--yellow-bg); border: 1px solid var(--yellow); }

/* Status */
.status { margin-top: 0.5rem; font-size: 0.85rem; }
.status.error { color: var(--red); }
.status.success { color: var(--green); }
.status.loading { color: var(--text-muted); }

/* Profile section */
.profile-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
}
.dot-sep { color: var(--text-muted); }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

.input-detect {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.detect-ok { color: var(--green); }
.detect-warn { color: var(--yellow); }
.detect-neutral { color: var(--text-muted); }

/* Connected profile card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--green);
  border-radius: var(--radius);
}
.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-weight: 700; font-size: 0.9rem; }
.profile-stats { font-size: 0.8rem; color: var(--text-muted); }

/* Privacy fix guide */
.privacy-guide {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius);
}
.privacy-header {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.privacy-steps {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.8;
}
.privacy-steps a { color: var(--accent); }
.privacy-steps .btn-retry { font-size: 0.85rem; font-weight: 700; }
.privacy-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Help guide */
.help-guide {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.help-guide h4 { margin-bottom: 0.75rem; font-size: 0.95rem; }
.help-method {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.help-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  margin-top: 0.1rem;
}
.help-method code { background: var(--surface); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.8rem; }
.help-method a { color: var(--accent); }
.help-note {
  padding: 0.5rem 0.7rem;
  background: var(--yellow-bg);
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

/* Section headers */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.section-header h2 { margin: 0; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Loading */
.loading { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; color: var(--text-muted); }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ========== HUMBLE CHOICE ========== */

.choice-card {
  background: var(--surface);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(240, 136, 62, 0.1);
}
.choice-hero {
  position: relative;
  width: 100%;
  max-height: 240px;
  overflow: hidden;
  background: var(--bg);
}
.choice-hero img {
  width: 100%;
  height: auto;
  display: block;
}
.choice-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
}
.choice-badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: var(--orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  border-radius: 4px;
}
.choice-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.choice-title {
  font-size: 1.2rem;
  font-weight: 700;
}
.choice-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.choice-verdict {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.choice-cpg {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  margin-left: auto;
}
.choice-games {
  padding: 0.75rem 1.25rem;
}
.choice-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.choice-bonuses {
  padding: 0.5rem 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.choice-cta {
  background: var(--surface-hover);
  border-top: 1px solid var(--border);
}
.btn-cta-choice {
  background: var(--orange);
  font-size: 1rem;
  padding: 0.7rem 2rem;
}
.btn-cta-choice:hover {
  background: #f59b4f;
}

/* ========== BUNDLE CARDS ========== */

.bundle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.bundle-card.bundle-wishlisted { border-color: var(--purple); }

/* Hero banner */
.bundle-hero {
  width: 100%;
  background: var(--bg);
}
.bundle-hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* Header */
.bundle-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.bundle-header h3 { font-size: 1.05rem; }

.bundle-summary {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.bundle-summary .stat {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
}
.stat-owned { background: var(--green-bg); color: var(--green); }
.stat-new { background: var(--red-bg); color: var(--red); }
.stat-total { background: rgba(88, 166, 255, 0.1); color: var(--accent); }
.stat-wishlist { background: var(--purple-bg); color: var(--purple); }

/* Value bar */
.value-bar {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.value-meter {
  flex: 0 0 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.value-meter-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--green));
  transition: width 0.4s ease;
}
.value-verdict { font-size: 0.8rem; font-weight: 600; }
.verdict-great { color: var(--green); }
.verdict-good { color: var(--orange); }
.verdict-low { color: var(--text-muted); }
.verdict-skip { color: var(--text-muted); font-style: italic; }

/* CTA */
.bundle-cta {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn-cta {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--humble-red);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}
.btn-cta:hover { background: var(--humble-red-hover); transform: translateY(-1px); }
.cta-savings { font-size: 0.78rem; color: var(--green); font-weight: 600; }

/* Wishlist callout */
.wishlist-callout {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--purple-bg);
  border-left: 3px solid var(--purple);
}
.callout-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 0.5rem;
}
.callout-games {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.callout-game {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  background: rgba(188, 140, 255, 0.15);
  border: 1px solid rgba(188, 140, 255, 0.3);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.callout-game:hover {
  background: rgba(188, 140, 255, 0.25);
  border-color: var(--purple);
}
.callout-thumb {
  width: 40px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
}

/* ========== TIERS ========== */

.tier {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.tier:last-child { border-bottom: none; }

.tier-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.tier-name {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}
.tier-value {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.4rem;
}
.tier-value-item { color: var(--green); font-weight: 600; }
.tier-value-skip { color: var(--text-muted); font-style: italic; font-weight: 400; }

/* ========== LIST VIEW ========== */

.game-list { list-style: none; }
.game-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}
.game-badge {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-owned { background: var(--green); }
.badge-new { background: var(--red); }
.badge-unknown { background: var(--text-muted); }

/* Thumbnails in list view */
.game-thumb {
  width: 48px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--bg);
}
.game-thumb-placeholder {
  display: inline-block;
  width: 48px;
  height: 18px;
  flex-shrink: 0;
}

.game-name { flex: 1; color: var(--text); text-decoration: none; }
.game-name:hover { color: var(--accent); }
.game-name.owned { color: var(--text-muted); text-decoration: line-through; }
.game-name.owned:hover { color: var(--accent); }

.game-msrp { font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; }

.game-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
}
.tag-owned { background: var(--green-bg); color: var(--green); }
.tag-new { background: var(--red-bg); color: var(--red); }
.tag-wishlist { background: var(--purple-bg); color: var(--purple); }

.game-wishlisted {
  background: var(--purple-bg);
  margin: 0.1rem -0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border-left: 3px solid var(--purple);
}

.no-compare-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* ========== GRID VIEW ========== */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.game-card-owned { opacity: 0.55; }
.game-card-owned:hover { opacity: 0.85; }
.game-card-wishlisted {
  border-color: var(--purple);
  box-shadow: 0 0 8px rgba(188, 140, 255, 0.4), 0 0 20px rgba(188, 140, 255, 0.15);
  animation: wishlist-glow 2s ease-in-out infinite;
}
@keyframes wishlist-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(188, 140, 255, 0.4), 0 0 20px rgba(188, 140, 255, 0.15); }
  50% { box-shadow: 0 0 14px rgba(188, 140, 255, 0.6), 0 0 30px rgba(188, 140, 255, 0.25); }
}

.game-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 460 / 215;
  background: var(--surface);
  overflow: hidden;
}
.game-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.game-card-img.img-error { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.7rem; }
.game-card-owned-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
.game-card-star {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 1.3rem;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
  z-index: 2;
  animation: star-pulse 1.5s ease-in-out infinite;
}
@keyframes star-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.game-card-tags {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
}

.game-card-info {
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 0;
}
.game-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.game-card-rating { color: var(--green); }
.game-card-price { color: var(--text-muted); }

/* ========== HOVER PREVIEW ========== */

.hover-preview {
  position: fixed;
  z-index: 1000;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: none;
}
.preview-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  overflow: hidden;
}
.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-loading {
  position: absolute;
  bottom: 6px;
  right: 6px;
}
.preview-loading .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
.preview-body {
  padding: 0.6rem 0.75rem;
}
.preview-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.preview-rating {
  font-size: 0.78rem;
  color: var(--green);
  margin-bottom: 0.15rem;
}
.preview-price {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.preview-link {
  font-size: 0.72rem;
  color: var(--accent);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 600px) {
  .input-row { flex-direction: column; }
  .bundle-header { flex-direction: column; align-items: flex-start; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .game-thumb { width: 36px; height: 14px; }
}
