:root {
  --color-bg: #0f1420;
  --color-surface: #171e2e;
  --color-border: #2a3348;
  --color-text: #e7ecf5;
  --color-muted: #9aa6bd;
  --color-accent: #4f8cff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
}

.site-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--color-text); }
.site-logo-text {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--color-accent); color: #fff; font-weight: 800;
}
.site-logo { height: 32px; }

.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--color-muted); }

.site-main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; min-height: 60vh; }

.hero { text-align: center; padding: 48px 16px; }
.hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.hero p { color: var(--color-muted); font-size: 1.1rem; }

.platform-grid, .category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.platform-card, .category-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--color-text);
}
.platform-card h3 { margin: 0 0 6px; }
.platform-card p { margin: 0; color: var(--color-muted); font-size: 0.92rem; }

.platform-detail .score { color: var(--color-accent); font-weight: 700; }
.platform-detail ul { padding-left: 20px; }

.static-page { max-width: 760px; margin: 0 auto; }

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px;
  text-align: center;
  color: var(--color-muted);
}
.footer-nav { display: flex; gap: 16px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }

.ad-rail { display: none; }
@media (min-width: 1280px) {
  .ad-rail { display: block; position: fixed; top: 100px; width: 160px; }
  .ad-rail-left { left: 24px; }
  .ad-rail-right { right: 24px; }
}
.ad-slot { min-height: 1px; }
.ad-slot img { max-width: 100%; border-radius: 6px; }

.search-form { display: flex; gap: 8px; margin: 16px 0; }
.search-form input {
  flex: 1; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
}
.search-form button {
  padding: 10px 18px; border-radius: 8px; border: none;
  background: var(--color-accent); color: #fff; cursor: pointer;
}

/* =====================================================================================
   Frontend UX improvement: homepage Top-Rated Platforms cards (Goal 1), platform detail
   hero + Play Now CTA (Goal 2), bottom secondary CTA (Goal 3). All scoped to new classes —
   .platform-card / .platform-grid (used by /platforms and /categories/:slug) are untouched,
   per "do not redesign unrelated pages".
   ===================================================================================== */

:root {
  --radius-lg: 14px;
}

/* --- Goal 1: homepage Top-Rated Platforms horizontal cards --- */
.featured-platforms-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.featured-platform-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  color: var(--color-text);
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.featured-platform-card:hover,
.featured-platform-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  background: #1b2436;
  text-decoration: none;
}

.fpc-logo, .fpc-logo-fallback {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 10px;
}
.fpc-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.fpc-logo img { width: 100%; height: 100%; object-fit: contain; }
.fpc-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
}
.fpc-logo-fallback[hidden] { display: none; }

.fpc-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fpc-name { font-weight: 700; font-size: 1.05rem; color: var(--color-text); }
.fpc-tagline {
  color: var(--color-muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fpc-categories { color: var(--color-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }

.fpc-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fpc-score { font-weight: 700; color: var(--color-accent); font-size: 1.05rem; white-space: nowrap; }
.fpc-score-max { color: var(--color-muted); font-weight: 500; font-size: 0.85rem; }
.fpc-arrow { color: var(--color-muted); font-size: 1.1rem; }

@media (max-width: 640px) {
  .featured-platform-card { flex-wrap: wrap; }
  .fpc-tagline { white-space: normal; }
}

/* --- Goal 2: platform detail hero --- */
.platform-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.hero-logo, .hero-logo-fallback {
  flex: 0 0 auto;
  width: 108px;
  height: 108px;
  border-radius: 14px;
}
.hero-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.6rem;
}
.hero-logo-fallback[hidden] { display: none; }
.hero-main { flex: 1 1 260px; min-width: 0; }
.hero-name { margin: 0 0 6px; font-size: 1.8rem; }
.hero-tagline { margin: 0 0 10px; color: var(--color-muted); font-size: 1.05rem; }
.hero-score-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
.hero-score { font-weight: 700; color: var(--color-accent); font-size: 1.2rem; }
.hero-score-max { color: var(--color-muted); font-weight: 500; font-size: 0.95rem; }
.hero-score-pending { color: var(--color-muted); font-size: 0.95rem; }
.hero-categories { color: var(--color-muted); font-size: 0.85rem; }
.hero-cta { flex: 0 0 auto; }

/* --- Shared: Play Now CTA (primary = hero, secondary = after Pros/Cons) --- */
.cta-play-now {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.cta-play-now:hover { background: #3d78e8; text-decoration: none; }

.bottom-cta { margin-top: 24px; text-align: center; }
.cta-play-now-secondary {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.cta-play-now-secondary:hover { color: var(--color-text); border-color: var(--color-accent); text-decoration: none; }

@media (max-width: 640px) {
  .platform-hero { padding: 18px; }
  .hero-cta { width: 100%; }
  .cta-play-now { display: block; text-align: center; }
}

/* --- Homepage optimization: rank badge (Goal 3) + View All Platforms CTA (Goal 2) --- */
.fpc-rank {
  flex: 0 0 auto;
  width: 26px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.featured-platforms-cta {
  margin-top: 16px;
  text-align: center;
}
.view-all-platforms {
  display: inline-block;
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.view-all-platforms:hover {
  color: var(--color-accent);
  text-decoration: none;
}

@media (max-width: 640px) {
  .fpc-rank { width: auto; }
}

/* =====================================================================================
   v1.1.0 Platform Discovery — /platforms search + category filter + sort + redesigned
   2-column card grid. All scoped to new discovery-* classes; .platform-card / .platform-grid
   (still used by /categories/:slug) are untouched, per "do not touch unrelated routes".
   ===================================================================================== */

.discovery-page { max-width: 1100px; }
.discovery-subhead { margin: 0 0 20px; color: var(--color-muted); font-size: 1rem; }

.discovery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}
.discovery-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.discovery-field-search { flex: 1 1 260px; }
.discovery-field-sort { flex: 0 0 auto; }
.discovery-field input[type="text"],
.discovery-field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  min-width: 180px;
}
.discovery-field input[type="text"]:focus-visible,
.discovery-field select:focus-visible,
.discovery-apply-btn:focus-visible,
.discovery-pill:focus-visible,
.discovery-clear-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.discovery-apply-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  height: 42px;
}
.discovery-apply-btn:hover { background: #3d78e8; }

.discovery-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.discovery-pill {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.discovery-pill:hover { color: var(--color-text); border-color: var(--color-accent); text-decoration: none; }
/* Active category is never color-only: bold text, underline and a filled background all change
   together, not just the accent color (so it still reads correctly without color perception). */
.discovery-pill.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.discovery-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.discovery-count { color: var(--color-muted); }
.discovery-clear-link { color: var(--color-muted); font-weight: 600; text-decoration: underline; }
.discovery-clear-link:hover { color: var(--color-accent); }

.discovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.discovery-platform-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  color: var(--color-text);
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.discovery-platform-card:hover,
.discovery-platform-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  background: #1b2436;
  text-decoration: none;
}

.dpc-logo, .dpc-logo-fallback {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
}
.dpc-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.dpc-logo img { width: 100%; height: 100%; object-fit: contain; }
.dpc-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
}
.dpc-logo-fallback[hidden] { display: none; }

.dpc-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dpc-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.dpc-name { font-weight: 700; font-size: 1rem; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpc-score { font-weight: 700; color: var(--color-accent); font-size: 0.95rem; white-space: nowrap; }
.dpc-score-max { color: var(--color-muted); font-weight: 500; font-size: 0.8rem; }
.dpc-score-pending { color: var(--color-muted); font-size: 0.8rem; white-space: nowrap; }
.dpc-tagline {
  color: var(--color-muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dpc-categories { color: var(--color-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }

.discovery-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}
.discovery-empty p { margin: 0 0 10px; }

@media (max-width: 640px) {
  .discovery-controls { flex-direction: column; align-items: stretch; }
  .discovery-field input[type="text"],
  .discovery-field select { min-width: 0; width: 100%; }
  .discovery-apply-btn { width: 100%; }
  .discovery-grid { grid-template-columns: 1fr; }
  .discovery-platform-card { flex-wrap: wrap; }
  .dpc-name, .dpc-tagline { white-space: normal; }
}


/* --- v1.2.0 Platform Comparison (/compare) --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.compare-page { max-width: 1000px; }
.compare-subhead { margin: 0 0 20px; color: var(--color-muted); font-size: 1rem; }

.compare-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 20px;
}
.compare-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; }
.compare-field-label { font-size: 0.85rem; color: var(--color-muted); }
.compare-field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  min-width: 180px;
  width: 100%;
}
.compare-vs { color: var(--color-muted); font-weight: 700; padding-bottom: 10px; }
.compare-submit-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  height: 42px;
}
.compare-submit-btn:hover { background: #3d78e8; }
.compare-field select:focus-visible,
.compare-submit-btn:focus-visible,
.cmp-name-link:focus-visible,
.cmp-cta a:focus-visible,
.discovery-compare-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.compare-error {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--color-text);
}

.discovery-compare-link { color: var(--color-muted); font-weight: 600; text-decoration: underline; margin-left: 12px; }
.discovery-compare-link:hover { color: var(--color-accent); }

.cmp-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.cmp-column { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; min-width: 0; }
.cmp-name-link { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--color-text); max-width: 100%; }
.cmp-name-link:hover { text-decoration: none; color: var(--color-accent); }
.cmp-name { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.cmp-score { font-weight: 700; color: var(--color-accent); font-size: 1.1rem; }
.cmp-score-max { color: var(--color-muted); font-weight: 500; font-size: 0.9rem; }
.cmp-score-pending { color: var(--color-muted); font-size: 0.9rem; }
.cmp-tagline { margin: 0; color: var(--color-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.cmp-vs-divider { color: var(--color-muted); font-weight: 700; align-self: center; }

.cmp-section-heading { margin: 28px 0 12px; font-size: 1.1rem; }

.cmp-table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.cmp-table th, .cmp-table td { padding: 10px 14px; text-align: center; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }
.cmp-table thead th { color: var(--color-muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.cmp-table th[scope="row"] { text-align: left; font-weight: 600; color: var(--color-text); }
.cmp-table tbody tr:last-child th, .cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-cell-text { color: var(--color-text); }
.cmp-unrated { color: var(--color-muted); font-size: 0.9rem; }
.cmp-higher { font-weight: 700; color: var(--color-accent); background: rgba(79, 140, 255, 0.08); }
.cmp-higher-icon { font-size: 0.75em; }

.cmp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.cmp-col-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.cmp-col-heading { margin: 0 0 8px; font-size: 1rem; overflow-wrap: anywhere; }
.cmp-list-heading { margin: 10px 0 4px; font-size: 0.85rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.cmp-list { margin: 0; padding-left: 20px; }
.cmp-list li { overflow-wrap: anywhere; }
.cmp-list-empty { color: var(--color-muted); list-style: none; margin-left: -20px; }
.cmp-categories { margin: 0; color: var(--color-muted); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .compare-form { flex-direction: column; align-items: stretch; }
  .compare-field select { width: 100%; min-width: 0; }
  .compare-submit-btn { width: 100%; }
  .compare-vs { align-self: center; padding-bottom: 0; }
  .cmp-header { grid-template-columns: 1fr; }
  .cmp-vs-divider { display: none; }
  .cmp-two-col { grid-template-columns: 1fr; }
  .cmp-table th, .cmp-table td { padding: 8px 8px; font-size: 0.9rem; }
}
