*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a1628;
  --bg-card: #111d35;
  --bg-nav: rgba(10,22,40,.97);
  --text: #f0f4ff;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #93c5fd;
  --border: #1e3a5f;
  --radius: 8px;
  --max-w: 960px;
  --font: system-ui, -apple-system, sans-serif;
  --font-game: '1Minute Hell', var(--font);
}
@font-face {
  font-family: '1Minute Hell';
  src: url('../assets/fonts/1MinuteHell.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  font-family: var(--font-game);
  background: transparent;
  color: var(--text);
  line-height: 1.6;
  letter-spacing: .05em;
}
#grid-canvas {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1; pointer-events: none;
  background-color: #080812;
  contain: strict;
}
#grid-canvas::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(26,26,77,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,26,77,0.3) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: gridScroll 12s linear infinite;
}
#grid-canvas::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(51,102,255,0.06) 0%, transparent 60%);
}
@keyframes gridScroll {
  from { background-position: 0 0; }
  to { background-position: 64px 64px; }
}
section {
  background: rgba(10, 22, 40, 0.85);
}
section.hero {
  background: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, strong, b { font-weight: 400; }

nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
nav .logo { font-family: var(--font-game); font-size: 1.3rem; font-weight: 400; color: var(--accent); letter-spacing: .02em; }
nav .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
nav .nav-links a {
  color: var(--text-muted); font-size: .85rem; padding: 6px 10px; border-radius: var(--radius);
  transition: color .2s, background .2s;
}
nav .nav-links a:hover { color: var(--text); background: var(--border); }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  nav .nav-links {
    display: none; position: fixed; top: 60px; left: 0; right: 0;
    background: var(--bg-nav); flex-direction: column; padding: 12px 20px;
    border-bottom: 1px solid var(--border);
  }
  nav .nav-links.open { display: flex; }
}

main { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; isolation: isolate; }
section { padding: 80px 0; border-bottom: 1px solid var(--border); opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
section:last-of-type { border-bottom: none; }
section.visible { opacity: 1; transform: translateY(0); }
section.hero { opacity: 1; transform: none; }

h2 {
  font-size: 1.8rem; margin-bottom: 24px; color: var(--accent);
  text-align: center;
}
h3 { font-size: 1.2rem; margin-bottom: 12px; color: var(--accent); }

.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 120px 20px 80px;
}
.hero h1.game-title {
  font-family: var(--font-game);
  font-weight: 400;
  font-size: clamp(2.8rem, 9vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: .06em;
  margin-bottom: 16px;
  position: relative;
  user-select: none;
}
.game-title .title-1minute {
  display: block;
  position: relative;
  width: max-content;
  margin: 0 auto;
}
/* ── "Hell" wrapper: la base in flow dà le dimensioni, ghost/glitch ci stanno sopra ── */
.game-title .title-hell-wrap {
  display: block;
  position: relative;
  width: max-content;
  margin: 0 auto;
}
/* ── "Hell" base (in flow: definisce l'ingombro del wrap) ── */
.game-title .title-hell {
  display: block;
  color: #ff1a1a;
}
.game-title .title-ghost,
.game-title .title-hell--glitch {
  position: absolute;
  top: 0; left: 0;
  width: max-content;
  margin: 0;
}
/* ── Chromatic aberration (TitleHellCARed / CABlu) ── */
.game-title .title-ghost {
  pointer-events: none;
}
.game-title .title-ghost.red {
  color: rgba(255, 0, 0, .333);
  transform: translate(2px, 0);
}
.game-title .title-ghost.blue {
  color: rgba(0, 0, 255, .333);
  transform: translate(-2px, 0);
}
/* ── Glitch (Glitch.gdshader) ── */
.game-title .title-hell--glitch {
  position: absolute;
  top: 0; left: 0;
  margin: 0;
  color: #ff1a1a;
  animation: titleGlitch 1.2s infinite steps(1);
}
/* ── Contorno nero sui layer "Hell" ── */
.game-title .title-hell,
.game-title .title-hell--glitch
/* ── Shake (LabelShake.gd) ── */
.game-title .title-hell--shake {
  animation: titleShake 5s infinite;
}
@property --sweep {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
/* ── "1Minute" golden sweep (TitleClock.gdshader) ── */
.game-title .title-1minute {
  color: #ffffff;
  position: relative;
}
.game-title .title-1minute::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  background-image:
    conic-gradient(from var(--sweep),
      rgba(255, 255, 255, 0) 0deg,
      rgba(255, 255, 255, 0) 327deg,
      rgba(255, 210, 80, .35) 345deg,
      #ffd700 359deg,
      #ffd700 360deg);
  -webkit-background-clip: text;
  background-clip: text;
  animation: titleSweep 24s linear infinite;
  pointer-events: none;
}

@keyframes titleSweep {
  from { --sweep: 0deg; }
  to { --sweep: 360deg; }
}
@keyframes titleGlitch {
  0%, 92% {
    clip-path: inset(0 0 0 0);
    transform: translate(0, 0);
  }
  93% { clip-path: inset(20% 0 40% 0); transform: translate(2px, 0); }
  95% { clip-path: inset(60% 0 10% 0); transform: translate(-3px, 0); }
  97% { clip-path: inset(40% 0 30% 0); transform: translate(1px, 0); }
  99%, 100% {
    clip-path: inset(0 0 0 0);
    transform: translate(0, 0);
  }
}
@keyframes titleShake {
  0%, 95%, 100% { transform: translate(0, 0); }
  96% { transform: translate(-2px, 1px); }
  97% { transform: translate(2px, -1px); }
  98% { transform: translate(-1px, 0); }
  99% { transform: translate(1px, 0); }
}
.hero p { font-size: 1.2rem; color: var(--text-muted); max-width: 540px; margin-bottom: 32px; }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-block; padding: 12px 32px; border-radius: var(--radius);
  font-size: 1rem; font-weight: 400; cursor: pointer; transition: .2s;
  border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--accent-light); border: 2px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

.card {
  background: var(--bg-card); border-radius: var(--radius); padding: 24px;
  border: 1px solid var(--border);
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.screenshot-grid .placeholder {
  aspect-ratio: 16/9; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .9rem;
}
.screenshot-grid img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); display: block;
}

.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox.open { display: flex; }
.lightbox-content {
  margin: 0; display: flex; flex-direction: column; align-items: center;
  max-width: 92vw; max-height: 92vh;
}
.lightbox-content img {
  max-width: 92vw; max-height: 82vh; object-fit: contain;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.lightbox-content figcaption {
  margin-top: 12px; color: var(--text-muted); font-size: .9rem; text-align: center;
}
.lightbox-close {
  position: absolute; top: 16px; right: 24px;
  background: none; border: none; color: #fff; font-size: 1.6rem;
  cursor: pointer; line-height: 1; padding: 8px; opacity: .8; transition: .2s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff; font-size: 1.4rem; cursor: pointer;
  padding: 14px 18px; border-radius: var(--radius); opacity: .8; transition: .2s;
}
.lightbox-nav:hover { opacity: 1; background: rgba(255, 255, 255, 0.16); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 32px; }
.controls-table { width: 100%; border-collapse: collapse; max-width: 480px; margin: 0 auto; }
.controls-table td { padding: 8px 16px; border-bottom: 1px solid var(--border); }
.controls-table td:first-child { color: var(--accent); font-weight: 400; white-space: nowrap; }
.controls-table td:last-child { color: var(--text-muted); }
kbd {
  background: var(--border); padding: 2px 8px; border-radius: 4px;
  font-family: var(--font); font-size: .85rem; border: 1px solid #555;
}

.season-selector { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; justify-content: center; }
.season-selector button { padding: 6px 16px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; border-radius: var(--radius); font-size: .85rem; transition: .2s; }
.season-selector button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 400; }
.leaderboard-tabs { display: flex; gap: 0; margin-bottom: 20px; justify-content: center; }
.leaderboard-tabs button {
  padding: 10px 28px; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: .95rem; transition: .2s;
}
.leaderboard-tabs button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.leaderboard-tabs button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.leaderboard-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 400; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th, .lb-table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.lb-table th { color: var(--text-muted); font-weight: 400; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.lb-table tr:hover td { background: rgba(255,255,255,.03); }
.lb-table .rank { color: var(--accent); font-weight: 400; width: 48px; }
.lb-table .rank-1 { color: #ffd700; }
.lb-table .rank-2 { color: #c0c0c0; }
.lb-table .rank-3 { color: #cd7f32; }

.avatar-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 12px;
}
.avatar-grid .placeholder {
  aspect-ratio: 1; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .75rem;
}
.season-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.season-tabs button {
  padding: 6px 18px; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; border-radius: var(--radius); font-size: .85rem; transition: .2s;
}
.season-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 400; }

.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header {
  width: 100%; padding: 16px 20px; background: var(--bg-card); border: none;
  color: var(--text); cursor: pointer; font-size: 1rem; text-align: left;
  display: flex; justify-content: space-between; align-items: center; transition: .2s;
}
.accordion-header:hover { background: rgba(255,255,255,.03); }
.accordion-header .arrow { transition: transform .2s; color: var(--text-muted); }
.accordion-item.open .accordion-header .arrow { transform: rotate(180deg); }
.accordion-body { display: none; padding: 0 20px 16px; color: var(--text-muted); font-size: .9rem; }
.accordion-item.open .accordion-body { display: block; }
.changelog-date { color: var(--text-muted); font-size: .8rem; margin-top: -8px; margin-bottom: 12px; }
.changelog-list { padding-left: 20px; color: var(--text-muted); }
.changelog-list li { margin-bottom: 4px; }

.credits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; text-align: center; }
.credits-grid .card h3 { margin-bottom: 4px; }
.credits-grid .card p { color: var(--text-muted); font-size: .85rem; }

footer {
  text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: .85rem;
}
footer .footer-title {
  font-family: var(--font-game);
  font-size: 1.6rem;
  color: #ffd700;
  letter-spacing: .02em;
  margin-bottom: 8px;
  animation: titleShake 7s infinite;
}
footer a { color: var(--accent); }
footer .social-links { display: flex; gap: 16px; justify-content: center; margin-bottom: 12px; }
footer .social-links a { font-size: 1.4rem; }

.discord-widget {
  text-align: center; padding: 40px;
}
.discord-widget p { color: var(--text-muted); margin-bottom: 20px; }

.download-btns { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.download-btns .btn { min-width: 180px; }
