/* I colori del tema (sfondo, accento, giocatori, mascotte) arrivano da app.js in <style id="theme-css">; qui ci sono i colori comuni e il layout */
:root {
  --gold: #f0aa2a;
  --good: #2f9a5c;
  --bad: #c9473f;
  --blush: #f39aae;
  /* --on-accent (testo sopra il colore del tema) arriva dal tema */
  --t-oro: #f2b632; --t-oro-rim: #c48a10;
  --t-argento: #c9d4dc; --t-argento-rim: #8a9eab;
  --t-bronzo: #d8935a; --t-bronzo-rim: #a2602c;
  --t-fango: #a07e5c; --t-fango-rim: #6c5034;
  --shadow: 0 2px 0 color-mix(in srgb, var(--accent) 18%, transparent), 0 8px 24px color-mix(in srgb, var(--accent) 10%, transparent);
  --f-display: "Fredoka", "Baloo 2", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --gold: #f6bd4a; --good: #5fcf8a; --bad: #f07b72;
    --shadow: 0 2px 0 rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-2) 0, var(--bg) 260px);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: 120px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }

/* Colori dei giocatori: ogni elemento con la lettera del lato (a…f) prende --p (colore) e --ps (tinta di fondo) */
.a { --p: var(--pa); --ps: var(--pa-soft); } .b { --p: var(--pb); --ps: var(--pb-soft); }
.c { --p: var(--pc); --ps: var(--pc-soft); } .d { --p: var(--pd); --ps: var(--pd-soft); }
.e { --p: var(--pe); --ps: var(--pe-soft); } .f { --p: var(--pf); --ps: var(--pf-soft); }

/* Intestazione */
.hero { position: relative; text-align: center; padding-top: 6px; }
.hero h1 { font-size: clamp(26px, 7vw, 36px); font-weight: 700; color: var(--accent-deep); letter-spacing: .3px; line-height: 1.05; padding: 0 46px; }
.hero p:empty { display: none; }
.hero p { margin: 4px 0 0; color: var(--muted); font-weight: 700; font-size: 14px; }
.gear {
  position: absolute; right: 0; top: 2px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
  display: grid; place-items: center; box-shadow: var(--shadow); color: var(--ink);
}
.gear svg { width: 22px; height: 22px; }
.gear.left { right: auto; left: 0; }
.pond { position: relative; height: 78px; margin-top: 8px; }
.pond .waves { position: absolute; left: 0; right: 0; bottom: 0; height: 32px; width: 100%; }
.pond .duo { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 6px; }
.pond .duo svg.mascot { width: 56px; height: 56px; }
.pond .vs { width: 22px; height: 22px; margin-bottom: 30px; }
.bob { animation: bob 3.2s ease-in-out infinite; }
.bob.late { animation-delay: -1.6s; }
.vs { animation: beat 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes beat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* Tabellone */
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  background: var(--surface); border: 2px solid var(--line); border-radius: 22px;
  padding: 14px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; position: relative; min-width: 0;
}
.card.a, .card.b, .card.c, .card.d, .card.e, .card.f { border-color: color-mix(in srgb, var(--p) 45%, var(--line)); }
.card.win { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 30%, transparent), var(--shadow); }
.avatar { width: 68px; height: 68px; position: relative; }
.avatar svg.mascot { width: 100%; height: 100%; }
.crown { position: absolute; width: 30px; height: 22px; left: 50%; top: -14px; transform: translateX(-50%) rotate(-8deg); }
.crown.side { left: auto; right: -14px; top: -6px; transform: rotate(22deg); }
.pname { font-family: var(--f-display); font-weight: 600; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a .pname, .b .pname, .c .pname, .d .pname, .e .pname, .f .pname { color: var(--p); }
.total { font-family: var(--f-display); font-weight: 700; font-size: clamp(34px, 10vw, 48px); line-height: 1; margin-top: 2px; }
.left { font-size: 13px; color: var(--muted); font-weight: 700; }
.left b { color: var(--ink); }
.mood { margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.mood.happy { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good); }
.mood.sad { background: var(--accent-soft); color: var(--accent-deep); }
.mood.wow { background: color-mix(in srgb, var(--gold) 25%, var(--surface)); color: var(--ink); }
.jump { animation: jump .9s cubic-bezier(.3,1.6,.5,1) 2; }
.pond .duo .bob.jump { animation: jump .9s cubic-bezier(.3,1.6,.5,1) 2, bob 3.2s ease-in-out 1.8s infinite; }
@keyframes jump { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-14px) rotate(-6deg); } 70% { transform: translateY(0) rotate(4deg); } }

/* Corsa verso il traguardo */
.river { background: var(--surface); border: 2px solid var(--line); border-radius: 22px; padding: 14px 14px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.river-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-family: var(--f-display); font-weight: 600; font-size: 13px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.river-head .goal { font-weight: 800; font-size: 13px; color: var(--accent-deep); }
.lane { position: relative; height: 44px; border-radius: 22px; background: var(--accent-soft); overflow: hidden; }
.lane .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 22px; opacity: .22; transition: width .6s cubic-bezier(.3,1.4,.5,1); }
.lane.a .fill, .lane.b .fill, .lane.c .fill, .lane.d .fill, .lane.e .fill, .lane.f .fill { background: var(--p); }
.lane .runner { position: absolute; top: 2px; width: 40px; height: 40px; transition: left .6s cubic-bezier(.3,1.4,.5,1); }
.lane .runner svg { width: 100%; height: 100%; }
.lane .flag { position: absolute; right: 8px; top: 8px; width: 22px; height: 28px; }

/* Sezioni e pannelli */
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-head h2 { font-size: 21px; font-weight: 600; }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.view { display: flex; flex-direction: column; gap: 22px; }
#banner:empty, #stake:empty, #dealer:empty { display: none; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--gold) 18%, var(--surface)); border: 2px solid var(--gold); border-radius: 20px;
}
.banner > svg { width: 48px; height: 48px; flex: none; }
.banner .bt { flex: 1; min-width: 150px; }
.banner .t { font-family: var(--f-display); font-weight: 600; font-size: 18px; }
.banner .s { color: var(--muted); font-weight: 700; font-size: 13px; }
.banner .acts { display: flex; gap: 8px; }

.hands { list-style: none; margin: 0; padding: 0; }
.hand { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 10px 10px 10px 14px; border-top: 2px dashed var(--line); }
.hand:first-child { border-top: 0; }
.hand .no { font-family: var(--f-display); font-weight: 600; color: var(--muted); font-size: 13px; width: 52px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; padding: 5px 10px; border-radius: 12px; min-width: 0; border: 0; text-align: left; }
.chip.a, .chip.b, .chip.c, .chip.d, .chip.e, .chip.f { background: var(--ps); }
.chip .v { font-family: var(--f-display); font-weight: 600; font-size: 18px; line-height: 1.1; }
.chip.a .v, .chip.b .v, .chip.c .v, .chip.d .v, .chip.e .v, .chip.f .v { color: var(--p); }
.chip .r { font-size: 13px; color: var(--muted); font-weight: 700; }
.icon-btn { width: 36px; height: 36px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.confirm { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 14px; }
.btn-s { padding: 7px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 14px; }
.btn-s.danger { background: var(--bad); border-color: var(--bad); color: var(--on-accent); }
.btn-s.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
a.btn-s { display: inline-block; color: var(--ink, inherit); text-decoration: none; }
.btn-s:disabled { opacity: .5; cursor: not-allowed; }
.hh-right { display: flex; align-items: center; gap: 8px; flex: none; }
.btn-s.undo { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.btn-s.undo svg { width: 15px; height: 15px; }

.empty { padding: 22px 18px; display: flex; gap: 14px; align-items: center; }
.empty svg { width: 64px; height: 64px; flex: none; }
.empty .t { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.empty .s { color: var(--muted); font-size: 14px; }

/* Posta in gioco e mazziere */
.stake { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 20px; background: var(--surface); border: 2px solid color-mix(in srgb, var(--gold) 55%, var(--line)); box-shadow: var(--shadow); }
.stake > svg { width: 38px; height: 38px; flex: none; }
.stake .st { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.stake .st b { font-family: var(--f-display); font-weight: 600; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.stake .s { color: var(--muted); font-weight: 700; font-size: 13px; }
.stake .chg { font-weight: 800; font-size: 13px; color: var(--accent-deep); flex: none; }
.stake-add { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 999px; border: 2px dashed color-mix(in srgb, var(--gold) 55%, var(--line)); background: transparent; color: var(--ink); font-weight: 800; font-size: 14px; }
.stake-add > svg { width: 26px; height: 26px; flex: none; }
.stake.edit { flex-direction: column; align-items: stretch; gap: 10px; }
.stake.edit input { font: inherit; font-weight: 700; color: var(--ink); background: var(--surface-2); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipb { padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 13px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dealer { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border-radius: 16px; border: 2px dashed var(--line); background: transparent; text-align: left; font-weight: 700; font-size: 14px; }
.dealer svg { width: 26px; height: 26px; flex: none; color: var(--accent-deep); }
.dealer > span:first-of-type { flex: 1; min-width: 0; }
.dealer .chg { font-weight: 800; font-size: 13px; color: var(--accent-deep); flex: none; }

/* Grafico */
.chart-box { padding: 10px 8px 4px; }
.chart-box.in { border-top: 2px dashed var(--line); padding: 10px 6px 0; }
.chart { display: block; width: 100%; height: auto; font-family: var(--f-body); }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; font-weight: 800; font-size: 13px; min-width: 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend span::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: currentColor; flex: none; }
.legend .a, .legend .b, .legend .c, .legend .d, .legend .e, .legend .f { color: var(--p); }

/* Albo d'oro */
.tally { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px; }
.tally .side { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; min-width: 0; }
/* il nome va sotto, largo quanto tutto il lato: così non si taglia sugli schermi stretti */
.tally .side > div { display: contents; }
.tally .side svg { grid-row: 1; grid-column: 1; }
.tally .side .w { grid-row: 1; grid-column: 2; }
.tally .side .n { grid-row: 2; grid-column: 1 / -1; margin-top: 4px; }
.tally .side.b { grid-template-columns: 1fr auto; text-align: right; }
.tally .side.b svg { grid-column: 2; }
.tally .side.b .w { grid-column: 1; }
.tally .side svg { width: 46px; height: 46px; flex: none; }
.tally .w { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1; }
.tally .a .w, .tally .b .w, .tally .c .w, .tally .d .w, .tally .e .w, .tally .f .w { color: var(--p); }
.tally .n { font-size: 13px; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally .mid { text-align: center; color: var(--muted); font-weight: 800; font-size: 13px; }
.tally .mid b { display: block; font-family: var(--f-display); font-size: 20px; color: var(--ink); }
.past { list-style: none; margin: 0; padding: 0; border-top: 2px dashed var(--line); }
.past li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 14px; font-size: 14px; border-top: 1px solid var(--line); }
.past li:first-child { border-top: 0; }
.past .d { color: var(--muted); font-weight: 700; width: 60px; flex: none; }
.past .sc { font-weight: 800; flex: 1; }
.pill { padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.pill.a, .pill.b, .pill.c, .pill.d, .pill.e, .pill.f { background: var(--ps); color: var(--p); }
.pill.live { background: var(--accent-soft); color: var(--accent-deep); }
.more { display: block; width: 100%; border: 0; border-top: 2px dashed var(--line); background: transparent; padding: 12px 14px; font-weight: 800; color: var(--accent-deep); text-align: center; }

/* Schede */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.tabs button { border: 0; background: transparent; border-radius: 999px; padding: 9px 8px; font-family: var(--f-display); font-weight: 600; font-size: 16px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }

/* Storico */
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 14px; padding: 6px 14px 10px; align-items: baseline; }
.cmp > * { padding: 8px 0; border-top: 1px solid var(--line); }
.cmp .hd { border-top: 0; font-family: var(--f-display); font-weight: 600; font-size: 15px; text-align: right; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp .hd.a, .cmp .hd.b, .cmp .hd.c, .cmp .hd.d, .cmp .hd.e, .cmp .hd.f { color: var(--p); }
.cmp .k { font-weight: 700; color: var(--muted); font-size: 14px; }
.cmp .v { text-align: right; font-weight: 800; font-size: 15px; }
.cmp .v.best { color: var(--good); }
.cmp .v small { display: block; font-weight: 700; color: var(--muted); font-size: 13px; }
.streak { padding: 12px 14px; border-top: 2px dashed var(--line); display: flex; align-items: center; gap: 10px; font-weight: 700; }
.streak svg { width: 36px; height: 36px; flex: none; }
.month { font-family: var(--f-display); font-weight: 600; font-size: 14px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin: 4px 2px -4px; }
.games { display: flex; flex-direction: column; gap: 10px; }
.gcard { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.gcard.live { border-color: var(--accent); }
.ghead { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 14px; }
.ghead:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; border-radius: 18px; }
.ghead .when { font-weight: 800; font-size: 14.5px; }
.ghead .when small { display: block; font-weight: 700; color: var(--muted); font-size: 13px; }
.ghead .res { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ghead .sc { font-family: var(--f-display); font-weight: 600; font-size: 19px; white-space: nowrap; }
.ghead .sc .a, .ghead .sc .b, .ghead .sc .c, .ghead .sc .d, .ghead .sc .e, .ghead .sc .f { color: var(--p); }
.ghead .chev { grid-column: 1 / -1; font-size: 13px; font-weight: 800; color: var(--accent-deep); }
.hlist { list-style: none; margin: 0; padding: 0 14px 6px; border-top: 2px dashed var(--line); }
.hlist li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.hlist li:first-child { border-top: 0; }
.hlist .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13px; color: var(--muted); }
.hlist .pl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; font-size: 13.5px; }
.hlist .pl .who { font-weight: 800; }
.hlist .pl.a .who, .hlist .pl.b .who, .hlist .pl.c .who, .hlist .pl.d .who, .hlist .pl.e .who, .hlist .pl.f .who, .hlist .pl.a .pts, .hlist .pl.b .pts, .hlist .pl.c .pts, .hlist .pl.d .pts, .hlist .pl.e .pts, .hlist .pl.f .pts { color: var(--p); }
.hlist .pl .det { color: var(--muted); font-weight: 700; font-size: 13px; display: block; }
.hlist .pl .pts { font-weight: 800; text-align: right; white-space: nowrap; }
.hlist .pl .pts small { display: block; color: var(--muted); font-size: 13px; }
.gfoot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px 14px; font-weight: 700; font-size: 14px; }

/* Trofei */
.troom { padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.troom-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.troom-top .side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.troom-top .side.b { flex-direction: row-reverse; text-align: right; }
.troom-top .side svg { width: 44px; height: 44px; flex: none; }
.troom-top .w { font-family: var(--f-display); font-weight: 700; font-size: 28px; line-height: 1; }
.troom-top .a .w, .troom-top .b .w, .troom-top .c .w, .troom-top .d .w, .troom-top .e .w, .troom-top .f .w { color: var(--p); }
.troom-top .n { font-size: 13px; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.troom-top .mid { text-align: center; }
.troom-top .mid svg { width: 40px; height: 46px; }
.troom-top .mid small { display: block; font-weight: 800; font-size: 13px; color: var(--muted); }
.tbar { height: 12px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.tbar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--t-bronzo), var(--t-oro)); }
.tnote { margin: 0; text-align: center; font-weight: 800; font-size: 13px; color: var(--muted); }
.shelf .section-head { margin-bottom: 10px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 4px; }
.plank { height: 12px; margin-top: 8px; border-radius: 6px; background: var(--accent-deep); opacity: .8; box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.trophy { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.trophy .medal { width: 60px; height: 68px; }
.trophy.locked .medal { filter: grayscale(1); opacity: .45; }
.trophy .tn { font-family: var(--f-display); font-weight: 600; font-size: 15px; line-height: 1.15; }
.trophy .td { font-size: 13px; color: var(--muted); font-weight: 700; line-height: 1.3; }
.trophy .tier { font-size: 13px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.trophy .owners { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.owner { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 999px; font-weight: 800; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner svg { width: 22px; height: 22px; flex: none; }
.owner.a, .owner.b, .owner.c, .owner.d, .owner.e, .owner.f { background: var(--ps); color: var(--p); }
.owner.both { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--ink); padding-left: 8px; }
.trophy .since { font-size: 13px; color: var(--muted); font-weight: 700; }
.trophy .lock { font-size: 13px; font-weight: 800; color: var(--muted); margin-top: 4px; }
.newt { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.newt .it { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--surface-2); border-radius: 14px; padding: 6px 10px; }
.newt .it svg.medal { width: 40px; height: 46px; flex: none; }
.newt .it b { font-family: var(--f-display); font-weight: 600; font-size: 15px; display: block; }
.newt .it span { font-size: 13px; color: var(--muted); font-weight: 700; }

.foot { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; margin: 0; }

/* Impostazioni */
.settings { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lb { font-weight: 800; font-size: 13px; color: var(--muted); }
.field input[type="text"], .field input:not([type]) {
  font: inherit; font-weight: 700; color: var(--ink); background: var(--surface-2);
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; width: 100%;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .field label { font-size: 13px; }
.targets { display: flex; gap: 8px; flex-wrap: wrap; }
.targets button { padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; }
.targets button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.hint b { color: var(--ink); }
.rules { display: flex; flex-direction: column; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-weight: 700; }
.rule:first-child { border-top: 0; }
.rule .rl { min-width: 0; }
.rule .rl small { display: block; color: var(--muted); font-size: 13px; }
.rule .rr { display: flex; align-items: center; gap: 8px; flex: none; }
.rules .rule input { width: 78px; font: inherit; font-weight: 800; text-align: right; color: var(--ink); background: var(--surface-2); border: 2px solid var(--line); border-radius: 12px; padding: 7px 9px; }
.rule input:disabled { opacity: .45; }
.pref { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; padding: 4px 0; }
.pref span small { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.danger-zone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 2px dashed var(--line); padding-top: 14px; }
.filebtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* Scelta del tema */
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.catb { padding: 7px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.catb small { font-size: 13px; font-weight: 800; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.catb[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.catb[aria-pressed="true"] small { background: transparent; color: inherit; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tcard { border: 2px solid var(--line); border-radius: 18px; padding: 10px 8px 10px; background: linear-gradient(180deg, var(--bg-2), var(--bg)); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.tcard .pair { display: flex; gap: 2px; }
.tcard .pair svg { width: 50px; height: 50px; }
.tcard b { font-family: var(--f-display); font-weight: 600; font-size: 15px; color: var(--accent-deep); line-height: 1.15; }
.tcard .sw { display: flex; gap: 4px; }
.tcard .sw i { width: 14px; height: 14px; border-radius: 50%; display: block; border: 2px solid var(--surface); }
.tcard[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.tcard[aria-pressed="true"] b::after { content: " ✓"; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line); }
.seg button { border: 0; border-radius: 12px; padding: 9px 8px; background: transparent; font-weight: 800; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.seg button small { font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button[aria-pressed="true"] small { color: inherit; opacity: .85; }
.team-lbl { grid-column: 1 / -1; font-weight: 800; font-size: 13px; margin-top: 2px; }
.team-lbl.a, .team-lbl.b, .team-lbl.c, .team-lbl.d, .team-lbl.e, .team-lbl.f { color: var(--p); }

/* Barra in basso */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 10px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--bg) 40%);
}
.bar .inner { max-width: 640px; margin: 0 auto; }
.big {
  width: 100%; border: 0; border-radius: 20px; padding: 15px 18px;
  background: var(--accent); color: var(--on-accent); font-family: var(--f-display); font-weight: 600; font-size: 20px;
  box-shadow: 0 4px 0 var(--accent-deep), 0 10px 24px color-mix(in srgb, var(--accent) 25%, transparent);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .12s, box-shadow .12s;
}
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-deep); }
.big svg { width: 24px; height: 24px; }
.big.gold { background: var(--gold); box-shadow: 0 4px 0 color-mix(in srgb, var(--gold) 60%, #000), 0 10px 24px rgba(0,0,0,.15); color: #3a2216; }

/* Fogli che salgono dal basso */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(8, 20, 30, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 600px; max-height: 94%; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 14px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
  animation: up .28s cubic-bezier(.2,1.2,.4,1);
}
.sheet.full { max-height: 100%; height: 100%; border-radius: 0; padding-top: max(18px, env(safe-area-inset-top, 0px)); }
.sheet.noanim { animation: none; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-head h2 { font-size: 22px; font-weight: 600; }
.pcol { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.pcol.a, .pcol.b, .pcol.c, .pcol.d, .pcol.e, .pcol.f { border-color: color-mix(in srgb, var(--p) 50%, var(--line)); }
.pcol-head { display: flex; align-items: center; gap: 10px; padding-bottom: 4px; }
.pcol-head svg { width: 40px; height: 40px; flex: none; }
.pcol-head .nm { font-family: var(--f-display); font-weight: 600; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcol.a .nm, .pcol.b .nm, .pcol.c .nm, .pcol.d .nm, .pcol.e .nm, .pcol.f .nm { color: var(--p); }
.pcol-head .sub { font-family: var(--f-display); font-weight: 700; font-size: 26px; }
button.pcol-head { width: 100%; border: 0; background: none; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.pcol.acc:not(.open) .pcol-head { padding-bottom: 0; }
.pcol-head .chev { width: 22px; height: 22px; flex: none; color: var(--muted); transition: transform .2s; }
.pcol.open .pcol-head .chev { transform: rotate(180deg); }
.pcol-body { display: flex; flex-direction: column; gap: 6px; }
.next-p { align-self: flex-end; margin-top: 6px; }
:root.big-text { zoom: 1.15; }
@media (max-width: 360px) { :root.big-text { zoom: 1.08; } } /* telefoni stretti: ingrandisce meno, sennò le scritte vanno a capo parola per parola */
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.line .lbl { font-weight: 700; font-size: 14.5px; min-width: 0; }
.line .lbl small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 6px; flex: none; }
.stepper button { width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 20px; line-height: 1; }
.stepper .c { min-width: 26px; text-align: center; font-family: var(--f-display); font-weight: 600; font-size: 20px; }
.inwrap { display: flex; align-items: center; gap: 6px; flex: none; }
.line input { width: 84px; flex: none; font: inherit; font-weight: 800; font-size: 17px; text-align: right; color: var(--ink); background: var(--surface-2); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.calc-btn { padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 13px; color: var(--accent-deep); }
.calc-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.calc { background: var(--surface-2); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.calc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: var(--muted); }
.calc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.ccard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); }
.ccard b { font-family: var(--f-display); font-weight: 600; font-size: 14px; }
.ccard span { font-size: 13px; font-weight: 700; color: var(--muted); }
.ccard:active { transform: scale(.96); }
.tog { flex: none; width: 56px; height: 32px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface-2); position: relative; padding: 0; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: left .18s, background .18s; }
.tog[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.tog[aria-pressed="true"]::after { left: 27px; background: var(--on-accent); }
.tog.neg[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); }
.sheet-foot { display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); background: var(--bg); padding-block: 8px 4px; }
.recap { display: flex; justify-content: center; gap: 16px; font-weight: 800; font-size: 14px; flex-wrap: wrap; }
.recap .a, .recap .b, .recap .c, .recap .d, .recap .e, .recap .f { color: var(--p); }
.welcome { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.welcome h1 { font-size: 28px; color: var(--accent-deep); }
.welcome p { margin: 0; color: var(--muted); font-weight: 700; }
.welcome .pair { display: flex; gap: 4px; }
.welcome .pair svg { width: 70px; height: 70px; }

/* Festa di fine partita */
.party { position: fixed; inset: 0; z-index: 30; background: rgba(8, 20, 30, .55); display: grid; place-items: center; padding: 16px; overflow: hidden; }
.party .box { max-height: 100%; overflow-y: auto; position: relative; z-index: 2; background: var(--surface); border-radius: 28px; padding: 22px 20px 18px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; align-items: center; animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
.party .box > * { flex-shrink: 0; }
.party .box > svg.mascot { width: 120px; height: 120px; }
.party h2 { font-size: 28px; font-weight: 700; }
.party p { margin: 0; color: var(--muted); font-weight: 700; }
.party .stake { box-shadow: none; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: absolute; top: -40px; font-size: 26px; line-height: 1; animation: fall linear forwards; z-index: 1; font-family: system-ui, sans-serif; }
.confetti svg { width: 22px; height: 22px; display: block; }
@keyframes fall { to { transform: translateY(115vh) rotate(540deg); } }

.toast { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 40; width: max-content; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 800; font-size: 14px; max-width: calc(100% - 136px); text-align: center; display: flex; align-items: center; gap: 10px; }
.toast-btn { border: 0; border-radius: 10px; padding: 4px 10px; background: var(--gold); color: #3a2216; font-weight: 800; }

/* Più giocatori, giochi, tutorial */
.hchips { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; min-width: 0; }
.chip.out { background: var(--surface-2); }
.chip.out .v { color: var(--muted); font-size: 14px; }
.card.out { opacity: .55; }
.pond .duo.many { gap: 2px; }
.pond .duo.many svg.mascot { width: min(42px, calc((100vw - 48px) / 6)); height: min(42px, calc((100vw - 48px) / 6)); }
.board.many .card { padding: 10px 8px; }
.board.many .avatar { width: 52px; height: 52px; }
.board.many .total { font-size: clamp(28px, 8vw, 38px); }
.gamebar { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow); text-align: left; margin-top: -8px; }
.gamebar > svg { width: 40px; height: 40px; flex: none; color: var(--ink); }
.gamebar > span:first-of-type { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.gamebar b { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.gamebar small { color: var(--muted); font-weight: 700; font-size: 13px; }
.gamebar .chg { font-weight: 800; font-size: 13px; color: var(--accent-deep); flex: none; }
.gpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gopt { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); text-align: left; min-width: 0; }
.gopt svg { width: 40px; height: 40px; flex: none; color: var(--ink); }
.gopt span { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gopt b { font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.gopt small { color: var(--muted); font-weight: 700; font-size: 13px; }
.gopt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.seg.n5 { grid-template-columns: repeat(5, 1fr); }
.seg.n1 { grid-template-columns: 1fr; }
.seg.bq { margin-bottom: 12px; }
.rank { list-style: none; margin: 0; padding: 6px 14px 10px; }
.rank li { display: grid; grid-template-columns: auto minmax(0, 1fr) repeat(3, auto); align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 800; }
.rank li:first-child { border-top: 0; }
.rank li.hd { font-size: 13px; color: var(--muted); padding-bottom: 2px; }
.rank svg { width: 34px; height: 34px; }
.rank .nm { color: var(--p, var(--ink)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .v { text-align: right; min-width: 44px; }
.rank .v.best { color: var(--good); }
.items { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.itrow { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.itrow:first-of-type { border-top: 0; padding-top: 0; }
.itrow .lbl { font-weight: 700; font-size: 14.5px; }
.itrow .lbl small { color: var(--muted); font-size: 13px; margin-left: 6px; }
.pick3 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; }
.pick3 button { padding: 8px 6px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pick3 button[aria-pressed="true"] { background: var(--p, var(--accent)); border-color: var(--p, var(--accent)); color: var(--surface); }
.pick3 button.none[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 6px; }
.quick button { padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 13px; }
.quick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.quick button.neg[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); }
.outline { color: var(--muted); font-weight: 800; padding: 6px 0; border-top: 1px solid var(--line); }
.sign { width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 18px; flex: none; }
.sign[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.field input[data-target] { max-width: 160px; }
.dots { display: flex; gap: 8px; justify-content: center; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: block; }
.dots i.on { background: var(--accent); width: 24px; border-radius: 6px; }
.tut-foot { display: flex; gap: 10px; }
/* tutorial guidato: il resto dello schermo si scurisce, la parte spiegata resta illuminata */
.coach { position: fixed; inset: 0; z-index: 20; touch-action: none; overscroll-behavior: contain; }
.coach-hole { position: fixed; border-radius: 20px; box-shadow: 0 0 0 200vmax rgba(8, 14, 24, .62); outline: 3px solid #fff; outline-offset: 0; pointer-events: none; transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease; }
.coach-card { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: 480px; margin: 0 auto; background: var(--surface); color: var(--ink); border-radius: 24px; padding: 16px 16px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 6px; animation: pop .3s ease; }
.coach-card.top { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }
.coach-card h2 { margin: 0; font-size: 22px; }
.coach-card p { margin: 0 0 4px; color: var(--muted); font-weight: 700; font-size: 15px; line-height: 1.45; }
.coach-card .step { font-weight: 800; font-size: 13px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.coach-card .dots { margin: 2px 0 6px; justify-content: flex-start; }
.tut-foot .btn-s { flex: none; padding: 12px 16px; border-radius: 16px; }
.tut-foot .big { flex: 1; }

@media (max-width: 380px) {
  .hand { grid-template-columns: 1fr auto; }
  .hand .no { grid-column: 1 / -1; width: auto; }
  .line input { width: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .bob, .vs, .sheet, .party .box, .jump, .pond .duo .bob.jump, .coach-card { animation: none; }
  .coach-hole { transition: none; }
  .confetti { display: none; }
  .lane .fill, .lane .runner { transition: none; }
}

/* Frasi di sfottò: la mascotte di chi ha fatto la mano migliore commenta */
#quip:empty { display: none; }
.quip { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.quip > svg { width: 46px; height: 46px; flex: none; }
.quip .qb { flex: 1; min-width: 0; background: var(--surface); border: 2px solid var(--line); border-radius: 18px 18px 18px 4px; padding: 10px 14px; font-weight: 800; font-size: 15px; box-shadow: var(--shadow); color: var(--ink); }
.quip .qb small { display: block; font-weight: 700; font-size: 13px; color: var(--muted); margin-top: 2px; }
.quip:focus-visible .qb { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Guardaroba delle mascotte (pagina Trofei) */
.wardrobe { display: flex; flex-direction: column; gap: 10px; }
.wardrobe + .tnote { margin-top: 10px; }
.wrow { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; display: flex; gap: 12px; align-items: center; }
.wprev { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; width: 76px; }
.wprev svg { width: 64px; height: 64px; overflow: visible; }
.wprev .n { font-weight: 800; font-size: 13px; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.wrow { border-left: 6px solid var(--p); }
.wopts { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.wopt { padding: 8px 10px; min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 800; font-size: 13px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.2; cursor: pointer; }
.wopt small { font-weight: 700; font-size: 13px; color: var(--muted); }
.wopt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wopt:disabled { opacity: .55; cursor: not-allowed; }
.wopt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Calendario delle partite (Storico) */
.calbox { padding: 12px; }
.calnav { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.calnav .btn-s { min-width: 44px; min-height: 40px; font-size: 18px; }
.calnav .ml { font-weight: 800; font-size: 15px; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.cal .dw { text-align: center; font-weight: 800; font-size: 13px; color: var(--muted); }
.cd { all: unset; box-sizing: border-box; position: relative; aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--muted); background: var(--surface-2); }
button.cd { cursor: pointer; }
button.cd:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.cd.empty { background: transparent; }
.cd.won { background: var(--p); color: #fff; }
.cd.mix { background: var(--accent); color: var(--on-accent); }
.cd.live { outline: 2px dashed var(--accent); outline-offset: -2px; color: var(--ink); }
.cd.today { box-shadow: 0 0 0 2px var(--gold); }
.cd i { position: absolute; top: 1px; right: 4px; font-style: normal; font-size: 11px; }
.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--p, var(--accent)); }
.lg.mix::before { background: var(--accent); }
.lg.live::before { background: transparent; outline: 2px dashed var(--accent); outline-offset: -2px; }

/* Note e foto della partita (Storico) */
.memo { display: grid; gap: 8px; padding: 6px 14px 4px; }
.memo-l { font-weight: 800; font-size: 13px; color: var(--muted); }
.memo textarea { width: 100%; resize: vertical; min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 10px 12px; font: inherit; font-size: 16px; font-weight: 700; }
.memo textarea:focus { outline: none; border-color: var(--accent); }
.foto { margin: 0; }
.foto img { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); }
.memo-b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.memo-n { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.nw { white-space: nowrap; }
.inv { margin: 0 0 12px; color: var(--muted); font-weight: 700; font-size: 15px; line-height: 1.45; }
/* avviso di trasloco a un nuovo indirizzo (compare solo sul vecchio indirizzo, quando MOVE_TO è impostato) */
.movebar { margin: 0 0 14px; background: var(--surface); border: 2px solid var(--gold, #f2b33d); border-radius: 20px; padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.movebar > div { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.movebar b { font-size: 15px; }
.movebar span { color: var(--muted); font-size: 14px; font-weight: 700; }

/* burraco: avviso leggero (non blocca) */
.warn { margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--gold) 20%, transparent); }
/* sala dei trofei: quelli ancora da vincere raccolti sotto */
.tcount { font-size: 13px; font-weight: 800; color: var(--muted); }
.tlock { margin-top: 10px; }
.tlock > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-radius: 14px; border: 2px dashed var(--line); font-weight: 800; color: var(--muted); }
.tlock > summary::-webkit-details-marker { display: none; }
.tlock > summary::after { content: ""; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.tlock[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.tlock > .tgrid { margin-top: 10px; }
.tlock > summary .num { margin-right: auto; }

/* tablet in verticale (appoggiato sul tavolo): tutto un po' più grande; non durante il tutorial, come il testo grande */
@media (min-width: 768px) and (min-height: 900px) {
  :root:not(.tutoring) { zoom: 1.15; }
  :root.big-text { zoom: 1.3; }
}
