:root {
  --bg: #0b0f19;
  --card: #141a29;
  --muted: #8aa0b7;
  --text: #e8f0ff;
  --accent: #6ee7ff;
  --accent-2: #8b5cf6;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  padding-bottom: 80px; /* spazio per il footer fisso */
}

#bgCanvas {
  position: fixed;
  inset: 0;
  z-index:0;
  width: 100vw;
  height: 100vh;
  display: block;
}

header { text-align:center; padding: 64px 16px 28px; }
header h1 {
  margin: 0 0 8px;
  font-size: clamp(36px, 6vw, 64px); /* titolo più grande */
  letter-spacing: .5px;
}
header p { margin: 0; color: var(--muted); font-size: 16px; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px 20px 56px; position: relative; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* moduli più grandi */
  gap: 22px;
  margin-top: 32px;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(0,0,0,.36); border-color: rgba(255,255,255,0.14); }

.badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;

  position:relative; font-size: 12px; padding: 7px 11px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); color:#06101a; font-weight: 700; letter-spacing:.2px;
}

.thumb {
  height: 140px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(110,231,255,.16), rgba(139,92,246,.16));
  border: 1px dashed rgba(255,255,255,0.14);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size: 18px; color: rgba(232,240,255,.9);
}

.title { margin: 14px 0 8px; font-size: 20px; font-weight: 800; }
.desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.actions { margin-top: 16px; display:flex; gap: 12px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap:8px; text-decoration: none;
  padding: 13px 16px; border-radius: 14px; font-weight: 800; font-size: 14px; letter-spacing:.35px; border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05); color: var(--text);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}

.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #0b0f19; border: none; }
.btn.primary:hover { filter: brightness(1.06); }

/* Footer fisso in fondo alla pagina */
footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  text-align:center; color: var(--muted); font-size: 13px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(10,14,24,0.2), rgba(10,14,24,0.6));
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Rimosso bottone Home top-right in quanto siamo nella home */

footer{position:fixed;left:0;right:0;bottom:0;text-align:center;color:#8aa0b7;font-size:13px;padding:14px 16px;background:linear-gradient(180deg,rgba(10,14,24,.2),rgba(10,14,24,.6));backdrop-filter:blur(6px);border-top:1px solid rgba(255,255,255,.08)}
body{padding-bottom:80px}


/* Background Tetris canvas */
#bgCanvas{position:fixed;inset:0;z-index:-1;width:100vw;height:100vh;display:block}

/* Modal dettagli */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.5);z-index:50}
.modal.hidden{display:none}
.modal-card{max-width:560px;width:90%;background:#141a29;border:1px solid rgba(255,255,255,.12);border-radius:16px;padding:18px;box-shadow:0 10px 30px rgba(0,0,0,.5)}
#modal-title{margin:0 0 8px;font-size:20px}
#modal-text{margin:0 0 14px;color:#8aa0b7;font-size:14px;line-height:1.55}
#modal-ok{display:inline-flex;align-items:center;justify-content:center;padding:10px 16px;border-radius:12px;border:none;font-weight:800;letter-spacing:.3px;cursor:pointer;background:linear-gradient(90deg,var(--accent),var(--accent-2));color:#0b0f19}
#modal-ok:hover{filter:brightness(1.06)}


.thumb-img{width:100%;height:100%;object-fit:cover;border-radius:12px}


/* Ensure game logo fits the thumb box without overflow */
.thumb{position:relative; overflow:hidden; border-radius:12px}
.thumb-img{display:block; width:100%; height:100%; object-fit:cover}



/* Keep badge above thumbnail image */
.card{
  display:flex;
  flex-direction:column;
  min-height: 430px;
position:relative}
.badge{position:absolute; top:12px; right:12px; z-index:15}
.thumb{position:relative; overflow:hidden}
.thumb-img{display:block; width:100%; height:100%; object-fit:cover; border-radius:12px}



/* Badge always above image */
.card{
  display:flex;
  flex-direction:column;
  min-height: 430px;
position:relative}
.badge{position:absolute; top:12px; right:12px; z-index:20}
.thumb{position:relative; overflow:hidden}
.thumb-img{display:block; width:100%; height:100%; object-fit:cover; border-radius:12px}

/* Top right actions (Amministrazione / Contatti) */
header{ position:relative; }

.top-actions{
  position:absolute;
  top:18px;
  right:22px;
  display:flex;
  gap:10px;
  align-items:center;
  z-index:2;
}

.top-btn{
  appearance:none;
  border:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:14px;
  font-weight:800;
  font-size:13px;
  letter-spacing:.2px;
  cursor:pointer;
  user-select:none;
  transition:transform .18s ease, filter .18s ease, box-shadow .18s ease;
  box-shadow: inset 0 0 0 1px rgba(43,58,87,.9), 0 10px 22px rgba(0,0,0,.32);
  backdrop-filter: blur(6px);
  position:relative;
  overflow:hidden;
  isolation:isolate;
}

.top-btn::after{
  content:"";
  position:absolute;
  top:-30%;
  left:-60%;
  width:60%;
  height:160%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.20), transparent);
  transform: rotate(18deg);
  opacity:.55;
  animation: topSheen 2.8s ease-in-out infinite;
  z-index:-1;
}
@keyframes topSheen{
  0%{ transform: translateX(0) rotate(18deg); opacity:.12;}
  45%{ opacity:.55;}
  100%{ transform: translateX(220%) rotate(18deg); opacity:.12;}
}

.top-btn.admin{
  color: var(--text);
  background: linear-gradient(180deg, rgba(27,36,54,.92), rgba(16,23,39,.92));
}
.top-btn.contact{
  color:#031018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px rgba(106,227,255,.22);
}

.top-btn:hover{
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.05);
  box-shadow: inset 0 0 0 1px rgba(106,227,255,.28), 0 16px 28px rgba(0,0,0,.35);
}
.top-btn:active{ transform: translateY(0) scale(.99); }

@media (max-width: 520px){
  .top-actions{ top:12px; right:12px; gap:8px; }
  .top-btn{ padding:9px 12px; border-radius:12px; font-size:12.5px; }
  header{ padding-top:78px; } /* prevent overlap with title */
}

/* Mobile header buttons fix */
@media (max-width: 520px){
  header{ padding-top: 28px; }
  .top-actions{ position: static; margin:0 auto 14px; justify-content:center; flex-wrap:wrap; }
}


.modal-actions{display:flex;justify-content:flex-end;margin-top:10px}
#modal-ok{margin-left:auto}

.thumb{height:140px; display:flex; align-items:center; justify-content:center; margin-bottom:14px}
.thumb-img{max-height:140px; width:auto}

.card .desc{flex:1}
.card .actions{margin-top:auto; display:flex; gap:12px; justify-content:center; flex-wrap:wrap}

/* Hover shimmer for primary buttons (Gioca) */
.btn.primary{position:relative; overflow:hidden}
.btn.primary::after{
  content:"";
  position:absolute; inset:-40% -60%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.28), transparent);
  transform: translateX(-30%) rotate(18deg);
  opacity:0;
  transition: opacity .15s ease;
}
.btn.primary:hover::after{
  opacity:.85;
  animation: shimmer 1.15s linear infinite;
}
@keyframes shimmer{
  0%{ transform: translateX(-40%) rotate(18deg); }
  100%{ transform: translateX(110%) rotate(18deg); }
}

#bgCanvas{max-width:none}

.desc{margin-bottom:18px}

.grid{margin-bottom:92px}

.badge.online{background:rgba(106,227,255,.14); color:#bfefff; box-shadow:inset 0 0 0 1px rgba(106,227,255,.22)}

#bgCanvas{position:fixed; inset:0; width:100vw; height:100vh; display:block; max-width:none;}

.badges{
  position:absolute;
  top:14px;
  right:14px;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
  z-index:2;
}

.modal-text p{margin:0 0 10px}
.modal-text p:last-child{margin-bottom:0}
.modal-text ul{margin:8px 0 10px 18px; padding:0}
.modal-text li{margin:6px 0}
.modal-text b{color:#d7e7ff}

header, .container, footer{position:relative; z-index:1}

#bgCanvas{position:fixed; inset:0; width:100vw; height:100vh; display:block; z-index:0; pointer-events:none; filter:contrast(110%) saturate(110%)}

.overlay{position:fixed; inset:0; z-index:0; pointer-events:none}
header, .container, footer{position:relative; z-index:1}

.badges{flex-direction:row; gap:8px}
.badges .badge{position:relative}

/* Landing overrides */
.hub-grid{grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:18px; margin-top:22px; margin-bottom:92px;}
.hub-card{min-height:320px;}
.hub-card .thumb{height:120px; margin-bottom:14px; border-radius:16px; background:linear-gradient(180deg, rgba(110,231,255,.18), rgba(139,92,246,.12)); box-shadow: inset 0 0 0 1px rgba(110,231,255,.16); display:flex; align-items:center; justify-content:center;}
.hub-card .thumb span{font-size:44px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.35));}
.hub-card p{max-width:44ch; margin:0 auto 16px;}
@media (max-width:520px){ header{padding:56px 14px 22px;} .hub-card{min-height:300px;} }

/* Homepage (Landing) refinements */
.hub-grid{
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
  margin-top:18px;
  margin-bottom:26px;
}
.hub-card{
  min-height: 280px;
  padding:18px 18px 16px;
}
.hub-card h3{font-size:18px; margin-top:14px}
.hub-card p{font-size:13.5px; line-height:1.45; margin-bottom:14px}
.hub-card .actions{gap:10px}
.hub-card .thumb{
  height:110px;
  border-radius:16px;
  overflow:hidden;
  background:rgba(12,18,32,.55);
  box-shadow: inset 0 0 0 1px rgba(110,231,255,.14);
}
.hub-card .thumb svg{display:block; width:100%; height:100%}
.lorem{margin:0 0 92px}
.lorem-card{
  background:rgba(15,22,38,.5);
  border-radius:16px;
  padding:16px 16px;
  box-shadow: inset 0 0 0 1px rgba(43,58,87,.55);
}
.lorem-card h2{margin:0 0 8px; font-size:16px}
.lorem-card p{margin:0 0 10px; color:var(--muted); line-height:1.55}
.lorem-card p.muted{opacity:.9}
@media (max-width: 420px){
  .hub-card{min-height: 0}
  .hub-card .thumb{height:100px}
}


/* Homepage v4 tweaks */
.hub-grid{
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  gap:16px;
  margin-top:16px;
  margin-bottom:22px;
}
.hub-card{
  min-height: 320px;
  padding:18px 18px 16px;
}
.hub-card h3{
  font-size:21px;
  margin:12px 0 10px;
}
.hub-card p{
  font-size:13.6px;
  line-height:1.55;
  margin:0 0 14px;
}
.hub-card .thumb{height:112px}

/* Stronger "Seleziona" button animation */
.btn.play{
  position:relative;
  overflow:hidden;
  transform: translateZ(0);
  will-change: transform, box-shadow, filter;
}
.btn.play::before{
  content:"";
  position:absolute;
  inset:-40% -60%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.32), transparent);
  transform: translateX(-60%) rotate(18deg);
  opacity:0;
}
.btn.play:hover{
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 14px 26px rgba(106,227,255,.42);
  filter: brightness(1.06);
}
.btn.play:hover::before{
  opacity:.9;
  animation: shimmer 1.05s linear infinite;
}
.btn.play:active{
  transform: translateY(-1px) scale(.98);
  box-shadow: 0 10px 18px rgba(106,227,255,.30);
}
.btn.play.disabled{
  opacity:.55;
  pointer-events:none;
  filter:saturate(.7);
}

/* Refined Contact button style */
.top-btn.contact{
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
}
.top-btn.contact:hover{
  background: rgba(106,227,255,.12);
  border-color: rgba(106,227,255,.45);
  box-shadow: 0 10px 22px rgba(106,227,255,.18);
  transform: translateY(-2px);
}

/* Ensure images fully fill box */
.hub-card .thumb{
  padding:0;
}
.hub-card .thumb svg{
  width:100%;
  height:100%;
}

.lorem{margin-bottom:48px}
footer{margin-top:0}

.top-btn.contact{
  background:transparent;
  color:rgba(255,255,255,.85);
  border:1px dashed rgba(255,255,255,.35);
}
.top-btn.contact:hover{
  background:rgba(255,255,255,.08);
  border-style:solid;
  border-color:rgba(120,200,255,.6);
  color:#fff;
}

.hub-card .thumb{
  padding:0;
}
.hub-card .thumb svg{
  width:100%;
  height:100%;
  display:block;
}

/* spacing tweaks */
.hub-grid{margin-bottom:48px}
.lorem{margin-bottom:32px}
footer{margin-top:0}

.top-btn.contact{
  background:transparent;
  color:rgba(200,215,240,.9);
  border-bottom:2px solid rgba(200,215,240,.4);
  border-radius:0;
}
.top-btn.contact:hover{
  color:#fff;
  border-bottom-color:#6ae3ff;
  background:transparent;
}

.top-btn.contact{
  background: rgba(80,140,255,.18);
  color: #e9f0ff;
  border: 1px solid rgba(120,170,255,.45);
}
.top-btn.contact:hover{
  background: rgba(80,140,255,.28);
  border-color: rgba(120,170,255,.75);
  box-shadow: 0 10px 22px rgba(80,140,255,.35);
}

/* Contact button = Admin clone with blue tint */
.top-btn.contact{
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: rgba(106,227,255,.18);
  color: #e9f0ff;
  border: 1px solid rgba(106,227,255,.45);
}
.top-btn.contact:hover{
  background: rgba(106,227,255,.30);
  border-color: rgba(106,227,255,.75);
  box-shadow: 0 12px 22px rgba(106,227,255,.35);
  transform: translateY(-2px);
}

/* White background for hub images */
.hub-card .thumb{
  
  
  overflow: hidden;
}

.thumb-inner{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-inner svg{
  width: 92%;
  height: 92%;
}

/* Image thumbs refinement */
.hub-card .thumb{
  background: transparent;
  padding: 6px 4px;
}

.thumb-inner{
  width: 100%;
  height: 100%;
}

.thumb-inner svg{
  width: 100%;
  height: 100%;
  max-height: 140px;
}

/* More breathing room for hub images */
.hub-card .thumb{
  padding: 16px 14px 18px;
}

.thumb-inner svg{
  max-height: 150px;
}
