:root {
  --bg: #f7f7f4;
  --bg2: #f1f1ef;
  --panel: #ffffff;
  --border: #dbdbea;
  --text: #2b2b2b;
  --muted: #666666;
  --accent: #24890d;
  --accent-hover: #1d700a;
  --link: #287d55;
  --pink: #f887ff;
  --sp: #24890d;
  --coop: #339966;
  --mp: #2b2b2b;
  --online: #f887ff;
  --radius: 14px;
  --shadow: 0 16px 38px rgba(43, 43, 43, .12);
}

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

html, body { background: var(--bg); color: var(--text); font-family: "Inter", system-ui, sans-serif; }

body { min-height: 100vh; }

a { color: var(--link); text-decoration: none; }

::selection { color: #2b2b2b; background: rgba(248, 135, 255, .52); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #000000;
  border-bottom: 1px solid #000000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .16);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #ffffff; }
.brand:focus-visible { outline: 2px solid var(--pink); outline-offset: 5px; border-radius: 4px; }
.brand-text { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand-text em { font-style: normal; color: var(--pink); }

.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #a9a9a9; }
#search {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 12px;
  background: #171717; border: 1px solid #424242; color: #ffffff;
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
#search::placeholder { color: #a9a9a9; opacity: 1; }
#search:hover { border-color: #666666; }
#search:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(248, 135, 255, .2); background: #1d1d1d; }

.stats-chip {
  font-size: 13px; color: #d6d6d6; background: #171717;
  border: 1px solid #424242; padding: 8px 14px; border-radius: 12px; white-space: nowrap;
}

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 63px; z-index: 40;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(43, 43, 43, .055);
  backdrop-filter: blur(10px);
}
.filters-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 20px 10px;
}
.filters-top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.mode-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #ffffff; color: #555555; border: 1px solid var(--border); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s, transform .15s;
  white-space: nowrap; line-height: 1.4; display: inline-flex; align-items: center;
}
.chip:hover { color: var(--accent-hover); border-color: #8abf7e; background: #f8fcf7; }
.chip:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(43, 43, 43, .14); }
.chip.active {
  background: var(--accent); color: #ffffff; border-color: var(--accent);
  box-shadow: 0 3px 9px rgba(36, 137, 13, .2);
}
.chip.active .chip-count { opacity: 1; }
.chip-count { font-size: 10.5px; font-weight: 600; opacity: .65; margin-left: 6px; }
.filters-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.count { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.select {
  padding: 7px 12px; border-radius: 10px; background: #ffffff; border: 1px solid var(--border);
  color: var(--text); font-size: 13px; outline: none; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.select:hover { border-color: #aaaabd; }
.select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(248, 135, 255, .22), 0 0 0 4px rgba(43, 43, 43, .16); }
.genre-row {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; min-width: 0;
}
.genre-chips {
  flex: 1; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  height: 36px; align-items: center;
  scrollbar-width: none;
}
.genre-chips::-webkit-scrollbar { display: none; }
.genre-select { max-width: 220px; }

/* ---------- skeleton ---------- */
.card.skeleton { pointer-events: none; }
.skeleton .card-media,
.skeleton .sk-line {
  background: linear-gradient(100deg, #ededeb 40%, #f8f8f7 50%, #ededeb 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton .card-media { border-bottom: 1px solid var(--border); }
.sk-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 108px; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line.w70 { width: 70%; }
.sk-line.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- grid ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 18px 20px 60px; }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .18s ease, border-color .18s, box-shadow .18s;
  display: flex; flex-direction: column; color: var(--text); text-decoration: none;
}
.card:hover { transform: translateY(-4px); border-color: #b9b9cb; box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; box-shadow: 0 0 0 5px rgba(43, 43, 43, .16); }

.card-media { position: relative; aspect-ratio: 16 / 9; background: var(--bg2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card:hover .card-media img { transform: scale(1.05); }
.card-media .fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 34px; font-weight: 800; color: #9696a8;
  background: var(--bg2);
}

.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; color: #ffffff;
  border: 1px solid rgba(255, 255, 255, .38); box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
.badge.sp { background: var(--sp); }
.badge.coop { background: var(--coop); color: #202020; border-color: rgba(32, 32, 32, .24); }
.badge.mp { background: var(--mp); }
.badge.online { background: var(--online); color: #2b2b2b; border-color: rgba(43, 43, 43, .2); }
.badge.unknown { background: #666666; color: #ffffff; }

.player-pill {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(0, 0, 0, .86); border: 1px solid rgba(255, 255, 255, .28);
  padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 700; color: #9adc8b;
  display: flex; align-items: center; gap: 6px;
}
.player-pill svg { color: #9adc8b; }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 14.5px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title .ver { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tag {
  font-size: 11px; color: #555555; background: #f7f7f5;
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px;
}
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--muted);
}

/* ---------- loader / empty ---------- */
.loader { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#sentinel { height: 1px; }
.empty { text-align: center; padding: 80px 20px; color: var(--muted); font-size: 16px; }

.hidden { display: none !important; }

/* ---------- detail page ---------- */
body.on-detail .filters,
body.on-detail .search-wrap,
body.on-detail .stats-chip { display: none; }
#detail { padding-bottom: 48px; }
.detail-shell { max-width: 1220px; margin: 0 auto; }

.back-link {
  width: fit-content; min-height: 40px; margin: -4px 0 12px; padding: 8px 10px 8px 4px;
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted);
  border-radius: 8px; font-size: 13.5px; font-weight: 700; transition: color .15s, background .15s;
}
.back-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-link:hover { color: var(--accent-hover); background: rgba(36, 137, 13, .06); }
.back-link:focus-visible,
.fitgirl-cta:focus-visible,
.shot-link:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; box-shadow: 0 0 0 5px rgba(43, 43, 43, .16); }

.game-detail { position: relative; }
.detail-hero {
  position: relative; min-height: 300px; aspect-ratio: 16 / 6.35; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 20px 52px rgba(43, 43, 43, .13);
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-hero .fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: #9696a8; background: var(--bg2);
  font-size: 64px; font-weight: 800;
}
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 65%, rgba(0, 0, 0, .24));
}

.detail-intro {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  align-items: end; gap: 48px; padding: 32px 8px 0;
}
.detail-heading { min-width: 0; }
.detail-kicker,
.section-eyebrow {
  display: block; color: var(--accent); font-size: 10.5px; font-weight: 800;
  letter-spacing: 1.35px; line-height: 1.4; text-transform: uppercase;
}
.detail-title {
  max-width: 850px; margin-top: 7px; color: var(--text);
  font-size: clamp(30px, 4.2vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05;
}
.detail-title .ver {
  display: block; margin-top: 10px; color: var(--muted);
  font-size: 13px; font-weight: 600; letter-spacing: .01em; line-height: 1.4;
}
.detail-genres,
.detail-modes { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-genres { margin-top: 18px; }
.detail-modes { margin-top: 10px; }
.detail-tag {
  padding: 4px 9px; color: #555555; background: #ffffff;
  border: 1px solid var(--border); border-radius: 6px; font-size: 11.5px; line-height: 1.35;
}
.badge.big { padding: 4px 9px; border-radius: 6px; font-size: 10.5px; }

.fitgirl-cta {
  min-height: 76px; padding: 15px 14px 15px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; color: #ffffff;
  background: var(--accent); border: 1px solid var(--accent); border-radius: 13px;
  box-shadow: 0 10px 22px rgba(36, 137, 13, .19);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.fitgirl-cta span:first-child { display: flex; flex-direction: column; gap: 3px; }
.fitgirl-cta small { font-size: 10px; font-weight: 800; letter-spacing: 1.15px; text-transform: uppercase; }
.fitgirl-cta strong { font-size: 16px; line-height: 1.3; }
.fitgirl-cta svg {
  width: 20px; height: 20px; display: block; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.fitgirl-cta-icon {
  width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center;
  background: rgba(0, 0, 0, .12); border: 1px solid rgba(255, 255, 255, .28); border-radius: 10px;
}
.fitgirl-cta:hover {
  color: #ffffff; background: var(--accent-hover); transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(36, 137, 13, .24);
}

.player-panel,
.repack-panel {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(43, 43, 43, .055);
}
.player-panel {
  margin: 40px 8px 0; padding: 20px 24px; display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(0, 2fr); align-items: center; gap: 32px;
}
.panel-heading { display: flex; align-items: center; gap: 12px; }
.panel-heading h2,
.media-heading h2 { margin-top: 2px; color: var(--text); font-size: 18px; line-height: 1.3; }
.panel-icon {
  width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center;
  color: var(--accent); background: rgba(36, 137, 13, .08); border: 1px solid rgba(36, 137, 13, .18); border-radius: 10px;
}
.panel-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.player-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 16px; }
.player-stat { min-width: 0; padding-left: 16px; border-left: 1px solid var(--border); }
.player-stat strong { display: block; color: var(--text); font-size: 21px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.player-stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.3; }

.detail-content {
  display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start;
  gap: 48px; padding: 56px 8px 0;
}
.detail-content--facts-only { grid-template-columns: minmax(260px, 430px); justify-content: end; }
.detail-media { min-width: 0; display: flex; flex-direction: column; gap: 56px; }
.media-heading { margin-bottom: 16px; }
.detail-video {
  width: 100%; display: block; aspect-ratio: 16 / 9; background: #000000;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 38px rgba(43, 43, 43, .13);
}
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shot-link { display: block; overflow: hidden; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.shot-link img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform .25s ease, opacity .2s; }
.shot-link:hover img { transform: scale(1.025); opacity: .9; }

.repack-panel { position: sticky; top: 88px; padding: 20px; }
.size-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.size-item { min-width: 0; padding: 13px; background: var(--bg2); border: 1px solid #e6e6ed; border-radius: 9px; }
.size-item span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.3; }
.size-item strong { display: block; margin-top: 5px; color: var(--accent); font-size: 16px; line-height: 1.25; }
.fact-list { margin-top: 18px; }
.fact-list div { padding: 11px 0; display: grid; grid-template-columns: minmax(85px, auto) minmax(0, 1fr); gap: 16px; border-top: 1px solid var(--border); }
.fact-list dt { color: var(--muted); font-size: 11.5px; }
.fact-list dd { color: var(--text); font-size: 12.5px; text-align: right; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border); padding: 22px 20px; background: #ffffff;
  text-align: center; color: var(--muted); font-size: 12.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.footer-sub { font-size: 11.5px; opacity: .75; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; }
  .search-wrap { order: 3; max-width: none; flex-basis: 100%; }
  .stats-chip { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .badges { top: 8px; left: 8px; gap: 4px; }
  .badge { padding: 3px 5px; font-size: 9px; letter-spacing: .2px; }
  .badge.big { padding: 4px 9px; font-size: 10.5px; }
  body.on-detail main { padding: 12px 14px 44px; }
  body.on-detail .topbar-inner { padding-top: 11px; padding-bottom: 11px; }
  .back-link { margin-bottom: 8px; }
  .detail-hero { min-height: 0; aspect-ratio: 16 / 8.5; border-radius: 12px; }
  .detail-hero .fallback { font-size: 44px; }
  .detail-intro { grid-template-columns: 1fr; gap: 24px; padding: 24px 2px 0; }
  .detail-title { font-size: clamp(28px, 9vw, 40px); }
  .fitgirl-cta { width: 100%; }
  .player-panel { margin: 32px 2px 0; padding: 18px; grid-template-columns: 1fr; gap: 22px; }
  .player-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .detail-content,
  .detail-content--facts-only { grid-template-columns: 1fr; gap: 40px; padding: 44px 2px 0; }
  .detail-media { gap: 44px; }
  .repack-panel { position: static; grid-row: 1; }
  .shots { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .detail-intro { grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
  .detail-content { grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
  .player-panel { grid-template-columns: 180px minmax(0, 1fr); gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .back-link,
  .fitgirl-cta,
  .shot-link img { transition: none; }
}
