/* ============================================================
   LunasCal Games — design system
   ============================================================ */
:root {
  --bg: #05070f;
  --bg-2: #0b1226;
  --panel: rgba(17, 26, 51, .72);
  --panel-solid: #111a33;
  --panel-2: #16213f;
  --text: #eef2ff;
  --muted: #94a3c4;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --accent-3: #e879f9;
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #f59e0b;
  --danger: #fb7185;
  --ok: #4ade80;
  --border: rgba(148, 163, 196, .14);
  --border-strong: rgba(148, 163, 196, .28);
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --glow: 0 0 0 1px rgba(129, 140, 248, .25), 0 8px 30px rgba(99, 102, 241, .25);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Ubuntu, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* aurora backdrop */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  pointer-events: none;
}
body::before {
  width: 60vw; height: 60vw; max-width: 720px; max-height: 720px;
  top: -18vw; right: -12vw;
  background: radial-gradient(circle, rgba(129, 140, 248, .5), transparent 65%);
  animation: aurora 16s ease-in-out infinite alternate;
}
body::after {
  width: 55vw; height: 55vw; max-width: 640px; max-height: 640px;
  bottom: -20vw; left: -14vw;
  background: radial-gradient(circle, rgba(94, 234, 212, .38), transparent 65%);
  animation: aurora 20s ease-in-out infinite alternate-reverse;
}
@keyframes aurora {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-4vw, 5vh, 0) scale(1.12); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes sheen {
  from { transform: translateX(-120%) skewX(-18deg); }
  to   { transform: translateX(220%) skewX(-18deg); }
}

::selection { background: rgba(129, 140, 248, .4); color: #fff; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(129, 140, 248, .5), rgba(94, 234, 212, .35));
  border-radius: 999px; border: 2px solid var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code {
  background: rgba(129, 140, 248, .12); border: 1px solid rgba(129, 140, 248, .25);
  padding: .08rem .38rem; border-radius: 7px; font-size: .85em; color: #c7d2fe;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.container { width: min(1220px, 100% - 2rem); margin-inline: auto; }
main.container { flex: 1; padding-block: 1.6rem 3.2rem; animation: fadeUp .45s ease both; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.error { color: var(--danger) !important; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(5, 7, 15, .62);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid transparent;
  background-clip: padding-box;
}
.site-header::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, .55), rgba(129, 140, 248, .55), rgba(232, 121, 249, .45), transparent);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  padding-block: .7rem; position: relative;
}
.brand {
  display: inline-flex; align-items: center; gap: .65rem;
  font-weight: 800; font-size: 1.18rem; color: var(--text);
  letter-spacing: -.01em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  display: block; border-radius: 10px;
  box-shadow: 0 0 18px rgba(129, 140, 248, .45), 0 0 4px rgba(94, 234, 212, .5);
  transition: transform .25s, box-shadow .25s;
}
.brand:hover .brand-logo {
  transform: rotate(-6deg) scale(1.06);
  box-shadow: 0 0 26px rgba(129, 140, 248, .65), 0 0 8px rgba(94, 234, 212, .7);
}
.brand-logo-lg { border-radius: 14px; }
.brand-word em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-mark { color: var(--accent); font-size: 1.2rem; }

.search { position: relative; flex: 1; display: flex; max-width: 460px; }
.search input {
  flex: 1; padding: .64rem 1.05rem; border: 1px solid var(--border);
  background: rgba(17, 26, 51, .7); color: var(--text); border-radius: 999px 0 0 999px;
  outline: none; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: rgba(148, 163, 196, .75); }
.search input:focus {
  border-color: rgba(129, 140, 248, .65);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, .16);
}
.search button {
  padding: 0 1.05rem; border: 1px solid var(--border); border-left: 0;
  background: rgba(22, 33, 63, .9); color: var(--text); border-radius: 0 999px 999px 0;
  cursor: pointer; transition: background .15s;
}
.search button:hover { background: #1d2a55; }

.suggestions {
  position: absolute; top: calc(100% + .45rem); left: 0; right: 0;
  background: rgba(14, 21, 43, .96); backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow), 0 0 30px rgba(99, 102, 241, .15);
  overflow: hidden; z-index: 60;
  transform-origin: top center; animation: fadeUp .16s ease both;
}
.suggestions[hidden] { display: none !important; }

.sugg-item {
  display: flex !important; align-items: center; gap: .75rem;
  padding: .5rem .75rem; color: var(--text); border-bottom: 1px solid var(--border);
  transition: background .1s; outline-offset: -2px;
}
.sugg-item:hover, .sugg-item.is-active { background: rgba(129, 140, 248, .16); text-decoration: none; }
.sugg-item.is-active { box-shadow: inset 3px 0 0 var(--accent); }
.sugg-item img {
  width: 54px; height: 36px; object-fit: cover; border-radius: 8px; flex: none;
  border: 1px solid var(--border); background: var(--bg-2);
}
.sugg-text { display: flex; flex-direction: column; gap: .08rem; min-width: 0; }
.sugg-title {
  font-weight: 600; font-size: .92rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sugg-meta {
  font-size: .76rem; color: var(--muted); text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sugg-item mark {
  background: rgba(94, 234, 212, .22); color: #a7f3d0;
  border-radius: 4px; padding: 0 2px; font-weight: 700;
}
.sugg-empty { padding: .95rem .85rem; color: var(--muted); font-size: .9rem; border-bottom: 1px solid var(--border); }
.sugg-all {
  display: flex !important; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .58rem .85rem; font-weight: 700; font-size: .88rem;
  background: rgba(22, 33, 63, .95); color: var(--accent);
}
.sugg-all:hover { background: rgba(129, 140, 248, .18); text-decoration: none; }

.main-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.main-nav a {
  padding: .48rem .95rem; border-radius: 999px; color: var(--muted);
  font-weight: 600; font-size: .93rem; transition: color .15s, background .15s, box-shadow .15s;
}
.main-nav a:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .06); }
.main-nav a.active {
  color: #04140f; background: var(--grad);
  box-shadow: 0 4px 18px rgba(94, 234, 212, .3);
}
.main-nav .nav-cta {
  color: #06121f; background: var(--grad); font-weight: 700; margin-left: .3rem;
  box-shadow: 0 4px 18px rgba(129, 140, 248, .35);
}
.main-nav .nav-cta:hover { filter: brightness(1.1); transform: translateY(-1px); }
.nav-toggle {
  display: none; background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px;
  padding: .38rem .65rem; cursor: pointer; font-size: 1rem;
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.4rem;
  align-items: center; padding: 2.8rem 0 1rem;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .76rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  background: rgba(94, 234, 212, .08); border: 1px solid rgba(94, 234, 212, .28);
  padding: .3rem .8rem; border-radius: 999px; margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(94, 234, 212, .12);
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }
.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.08;
  margin: 0 0 .7rem; letter-spacing: -.03em; font-weight: 800;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 1.4rem; font-size: 1.08rem; max-width: 48ch; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 2rem; margin-top: 1.9rem; padding-top: 1.3rem;
  border-top: 1px solid var(--border);
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong {
  font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #fff, #c7d2fe);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-stats span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

.hero-card {
  position: relative; display: block; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border-strong); aspect-ratio: 16/10;
  transition: transform .3s, box-shadow .3s;
  animation: float 7s ease-in-out infinite;
}
.hero-card::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from 180deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  filter: blur(16px); opacity: .5;
}
.hero-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s; }
.hero-card:hover { transform: translateY(-6px) scale(1.015); text-decoration: none; box-shadow: 0 26px 70px rgba(0, 0, 0, .6); }
.hero-card:hover img { transform: scale(1.06); }
.hero-badge {
  position: absolute; top: .85rem; left: .85rem; background: var(--grad); color: #06121f;
  font-size: .72rem; font-weight: 800; padding: .26rem .7rem; border-radius: 999px;
  letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(94, 234, 212, .35);
}
.hero-title {
  position: absolute; inset-inline: 0; bottom: 0; padding: 2.2rem 1.1rem .95rem;
  background: linear-gradient(transparent, rgba(3, 6, 15, .95)); font-weight: 700; font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .68rem 1.3rem; border-radius: 999px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; font-size: .95rem; font-family: inherit;
  transition: filter .15s, transform .15s, box-shadow .2s, border-color .15s, background .15s;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: translateX(-120%) skewX(-18deg);
}
.btn:hover::after { animation: sheen .7s ease; }
.btn-primary {
  background: var(--grad); color: #06121f;
  box-shadow: 0 6px 24px rgba(99, 102, 241, .4);
}
.btn-primary:hover { box-shadow: 0 10px 32px rgba(99, 102, 241, .55); transform: translateY(-2px); }
.btn-ghost {
  background: rgba(17, 26, 51, .75); color: var(--text); border-color: var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: rgba(129, 140, 248, .55); box-shadow: 0 0 20px rgba(129, 140, 248, .18); }
.btn-danger { background: rgba(251, 113, 133, .12); color: var(--danger); border-color: rgba(251, 113, 133, .35); }
.btn-danger:hover { background: rgba(251, 113, 133, .2); }
.btn-sm { padding: .36rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Sections / rails / cards ---------- */
.rail { margin-top: 2.5rem; }
.rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: .95rem;
}
.rail-head h2 {
  margin: 0; font-size: 1.3rem; letter-spacing: -.02em; font-weight: 800;
  display: flex; align-items: center; gap: .6rem;
}
.rail-head h2::before {
  content: ""; width: 5px; height: 1.05em; border-radius: 4px; background: var(--grad);
  box-shadow: 0 0 12px rgba(129, 140, 248, .6);
}
.rail-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 190px; gap: 1rem;
  overflow-x: auto; padding: .25rem .25rem .6rem; scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.rail-track > * { scroll-snap-align: start; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 1.1rem; margin-top: 1rem;
}
.grid-tight { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--text); display: flex; flex-direction: column;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), border-color .22s, box-shadow .22s;
  position: relative; backdrop-filter: blur(10px);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(129, 140, 248, .16), transparent 40%);
  opacity: 0; transition: opacity .25s;
}
.card:hover {
  transform: translateY(-7px); border-color: rgba(129, 140, 248, .55);
  box-shadow: var(--glow), var(--shadow); text-decoration: none;
}
.card:hover::before { opacity: 1; }
.card-cover { position: relative; aspect-ratio: 16/10; background: var(--bg-2); overflow: hidden; }
.card-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.card:hover .card-cover img { transform: scale(1.08); }
.card-cover::after {
  content: "▶  Play"; position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(4, 8, 20, .25), rgba(4, 8, 20, .72));
  color: #fff; font-weight: 800; letter-spacing: .12em; font-size: .9rem;
  opacity: 0; transition: opacity .22s;
}
.card:hover .card-cover::after { opacity: 1; }
.card-plays {
  position: absolute; right: .5rem; top: .5rem; font-size: .72rem;
  background: rgba(4, 8, 20, .8); padding: .2rem .55rem; border-radius: 999px;
  z-index: 1; backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .08);
}
.card-body { padding: .78rem .88rem 1rem; display: flex; flex-direction: column; gap: .34rem; }
.card-body h3 { margin: 0; font-size: .99rem; line-height: 1.3; font-weight: 700; }
.card-sub {
  margin: 0; color: var(--muted); font-size: .83rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sm .card-body h3 { font-size: .9rem; }

.tag {
  display: inline-block; font-size: .7rem; color: var(--accent); font-weight: 600;
  background: rgba(94, 234, 212, .09); border: 1px solid rgba(94, 234, 212, .24);
  padding: .12rem .55rem; border-radius: 999px; width: fit-content;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.chip {
  padding: .4rem .9rem; border-radius: 999px; background: rgba(17, 26, 51, .7);
  border: 1px solid var(--border); color: var(--muted); font-size: .88rem; font-weight: 600;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.chip:hover {
  color: var(--text); text-decoration: none; border-color: rgba(129, 140, 248, .5);
  transform: translateY(-1px); box-shadow: 0 4px 14px rgba(129, 140, 248, .18);
}
.chip-active {
  background: var(--grad); color: #06121f; border-color: transparent;
  box-shadow: 0 4px 18px rgba(94, 234, 212, .3);
}
.chip-active .chip-count { color: #06121f; opacity: .7; }
.chip-count { color: var(--muted); font-size: .78rem; margin-left: .2rem; }

/* ---------- Pagination / empty ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.2rem;
}
.page-link {
  background: rgba(17, 26, 51, .8); border: 1px solid var(--border); padding: .52rem 1.1rem;
  border-radius: 999px; color: var(--text); font-weight: 600;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.page-link:hover {
  text-decoration: none; border-color: rgba(129, 140, 248, .55);
  box-shadow: 0 0 18px rgba(129, 140, 248, .2); transform: translateY(-1px);
}
.empty, .empty-state { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.empty-state h1 { color: var(--text); }
.page-head h1 { margin: .4rem 0 .3rem; letter-spacing: -.02em; font-weight: 800; }
.page-head p { margin-top: 0; }

/* ---------- Play page ---------- */
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .9rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span { color: var(--text); }

.play-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.3rem; align-items: start;
}
.play-head h1 { margin: 0; font-size: 1.65rem; letter-spacing: -.02em; font-weight: 800; }
.play-head p { margin: .25rem 0 .55rem; }
.play-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .9rem; }

.frame-wrap {
  position: relative; aspect-ratio: 16/10; background: #03050b;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(129, 140, 248, .12), 0 0 60px rgba(99, 102, 241, .12);
}
.frame-wrap:fullscreen { aspect-ratio: auto; border-radius: 0; }
.frame-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
  background: #03050b;
}
.frame-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); background: #03050b; z-index: 2;
  background-image: radial-gradient(rgba(129, 140, 248, .16) 1px, transparent 1px);
  background-size: 22px 22px;
}
.frame-loading[hidden] { display: none; }

.play-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; align-items: center; }
.play-side { display: flex; flex-direction: column; gap: 1rem; }

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  backdrop-filter: blur(12px); box-shadow: 0 10px 34px rgba(0, 0, 0, .25);
}
.panel h2 { margin: 0 0 .75rem; font-size: 1.05rem; font-weight: 700; }
.panel-flush { padding: 0; overflow: hidden; backdrop-filter: none; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .6rem;
}
.panel-head h2 { margin: 0; font-size: 1.02rem; }
.panel-head a { font-size: .86rem; font-weight: 600; }

.score-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.score-list li {
  display: grid; grid-template-columns: 30px 1fr auto; gap: .55rem; align-items: center;
  padding: .42rem .55rem; border-radius: 10px; font-size: .92rem;
}
.score-list li:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.score-list .rank { color: var(--accent-2); font-weight: 700; text-align: center; }
.score-list li:first-child .rank { color: var(--gold); text-shadow: 0 0 12px rgba(251, 191, 36, .6); }
.score-list .pts { font-variant-numeric: tabular-nums; font-weight: 700; }
.score-list li.fresh { outline: 1px solid var(--accent); box-shadow: 0 0 16px rgba(94, 234, 212, .25); }

/* Empty leaderboard: friendly invite instead of a broken grid row */
.score-list li.score-empty {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  text-align: center; padding: 1.5rem .9rem 1.3rem;
  background: transparent !important; border: 1px dashed var(--border-strong);
  border-radius: 12px; color: var(--muted);
}
.score-empty-icon {
  color: var(--gold); opacity: .92; margin-bottom: .2rem;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, .35));
}
.score-empty-title { margin: 0; font-size: .93rem; font-weight: 600; color: var(--text); }
.score-empty-sub {
  margin: .1rem 0 0; font-size: .82rem; font-weight: 700; letter-spacing: .01em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Auto-detected score: highlight the field the game filled in for you */
#score-form.auto-detected input[name="score"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, .14);
}
#score-form.auto-detected input[name="score"]:focus {
  box-shadow: 0 0 0 3px rgba(94, 234, 212, .28);
}

/* ---------- Podium (leaderboard) ---------- */
.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  margin: 1.4rem 0 2rem; align-items: end;
}
.podium-card {
  display: flex; flex-direction: column; align-items: center; gap: .28rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1rem; color: var(--text);
  transition: transform .2s, box-shadow .2s; position: relative; overflow: hidden;
  backdrop-filter: blur(10px);
}
.podium-card:hover { text-decoration: none; transform: translateY(-5px); box-shadow: var(--glow), var(--shadow); }
.podium-first {
  border-color: rgba(251, 191, 36, .55);
  background: linear-gradient(180deg, rgba(251, 191, 36, .14), var(--panel));
  padding-top: 2.1rem; padding-bottom: 1.8rem;
  box-shadow: 0 0 40px rgba(251, 191, 36, .15);
}
.podium-first::before {
  content: ""; position: absolute; inset: -40% -10% auto; height: 80%;
  background: radial-gradient(closest-side, rgba(251, 191, 36, .22), transparent);
  pointer-events: none;
}
.podium-second { border-color: rgba(203, 213, 225, .35); }
.podium-third { border-color: rgba(245, 158, 11, .38); }
.podium-rank { font-size: .85rem; font-weight: 800; color: var(--muted); position: relative; }
.podium-first .podium-rank { color: var(--gold); font-size: 1.05rem; text-shadow: 0 0 14px rgba(251, 191, 36, .7); }
.podium-second .podium-rank { color: var(--silver); }
.podium-third .podium-rank { color: var(--bronze); }
.podium-name { font-weight: 800; font-size: 1.15rem; position: relative; }
.podium-score {
  font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}

/* ---------- Forms (public) ---------- */
.stack { display: flex; flex-direction: column; gap: .75rem; }
.form label, .stack label {
  display: flex; flex-direction: column; gap: .32rem; font-weight: 600; font-size: .9rem;
}
.form input, .form select, .stack input, .search select {
  padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(11, 18, 38, .85); color: var(--text); font-size: .95rem; outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .stack input:focus, .form select:focus, .search select:focus {
  border-color: rgba(129, 140, 248, .65); box-shadow: 0 0 0 4px rgba(129, 140, 248, .15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.form { max-width: 680px; display: flex; flex-direction: column; gap: .95rem; }
.form-actions { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: .3rem; }
.check-row { flex-direction: row !important; align-items: center; gap: .55rem !important; }
.check-row input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.tips { margin: 0; padding-left: 1.15rem; color: var(--muted); font-size: .92rem; }
.tips li { margin-bottom: .45rem; }
.hint ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }

.alert {
  border-radius: var(--radius); padding: .95rem 1.15rem; margin-bottom: 1.2rem;
  border: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  backdrop-filter: blur(10px);
}
.alert p { margin: 0; }
.alert-error { border-color: rgba(251, 113, 133, .5); background: rgba(251, 113, 133, .1); }
.alert-ok { border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .1); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: .72rem .9rem; text-align: left; font-size: .92rem; vertical-align: middle; }
.table thead { background: rgba(22, 33, 63, .9); }
.table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
}
.table tbody tr { border-top: 1px solid var(--border); transition: background .12s; }
.table tbody tr:hover { background: rgba(129, 140, 248, .06); }
.table .rank { color: var(--accent-2); font-weight: 700; }
.table .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.table-compact th, .table-compact td { padding: .52rem .75rem; }
.thumb {
  width: 52px; height: 34px; object-fit: cover; border-radius: 8px; display: block;
  background: var(--bg-2); border: 1px solid var(--border);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2.5rem;
  background: linear-gradient(180deg, transparent, rgba(11, 18, 38, .75));
  position: relative;
}
.site-footer::before {
  content: ""; position: absolute; inset-inline: 0; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, .4), rgba(129, 140, 248, .4), transparent);
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 1.6rem;
  padding: 2.3rem 0 1.4rem;
}
.footer-grid h4 {
  margin: 0 0 .65rem; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted);
}
.footer-grid a { display: block; color: var(--text); opacity: .85; padding: .15rem 0; font-size: .93rem; transition: color .15s, transform .15s; }
.footer-grid a:hover { color: var(--accent); opacity: 1; transform: translateX(3px); }
.footer-brand p { margin: .7rem 0 0; max-width: 32ch; }
.footer-bar {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-block: 1rem 1.3rem;
}
.footer-bar a { color: var(--muted); font-weight: 600; }
.footer-bar a:hover { color: var(--accent); }

/* ---------- Cookie notice ---------- */
.cookie-bar {
  position: fixed; z-index: 60; left: 50%; bottom: 1rem; transform: translateX(-50%);
  width: min(680px, calc(100% - 2rem));
  display: flex; align-items: center; gap: 1rem;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: .85rem 1rem;
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
  animation: fadeUp .35s ease both;
}
.cookie-bar[hidden] { display: none; }
.cookie-bar-text { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.cookie-bar-text a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.cookie-bar .btn { flex-shrink: 0; }
@media (max-width: 560px) {
  .cookie-bar { flex-direction: column; align-items: stretch; text-align: center; bottom: .6rem; }
  .cookie-bar .btn { width: 100%; }
}

/* ---------- Legal / static prose pages ---------- */
.legal { max-width: 760px; margin-inline: auto; }
.legal h1 { margin: 0 0 .2rem; font-size: 1.6rem; }
.legal h2 { margin: 1.4rem 0 .45rem; font-size: 1.08rem; }
.legal p, .legal li { color: var(--muted); font-size: .95rem; }
.legal p { margin: .45rem 0; }
.legal ul { margin: .45rem 0; padding-left: 1.25rem; }
.legal li { margin: .3rem 0; }
.legal code {
  font-size: .85em; background: rgba(11, 18, 38, .8); border: 1px solid var(--border);
  border-radius: 6px; padding: .08em .4em; color: var(--text);
}
.legal .btn { margin-top: 1.2rem; }

/* ============================================================
   Admin area
   ============================================================ */
.admin-body { display: block; background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

.admin-side {
  background: rgba(11, 18, 38, .8); backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.1rem .9rem; gap: 1.2rem;
  position: sticky; top: 0; height: 100vh;
}
.admin-brand { padding: .2rem .5rem; font-size: 1.02rem; }
.brand-tag {
  margin-left: auto; font-size: .64rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: #06121f; background: var(--grad);
  padding: .18rem .5rem; border-radius: 999px;
}
.admin-nav { display: flex; flex-direction: column; gap: .18rem; }
.admin-nav a {
  display: flex; align-items: center; gap: .65rem; padding: .58rem .75rem;
  border-radius: 12px; color: var(--muted); font-weight: 600; font-size: .94rem;
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
.admin-nav a:hover {
  color: var(--text); background: rgba(255, 255, 255, .05);
  text-decoration: none; transform: translateX(3px);
}
.admin-nav a.active {
  color: #06121f; background: var(--grad);
  box-shadow: 0 4px 18px rgba(99, 102, 241, .35);
}
.admin-nav-icon { width: 1.15rem; text-align: center; opacity: .9; }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .35rem; padding: .4rem .5rem; }
.admin-side-foot a { color: var(--muted); font-size: .88rem; }
.admin-side-foot a:hover { color: var(--text); }

.admin-main { padding: 1.5rem 1.7rem 3rem; min-width: 0; animation: fadeUp .4s ease both; }
.admin-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-top h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.02em; font-weight: 800; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .95rem; margin-bottom: 1.2rem;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.15rem; display: flex; flex-direction: column; gap: .15rem;
  position: relative; overflow: hidden; backdrop-filter: blur(10px);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.stat-card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--grad);
}
.stat-card::after {
  content: ""; position: absolute; width: 90px; height: 90px; right: -30px; top: -30px;
  background: radial-gradient(circle, rgba(129, 140, 248, .28), transparent 70%);
  border-radius: 50%;
}
.stat-num {
  font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #fff, #c7d2fe);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

.admin-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
.admin-cols-wide { grid-template-columns: 1.7fr 1fr; }

.toolbar {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.toolbar .muted { margin-right: auto; }
.search-admin { max-width: 320px; flex: initial; }
.search-admin select { border-radius: 999px 0 0 999px; }
.search-admin button { border-radius: 0 999px 999px 0; }

.inline-form { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
.rename-form input[type="text"] { max-width: 190px; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.toggle {
  background: none; border: 1px solid var(--border); border-radius: 9px;
  color: var(--muted); cursor: pointer; font-size: 1rem; padding: .18rem .45rem;
  transition: color .15s, border-color .15s, transform .15s;
}
.toggle:hover { color: var(--gold); border-color: rgba(251, 191, 36, .5); transform: scale(1.1); }
.toggle-on { color: var(--gold); border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .1); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex; justify-content: space-between; gap: .8rem; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .92rem;
}
.mini-list li:last-child { border-bottom: 0; }

.bar-list { display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 42px; gap: .7rem; align-items: center; font-size: .9rem; }
.bar-name { color: var(--muted); text-transform: capitalize; }
.bar-track { background: rgba(11, 18, 38, .9); border-radius: 999px; height: 10px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill {
  height: 100%; background: var(--grad); border-radius: 999px;
  box-shadow: 0 0 12px rgba(99, 102, 241, .5);
}
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Cover-mirror progress (admin → Health) */
.mirror-progress { margin-bottom: 1rem; }
.mirror-progress-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-bottom: .4rem;
}
.mirror-progress-label { font-weight: 700; font-size: .92rem; }
.mirror-progress-count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.mirror-progress-bar { height: 12px; }
.mirror-progress-bar .bar-fill { transition: width .45s ease; }
.mirror-progress-note { margin: .5rem 0 0; }
#mirror-status { min-height: 1.2em; margin: .4rem 0 0; }
.mirror-done { color: var(--ok); font-weight: 600; }

/* Honeypot field — visually hidden from humans, tempting to bots */
.honeypot {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 1.2rem; }
.login-wrap { width: min(430px, 100%); }
.login-card {
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 2.2rem 1.9rem; display: flex; flex-direction: column; gap: .9rem;
  box-shadow: var(--shadow); backdrop-filter: blur(16px); position: relative; overflow: hidden;
  animation: fadeUp .45s ease both;
}
.login-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from 210deg, rgba(94, 234, 212, .5), rgba(129, 140, 248, .5), rgba(232, 121, 249, .4), rgba(94, 234, 212, .5));
  filter: blur(18px); opacity: .35;
}
.login-brand { justify-content: center; margin-bottom: .4rem; flex-direction: column; gap: .7rem; }
.login-brand .brand-word { font-size: 1.25rem; }
.login-card h1 { margin: 0; font-size: 1.45rem; text-align: center; font-weight: 800; letter-spacing: -.02em; }
.login-card > p { margin: 0 0 .5rem; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: .32rem; font-weight: 600; font-size: .9rem; }
.login-card input {
  padding: .66rem .85rem; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(11, 18, 38, .9); color: var(--text); font-size: 1rem; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: rgba(129, 140, 248, .65); box-shadow: 0 0 0 4px rgba(129, 140, 248, .15); }
.login-card .alert { margin-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--border); padding: .8rem 1rem;
  }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-foot { margin: 0 0 0 auto; flex-direction: row; gap: 1rem; }
  .admin-cols, .admin-cols-wide { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .play-layout { grid-template-columns: 1fr; }
  .frame-wrap { aspect-ratio: 16/9; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; }
  .search { order: 3; max-width: none; width: 100%; }
  .nav-toggle { display: block; margin-left: auto; }
  .main-nav {
    display: none; width: 100%; flex-direction: column; align-items: stretch; order: 4;
    background: rgba(14, 21, 43, .95); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .45rem; gap: .15rem; backdrop-filter: blur(14px);
  }
  .main-nav.open { display: flex; }
  .main-nav .nav-cta { margin-left: 0; text-align: center; }
  .form-row { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .podium-first { order: -1; }
  .admin-main { padding: 1rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.2rem; }
  .bar-row { grid-template-columns: 90px 1fr 36px; }
  .hero-stats { gap: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Ratings & stars ---------- */
.rate-box, .comments-box { margin-top: 1rem; }
.star-row {
  display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .15rem;
}
.star-row input { position: absolute; opacity: 0; pointer-events: none; }
.star-row label {
  font-size: 1.7rem; color: rgba(148, 163, 196, .35); cursor: pointer;
  transition: color .12s, transform .12s; padding: 0 .1rem;
}
.star-row label:hover, .star-row label:hover ~ label,
.star-row input:checked ~ label { color: var(--gold); text-shadow: 0 0 14px rgba(251, 191, 36, .55); }
.star-row label:hover { transform: scale(1.15); }
.rating-tag { color: var(--gold); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .08); }

/* ---------- Comments ---------- */
.comments-box textarea {
  padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(11, 18, 38, .85); color: var(--text); font-size: .95rem;
  outline: none; font-family: inherit; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
.comments-box textarea:focus { border-color: rgba(129, 140, 248, .65); box-shadow: 0 0 0 4px rgba(129, 140, 248, .15); }
.comment-list { list-style: none; margin: 1.1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.comment-list li {
  padding: .7rem .85rem; border-radius: 12px; background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
}
.comment-list p { margin: .25rem 0 0; font-size: .93rem; }
.comment-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }

/* ---------- Tag chips on game page ---------- */
.play-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip-sm { padding: .22rem .65rem; font-size: .78rem; }
.chip-x { color: inherit; margin-left: .25rem; opacity: .8; }
.chip-x:hover { opacity: 1; text-decoration: none; }

/* ---------- Browse bar (games.php) ---------- */
.browse-bar {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  margin: 1rem 0 1.1rem; padding: .9rem 1rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
.browse-bar select {
  padding: .58rem .8rem; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(11, 18, 38, .85); color: var(--text); font-size: .92rem; outline: none; font-family: inherit;
}
.browse-search { flex: 1 1 220px; max-width: 380px; }
.browse-search input { border-radius: 999px 0 0 999px; }

/* ---------- Ad slots ---------- */
.ad-slot {
  border: 1px dashed rgba(148, 163, 196, .3); border-radius: var(--radius);
  padding: .6rem; margin: 1.1rem 0; text-align: center;
  background: rgba(11, 18, 38, .4); min-height: 40px; overflow: hidden;
}
/* In-feed ad sits inside the game grid: span the full row, no dashed box
   once the network fills it (ad networks style the <ins> themselves). */
.ad-slot-infeed {
  grid-column: 1 / -1; margin: 0; padding: .4rem;
  border: none; background: transparent;
  display: flex; justify-content: center;
}
.ad-slot-infeed:empty { display: none; }

/* ---------- Dynamic rails (favorites / recent) ---------- */
.rail-dynamic[hidden] { display: none !important; }

/* ---------- Import / admin forms ---------- */
.import-form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; margin-bottom: .5rem; }
.import-form input[type="number"] {
  max-width: 120px; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(11, 18, 38, .85); color: var(--text);
}

/* ---------- Cover loading shimmer ---------- */
.card-cover, .hero-card {
  background: linear-gradient(110deg, var(--bg-2) 8%, #16213f 18%, var(--bg-2) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
