/* Minix Games — site stylesheet
 * Dark, CrazyGames-style layout: sticky top bar, vertical category sidebar,
 * content rows of game cards. Mobile: sidebar collapses behind a drawer.
 */

/* ---------- Reset / tokens ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg:        #0e0f13;
  --surface:   #181a21;
  --surface-2: #20232c;
  --surface-3: #2a2e3a;
  --border:    #262a35;
  --text:      #e7e9ee;
  --muted:     #98a0b3;
  --accent:    #7c3aed;
  --accent-2:  #06b6d4;
  --warn:      #f59e0b;
  --danger:    #ef4444;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 6px 18px rgba(0,0,0,.35);
  --topbar-h:  56px;
  --sidebar-w: 240px;
  --content-max: 1480px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(14,15,19,.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .2px;
  color: var(--text);
}
.topbar .brand img { width: 32px; height: 32px; border-radius: 8px; }
.topbar .brand-name {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; font-size: 18px;
}
.topbar .search {
  flex: 1; max-width: 560px; margin: 0 auto;
  position: relative;
}
.topbar .search input {
  width: 100%; height: 40px;
  padding: 0 14px 0 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.topbar .search input::placeholder { color: var(--muted); }
.topbar .search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.topbar .search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }

.topbar .nav { display: none; }
.topbar .nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.topbar .nav a:hover { color: var(--text); background: var(--surface-2); }
.topbar .nav a.cta {
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: white;
}
.topbar .nav a.cta:hover { filter: brightness(1.1); }

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  cursor: pointer;
}

/* ---------- App layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 10px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar h3 {
  margin: 12px 8px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase;
}
.sidebar a.cat {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: background .12s, color .12s;
}
.sidebar a.cat:hover { background: var(--surface-2); }
.sidebar a.cat.active { background: linear-gradient(90deg, rgba(124,58,237,.20), transparent); color: white; }
.sidebar a.cat .ic { font-size: 18px; width: 24px; text-align: center; }
.sidebar .external { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar .external a.cat { color: var(--muted); }

main.content {
  min-width: 0;
  padding: 18px clamp(12px, 3vw, 28px) 60px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #1f1147, #061525);
  border: 1px solid var(--border);
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 80% at 80% 20%, rgba(124,58,237,.30), transparent 70%),
    radial-gradient(40% 60% at 20% 90%, rgba(6,182,212,.25), transparent 70%);
  z-index: -1;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 28px clamp(18px, 3vw, 36px);
}
.hero h1 {
  font-size: clamp(22px, 3vw, 34px);
  margin: 0 0 8px;
  letter-spacing: -.4px;
}
.hero h1 .glow {
  background: linear-gradient(135deg, #fff, #c4b5fd 50%, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: #cbd5e1; margin: 0 0 14px; max-width: 56ch; }
.hero .cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hero a.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; font-weight: 600;
  background: white; color: #1a1145; transition: transform .12s, filter .12s;
}
.hero a.btn:hover { transform: translateY(-1px); filter: brightness(.97); }
.hero a.btn.ghost { background: transparent; color: white; border: 1px solid rgba(255,255,255,.25); }
.hero-thumb {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: var(--shadow);
}
.hero-thumb img, .hero-thumb video { width: 100%; height: 100%; object-fit: cover; }
.hero-thumb .badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: white;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* ---------- Sections / rails ---------- */
.section { margin: 26px 0 6px; }
.section .head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.section h2 {
  font-size: 18px; margin: 0; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 8px;
}
.section h2 .ic { font-size: 20px; }
.section .more {
  color: var(--accent-2); font-size: 13px; font-weight: 500;
}
.section .more:hover { text-decoration: underline; }

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.grid.dense {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(124,58,237,.55);
  box-shadow: 0 10px 22px rgba(124,58,237,.18);
}
.card .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.card:hover .thumb img { transform: scale(1.05); }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: white;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase;
}
.card .badge.hot { background: var(--warn); color: #1a1500; }
.card .title {
  padding: 8px 10px 10px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Highlight-tile layout: a tall featured card */
.featured-card {
  grid-column: span 2; grid-row: span 2;
}
.featured-card .thumb { aspect-ratio: 1 / 1; }
.featured-card .title { font-size: 16px; padding: 12px 14px; }
@media (max-width: 700px) { .featured-card { grid-column: span 2; grid-row: auto; } }

/* ---------- Category chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--surface-3); border-color: var(--accent); }
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
  margin-top: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 30px clamp(12px, 3vw, 28px);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 24px;
}
.footer h4 { margin: 0 0 10px; font-size: 13px; color: var(--text); letter-spacing: .5px; text-transform: uppercase; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin: 4px 0; }
.footer a { color: var(--muted); font-size: 13px; }
.footer a:hover { color: var(--text); }
.footer p.about { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.footer .legal {
  border-top: 1px solid var(--border);
  padding: 14px clamp(12px, 3vw, 28px);
  font-size: 12px; color: var(--muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  max-width: var(--content-max); margin: 0 auto;
}

/* ---------- Play page ---------- */
.play-wrap {
  max-width: 1180px; margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 60px;
}
.breadcrumb {
  font-size: 13px; color: var(--muted); margin: 4px 0 12px;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { margin: 0 6px; }

.play-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.play-stage .frame {
  position: relative;
  aspect-ratio: 16 / 9;
}
.play-stage iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  background: #000;
}
.play-stage .stage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.play-stage .stage-bar .left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.play-stage .stage-bar img.icon {
  width: 28px; height: 28px; border-radius: 6px;
}
.play-stage .stage-bar .name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-icon {
  height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn-icon:hover { background: var(--surface-3); border-color: var(--accent); }

.play-meta {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  margin-top: 22px;
}
.play-meta .about h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.3px; }
.play-meta .about .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.play-meta .about .tags a { font-size: 12px; padding: 4px 10px; background: var(--surface-2); border-radius: 999px; color: var(--muted); border: 1px solid var(--border); }
.play-meta .about .tags a:hover { color: var(--text); }
.play-meta .about h2 { font-size: 16px; margin: 18px 0 6px; }
.play-meta .about p { color: #d6d9e0; }

.play-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.play-side h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.play-side .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.play-side .row:last-child { border-bottom: 0; }

/* ---------- Generic helpers ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { height: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .play-meta { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h);
    width: 260px; height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform .2s ease;
    background: var(--bg);
    z-index: 40;
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .topbar .nav a:not(.cta) { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}

/* ---------- Backdrop for mobile sidebar ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: var(--topbar-h) 0 0 0;
  background: rgba(0,0,0,.5);
  z-index: 30;
}
.sidebar-backdrop.show { display: block; }

/* ---------- Misc legacy errors / 404 / privacy ---------- */
.text-page {
  max-width: 760px; margin: 0 auto;
  padding: 26px clamp(12px, 3vw, 28px) 60px;
}
.text-page h1 { margin-top: 0; font-size: 28px; }
.text-page h2 { margin-top: 28px; font-size: 18px; }
.text-page p, .text-page li { color: #d6d9e0; }
.text-page a { color: var(--accent-2); }

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