/* ============ NexusPlay — dark gaming theme ============ */

:root {
  --bg: #0b0e17;
  --bg-2: #10141f;
  --surface: #151a28;
  --surface-2: #1c2333;
  --border: #262f44;
  --text: #e8ecf4;
  --muted: #9aa6bd;
  --accent: #22d3ee;
  --accent-2: #a855f7;
  --accent-3: #f43f5e;
  --gold: #fbbf24;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font-display: "Orbitron", sans-serif;
  --font-body: "Rubik", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }

.container { width: min(1240px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 23, .8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 68px;
}

.logo {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--font-display); font-weight: 900; font-size: 1.25rem;
  color: var(--text); text-decoration: none; letter-spacing: .04em;
}
.logo-mark { width: 30px; height: 30px; }
.logo em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.main-nav { display: flex; gap: .25rem; margin-inline-start: .75rem; }
.nav-link {
  color: var(--muted); text-decoration: none; font-weight: 500;
  padding: .5rem .9rem; border-radius: 8px; transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: var(--text); background: var(--surface-2); }

.header-tools { display: flex; align-items: center; gap: .6rem; margin-inline-start: auto; }

.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .45rem .7rem; min-width: 260px;
  transition: border-color .2s, box-shadow .2s;
}
.header-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }
.header-search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.header-search input {
  flex: 1; background: none; border: 0; outline: 0;
  color: var(--text); font: inherit; min-width: 0;
}
.header-search input::placeholder { color: var(--muted); }
.header-search kbd {
  font-family: var(--font-body); font-size: .7rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: .1rem .4rem; background: var(--bg-2);
}

.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--accent-3); border-color: var(--accent-3); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.is-on { color: var(--accent-3); border-color: var(--accent-3); }
.icon-btn.is-on svg path { fill: var(--accent-3); }
.faves-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent-3); color: #fff; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center;
}

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span {
  display: block; width: 24px; height: 2px; margin: 5px 0;
  background: var(--text); border-radius: 2px; transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(3.5rem, 9vw, 7rem) 0; }
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 80% at 15% 10%, rgba(34, 211, 238, .14), transparent 60%),
    radial-gradient(55% 75% at 85% 20%, rgba(168, 85, 247, .16), transparent 60%),
    radial-gradient(50% 60% at 50% 100%, rgba(244, 63, 94, .1), transparent 65%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 70% at 50% 40%, #000 30%, transparent 100%);
}
.hero-inner { position: relative; max-width: 780px; }
.hero-kicker {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid rgba(34, 211, 238, .35); border-radius: 999px; padding: .35rem .9rem;
  margin-bottom: 1.1rem;
}
.hero-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(2.1rem, 5.5vw, 3.6rem); line-height: 1.12; margin-bottom: 1rem;
}
.hero-title span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: 1.05rem; max-width: 56ch; margin-bottom: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 2.2rem; }
.hero-stats { display: flex; gap: 2.2rem; list-style: none; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--text); }
.hero-stats span { color: var(--muted); font-size: .85rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border-radius: 10px; padding: .65rem 1.3rem; border: 1px solid transparent;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad); color: #06121a;
  box-shadow: 0 6px 22px rgba(34, 211, 238, .25);
}
.btn-primary:hover { box-shadow: 0 8px 28px rgba(168, 85, 247, .4); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }
.btn-play { background: linear-gradient(135deg, #34d399, #22d3ee); color: #04121b; box-shadow: 0 6px 22px rgba(52, 211, 153, .3); }
.btn-play:hover { box-shadow: 0 8px 28px rgba(34, 211, 238, .45); }

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--border); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: 1.6rem; }
.section-title { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: .03em; }
.section-sub { color: var(--muted); font-size: .92rem; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.8rem; }

.filter-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill {
  font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: .42rem 1rem; transition: all .2s;
}
.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.is-active { background: var(--grad); border-color: transparent; color: #06121a; font-weight: 600; }

.toolbar-row { display: flex; flex-wrap: wrap; align-items: end; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .5rem .8rem;
  cursor: pointer; outline: none; transition: border-color .2s;
}
.field select:focus { border-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .92rem; color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 42px; height: 22px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); position: relative; transition: background .2s, border-color .2s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--accent-3); border-color: var(--accent-3); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(244, 63, 94, .25); }

/* ---------- Games grid ---------- */
.grid {
  display: grid; gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.grid[hidden] { display: none; }

.game-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  animation: card-in .35s ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }
.game-card:hover {
  transform: translateY(-5px); border-color: rgba(34, 211, 238, .5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 0 1px rgba(34, 211, 238, .2);
}

.card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.game-card:hover .card-media img { transform: scale(1.06); }

.card-rating {
  position: absolute; top: .6rem; left: .6rem;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  padding: .25rem .6rem; border-radius: 8px;
  background: rgba(8, 11, 18, .8); backdrop-filter: blur(6px);
  border: 1px solid;
}
.rating-high { color: #34d399; border-color: rgba(52, 211, 153, .5); }
.rating-mid { color: var(--gold); border-color: rgba(251, 191, 36, .5); }
.rating-low { color: var(--accent-3); border-color: rgba(244, 63, 94, .5); }

.fav-btn {
  position: absolute; top: .55rem; right: .55rem;
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(8, 11, 18, .75); border: 1px solid var(--border); color: var(--muted);
  transition: color .2s, border-color .2s, transform .15s;
}
.fav-btn:hover { color: var(--accent-3); border-color: var(--accent-3); }
.fav-btn:active { transform: scale(.9); }
.fav-btn svg { width: 17px; height: 17px; }
.fav-btn.is-fav { color: var(--accent-3); border-color: var(--accent-3); }
.fav-btn.is-fav svg path { fill: var(--accent-3); }

.card-body { display: flex; flex-direction: column; gap: .55rem; padding: .95rem 1rem 1.05rem; flex: 1; }
.card-title { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.card-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.tag {
  font-size: .74rem; font-weight: 500; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: .18rem .55rem;
}
.tag-genre { color: var(--accent); border-color: rgba(34, 211, 238, .3); }

.card-foot { display: flex; align-items: center; justify-content: space-between; }
.stars { display: inline-flex; gap: 2px; color: var(--gold); font-size: .85rem; }
.stars .dim { color: var(--border); }
.card-year { color: var(--muted); font-size: .82rem; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-state svg { width: 54px; height: 54px; color: var(--border); margin-bottom: .8rem; }
.empty-state h3 { color: var(--text); font-family: var(--font-display); margin-bottom: .4rem; }
.empty-state .btn { margin-top: 1.2rem; }

/* ---------- News ---------- */
.news-grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.news-card {
  display: flex; flex-direction: column; gap: .8rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.3rem; transition: border-color .2s, transform .2s;
}
.news-card:hover { border-color: rgba(168, 85, 247, .5); transform: translateY(-3px); }
.news-top { display: flex; align-items: center; gap: .7rem; }
.news-type {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: .25rem .65rem; border-radius: 6px;
}
.type-news { color: var(--accent); background: rgba(34, 211, 238, .12); }
.type-review { color: var(--accent-2); background: rgba(168, 85, 247, .14); }
.type-patch { color: var(--gold); background: rgba(251, 191, 36, .12); }
.news-date { color: var(--muted); font-size: .82rem; }
.news-title { font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.news-excerpt { color: var(--muted); font-size: .92rem; }
.news-link { margin-top: auto; color: var(--accent); text-decoration: none; font-weight: 600; font-size: .9rem; }
.news-link:hover { text-decoration: underline; }
.news-score { font-family: var(--font-display); color: var(--gold); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 1.4rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; }
.footer-nav { display: flex; gap: 1.2rem; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 12, .72); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(680px, 100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  overflow: hidden; box-shadow: var(--shadow);
  animation: modal-in .25s ease both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-close {
  position: absolute; top: .8rem; right: .8rem; z-index: 2;
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  background: rgba(8, 11, 18, .7); border: 1px solid var(--border); color: var(--text);
}
.modal-close:hover { border-color: var(--accent-3); color: var(--accent-3); }
.modal-media { aspect-ratio: 21 / 9; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-body { padding: 1.3rem 1.5rem 1.5rem; }
.modal-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.modal-body h3 { font-family: var(--font-display); font-size: 1.45rem; margin-bottom: .5rem; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .9rem; margin-bottom: .9rem; }
.modal-meta strong { color: var(--gold); font-family: var(--font-display); }
.modal-desc { color: var(--muted); margin-bottom: 1.3rem; }
.modal-actions { display: flex; gap: .7rem; }

/* ---------- Game player ---------- */
.player { position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; background: #05070d; }
.player[hidden] { display: none; }
.player-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.player-bar span { font-family: var(--font-display); font-weight: 700; letter-spacing: .03em; }
#player-frame { flex: 1; width: 100%; border: 0; background: #000; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translate(-50%, 20px);
  background: var(--surface-2); border: 1px solid var(--accent); color: var(--text);
  padding: .7rem 1.2rem; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 120;
  font-size: .92rem;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .header-search { min-width: 180px; }
  .header-search kbd { display: none; }
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: .2rem; padding: .6rem 1.25rem 1rem;
    background: rgba(11, 14, 23, .97); border-bottom: 1px solid var(--border);
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .hero-stats { gap: 1.4rem; }
}

@media (max-width: 620px) {
  .header-search { display: none; }
  .site-header.search-open .header-search {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    margin: 0; border-radius: 0; border-inline: 0; min-width: 0;
  }
  .header-inner { gap: .8rem; }
  .toolbar-row { gap: .7rem; }
  .field { flex: 1 1 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
  .news-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .modal-body { padding: 1.1rem 1.1rem 1.2rem; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
