:root {
  --bg: #0a0b12;
  --bg2: #0e1018;
  --surface: #12141f;
  --surface2: #181b29;
  --surface3: #20243a;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .13);
  --ink: #eef0f7;
  --ink2: #aeb3c8;
  --ink3: #6d7290;
  --g: #a855f7;
  --g2: #f5c542;
  --good: #22c55e;
  --bad: #f05252;
  --warn: #f59e0b;
  --gold: #f5c542;
  --silver: #cbd5e1;
  --bronze: #d9894a;
  --r: 16px;
  --r-sm: 10px;
  --head: 'Chakra Petch', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar-h: 68px;
  color-scheme: dark;
}
body[data-game="yugioh"] { --g: #a855f7; --g2: #f5c542; }
body[data-game="onepiece"] { --g: #ef4444; --g2: #fbbf24; }
body[data-game="beyblade"] { --g: #22d3ee; --g2: #3b82f6; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body);
  min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  background-image:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--g) 16%, transparent), transparent 70%),
    radial-gradient(700px 400px at -10% 10%, color-mix(in srgb, var(--g2) 7%, transparent), transparent 70%);
  background-attachment: fixed;
  transition: background-color .3s;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 700; letter-spacing: .01em; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(26px, 6vw, 34px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.num { font-family: var(--head); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.up { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 11px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.center { text-align: center; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.topnav { display: none; gap: 4px; }
.topnav a { padding: 8px 12px; border-radius: 10px; color: var(--ink2); font-weight: 600; font-size: 14px; }
.topnav a.on, .topnav a:hover { color: var(--ink); background: var(--surface2); }
.topright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.coin { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 99px; background: var(--surface2);
  border: 1px solid var(--line); font-family: var(--head); font-weight: 700; font-size: 14px; }
.coin i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #1a1300;
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 55%, #b8860b); }

.view { max-width: 1080px; margin: 0 auto; padding: 18px 16px 24px; }
.view.narrow { max-width: 560px; }

/* ---------- Tab bar (mobile) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg2) 90%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 12px; color: var(--ink3); font-size: 11px; font-weight: 700; position: relative; }
.tabbar a .ic { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: .7; transition: .2s; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on .ic { filter: none; opacity: 1; transform: translateY(-1px); }
.tabbar a .dot { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; display: grid; place-items: center; font-weight: 800; }
.tabbar .fab { align-self: center; justify-self: center; width: 56px; height: 56px; padding: 0; margin-bottom: 10px; border-radius: 18px;
  background: linear-gradient(135deg, var(--g), var(--g2)); color: #fff; justify-content: center;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--g) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.3); }
.tabbar .fab .ic { filter: none; opacity: 1; font-size: 26px; font-weight: 800; font-family: var(--head); }

@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 32px; }
  .view { padding-top: 28px; }
}

/* ---------- Superfici ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card.glow { border-color: color-mix(in srgb, var(--g) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--g) 15%, transparent), 0 18px 40px -20px color-mix(in srgb, var(--g) 50%, transparent); }
.card h2 + *, .card h3 + * { margin-top: 10px; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 10px; }
.sec-title h2 { font-size: 18px; }
.sec-title a { color: var(--ink2); font-size: 13px; font-weight: 700; }
.sec-title a:hover { color: var(--ink); }
.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; } }

/* ---------- Bottoni & campi ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  cursor: pointer; font-weight: 800; font-size: 14.5px; background: var(--surface3); color: var(--ink); transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--g), color-mix(in srgb, var(--g) 55%, var(--g2))); color: #fff; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--g) 70%, transparent); }
.btn.good { background: var(--good); color: #052e14; }
.btn.bad { background: color-mix(in srgb, var(--bad) 18%, var(--surface2)); color: #ffb4b4; }
.btn.ghost { background: transparent; border: 1px solid var(--line2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { color: var(--g); font-weight: 700; cursor: pointer; background: none; border: 0; padding: 0; }
body[data-game=""] .link { color: #c4a5ff; }

.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea.input { min-height: 180px; resize: vertical; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13.5px; line-height: 1.5; }
.input:focus { border-color: var(--g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--g); flex: none; }
.form-err { color: #ffb4b4; background: color-mix(in srgb, var(--bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.form-warn { color: #fde68a; background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.form-warn ul { margin: 4px 0 0; padding-left: 18px; }

/* Controllo segmentato */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg > * { flex: 1; min-height: 38px; padding: 0 14px; border-radius: 10px; border: 0; background: none; color: var(--ink2); font-weight: 800; font-size: 13.5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.seg > .on { background: var(--surface3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.seg.result > * { min-height: 58px; flex-direction: column; gap: 0; font-size: 13px; }
.seg.result > * b { font-size: 22px; line-height: 1.1; }
.seg.result > .on.win { background: color-mix(in srgb, var(--good) 22%, var(--surface2)); box-shadow: inset 0 0 0 1.5px var(--good); }
.seg.result > .on.loss { background: color-mix(in srgb, var(--bad) 20%, var(--surface2)); box-shadow: inset 0 0 0 1.5px var(--bad); }
.seg.result > .on.draw { background: color-mix(in srgb, var(--warn) 18%, var(--surface2)); box-shadow: inset 0 0 0 1.5px var(--warn); }

/* ---------- Avatar, chip, tag ---------- */
.av { --c: #a855f7; --s: 36px; width: var(--s); height: var(--s); flex: none; border-radius: 30%; display: inline-grid; place-items: center;
  font-size: calc(var(--s) * .55); line-height: 1; background: linear-gradient(145deg, color-mix(in srgb, var(--c) 55%, #000), color-mix(in srgb, var(--c) 25%, #000));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, transparent); }
.av.xl { --s: 84px; border-radius: 28px; }
.av.lg { --s: 52px; }
.av.sm { --s: 28px; }
.av.xs { --s: 22px; border-radius: 7px; }
.ulink { display: inline-flex; align-items: center; gap: 9px; min-width: 0; font-weight: 700; }
.ulink b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ulink:hover b { text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.me-row { background: color-mix(in srgb, var(--g) 12%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap;
  background: var(--surface3); color: var(--ink2); }
.chip.g { --cc: var(--g); background: color-mix(in srgb, var(--cc) 18%, transparent); color: color-mix(in srgb, var(--cc) 55%, #fff); }
.chip.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: #86efac; }
.chip.ko { background: color-mix(in srgb, var(--bad) 18%, transparent); color: #fca5a5; }
.chip.wait { background: color-mix(in srgb, var(--warn) 18%, transparent); color: #fcd34d; }
.chip.live { background: color-mix(in srgb, var(--bad) 22%, transparent); color: #fecaca; }
.chip.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.res { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 14px; flex: none; }
.res.win { background: color-mix(in srgb, var(--good) 22%, transparent); color: #86efac; }
.res.loss { background: color-mix(in srgb, var(--bad) 20%, transparent); color: #fca5a5; }
.res.draw { background: color-mix(in srgb, var(--warn) 20%, transparent); color: #fcd34d; }

/* ---------- Hero profilo / home ---------- */
.hero { position: relative; overflow: hidden; padding: 20px; border-radius: 22px; border: 1px solid var(--line2);
  background: linear-gradient(140deg, color-mix(in srgb, var(--g) 26%, var(--surface)) 0%, var(--surface) 55%, color-mix(in srgb, var(--g2) 12%, var(--surface)) 100%); }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--g2) 28%, transparent), transparent 70%); pointer-events: none; }
.hero .hello { font-size: 13px; color: var(--ink2); font-weight: 700; }
.lvl-ring { position: relative; }
.lvl-ring .lv { position: absolute; right: -8px; bottom: -8px; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--head); font-weight: 700; font-size: 15px; color: #1a1300; background: linear-gradient(135deg, #fff1a8, var(--gold)); box-shadow: 0 0 0 3px var(--surface); }
.xp { height: 10px; border-radius: 99px; background: rgba(0,0,0,.35); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.xp > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--g), var(--g2)); box-shadow: 0 0 12px color-mix(in srgb, var(--g2) 60%, transparent);
  animation: grow .9s cubic-bezier(.2,.8,.2,1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-family: var(--head); font-size: 22px; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--ink2); font-weight: 700; }

.alert { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; font-weight: 700;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.alert .big { font-size: 24px; }
.alert.staff { background: color-mix(in srgb, #3b82f6 12%, var(--surface)); border-color: color-mix(in srgb, #3b82f6 40%, transparent); }

/* ---------- Scorrimento orizzontale tornei ---------- */
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 78%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }
@media (min-width: 700px) { .hscroll { grid-auto-columns: minmax(250px, 32%); } }
.tcard { --cc: #a855f7; position: relative; display: block; padding: 16px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line2);
  background: linear-gradient(160deg, color-mix(in srgb, var(--cc) 30%, var(--surface)), var(--surface) 70%); }
.tcard .date { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; }
.tcard .date b { font-family: var(--head); font-size: 30px; line-height: 1; }
.tcard h3 { margin-top: 8px; }
.tcard .ic { position: absolute; right: 12px; top: 8px; font-size: 44px; opacity: .25; transform: rotate(-12deg); }
.fill { height: 6px; border-radius: 9px; background: rgba(0,0,0,.35); overflow: hidden; margin-top: 12px; }
.fill > i { display: block; height: 100%; background: var(--cc); border-radius: 9px; }

/* ---------- Tile dei giochi ---------- */
.gtile { --cc: #a855f7; display: block; border-radius: 18px; padding: 16px; border: 1px solid var(--line); background: var(--surface); position: relative; overflow: hidden; transition: transform .15s, border-color .15s; }
.gtile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--cc) 50%, var(--line)); }
.gtile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--cc), transparent); }
.gtile .gname { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 18px; }
.gtile .gname .e { font-size: 26px; }
.mini-pod { margin-top: 12px; }
.mini-pod > div { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.medal { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 12.5px; flex: none; color: #111; }
.medal.m1 { background: linear-gradient(135deg, #fff3b0, var(--gold)); }
.medal.m2 { background: linear-gradient(135deg, #fff, var(--silver)); }
.medal.m3 { background: linear-gradient(135deg, #ffd2ad, var(--bronze)); }
.medal.mx { background: var(--surface3); color: var(--ink2); }

/* ---------- Banner gioco ---------- */
.gbanner { position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px 18px; border: 1px solid var(--line2);
  background: linear-gradient(120deg, color-mix(in srgb, var(--g) 40%, var(--surface)), var(--surface) 65%); }
.gbanner .e { position: absolute; right: 10px; top: -8px; font-size: 96px; opacity: .22; transform: rotate(-14deg); pointer-events: none; }
.gbanner h1 { position: relative; }
.gbanner .row { position: relative; }

/* ---------- Podio ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; gap: 8px; align-items: end; margin: 18px 0 6px; }
.pod { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.pod .ulink { flex-direction: column; gap: 6px; max-width: 100%; }
.pod .ulink b { font-size: 14px; max-width: 100%; }
.pod .block { width: 100%; border-radius: 14px 14px 6px 6px; padding: 10px 4px 12px; border: 1px solid var(--line2); }
.pod .block .pts { font-family: var(--head); font-weight: 700; font-size: 22px; line-height: 1; }
.pod.p1 .block { height: 108px; background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 34%, var(--surface)), var(--surface)); }
.pod.p2 .block { height: 80px; background: linear-gradient(180deg, color-mix(in srgb, var(--silver) 22%, var(--surface)), var(--surface)); }
.pod.p3 .block { height: 64px; background: linear-gradient(180deg, color-mix(in srgb, var(--bronze) 26%, var(--surface)), var(--surface)); }
.pod.p1 .av { --s: 64px; box-shadow: inset 0 0 0 2px var(--gold), 0 0 26px color-mix(in srgb, var(--gold) 45%, transparent); }
.crown { font-size: 22px; margin-bottom: -6px; }

/* ---------- Liste / tabelle ---------- */
.list > .li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.list > .li:first-child { border-top: 0; }
.list > a.li:hover { background: var(--surface2); }
.li .pos { width: 26px; text-align: center; font-family: var(--head); font-weight: 700; color: var(--ink2); flex: none; }
.li .val { text-align: right; flex: none; }
.li .val b { font-family: var(--head); font-size: 18px; display: block; line-height: 1.1; }
.li .val span { font-size: 11.5px; color: var(--ink3); font-weight: 700; }
.tbl-head { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink3); }
.wl { font-family: var(--head); font-size: 13px; color: var(--ink2); white-space: nowrap; }
.wl .w { color: #86efac; } .wl .l { color: #fca5a5; }

/* ---------- Meta ---------- */
.meta-row { padding: 12px 14px; border-top: 1px solid var(--line); }
.meta-row:first-child { border-top: 0; }
.meta-bar { height: 8px; border-radius: 0 4px 4px 0; background: var(--g); min-width: 3px; }
.meta-track { flex: 1; height: 8px; background: rgba(255,255,255,.04); border-radius: 4px; overflow: hidden; }
.wr { font-family: var(--head); font-weight: 700; }
.wr.hi { color: #86efac; } .wr.lo { color: #fca5a5; }

/* ---------- Badge ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 12px 6px 10px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); position: relative; }
.badge .e { font-size: 30px; line-height: 1.1; display: block; }
.badge b { display: block; font-size: 12.5px; margin-top: 6px; line-height: 1.2; }
.badge small { display: block; font-size: 10.5px; color: var(--ink3); margin-top: 3px; line-height: 1.25; }
.badge.on { background: linear-gradient(160deg, color-mix(in srgb, var(--g2) 18%, var(--surface2)), var(--surface2)); border-color: color-mix(in srgb, var(--g2) 40%, var(--line)); }
.badge:not(.on) .e { filter: grayscale(1) brightness(.6); }
.badge:not(.on) b { color: var(--ink2); }
.badge .prog { height: 4px; border-radius: 4px; background: rgba(0,0,0,.4); margin: 7px 8px 0; overflow: hidden; }
.badge .prog i { display: block; height: 100%; background: var(--ink3); }

/* ---------- Rating per gioco nel profilo ---------- */
.rbox { --cc: #a855f7; border-radius: 14px; padding: 12px 14px; background: linear-gradient(150deg, color-mix(in srgb, var(--cc) 16%, var(--surface2)), var(--surface2)); border: 1px solid var(--line); }
.rbox .rr { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.rbox .rr > div b { font-family: var(--head); font-size: 22px; display: block; line-height: 1.1; }
.rbox .rr > div span { font-size: 11px; color: var(--ink2); font-weight: 700; }

/* ---------- Mazzi ---------- */
.deckcard { --cc: #a855f7; display: block; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cc); }
.deckcard:hover { background: var(--surface2); }
.decklist { columns: 2 220px; column-gap: 24px; }
.decklist .sec { break-inside: avoid; margin-bottom: 16px; }
.decklist .sec h4 { font-size: 13px; color: var(--ink2); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.decklist .c { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.decklist .c b { font-family: var(--head); width: 22px; color: var(--g2); flex: none; }
.combo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.combo > div { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.combo > div span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); font-weight: 800; }
.combo > div b { font-family: var(--head); font-size: 15px; }

/* ---------- Partite ---------- */
.match { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.match:first-child { border-top: 0; }
.match .vs { font-family: var(--head); color: var(--ink3); font-size: 12px; }
.incoming { border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.incoming .actions { display: flex; gap: 8px; margin-top: 12px; }
.incoming .actions .btn { flex: 1; }

/* ---------- Suggerimenti ricerca ---------- */
.suggest { position: relative; }
.suggest .menu { position: absolute; z-index: 10; inset: calc(100% + 4px) 0 auto 0; background: var(--surface2); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.suggest .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; cursor: pointer; text-align: left; font-weight: 700; }
.suggest .menu button:hover, .suggest .menu button:focus { background: var(--surface3); outline: none; }
.picked { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 12px; border: 1px solid var(--g); background: color-mix(in srgb, var(--g) 12%, var(--bg2)); }

/* Scelta avatar */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.picker button { height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); font-size: 24px; cursor: pointer; }
.picker button.on { border-color: var(--g); box-shadow: 0 0 0 2px color-mix(in srgb, var(--g) 50%, transparent); background: var(--surface3); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #fff; }

/* Premi */
.reward { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.reward .e { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; background: var(--surface3); flex: none; }
.reward.locked .e { filter: grayscale(.8); opacity: .6; }
.voucher { border: 2px dashed color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 14px; padding: 14px; text-align: center; background: color-mix(in srgb, var(--gold) 6%, var(--surface)); }
.voucher code { font-family: var(--head); font-size: 24px; font-weight: 700; letter-spacing: .08em; color: var(--gold); }

/* Vuoto / caricamento */
.empty { text-align: center; padding: 34px 18px; color: var(--ink2); }
.empty .e { font-size: 40px; display: block; margin-bottom: 8px; }
.skel { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 0%, var(--surface2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* Feed */
.feed .li { font-size: 14px; }
.feed .li .ulink b { font-weight: 800; }

/* Accesso */
.auth { max-width: 440px; margin: 4vh auto 0; }
.auth .logo { width: 72px; height: 72px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 10px 30px rgba(168,85,247,.45)); }
.auth .games { display: flex; justify-content: center; gap: 10px; font-size: 26px; margin: 12px 0 4px; }

/* Modale & toast */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center; background: rgba(5, 6, 12, .72); backdrop-filter: blur(6px); padding: 12px; }
.modal[hidden] { display: none; }
.modal .sheet { width: 100%; max-width: 480px; max-height: 88dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line2); border-radius: 22px; padding: 22px 18px; animation: up .25s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 600px) { .modal { place-items: center; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.celebrate { text-align: center; }
.celebrate .big { font-size: 74px; line-height: 1; display: block; animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(.2) rotate(-20deg); } }
.toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 860px) { .toasts { bottom: 24px; } }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface3); border: 1px solid var(--line2); font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: up .25s; }
.toast.err { background: #3a1418; border-color: #7f1d1d; }
.toast.ok { background: #0f2a1a; border-color: #166534; }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 80; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* Staff */
.staffbox { border: 1px dashed color-mix(in srgb, #3b82f6 55%, transparent); background: color-mix(in srgb, #3b82f6 6%, var(--surface)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--ink3); font-weight: 700; }
.kv dd { margin: 0; }
details.rules summary { cursor: pointer; font-weight: 800; color: var(--ink2); list-style: none; }
details.rules summary::-webkit-details-marker { display: none; }
details.rules summary::before { content: '▸ '; }
details.rules[open] summary::before { content: '▾ '; }
.prose { color: var(--ink2); }
.prose h2 { color: var(--ink); margin: 22px 0 8px; }
.prose p, .prose ul { margin: 0 0 10px; }
.prose li { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Carte ---------- */
.cthumb { width: 34px; height: 50px; border-radius: 4px; object-fit: cover; background: var(--surface3); flex: none; }
.cost { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 14px;
  background: var(--surface3); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line2); }
.dot-c { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 3px; vertical-align: middle; box-shadow: 0 0 0 1.5px var(--bg); flex: none; }
.cmenu { max-height: 360px; overflow-y: auto; }
.cmenu button { padding: 8px 12px; }
.dsec { padding-top: 6px; }
.dsec h3 { font-size: 15px; }
.drow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.dsec .row + .drow { border-top: 0; margin-top: 6px; }
.qty { display: flex; align-items: center; gap: 2px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; flex: none; }
.qty button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; font-weight: 800; cursor: pointer; color: var(--ink2); border-radius: 9px; }
.qty button:hover { background: var(--surface3); color: var(--ink); }
.qty b { min-width: 18px; text-align: center; font-family: var(--head); }
.leaderbox { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 14px; background: linear-gradient(140deg, color-mix(in srgb, var(--g) 18%, var(--surface2)), var(--surface2)); border: 1px solid var(--line2); }
.leaderbox img { width: 92px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); flex: none; }
.clist .crow + .crow { border-top: 1px solid var(--line); }
.crow { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
a.crow:hover { background: var(--surface2); border-radius: 8px; }
.crow .q { font-family: var(--head); color: var(--g2); width: 18px; text-align: center; flex: none; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 10px; }
.cgrid > * { position: relative; display: block; aspect-ratio: 59 / 86; border-radius: 6px; overflow: hidden; background: var(--surface3); }
.cgrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cgrid .miss { display: grid; place-items: center; padding: 6px; font-size: 11px; text-align: center; color: #fcd34d; }
.cgrid .bq { position: absolute; right: 4px; bottom: 4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; display: grid; place-items: center;
  background: rgba(0,0,0,.8); color: #fff; font-family: var(--head); font-weight: 700; font-size: 13px; }
.cardpage { display: grid; gap: 18px; }
.cbig { width: min(280px, 70vw); justify-self: center; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 0 1px var(--line2); background: var(--surface3); aspect-ratio: 59 / 86; object-fit: cover; }
@media (min-width: 760px) { .cardpage { grid-template-columns: 300px 1fr; align-items: start; } .cbig { width: 100%; } }
