/* Stili dei giochi dentro la scheda */
dialog#dlg { width: min(720px, calc(100% - 20px)); }
dialog#dlg.wide { width: min(1040px, calc(100% - 20px)); }
.scene.photo .mark { stroke-width: 9; } .scene.photo .miss { stroke-width: 7; }
.card { max-height: calc(100vh - 28px); display: flex; flex-direction: column; }
.card-top { flex-shrink: 0; padding-bottom: 22px; }
.card-body { overflow: auto; }
.game { display: grid; gap: 14px; color: var(--ink); }
.game-root { display: grid; gap: 14px; }
.game p { margin: 0; }
.g-intro { font-size: 17px; }
.g-start { justify-self: start; }
.g-q { font-size: 19px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.g-step { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.g-opts { display: grid; gap: 8px; }
.g-opt { appearance: none; text-align: left; font: inherit; font-size: 16px; font-weight: 500; padding: 12px 16px; border-radius: 14px; border: 2px solid #d5dbe5; background: #fff; color: var(--ink); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.g-opt:hover { border-color: var(--navy); transform: translateX(3px); }
.g-opt.sel { background: var(--navy); color: #fff; border-color: var(--navy); }
.g-opt.right { background: #e3f6ea; border-color: #2e9e5b; }
.g-opt.wrong { background: #ffe6e9; border-color: var(--red); }
.g-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.g-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.g-count { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.btn.red { background: var(--red); border-color: var(--red); }
.btn:disabled { opacity: .45; cursor: default; }
.g-list { display: grid; gap: 12px; }
.g-item { display: grid; gap: 6px; padding: 12px 14px; border-radius: 0 16px 16px 16px; background: #f3f5f9; }
.g-emoji { font-size: 40px; line-height: 1.1; letter-spacing: .08em; }
.g-hint { font-size: 13px; color: #5b6b85; }
.shake { animation: gshake .35s ease; }
@keyframes gshake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* Memory */
.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 420px; margin: 0 auto; width: 100%; }
.mem button { appearance: none; border: 0; aspect-ratio: 1; border-radius: 50%; cursor: pointer; font-size: clamp(36px, 9vw, 58px); position: relative; perspective: 600px; background: transparent; padding: 0; }
.mem .in { position: absolute; inset: 0; transition: transform .4s cubic-bezier(.3,1.4,.5,1); transform-style: preserve-3d; }
.mem .f, .mem .b { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; }
.mem .b { background: radial-gradient(circle at 32% 26%, #1d3866, #0e2347 70%); box-shadow: inset 0 0 0 3px var(--coral); }
.mem .b::after { content: ""; width: 26%; height: 26%; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--navy); }
.mem .f { background: #fff4f5; box-shadow: inset 0 0 0 3px var(--coral); transform: rotateY(180deg); }
.mem .up .in { transform: rotateY(180deg); }
.mem .done .f { background: #ffe08a33; box-shadow: inset 0 0 0 3px #ffd45e; }

/* Scene SVG (differenze, caccia) */
.scenes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scene { width: 100%; height: auto; display: block; border-radius: 14px; cursor: crosshair; touch-action: manipulation; }
.scene .mark { fill: none; stroke: #ffd45e; stroke-width: 4; }
.scene .miss { fill: none; stroke: var(--red); stroke-width: 3; opacity: .8; }

/* Puzzle */
.pz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto; background: var(--navy); padding: 3px; border-radius: 14px; }
.pz button { appearance: none; border: 0; padding: 0; cursor: pointer; background-size: 300% 300%; border-radius: 6px; transition: transform .15s ease, box-shadow .15s ease; }
.pz button.sel { box-shadow: inset 0 0 0 4px #ffd45e; transform: scale(.94); }

/* Parola misteriosa */
.wd { display: grid; gap: 6px; justify-content: center; }
.wd .r { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; }
.wd .c { height: 52px; border-radius: 12px; border: 2px solid #d5dbe5; display: grid; place-items: center; font-weight: 800; font-size: 24px; text-transform: uppercase; }
.wd .c.g { background: #2e9e5b; border-color: #2e9e5b; color: #fff; }
.wd .c.p { background: #ffd45e; border-color: #ffd45e; color: var(--navy); }
.wd .c.x { background: #9fb0cc; border-color: #9fb0cc; color: #fff; }
.kb { display: grid; gap: 5px; }
.kb div { display: flex; gap: 5px; justify-content: center; }
.kb button { appearance: none; border: 0; font: inherit; font-weight: 700; min-width: 32px; height: 44px; padding: 0 6px; border-radius: 8px; background: #e6ebf3; color: var(--navy); cursor: pointer; }
.kb button.g { background: #2e9e5b; color: #fff; } .kb button.p { background: #ffd45e; } .kb button.x { background: #9fb0cc; color: #fff; }

/* Crucipuzzle */
.ws { display: grid; gap: 2px; touch-action: none; user-select: none; width: min(100%, 460px); margin: 0 auto; }
.ws span { aspect-ratio: 1; display: grid; place-items: center; font-weight: 700; font-size: clamp(12px, 2.6vw, 17px); border-radius: 6px; background: #f3f5f9; cursor: pointer; }
.ws span.sel { background: #ffd45e; }
.ws span.found { background: var(--coral); color: #fff; }
.ws-words { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-words span { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eef1f6; }
.ws-words span.found { background: var(--navy); color: #fff; text-decoration: line-through; }

/* Labirinto */
.mz { width: min(100%, 440px); margin: 0 auto; display: block; background: #0b1e3b; border-radius: 14px; touch-action: none; }
.pad { display: grid; grid-template-columns: repeat(3, 48px); gap: 6px; justify-content: center; }
.pad button { appearance: none; height: 48px; border: 0; border-radius: 12px; background: var(--navy); color: #fff; font-size: 20px; cursor: pointer; }

/* Zoom */
.zoom { width: 220px; height: 220px; margin: 0 auto; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #f3f5f9; box-shadow: inset 0 0 0 4px var(--coral); }
.zoom span { font-size: 120px; line-height: 1; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.zoom.photo { position: relative; display: block; width: min(300px, 80vw); height: min(300px, 80vw); border-radius: 22px; background: #0b1e3b; }
.zoom.photo img { position: absolute; max-width: none; user-select: none; transition: all .55s cubic-bezier(.2,.8,.2,1); }

/* Bingo */
.bingo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bingo button { appearance: none; font: inherit; font-size: 13px; line-height: 1.25; min-height: 84px; padding: 8px; border-radius: 12px; border: 2px solid #d5dbe5; background: #fff; color: var(--ink); cursor: pointer; position: relative; }
.bingo button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.bingo button.on::after { content: ""; position: absolute; top: 6px; right: 6px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 4px var(--red); }

/* Escape room */
.locks { display: flex; gap: 10px; justify-content: center; }
.locks span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: #eef1f6; }
.locks span.open { background: #e3f6ea; }

/* Foto dell'albero */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ph-prev { min-height: 220px; border-radius: 18px; border: 2px dashed #d5dbe5; display: grid; place-items: center; text-align: center; color: #5b6b85; overflow: hidden; background: #f7f9fc; }
.ph-prev span { font-size: 56px; }
.ph-prev img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #0b1e3b; }
label.btn { display: inline-flex; align-items: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; width: 100%; max-height: 420px; overflow: auto; }
.gallery figure { margin: 0; display: grid; gap: 4px; }
.gallery img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: #eef1f6; }
.gallery.big { max-height: 60vh; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery figcaption { font-size: 12px; color: #5b6b85; text-align: left; }

/* Risultato */
.res { display: grid; gap: 12px; text-align: center; justify-items: center; }
.res .big { font-size: 64px; font-weight: 900; color: var(--red); line-height: 1; font-variant-numeric: tabular-nums; }
.res .big small { font-size: 18px; color: var(--navy); font-weight: 700; }
.res .chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.res .chips span { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: #eef1f6; }
.res .chips .gold { background: #ffd45e; }
.letter { display: grid; gap: 4px; justify-items: center; padding: 12px 18px; border-radius: 18px; background: var(--navy); color: #fff; }
.letter b { width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--red); display: grid; place-items: center; font-size: 30px; font-weight: 900; box-shadow: 0 0 0 4px var(--red), 0 0 24px rgba(255,212,94,.6); }
.reveal { text-align: left; width: 100%; display: grid; gap: 8px; }
.reveal div { padding: 10px 12px; border-radius: 12px; background: #f3f5f9; font-size: 14px; }
.reveal div.ok { background: #e3f6ea; } .reveal div.ko { background: #ffe6e9; }
.reveal b { display: block; }
.wall { display: grid; gap: 8px; text-align: left; width: 100%; max-height: 260px; overflow: auto; }
.wall div { padding: 10px 12px; border-radius: 0 14px 14px 14px; background: #f3f5f9; font-size: 15px; }
.wall small { display: block; color: #5b6b85; font-size: 12px; margin-top: 2px; }
.podium { display: grid; gap: 6px; width: 100%; }
.podium div { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #f3f5f9; text-align: left; font-weight: 600; }
.podium div:nth-child(1) { background: #ffd45e; } .podium div:nth-child(2) { background: #e6ebf3; } .podium div:nth-child(3) { background: #f7d2b5; }

@media (max-width: 600px) {
  .scenes { grid-template-columns: 1fr; }
  .wd .r { grid-template-columns: repeat(5, 44px); } .wd .c { height: 44px; }
  .kb button { min-width: 26px; height: 40px; }
  .bingo button { font-size: 12px; min-height: 76px; padding: 6px; }
  .g-two { grid-template-columns: 1fr; }
}

/* v3.1: timer delle domande, feedback, punti dal vivo, bingo */
.act-btns { display: flex; gap: 10px; align-items: center; margin-left: auto; }
#primarySlot:empty { display: none; }
.timer-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.live { font-weight: 800; font-size: 14px; color: var(--red); font-variant-numeric: tabular-nums; }
.qt { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.qt i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--navy); transition: width 1s linear, background .3s ease; }
.qt i.hurry { background: var(--red); }
.qt-num { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); }
.qfb { margin: 0; min-height: 0; padding: 0; border-radius: 12px; font-size: 15px; }
.qfb.ok, .qfb.ko, .qfb.hint { padding: 10px 14px; }
.qfb.ok { background: #e3f6ea; } .qfb.ko { background: #ffe6e9; } .qfb.hint { background: #fff4d1; }
.g-opt:disabled { cursor: default; transform: none; }
.g-opt.right { background: #e3f6ea; border-color: #2e9e5b; color: var(--ink); animation: pop-right .35s ease; }
.g-opt.wrong { background: #ffe6e9; border-color: var(--red); color: var(--ink); animation: gshake .35s ease; }
@keyframes pop-right { 50% { transform: scale(1.03); } }
.bingo-status { font-size: 15px; padding: 10px 14px; border-radius: 12px; background: #f3f5f9; }
.bingo button.line { background: var(--red); border-color: var(--red); }
.bingo button.line::after { box-shadow: inset 0 0 0 4px #ffd45e; }

/* ---------- Minigiochi arcade ---------- */
.pond { position: relative; height: 360px; border-radius: 18px; overflow: hidden; touch-action: manipulation; user-select: none;
  background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.18) 0 40px, transparent 41px), radial-gradient(circle at 80% 70%, rgba(255,255,255,.08) 0 70px, transparent 71px), linear-gradient(180deg, #2b5f9e, #0b1e3b); }
.swimmer { position: absolute; left: 0; top: 0; appearance: none; border: 0; background: none; padding: 0; cursor: pointer; will-change: transform; transition: opacity .2s ease; }
.swimmer svg { display: block; width: 100%; height: auto; pointer-events: none; }
.swimmer.caught { opacity: 0; filter: drop-shadow(0 0 10px #ffd45e); }
.swimmer.wrong { opacity: 0; }
.sample { width: 76px; display: inline-block; } .sample svg { width: 100%; height: auto; display: block; }
.samples { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sample-card { margin: 0; display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; background: #ffe6e9; font-size: 12px; font-weight: 600; text-align: center; }
.sample-card.ok { background: #e3f6ea; box-shadow: inset 0 0 0 2px #2e9e5b; }
@media (max-width: 600px) { .samples { grid-template-columns: repeat(2, 1fr); } }
.simon { display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); gap: 22px; justify-content: center; padding: 18px 0 6px; }
.bauble-pad { appearance: none; border: 0; aspect-ratio: 1; border-radius: 50%; cursor: pointer; position: relative; background: radial-gradient(circle at 32% 28%, #ffffffaa, transparent 30%), var(--c); opacity: .55; box-shadow: inset 0 -8px 0 rgba(0,0,0,.12); transition: opacity .12s ease, transform .12s ease, box-shadow .12s ease; }
.bauble-pad::before { content: ""; position: absolute; top: -10px; left: 50%; width: 24%; height: 14px; transform: translateX(-50%); border-radius: 4px; background: linear-gradient(90deg, #9fb0cc, #e6ebf3, #9fb0cc); }
.bauble-pad.lit { opacity: 1; transform: scale(1.06); box-shadow: 0 0 0 4px #fff, 0 0 40px var(--c); }
.flappy { display: block; width: min(100%, 360px); height: auto; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 18px; touch-action: none; cursor: pointer; }
.m2048 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(100%, 360px); margin: 0 auto; padding: 8px; border-radius: 16px; background: #13294d; touch-action: none; user-select: none; }
.m2048 .t { aspect-ratio: 1; border-radius: 10px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: clamp(26px, 8vw, 40px); }
.m2048 .t.pop { animation: pop-right .25s ease; }
.m2048 .l0 { background: #e6ebf3; } .m2048 .l1 { background: #f7d2d5; } .m2048 .l2 { background: #f7a1a6; } .m2048 .l3 { background: #ffd45e; }
.m2048 .l4 { background: #ffb347; } .m2048 .l5 { background: #f65058; } .m2048 .l6 { background: #8fa3c8; } .m2048 .l7 { background: #4a6fa5; } .m2048 .l8 { background: #ff203c; box-shadow: 0 0 20px #ffd45e; }
.school { display: grid; gap: 6px; width: min(100%, 460px); margin: 0 auto; padding: 10px; border-radius: 16px; background: linear-gradient(180deg, #2b5f9e, #13294d); }
.school-fish { appearance: none; border: 0; background: none; padding: 2px; cursor: pointer; border-radius: 10px; }
.school-fish:hover { background: rgba(255,255,255,.1); }
.school-fish svg { display: block; width: 100%; height: auto; pointer-events: none; }
/* Escape room illustrata */
.esc-wrap svg { display: block; width: 100%; height: auto; border-radius: 16px; }
.locks span { width: 52px; height: 52px; background: #eef1f6; padding: 6px; }
.locks span svg { width: 100%; height: 100%; display: block; }
.locks span.open { background: #e3f6ea; }
.confirm-pub { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: #fff4d1; }
.confirm-pub[hidden] { display: none; }
