/* Palette di X: light */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #0f1419;
  --muted: #536471;
  --faint: #8b98a5;
  --border: #eff3f4;
  --line: #e1e8ed;
  --soft: #f7f9f9;
  --top: #f2f4f5;
  --sk: #eceff1;
  --sk-top: #e3e8eb;
  --shine: rgba(255,255,255,0.7);
  --btn-bg: #0f1419;
  --btn-text: #ffffff;
  --like: #f91880;
}
/* Palette di X: dark (sistema, se non c'è una scelta manuale) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --text: #e7e9ea;
    --muted: #71767b;
    --faint: #536471;
    --border: #16181c;
    --line: #2f3336;
    --soft: #080808;
    --top: #101113;
    --sk: #16181c;
    --sk-top: #1f2125;
    --shine: rgba(255,255,255,0.05);
    --btn-bg: #e7e9ea;
    --btn-text: #0f1419;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --text: #e7e9ea;
  --muted: #71767b;
  --faint: #536471;
  --border: #16181c;
  --line: #2f3336;
  --soft: #080808;
  --top: #101113;
  --sk: #16181c;
  --sk-top: #1f2125;
  --shine: rgba(255,255,255,0.05);
  --btn-bg: #e7e9ea;
  --btn-text: #0f1419;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav { display: flex; align-items: center; gap: 14px; height: 76px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 700; letter-spacing: -0.4px; }
.brand svg { width: 22px; height: auto; }

/* Logo: cade la goccia, poi si allarga e diventa la D col buco */
.logo-drop { overflow: visible; }
.logo-drop use { transform-box: fill-box; }
.d-fall { transform-origin: 50% 100%; animation: d-fall 1.7s .15s both; }
.d-grow { transform-origin: 50% 58%; transform: scale(4); animation: d-grow 1.7s .15s both; }
.d-hole { transform-origin: 50% 58%; animation: d-hole 1.7s .15s both; }
@keyframes d-fall {
  0%     { transform: translateY(-2200px) scale(.8, 1.15); opacity: 0; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  6%     { opacity: 1; }
  33%    { transform: translateY(0) scale(.86, 1.14); animation-timing-function: ease-out; }
  41%    { transform: translateY(40px) scale(1.16, .82); animation-timing-function: ease-in-out; }
  49%    { transform: translateY(-40px) scale(.96, 1.05); animation-timing-function: ease-in-out; }
  55%    { transform: none; opacity: 1; }
  55.1%, 100% { transform: none; opacity: 0; }
}
@keyframes d-grow {
  0%, 55% { transform: none; opacity: 0; }
  55.1%   { transform: none; opacity: 1; animation-timing-function: cubic-bezier(.6, 0, .3, 1); }
  88%, 100% { transform: scale(4); opacity: 1; }
}
@keyframes d-hole {
  0%, 60% { transform: scale(0); animation-timing-function: cubic-bezier(.3, 0, .3, 1.4); }
  88%     { transform: scale(1.08); }
  100%    { transform: none; }
}
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px;
  transition: border-color .2s, color .2s;
}
.status:hover { color: var(--text); }
.status b { color: var(--text); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); animation: pulse 1.6s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }
.links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.links a, .icon-btn {
  font-size: 15px; color: var(--muted); padding: 8px 10px; border-radius: 999px;
  transition: color .2s, background .2s;
}
.links a:hover, .icon-btn:hover { color: var(--text); background: var(--soft); }
.icon-btn { background: none; border: 0; cursor: pointer; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: block; }
  :root:not([data-theme="light"]) .theme .moon { display: none; }
}

/* Hero */
.hero { text-align: center; padding: 56px 0 48px; }
h1 { font-size: clamp(27px, 4.4vw, 44px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.12; }
.sub { font-size: 17px; color: var(--muted); margin: 14px auto 0; line-height: 1.5; max-width: 520px; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s, opacity .2s;
}
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.btn.primary:hover { opacity: .85; }
.btn.ghost:hover { background: var(--soft); }

/* Layout principale */
.main { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }

/* Leaderboard */
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px; font-size: 14px; }
.board-head .title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.board-head .meta { color: var(--muted); }

.empty {
  display: flex; align-items: center; gap: 14px;
  border: 1px dashed var(--line); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 10px;
  font-size: 14px; color: var(--muted); line-height: 1.5;
}
.empty b { color: var(--text); font-weight: 600; }
.empty .drop { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--soft); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text); }
.empty .drop svg { width: 14px; height: auto; }

.rows { list-style: none; }
.row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.row.top { background: var(--top); border-radius: 16px; border-bottom: 0; margin-bottom: 8px; }
.rank { width: 34px; text-align: center; font-size: 15px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.row.top .rank { color: var(--muted); }
.sk { background: var(--sk); border-radius: 6px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--shine), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%) } }
.row.top .sk { background: var(--sk-top); }
.logo { width: 52px; height: 52px; border-radius: 12px; flex: none; }
.lines { flex: 1; display: grid; gap: 8px; min-width: 0; }
.l1 { height: 14px; width: 42%; }
.l2 { height: 11px; width: 78%; }
.l3 { height: 9px; width: 30%; }
.likes { flex: none; display: flex; align-items: center; gap: 6px; color: var(--faint); align-self: flex-start; padding-top: 2px; }
.likes svg { width: 16px; height: 16px; }
.row.top:first-child .likes { color: var(--like); }
.likes .n { width: 26px; height: 11px; }
.row.ghost:nth-child(4) { opacity: .6; }
.row.ghost:nth-child(5) { opacity: .35; }
.row.ghost:nth-child(n+6) { display: none; }

/* Lanci veri */
.logo-link { flex: none; align-self: flex-start; }
.logo.icon { display: block; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 7px; }
.logo.letter { display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); font-size: 20px; font-weight: 700; color: var(--muted); }
.lines .name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lines .name:hover { text-decoration: underline; }
.lines .domain { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 4px; }
.lines .tag { font-size: 14px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lines .by { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); width: fit-content; }
.lines .by:hover { color: var(--text); }
.lines .by img { width: 18px; height: 18px; border-radius: 50%; }
.lines:has(.name) { gap: 4px; }
a.likes { border-radius: 999px; padding: 4px 8px; margin: -2px -8px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; transition: color .15s, background .15s; }
a.likes:hover { color: var(--like); background: color-mix(in srgb, var(--like) 10%, transparent); }
.row.top:first-child a.likes span { color: var(--text); }
.board-foot { padding: 14px 4px 0; font-size: 13px; color: var(--faint); }
.empty a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* Sidebar */
aside { display: grid; gap: 14px; position: sticky; top: 20px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.timeline { list-style: none; display: grid; gap: 12px; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.timeline li span:last-child { color: var(--text); font-weight: 500; white-space: nowrap; }
.steps { list-style: none; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; color: var(--muted); line-height: 1.45; counter-increment: s; }
.steps li::before { content: counter(s); font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.steps b { display: block; color: var(--text); font-weight: 600; margin-bottom: 1px; }

footer { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 72px 0 40px; color: var(--muted); font-size: 13px; }
footer a { color: var(--text); }
footer a:hover { text-decoration: underline; }
footer span { display: inline-flex; align-items: center; gap: 6px; }
footer a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
footer img { width: 18px; height: 18px; border-radius: 50%; }

@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; }
  aside { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .links .hide-sm { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  nav { height: 64px; gap: 10px; }
  .status .long { display: none; }
  .hero { padding: 36px 0 36px; }
  .sub { font-size: 16px; }
  .row { gap: 12px; padding: 14px 12px 14px 6px; }
  .rank { width: 24px; }
  .logo { width: 44px; height: 44px; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .dot, .sk::after, .d-grow, .d-hole { animation: none; }
  .d-fall { display: none; }
}

/* Sezioni a tutta larghezza */
.block { margin-top: 96px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.block-head h2 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.block-head p { font-size: 16px; color: var(--muted); margin-top: 6px; }
.more { font-size: 14px; font-weight: 600; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; transition: background .2s; white-space: nowrap; }
.more:hover { background: var(--soft); }
.ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text); }
.ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.like { color: var(--like); }

/* Premi: bento */
.bento { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 12px; }
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 22px; padding: 22px;
  transition: transform .2s, border-color .2s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--faint); }
.chip { align-self: flex-start; font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.tile h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin-top: 14px; }
.tile p { font-size: 14.5px; color: var(--muted); line-height: 1.5; margin-top: 5px; }
.tile .mock { margin-top: auto; padding-top: 20px; }

.tile-hero { grid-row: span 2; background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.tile-hero:hover { border-color: var(--btn-bg); }
.tile-hero h3 { font-size: 28px; letter-spacing: -0.035em; }
.tile-hero p { color: color-mix(in srgb, var(--btn-text) 62%, transparent); font-size: 15.5px; }
.tile-hero .chip { border-color: color-mix(in srgb, var(--btn-text) 28%, transparent); }
.stat { display: flex; align-items: center; gap: 14px; margin-top: 28px; }
.stat b { font-size: 44px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; }
.stat span { font-size: 13px; line-height: 1.35; color: color-mix(in srgb, var(--btn-text) 62%, transparent); }
.pin-label { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--btn-text) 70%, transparent); margin-bottom: 10px; }
.pin-label svg { width: 9px; height: auto; }
.pin-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); color: var(--text);
  border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.pin-logo { flex: none; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 18px; background: var(--top); border: 1px solid var(--line); }
.pin-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pin-text b { font-size: 15px; font-weight: 600; }
.pin-text span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-rank { flex: none; display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--like); }
.pin-rank svg { width: 16px; height: 16px; }
.ghost-row { height: 44px; border-radius: 14px; margin-top: 8px; background: color-mix(in srgb, var(--btn-text) 9%, transparent); }
.ghost-row + .ghost-row { opacity: .5; }

.post { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 13.5px; line-height: 1.45; }
.post img { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.post-head b { font-weight: 700; }
.post-head { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-head span { color: var(--muted); }
.post-body { margin-top: 2px; }
.post-body .sk { display: inline-block; height: 9px; width: 90px; vertical-align: middle; }

.badge-wrap { display: grid; gap: 10px; }
.badge {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px;
  background: var(--btn-bg); color: var(--btn-text);
  border-radius: 12px; padding: 9px 16px 9px 12px;
}
.badge svg { width: 24px; height: auto; }
.badge small { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: .1em; opacity: .7; }
.badge b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.link-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.link-line .lk { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.link-line b { color: var(--text); font-weight: 600; }
.link-line .tag { margin-left: auto; font-family: Inter, system-ui, sans-serif; font-size: 11px; font-weight: 600; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--text); }

.tile-wide { grid-column: 2 / 4; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 16px; }
.perk h4 { font-size: 15px; font-weight: 600; margin-top: 12px; }
.perk p { font-size: 13.5px; margin-top: 3px; }
.perk .url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.perk .url b { color: var(--text); }

/* Regole */
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rule { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--line); border-radius: 18px; padding: 20px; transition: border-color .2s; }
.rule:hover { border-color: var(--faint); }
.rule h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.rule p { font-size: 14px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.mod {
  display: flex; align-items: center; gap: 18px; margin-top: 12px;
  background: var(--btn-bg); color: var(--btn-text);
  border-radius: 22px; padding: 24px 26px;
}
.mod .ico { width: 52px; height: 52px; border-radius: 15px; background: color-mix(in srgb, var(--btn-text) 10%, transparent); border-color: color-mix(in srgb, var(--btn-text) 18%, transparent); color: var(--btn-text); }
.mod .ico svg { width: 24px; height: 24px; }
.mod h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.mod p { font-size: 14.5px; line-height: 1.5; margin-top: 3px; color: color-mix(in srgb, var(--btn-text) 65%, transparent); }
.mod a { margin-left: auto; flex: none; font-size: 14px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--btn-text) 28%, transparent); border-radius: 999px; padding: 9px 15px; transition: background .2s; }
.mod a:hover { background: color-mix(in srgb, var(--btn-text) 10%, transparent); }

/* Pagina regole */
.page-hero { padding-bottom: 8px; }
.page-hero + .block { margin-top: 24px; }

@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .tile-hero { grid-row: auto; grid-column: 1 / -1; }
  .tile-wide { grid-column: 1 / -1; }
  .rule-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .block { margin-top: 64px; }
  .bento, .rule-grid, .perks { grid-template-columns: 1fr; }
  .perk { display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; }
  .perk .ico { grid-row: span 2; }
  .perk h4 { margin-top: 0; }
  .mod { flex-direction: column; align-items: flex-start; }
  .mod a { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile:hover { transform: none; }
}
