/* =================================================================
   QuizFootball — stylesheet condiviso (responsive)
   Colori derivati dal tema dell'app Unity (Common.uss).
   ================================================================= */

:root {
  --color-bg:             #223816;
  --color-bg-elev:        #2d4a1f;
  --color-primary:        #4a7c2e;
  --color-primary-dark:   #2d5a1e;
  --color-accent:         #9fd356;
  --color-accent-soft:    rgba(159, 211, 86, 0.18);
  --color-gold:           #ffd700;
  --color-silver:         #c0c0c0;
  --color-bronze:         #cc8033;
  --color-text:           #ffffff;
  --color-text-soft:      #c8e6b1;
  --color-text-muted:     #9ab088;
  --color-border:         rgba(159, 211, 86, 0.22);
  --color-error:          #e65555;
  --color-success:        #33cc66;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 14px 38px rgba(0, 0, 0, 0.40);

  --max-width: 1120px;
  --font-stack: 'Inter', 'Helvetica Neue', Arial, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(74, 124, 46, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(159, 211, 86, 0.10) 0%, transparent 50%),
    var(--color-bg);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: #c4ed85; }

img { max-width: 100%; display: block; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { margin: 0 0 1em; color: var(--color-text-soft); }

/* ---------- Header / Nav ----------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(34, 56, 22, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-text);
  letter-spacing: .02em;
}
.brand img { height: 36px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.brand:hover { color: var(--color-text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--color-text-soft);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .95rem;
  transition: all .15s ease;
}
.nav-links a:hover { color: var(--color-text); background: var(--color-accent-soft); }
.nav-links a.active {
  color: var(--color-text);
  background: var(--color-primary);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}
.nav-toggle svg { display: block; }

/* ---------- Layout ----------------------------------------------- */

main { flex: 1; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

section { padding: 64px 0; }

/* ---------- Hero (home) ----------------------------------------- */

.hero {
  padding: 80px 0 56px;
  text-align: center;
}

.hero-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 24px;
  background: #ffffff;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.hero-logo img { width: 110px; height: 110px; object-fit: contain; }

.hero h1 { margin-bottom: 12px; }
.hero p.lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--color-text-soft);
  max-width: 640px;
  margin: 0 auto 32px;
}

.tagline {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.store-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: #000;
  color: #fff;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,.15);
  font-weight: 600;
  min-width: 200px;
  box-shadow: var(--shadow-md);
  transition: transform .15s ease, box-shadow .15s ease;
}
.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: #fff;
}
.store-btn.disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}
.store-btn .store-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.store-btn .store-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-btn .store-text small { font-size: .72rem; opacity: .75; font-weight: 400; }
.store-btn .store-text strong { font-size: 1.05rem; font-weight: 700; }

/* ---------- Features grid --------------------------------------- */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.feature-card {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: transform .2s ease, border-color .2s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
}
.feature-card .icon {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}
.feature-card h3 { color: var(--color-text); margin-bottom: 6px; }
.feature-card p { color: var(--color-text-muted); margin: 0; font-size: .95rem; }

/* ---------- Page title ------------------------------------------ */

.page-header {
  padding: 56px 0 24px;
  text-align: center;
}
.page-header h1 { margin-bottom: 8px; }
.page-header p { color: var(--color-text-muted); }

/* ---------- Tabs (classifiche) ---------------------------------- */

.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 auto 28px;
  max-width: 480px;
}

.tab {
  flex: 1 1 0;
  min-width: 140px;
  padding: 12px 18px;
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  color: var(--color-text-soft);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.tab:hover { color: var(--color-text); border-color: var(--color-accent); }
.tab.active {
  background: var(--color-primary);
  color: var(--color-text);
  border-color: var(--color-primary);
}

/* ---------- Leaderboard list ------------------------------------ */

.leaderboard {
  max-width: 720px;
  margin: 0 auto;
  background: var(--color-bg-elev);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.lb-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}
.lb-row:last-child { border-bottom: none; }

.lb-row .rank {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-text-soft);
}
.lb-row .rank.gold   { color: var(--color-gold); }
.lb-row .rank.silver { color: var(--color-silver); }
.lb-row .rank.bronze { color: var(--color-bronze); }

.lb-row .username {
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}
.lb-row .meta {
  font-size: .82rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.lb-row .score {
  font-weight: 700;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--color-text-muted);
}
.lb-state.error { color: var(--color-error); }

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Legal pages ----------------------------------------- */

.legal {
  max-width: 820px;
  margin: 0 auto;
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 36px clamp(20px, 4vw, 48px);
  box-shadow: var(--shadow-md);
}
.legal h2 {
  color: var(--color-accent);
  margin-top: 1.8em;
  font-size: 1.35rem;
}
.legal h2:first-of-type { margin-top: 0; }
.legal ul { color: var(--color-text-soft); padding-left: 22px; }
.legal li { margin-bottom: .35em; }
.legal .updated {
  display: inline-block;
  font-size: .85rem;
  color: var(--color-text-muted);
  margin-bottom: 28px;
  padding: 4px 12px;
  background: var(--color-accent-soft);
  border-radius: 999px;
}

/* ---------- Footer ----------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 20px;
  margin-top: 48px;
  background: rgba(0,0,0,0.18);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: .9rem;
  color: var(--color-text-muted);
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--color-text-soft); }

/* ---------- Responsive ------------------------------------------ */

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    right: 16px;
    left: 16px;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-bg-elev);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px;
    margin-top: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; }

  section { padding: 44px 0; }
  .hero { padding: 48px 0 32px; }

  .lb-row {
    grid-template-columns: 48px 1fr auto;
    padding: 12px 14px;
    gap: 10px;
  }
  .store-btn { min-width: unset; flex: 1 1 calc(50% - 8px); }
}

@media (max-width: 420px) {
  .store-buttons { flex-direction: column; align-items: stretch; }
  .store-btn { flex: 1 1 auto; }
  .tabs { flex-direction: column; }
}
