/* ==========================================================================
   Mekoplay design system — one stylesheet for the whole site (mobile first)
   ========================================================================== */
@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0b0d17;
  --surface: #151a2b;
  --surface-2: #1e2440;
  --surface-3: #272f52;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f4ff;
  --muted: #a7aecb;
  --volt: #c6ff3d;
  --volt-dark: #a8e01f;
  --violet: #7c5cff;
  --cyan: #3dd9ff;
  --coral: #ff5c7a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --max: 1240px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.no-scroll, html.no-scroll body { overflow: hidden; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3.2vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--volt); outline-offset: 2px; border-radius: 6px; }

.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;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--volt); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 700; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--volt); color: var(--ink); }
.btn-primary:hover { background: #d6ff6b; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 1.05rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn svg { width: 20px; height: 20px; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 23, 0.88);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 12px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo svg { width: 34px; height: 34px; }
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.08em; }

.search { position: relative; flex: 1; min-width: 0; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: 16px; /* 16px prevents iOS zoom */
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--volt); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; max-height: 70vh; overflow: auto;
}
.search-hit { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; color: var(--text); }
.search-hit:hover, .search-hit:focus { background: var(--surface-2); text-decoration: none; }
.search-hit img { width: 40px; height: 40px; border-radius: 8px; }
.search-hit span { display: flex; flex-direction: column; line-height: 1.3; }
.search-hit small { color: var(--muted); }
.search-empty { margin: 0; padding: 12px; color: var(--muted); }

.nav-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 12px; scrollbar-width: none; }
.nav-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-size: 0.9rem; font-weight: 600;
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip[aria-current="page"] { background: var(--volt); color: var(--ink); border-color: var(--volt); }
.chip svg { width: 16px; height: 16px; }

/* ---------- sections & grids ---------- */
main { display: block; min-height: 60vh; }
.section { padding: 28px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-link { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- game cards ---------- */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(198, 255, 61, 0.45); box-shadow: var(--shadow); text-decoration: none; }
.card-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-play {
  position: absolute; right: 10px; bottom: 10px;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--volt); color: var(--ink); font-size: 0.95rem; padding-left: 3px;
  opacity: 0; transform: translateY(6px); transition: opacity 0.15s, transform 0.15s;
}
.card:hover .card-play, .card:focus-visible .card-play { opacity: 1; transform: none; }
@media (hover: none) { .card-play { opacity: 1; transform: none; } }
.card-body { display: flex; flex-direction: column; padding: 10px 12px 12px; line-height: 1.3; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.card-cat { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.badge-new { background: var(--volt); color: var(--ink); }
.badge-hot { background: var(--coral); color: #fff; }
.badge-daily { background: var(--violet); color: #fff; }
.card-soon { pointer-events: none; border-style: dashed; background: transparent; }
.card-soon .card-title { color: var(--muted); }
.card-soon .card-media { display: grid; place-items: center; color: var(--muted); font-family: var(--font-display); font-weight: 700; }

/* ---------- hero ---------- */
.hero { padding: 28px 0 8px; }
.hero-inner {
  position: relative; overflow: hidden;
  display: grid; gap: 20px; align-items: center;
  padding: 24px; border-radius: 24px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(124, 92, 255, 0.35) 0%, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(198, 255, 61, 0.14) 0%, transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
}
.hero h1 { margin-bottom: 12px; }
.hero p { color: var(--muted); max-width: 46ch; font-size: 1.05rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-art { display: block; width: 100%; max-width: 360px; justify-self: center; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.hero-art img { width: 100%; height: auto; }
.kicker { display: inline-block; margin-bottom: 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--volt); }
@media (min-width: 800px) {
  .hero-inner { grid-template-columns: 1.3fr 1fr; padding: 44px; }
}

/* ---------- daily block ---------- */
.daily {
  display: grid; gap: 16px; align-items: center;
  padding: 22px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(61, 217, 255, 0.12));
  border: 1px solid rgba(124, 92, 255, 0.35);
}
.daily h2 { margin-bottom: 6px; }
.daily p { margin: 0; color: var(--muted); }
.daily-date { font-family: var(--font-display); font-weight: 700; color: var(--volt); }
@media (min-width: 700px) { .daily { grid-template-columns: 1fr auto; padding: 28px 32px; } }

/* ---------- categories ---------- */
.cat-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cat-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.cat-tile {
  display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-weight: 700;
}
.cat-tile:hover { background: var(--surface-2); text-decoration: none; border-color: rgba(198, 255, 61, 0.4); }
.cat-tile svg { width: 26px; height: 26px; color: var(--volt); flex-shrink: 0; }
.cat-tile small { display: block; font-weight: 500; color: var(--muted); font-size: 0.75rem; }

/* ---------- page heads, breadcrumb, prose ---------- */
.page-head { padding: 28px 0 6px; }
.page-head p { color: var(--muted); max-width: 70ch; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.85rem; color: var(--muted); padding: 16px 0 0; margin: 0; list-style: none; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }
.breadcrumb a { color: var(--muted); }
.prose { max-width: 760px; padding: 8px 0 32px; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.prose .note { padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.empty-note { padding: 18px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line); color: var(--muted); }

/* ---------- game page ---------- */
.game-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 0 14px; }
.game-head h1 { margin: 0; }
.game-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 600; }
a.tag:hover { color: var(--text); text-decoration: none; }
.fav-btn[aria-pressed="true"] { border-color: var(--coral); color: var(--coral); }
.fav-btn[aria-pressed="true"] svg { fill: var(--coral); }

.game-shell {
  scroll-margin-top: 136px; scroll-margin-bottom: 8px;
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
}
.game-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; min-width: 0; padding: 4px 12px; border-radius: 10px; background: var(--surface-2); line-height: 1.2; }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .game-bar { gap: 6px; padding: 8px; }
  .stat { padding: 4px 8px; flex: 1 1 auto; }
  .stat-value { font-size: 1.02rem; }
  .game-actions { gap: 4px; }
  .game-actions .icon-btn { width: 40px; height: 40px; }
}
.game-actions { display: flex; gap: 6px; margin-left: auto; }
.game-actions [data-armed] { background: var(--coral); border-color: var(--coral); }
.game-actions [aria-pressed="false"][data-action="sound"] .i-on, .game-actions [aria-pressed="true"][data-action="sound"] .i-off { display: none; }
.game-stage { position: relative; min-height: clamp(380px, min(118vw, calc(100svh - 330px)), 600px); display: grid; }
.game-root { display: grid; place-items: center; width: 100%; min-height: inherit; outline: none; }
.game-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 20px;
  background: rgba(11, 13, 23, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.game-overlay[hidden] { display: none; }
.game-overlay[data-kind="poster"] { background: radial-gradient(80% 80% at 50% 30%, rgba(124, 92, 255, 0.28), rgba(11, 13, 23, 0.94)); }
.overlay-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 360px; }
.overlay-card img { width: min(52vw, 200px); height: auto; border-radius: 22px; box-shadow: var(--shadow); }
.overlay-title { margin: 0; font-size: clamp(1.4rem, 5vw, 2rem); }
.overlay-text { margin: 0; color: var(--muted); }
.overlay-badge { margin: 0; padding: 4px 12px; border-radius: 999px; background: var(--volt); color: var(--ink); font-weight: 800; font-size: 0.85rem; }
.overlay-stats { display: flex; gap: 12px; }
.overlay-stat { display: flex; flex-direction: column; min-width: 110px; padding: 10px 16px; border-radius: 14px; background: var(--surface-2); }
.stat-big { font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--volt); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.game-toast {
  position: absolute; left: 50%; top: 14px; z-index: 11;
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px; background: var(--volt); color: var(--ink);
  font-weight: 800; font-size: 0.9rem; white-space: nowrap;
  transition: opacity 0.2s, transform 0.2s;
}
.game-toast.show { opacity: 1; transform: translate(-50%, 0); }
.game-shell.is-fs, .game-shell.is-pseudo-fs { border-radius: 0; border: 0; }
.game-shell.is-fs .game-stage, .game-shell.is-pseudo-fs .game-stage { flex: 1; min-height: 0; }
.game-shell.is-pseudo-fs { position: fixed; inset: 0; z-index: 1000; height: 100dvh; }

.game-layout { display: grid; gap: 24px; padding-bottom: 24px; }
.game-layout > * { min-width: 0; }
.game-content h2 { margin-top: 1.4em; }
.game-content ol, .game-content ul { padding-left: 1.3em; }
.game-content li { margin-bottom: 0.45em; }
.controls-table { width: 100%; border-collapse: collapse; }
.controls-table th, .controls-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.controls-table th { width: 34%; color: var(--muted); font-weight: 600; }
.best-box { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style-position: outside; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
@media (min-width: 1000px) {
  .game-layout.has-side { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .game-side { position: sticky; top: 140px; }
  /* the sidebar is only 300px wide: two cards per row, whatever the screen width */
  .game-side .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---------- ad slots (reserved space = no layout shift) ---------- */
.ad-slot {
  display: grid; place-items: center; width: 100%;
  margin: 24px auto; min-height: 100px;
  border-radius: 12px; background: var(--surface); border: 1px dashed var(--line);
  color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.ad-slot[data-ad-size="rect"] { min-height: 250px; max-width: 336px; }
.ad-slot[data-ad-size="leaderboard"] { min-height: 100px; max-width: 970px; }
@media (min-width: 768px) { .ad-slot[data-ad-size="leaderboard"] { min-height: 90px; } }

/* ---------- footer ---------- */
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); background: #090b13; padding: 36px 0 28px; color: var(--muted); font-size: 0.92rem; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
.footer-grid h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a, .linklike { color: var(--muted); }
.footer-grid a:hover, .linklike:hover { color: var(--text); }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; text-align: left; }
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { max-width: 40ch; }
.footer-bottom { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.82rem; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-brand { grid-column: auto; } }

/* ---------- consent banner ---------- */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200;
  max-width: 560px; margin: 0 auto; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.consent p { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.consent-actions .btn { flex: 1; }

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