/* GamzoHub design system — mobile-first */

:root {
  /* Brand surfaces stay deep purple in both themes so white text keeps contrast. */
  --brand: #3b1f6b;
  --brand-dark: #271047;
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-surface-2: #f1ecf9;
  --color-text: #1f1430;
  --color-text-muted: #5c5168;
  --color-primary: #3b1f6b;
  --color-primary-dark: #271047;
  --color-accent: #e8a93b;
  --color-accent-dark: #c6861c;
  --color-border: #e4ddf0;
  --color-success: #2f9e5b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(31, 20, 48, 0.08);
  --shadow-md: 0 6px 20px rgba(31, 20, 48, 0.12);
  --shadow-lg: 0 14px 40px rgba(31, 20, 48, 0.18);
  --header-h: 60px;
  --max-w: 1180px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #140c22;
    --color-surface: #1d1333;
    --color-surface-2: #261a40;
    --color-text: #f3eefc;
    --color-text-muted: #b6abc9;
    --color-primary: #a98cf0;
    --color-primary-dark: #8a68e0;
    --color-accent: #f2b94b;
    --color-accent-dark: #e8a93b;
    --color-border: #332552;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --color-bg: #140c22;
  --color-surface: #1d1333;
  --color-surface-2: #261a40;
  --color-text: #f3eefc;
  --color-text-muted: #b6abc9;
  --color-primary: #a98cf0;
  --color-primary-dark: #8a68e0;
  --color-accent: #f2b94b;
  --color-accent-dark: #e8a93b;
  --color-border: #332552;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

/* Skip link for a11y */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; opacity: 0.92; }
.brand .lamp-icon { width: 26px; height: 26px; flex: none; }

.nav-desktop {
  display: none;
}
.nav-desktop ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-desktop a {
  color: #efe9fb;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
  color: #fff;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.12); }
.nav-toggle svg { width: 24px; height: 24px; }

.nav-mobile {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: var(--brand-dark);
  z-index: 99;
  overflow-y: auto;
}
.nav-mobile.open { display: block; }
.nav-mobile ul {
  list-style: none;
  margin: 0;
  padding: 10px 16px 24px;
}
.nav-mobile a {
  display: block;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-mobile a:hover { text-decoration: none; opacity: 0.85; }

@media (min-width: 760px) {
  .nav-desktop { display: block; }
  .nav-toggle { display: none; }
  .nav-mobile { display: none !important; }
}

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(1200px 400px at 20% -10%, rgba(232, 169, 59, 0.25), transparent 60%),
    linear-gradient(160deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 44px 0 56px;
}
.hero h1 {
  font-size: clamp(1.7rem, 5vw, 2.7rem);
  margin: 0 0 10px;
  line-height: 1.15;
}
.hero p {
  color: #e7defa;
  font-size: 1.05rem;
  max-width: 55ch;
  margin: 0 0 20px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-accent); color: #2a1a03; }
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); }
.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }
.btn-block { width: 100%; }

/* ---------- Section headings ---------- */
.section { padding: 40px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head .see-all { font-weight: 700; font-size: 0.92rem; white-space: nowrap; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.search-input-wrap { position: relative; }
.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
}
#game-search {
  width: 100%;
  padding: 12px 12px 12px 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  min-height: 44px;
}
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.pill {
  flex: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 40px;
}
.pill[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #2a1a03;
}

@media (min-width: 640px) {
  .filter-bar { flex-direction: row; align-items: center; justify-content: space-between; }
  .search-input-wrap { width: 280px; }
}

/* ---------- Game grid / cards ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 540px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}
@media (min-width: 860px) {
  .game-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1080px) {
  .game-grid { grid-template-columns: repeat(5, 1fr); }
}

.game-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.game-card a.card-link {
  display: block;
  color: inherit;
}
.game-card a.card-link:hover { text-decoration: none; }

.thumb-wrap {
  aspect-ratio: 4 / 3;
  background: var(--color-surface-2);
  position: relative;
  overflow: hidden;
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.thumb-wrap .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 20, 48, 0.0);
  transition: background 0.15s ease;
}
.game-card:hover .play-overlay { background: rgba(31, 20, 48, 0.28); }
.play-overlay svg {
  width: 44px;
  height: 44px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s ease, transform 0.15s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
.game-card:hover .play-overlay svg { opacity: 1; transform: scale(1); }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--color-accent);
  color: #2a1a03;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  z-index: 2;
}
.badge.trending { background: #ef5f5f; color: #fff; }
.badge.soon { background: var(--color-surface-2); color: var(--color-text-muted); }

.card-body { padding: 10px 12px 14px; }
.card-body h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  line-height: 1.25;
}
.card-body .cat-tag {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.game-card.is-locked .thumb-wrap { opacity: 0.85; }
.game-card.is-locked:hover { transform: none; box-shadow: var(--shadow-sm); }
.card-desc { margin: 6px 0 0; font-size: 0.78rem; line-height: 1.35; color: var(--color-text-muted); }
.game-card.is-locked .card-body h3 { color: var(--color-text-muted); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

/* ---------- Game play page ---------- */
.play-hero {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  padding: 18px 0;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.play-hero h1 { margin: 0 0 6px; font-size: 1.6rem; }
.play-hero .tagline { color: var(--color-text-muted); margin: 0; }

.game-stage {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 16px;
  margin: 20px 0;
}
.game-stage--frame { padding: 0; overflow: hidden; background: #0d0716; }
.game-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - var(--header-h) - 120px);
  min-height: 260px;
}
.game-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
@media (max-width: 640px) and (orientation: portrait) {
  .game-frame-wrap { aspect-ratio: 3 / 4; max-height: none; }
  /* Fixed 16:9 canvases letterbox badly in a tall box. */
  .game-frame-wrap--wide { aspect-ratio: 16 / 9; min-height: 0; }
}
.rotate-hint { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .rotate-hint { display: block; margin: 0; font-weight: 600; color: var(--color-text); }
}
.game-frame-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.controls-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--color-surface-2);
  font: 600 0.8rem/1.4 var(--font-sans);
  text-align: center;
}

.instructions-card, .info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.instructions-card h2, .info-card h2 { margin-top: 0; font-size: 1.1rem; }

.related-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.related-strip .game-card { min-width: 150px; flex: none; }

/* Rating widget */
.rating-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stars { display: inline-flex; gap: 2px; }
.stars button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 36px;
  height: 36px;
  color: var(--color-border);
}
.stars button svg { width: 100%; height: 100%; }
.stars button.filled,
.stars button:hover,
.stars button:focus-visible {
  color: var(--color-accent);
}
.rating-summary { font-size: 0.9rem; color: var(--color-text-muted); }

/* ---------- Category / blog ---------- */
.page-hero {
  background: var(--color-surface-2);
  padding: 32px 0;
  border-bottom: 1px solid var(--color-border);
}
.page-hero h1 { margin: 0 0 8px; font-size: 1.8rem; }
.page-hero p { margin: 0; color: var(--color-text-muted); max-width: 65ch; }

.blog-list {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 680px) {
  .blog-list { grid-template-columns: 1fr 1fr; }
}
.blog-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.blog-card .meta { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 6px; }
.blog-card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.blog-card p { margin: 0 0 10px; color: var(--color-text-muted); }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code {
  background: var(--color-surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Forms (contact) ---------- */
.form-field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 700; font-size: 0.9rem; }
.form-field input,
.form-field textarea {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 44px;
}
.form-field textarea { min-height: 120px; resize: vertical; }
.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  max-width: 560px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand-dark);
  color: #cdc3e6;
  margin-top: 60px;
  padding: 40px 0 28px;
}
.footer-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.footer-grid h4 { color: #fff; margin: 0 0 10px; font-size: 0.95rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: #cdc3e6; }
.footer-grid a:hover { color: #fff; }
.footer-brand p { color: #a497c2; max-width: 36ch; font-size: 0.9rem; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 28px;
  padding-top: 18px;
  font-size: 0.8rem;
  color: #9c8fbe;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.text-muted { color: var(--color-text-muted); }
.mt-0 { margin-top: 0; }
