/* GiocaPop — design system. Mobile-first, dark, vivido. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* sfondo decorativo */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 85% -10%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(50vw 50vw at -10% 10%, rgba(255,93,158,.14), transparent 55%),
    radial-gradient(40vw 40vw at 50% 120%, rgba(54,226,201,.10), transparent 55%);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.08; letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--p1); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.gradient-text { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.hide-mobile { display: none; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:40px}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand);
  display: grid; place-items: center; box-shadow: var(--glow); flex: 0 0 auto;
}
.brand .mark svg { width: 18px; height: 18px; }
.brand .pop { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: none; gap: 4px; margin-left: 8px; }
.nav-links a { padding: 8px 12px; border-radius: var(--pill); color: var(--muted); font-weight: 600; font-size: .94rem; transition: .15s; }
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.avatar { width: 34px; height: 34px; border-radius: var(--pill); object-fit: cover; background: var(--surface-2); border: 1px solid var(--line-2); }
.avatar-fallback { display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand-2); }

/* menu account */
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r2);
  box-shadow: var(--sh2); padding: 8px; display: none; z-index: 60;
}
.menu.open .menu-panel { display: block; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r1); color: var(--text); background: none; border: 0; font-weight: 600; font-size: .92rem;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.burger { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r1); border: 1px solid var(--line-2); background: var(--surface); }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--pill); border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; color: var(--text); background: var(--b);
  transition: transform .12s ease, box-shadow .2s ease, background .2s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { box-shadow: 0 14px 50px rgba(124,92,255,.55); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface); }
.btn-soft { background: var(--surface-2); border-color: var(--line); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 8px 14px; font-size: .86rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: 18px; }
.card-2 { background: var(--surface-2); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); }

.section { padding-block: 38px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 800; color: var(--p3); }
.section-head h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
.see-all { color: var(--muted); font-weight: 700; font-size: .9rem; }
.see-all:hover { color: var(--text); }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--pill); font-size: .78rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip.accent { background: color-mix(in oklab, var(--p1) 22%, transparent); color: #d9cdff; border-color: transparent; }
.chip.teal { background: color-mix(in oklab, var(--p3) 20%, transparent); color: #b7fff2; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ok) 25%, transparent); }
.tag-soon { background: color-mix(in oklab, var(--p4) 20%, transparent); color: var(--p4); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 46px 0 30px; }
.hero-card {
  position: relative; overflow: hidden; border-radius: var(--r4);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); padding: clamp(24px, 5vw, 52px);
}
.hero-card::after { content:""; position:absolute; inset:0; background: radial-gradient(40% 60% at 80% 0%, rgba(124,92,255,.28), transparent 70%); pointer-events:none; }
.hero h1 { font-size: clamp(2.1rem, 7vw, 4rem); max-width: 14ch; }
.hero p.lead { color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.2rem); max-width: 46ch; margin-top: 14px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 30px; }
.hero-stats .stat b { font-family: var(--font-display); font-size: 1.7rem; display: block; }
.hero-stats .stat span { color: var(--muted); font-size: .82rem; }

/* ---------- Game grid / cards ---------- */
.grid { display: grid; gap: 14px; }
.grid-games { grid-template-columns: repeat(2, 1fr); }
.game-card { position: relative; overflow: hidden; border-radius: var(--r3); background: var(--surface); border: 1px solid var(--line); transition: transform .16s ease, border-color .2s, box-shadow .2s; }
.game-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--sh2); }
.game-cover { aspect-ratio: 16/10; display: grid; place-items: center; font-size: 2.6rem; position: relative; }
.game-cover.ph-0 { background: linear-gradient(135deg,#2a1f57,#3a2070); }
.game-cover.ph-1 { background: linear-gradient(135deg,#0f3b46,#0e5a52); }
.game-cover.ph-2 { background: linear-gradient(135deg,#4a1d3f,#71214e); }
.game-cover.ph-3 { background: linear-gradient(135deg,#3a3410,#5a4a13); }
.game-cover.ph-4 { background: linear-gradient(135deg,#1c2452,#22357a); }
.game-cover.ph-5 { background: linear-gradient(135deg,#3a1840,#5c1f4d); }
.game-cover img { position:absolute; inset:0; width:100%; height:100%; object-fit: cover; }
.game-cover .soon { position: absolute; top: 10px; left: 10px; }
.game-body { padding: 13px 14px 15px; }
.game-body h3 { font-size: 1.02rem; }
.game-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--faint); font-size: .8rem; }
.game-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* ---------- Leaderboard ---------- */
.lb { width: 100%; border-collapse: collapse; }
.lb th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 10px 12px; }
.lb td { padding: 11px 12px; border-top: 1px solid var(--line); }
.lb tr.me td { background: color-mix(in oklab, var(--p1) 12%, transparent); }
.lb tr.me td:first-child { box-shadow: inset 3px 0 0 var(--p1); }
.rank { font-family: var(--font-display); font-weight: 800; width: 46px; color: var(--muted); }
.rank.g1 { color: #ffd166; } .rank.g2 { color: #d7dbe6; } .rank.g3 { color: #e0975a; }
.lb .player { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.lb .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.lvl-pill { font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: var(--pill); background: var(--surface-2); color: var(--p3); border: 1px solid var(--line); }

.tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: var(--pill); flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: var(--pill); font-weight: 700; font-size: .86rem; color: var(--muted); }
.tabs a.active { background: var(--brand); color: #fff; }

/* ---------- Ad slot ---------- */
.ad-slot { margin: 16px 0; }
.ad-slot .ad-label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); text-align: center; margin-bottom: 4px; }
.ad-box { min-height: 90px; border: 1px dashed var(--line-2); border-radius: var(--r2); display: grid; place-items: center; background: color-mix(in oklab, var(--surface) 60%, transparent); overflow: hidden; }
.ad-box.filled { border-style: solid; border-color: var(--line); }
.ad-box .placeholder { color: var(--faint); font-size: .8rem; }
.ad-slot.sidebar .ad-box { min-height: 250px; }
.ad-slot[hidden] { display: none; }

/* ---------- Level bar ---------- */
.level-bar { height: 10px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; }
.level-bar > i { display: block; height: 100%; background: var(--brand); border-radius: var(--pill); }

/* ---------- Forms ---------- */
.form-card { max-width: 440px; margin: 40px auto; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: .86rem; }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: var(--r2);
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font: inherit;
}
.input:focus { border-color: var(--p1); }
textarea.input { resize: vertical; min-height: 90px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--p1); }
.help { font-size: .82rem; color: var(--faint); }
.divider-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .82rem; margin: 16px 0; }
.divider-or::before, .divider-or::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------- Flash / toast ---------- */
.flash-wrap { position: fixed; top: 76px; right: 16px; z-index: 80; display: grid; gap: 10px; max-width: 360px; }
.flash { padding: 13px 16px; border-radius: var(--r2); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--sh2); font-weight: 600; font-size: .9rem; animation: slidein .3s ease; }
.flash.success { border-left: 4px solid var(--ok); }
.flash.error { border-left: 4px solid var(--err); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* ---------- Cookie banner ---------- */
.cookie { position: fixed; inset: auto 12px 12px 12px; z-index: 90; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r3); box-shadow: var(--sh2); padding: 18px; max-width: 520px; margin-inline: auto; }
.cookie h4 { font-size: 1.05rem; }
.cookie p { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.cookie .cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.cookie-prefs { display: grid; gap: 8px; margin-top: 12px; }
.cookie[hidden] { display: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 50px; padding: 38px 0 calc(38px + env(safe-area-inset-bottom)); background: var(--bg-2); }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
.footer-col h5 { font-family: var(--font-display); font-size: .95rem; margin-bottom: 10px; }
.footer-col a { display: block; color: var(--muted); padding: 4px 0; font-size: .9rem; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Mobile bottom nav ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 55; display: flex;
  background: color-mix(in oklab, var(--bg) 80%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 9px 0; color: var(--faint); font-size: .66rem; font-weight: 700; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { color: var(--p1); }
body { padding-bottom: 64px; }

/* ---------- Game page ---------- */
.game-stage { position: relative; aspect-ratio: 16/10; border-radius: var(--r3); overflow: hidden; border: 1px solid var(--line); background: #07070d; display: grid; place-items: center; }
.game-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.game-stage .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: radial-gradient(60% 60% at 50% 30%, rgba(124,92,255,.2), transparent); }
.layout-game { display: grid; gap: 20px; }
.best-box { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--r2); background: var(--surface-2); border: 1px solid var(--line); }
.kv { display:flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--muted); }

/* prose (legal/news) */
.prose { max-width: 760px; }
.prose h2 { font-size: 1.3rem; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--text); margin-bottom: 10px; }
.prose ul { padding-left: 20px; margin-bottom: 12px; }
.prose a { color: var(--p3); text-decoration: underline; }

/* badges grid */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 12px; }
.badge-item { text-align: center; padding: 14px 8px; border-radius: var(--r2); background: var(--surface-2); border: 1px solid var(--line); }
.badge-item .ic { font-size: 1.8rem; }
.badge-item.locked { opacity: .35; filter: grayscale(1); }
.badge-item small { display:block; margin-top: 6px; font-weight: 700; font-size: .72rem; }

/* mission */
.mission { padding: 14px; border-radius: var(--r2); background: var(--surface-2); border: 1px solid var(--line); }
.mission .level-bar { margin-top: 10px; }

/* empty state */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .ic { font-size: 3rem; }

/* pagination */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pager a, .pager span { padding: 8px 13px; border-radius: var(--r1); border: 1px solid var(--line); font-weight: 700; font-size: .86rem; color: var(--muted); }
.pager a:hover { color: var(--text); background: var(--surface); }
.pager .current { background: var(--brand); color: #fff; border-color: transparent; }

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 1fr; gap: 18px; padding-block: 22px; }
.admin-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: 12px; height: max-content; }
.admin-side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r1); color: var(--muted); font-weight: 600; font-size: .9rem; }
.admin-side a:hover { background: var(--surface-2); color: var(--text); }
.admin-side a.active { background: var(--brand); color: #fff; }
.kpi-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.kpi { padding: 16px; border-radius: var(--r2); background: var(--surface); border: 1px solid var(--line); }
.kpi b { font-family: var(--font-display); font-size: 1.8rem; display: block; }
.kpi span { color: var(--muted); font-size: .8rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; padding: 10px; }
.table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.pill-status { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: var(--pill); }
.st-active, .st-published { background: color-mix(in oklab,var(--ok) 22%, transparent); color: #9af3c9; }
.st-suspended, .st-draft { background: color-mix(in oklab,var(--warn) 22%, transparent); color: #ffd98a; }
.st-banned, .st-archived, .st-deleted { background: color-mix(in oklab,var(--err) 22%, transparent); color: #ffb3b3; }
.level-warn { color: var(--warn); } .level-security { color: var(--err); }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .grid-games { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(4,1fr); }
  .layout-game { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  .nav-links { display: flex; }
  .burger { display: none; }
  .hide-mobile { display: revert; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
  .grid-games { grid-template-columns: repeat(4, 1fr); }
  .layout-game { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
  .admin-shell { grid-template-columns: 220px 1fr; }
}
@media (min-width: 1040px) {
  .grid-games.lg-5 { grid-template-columns: repeat(5, 1fr); }
}

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