/* =============================================================================
   CARDGAME.CSS — "Cyber Defense 2.0". Layout TCG con profondità 3D (CSS),
   glow olografico, modale guida. Niente immagini, solo token + gradienti.
   ========================================================================== */
.cg { position: relative; max-width: 960px; margin: 0 auto; }

/* ---- HUD ---- */
.cg-hud { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--bg-soft)), var(--bg-soft));
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 20px; }
.cg-hp { flex: 1 1 200px; min-width: 180px; }
.cg-hp__label { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 5px; }
.cg-hp__bar { height: 10px; border-radius: 6px; background: var(--bg-soft-2); border: 1px solid var(--line); overflow: hidden; }
.cg-hp__bar span { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #2dd4bf); transition: width .35s ease; }
.cg-hp__bar.is-low span { background: linear-gradient(90deg, #f59e0b, #f43f5e); }
.cg-hp__num { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin-top: 4px; }
.cg-stat { display: flex; flex-direction: column; gap: 2px; min-width: 52px; }
.cg-stat span { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); }
.cg-stat b { font-size: 1.2rem; font-weight: 800; color: var(--text); line-height: 1; }
.cg-stat--streak b { color: var(--accent); }
.cg-dots { display: flex; gap: 5px; margin-top: 4px; }
.cg-dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-soft-2); }
.cg-dot.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(45,212,191,.5); }
.cg-help { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--bg-soft-2); color: var(--muted); font-weight: 800; font-family: var(--mono); cursor: pointer; transition: .15s; }
.cg-help:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* ---- arena ---- */
.cg-arena { display: grid; grid-template-columns: minmax(160px, auto) 1fr minmax(170px, 1.3fr); gap: 18px; align-items: start; margin-bottom: 22px; position: relative; }
.cg-col__h { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 10px; }
.cg-hint { text-transform: none; letter-spacing: 0; color: var(--muted-2); opacity: .8; }
.cg-mid { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; padding-top: 22px; gap: 8px; position: relative; }
.cg-vs { font-weight: 800; font-size: 2rem; line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.cg-vs__mit { color: #34d399; } .cg-vs__sep { color: var(--muted-2); font-size: 1.3rem; } .cg-vs__imp { color: #f43f5e; }
.cg-vs__cap { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin-bottom: 6px; }
.cg-resolve { margin-top: 4px; }
.cg-combos { display: flex; flex-direction: column; gap: 5px; }
.cg-combo { font-family: var(--mono); font-size: .66rem; font-weight: 700; color: var(--accent);
  background: var(--grad-soft); border: 1px solid var(--line-2); border-radius: 7px; padding: .2rem .5rem; }
.cg-msg { font-family: var(--mono); font-size: .82rem; font-weight: 700; padding: 6px 10px; border-radius: 8px; }
.cg-msg--ok { color: #34d399; background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.35); }
.cg-msg--bad { color: #f43f5e; background: rgba(244,63,94,.1); border: 1px solid rgba(244,63,94,.35); }

/* difese schierate + drop-zone */
.cg-staged { display: flex; flex-wrap: wrap; gap: 12px; min-height: 214px; align-content: flex-start;
  border-radius: 14px; transition: border-color .2s, background .2s; }
.cg-staged.is-empty { border: 1.5px dashed var(--line-2); background: rgba(255,255,255,.012); align-items: center; justify-content: center; }
.cg-drop { color: var(--muted-2); font-family: var(--mono); font-size: .72rem; text-align: center; padding: 18px; max-width: 150px; line-height: 1.5; }

/* ---- onboarding (prima visita) ---- */
.cg-onboard { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--grad-soft); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.cg-onboard__txt { font-size: .9rem; color: var(--text); flex: 1 1 240px; line-height: 1.5; }
.cg-onboard__btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- mano ---- */
.cg-hand-wrap { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.cg-hand-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cg-hand-tools { display: flex; align-items: center; gap: 14px; }
.cg-counts { display: flex; gap: 10px; }
.cg-count { font-family: var(--mono); font-size: .68rem; color: var(--muted-2); letter-spacing: .02em; }
.cg-toggle { font-family: var(--body); font-size: .72rem; font-weight: 600; color: var(--muted);
  background: var(--bg-soft-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 4px 11px; cursor: pointer; transition: .15s; text-transform: none; letter-spacing: 0; }
.cg-toggle:hover { color: var(--text); border-color: var(--accent); }
.cg-toggle.is-on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.cg-hand { display: flex; flex-wrap: wrap; gap: 14px; }
.cg-foot { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* scena 3D: la prospettiva sta sui contenitori */
.cg-hand, .cg-staged, .cg-col--threat { perspective: 1100px; }

/* =============================================================== CARTA (TCG) */
.tcard {
  /* --c impostato da .type-* */
  width: 152px; min-height: 214px; box-sizing: border-box; position: relative;
  display: block; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: var(--text);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .18s ease, filter .18s ease;
}
.tcard__layer {
  position: relative; display: flex; flex-direction: column; height: 100%; min-height: 214px; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--line-2); transform-style: preserve-3d;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, var(--bg-soft)), var(--bg-soft) 56%);
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
}
/* texture "circuito" leggera */
.tcard__layer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; z-index: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--c) 22%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000, transparent 72%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000, transparent 72%);
}
/* sheen olografico */
.tcard__shine {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: 14px; opacity: 0; transition: opacity .2s;
  background: linear-gradient(125deg, transparent 35%, color-mix(in srgb, var(--c) 38%, #fff) 50%, transparent 65%);
  mix-blend-mode: overlay;
}
button.tcard { cursor: pointer; }
button.tcard:hover { --lift: -6px; filter: brightness(1.04); }
button.tcard:hover .tcard__layer, button.tcard.is-tilt .tcard__layer { border-color: var(--c); box-shadow: 0 18px 34px rgba(0,0,0,.42), 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
button.tcard:hover .tcard__shine, button.tcard.is-tilt .tcard__shine { opacity: .55; }
button.tcard:focus-visible { outline: none; }
button.tcard:focus-visible .tcard__layer { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 55%, transparent); }
button.tcard.is-disabled { opacity: .5; }   /* non schierabile, ma cliccabile per il dettaglio */
button.tcard.is-disabled:hover { --lift: 0px; filter: none; }
button.tcard:active { --lift: -2px; }

/* badge tasto numerico (scorciatoie da tastiera) */
.tcard__key { position: absolute; top: -7px; left: -7px; z-index: 4; width: 19px; height: 19px; border-radius: 6px;
  display: grid; place-items: center; font-family: var(--mono); font-size: .64rem; font-weight: 700;
  color: var(--muted); background: var(--bg-soft-2); border: 1px solid var(--line-2); transform: translateZ(40px); }
button.tcard:hover .tcard__key, button.tcard.is-tilt .tcard__key { color: var(--c); border-color: var(--c); }
button.tcard.is-disabled .tcard__key { opacity: .5; }
@media (pointer: coarse) { .tcard__key { display: none; } }

/* evidenza: difesa che combacia col tipo della minaccia */
button.tcard.is-match .tcard__layer { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 16px -2px color-mix(in srgb, var(--c) 70%, transparent); }
button.tcard.is-match::after {
  content: "✓"; position: absolute; top: -8px; right: -8px; z-index: 4; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #04121a; background: var(--c);
  transform: translateZ(40px); box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* contenuto carta (con leggero parallax in Z) */
.tcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 9px 10px 7px; position: relative; z-index: 1; transform: translateZ(14px); }
.tcard__title { font-size: .73rem; font-weight: 700; line-height: 1.18; min-height: 2.36em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard__cost { flex: none; width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: .82rem; background: var(--c); color: #04121a; }
.tcard__art { flex: 1; margin: 0 10px; border-radius: 10px; min-height: 66px; position: relative; z-index: 1; transform: translateZ(24px);
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--c) 26%, #0b1118), #0a0f15);
  border: 1px solid var(--line); display: grid; place-items: center; }
.tcard__art svg { width: 40px; height: 40px; color: var(--c); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 55%, transparent)); }
.tcard__type { text-align: center; font-family: var(--mono); font-size: .58rem; text-transform: uppercase; letter-spacing: .12em; color: var(--c); padding: 8px 6px 6px; position: relative; z-index: 1; }
.tcard__text { font-size: .66rem; line-height: 1.3; color: var(--muted); text-align: center; padding: 7px 9px 10px; border-top: 1px solid var(--line); background: rgba(0,0,0,.18); position: relative; z-index: 1; }
.tcard__text b { color: var(--text); font-size: .8rem; }
.tcard__half { color: #fbbf24; font-weight: 700; }
.tcard__trait { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 6px 0; position: relative; z-index: 1;
  font-family: var(--mono); font-size: .54rem; font-weight: 700; letter-spacing: .04em; color: #f43f5e; }
.tcard__trait svg { width: 13px; height: 13px; }

/* tipi (accent) */
.type-network     { --c: #60a5fa; }
.type-endpoint    { --c: #2dd4bf; }
.type-human       { --c: #fbbf24; }
.type-application { --c: #a78bfa; }
.type-identity    { --c: #f472b6; }
.type-cloud       { --c: #4ade80; }
.type-any         { --c: #22d3ee; }

/* carta minaccia */
.tcard--threat { cursor: pointer; }
.tcard--threat:focus-visible { outline: none; }
.tcard--threat:focus-visible .tcard__layer { box-shadow: 0 0 0 3px rgba(244,63,94,.55); }
.tcard--threat .tcard__layer { border-color: rgba(244,63,94,.5); background: linear-gradient(180deg, rgba(244,63,94,.14), var(--bg-soft) 58%); }
.tcard__impact { background: #f43f5e; color: #fff; }

/* sinergia / avvisi / numeri fluttuanti */
.cg-syn { font-family: var(--mono); font-size: .68rem; font-weight: 700; color: #34d399;
  background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); border-radius: 7px; padding: .2rem .5rem; }
.cg-syn--bad { color: #f43f5e; background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.32); }
.cg-warn { font-family: var(--mono); font-size: .7rem; font-weight: 700; color: #fb923c; }
.cg-float { position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-weight: 800; font-size: 1.5rem; pointer-events: none; z-index: 4;
  animation: cgFloat 1.1s ease-out forwards; }
.cg-float--ok { color: #34d399; } .cg-float--bad { color: #f43f5e; }

/* ---- overlay game over ---- */
.cg-over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,9,13,.82); border-radius: 16px; z-index: 6; }
.cg-over__box { text-align: center; background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 16px; padding: 30px 34px; box-shadow: var(--shadow); }
.cg-over__title { font-size: 1.5rem; font-weight: 800; color: #f43f5e; margin-bottom: 8px; }
.cg-over__sub { color: var(--muted); margin-bottom: 12px; }
.cg-over__sub b { color: var(--text); }
.cg-over__rec { font-family: var(--mono); font-weight: 800; color: var(--accent); margin-bottom: 16px; }

/* =================================================== MODALE "COME SI GIOCA" */
.cg-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(3,5,10,.66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; }
.cg-modal.cg-show { opacity: 1; }
.cg-modal__panel { width: 100%; max-width: 720px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow);
  transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.22,1,.36,1); }
.cg-modal.cg-show .cg-modal__panel { transform: none; }
.cg-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.cg-modal__title { font-family: var(--font); font-size: 1.3rem; font-weight: 800; margin: 0; }
.cg-modal__close { background: transparent; border: 1px solid var(--line-2); color: var(--muted); border-radius: 9px; width: 34px; height: 34px; font-size: 1.2rem; line-height: 1; cursor: pointer; flex: none; }
.cg-modal__close:hover { color: var(--text); border-color: var(--accent); }
.cg-modal__body { overflow-y: auto; padding: 8px 24px 4px; }
.cg-modal__foot { padding: 14px 24px 20px; border-top: 1px solid var(--line); text-align: right; }

.cg-guide__sec { margin: 18px 0; }
.cg-guide__sec h3 { font-family: var(--font); font-size: 1.02rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.cg-guide__count { font-family: var(--mono); font-size: .66rem; font-weight: 700; color: var(--accent); border: 1px solid var(--line-2); border-radius: 99px; padding: 1px 8px; }
.cg-guide__steps, .cg-guide__ul { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.cg-guide__steps li, .cg-guide__ul li { margin-bottom: 7px; }
.cg-guide__ul b, .cg-guide__steps b { color: var(--text); }
.cg-guide__ab { list-style: none; padding-left: 0; }
.cg-guide__ab li { display: flex; align-items: flex-start; gap: 8px; }
.cg-ab__ic { flex: none; color: #f43f5e; } .cg-ab__ic svg { width: 17px; height: 17px; }

.cg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cg-chip { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); border-radius: 99px; padding: 4px 11px; background: color-mix(in srgb, var(--c) 9%, transparent); }
.cg-chip__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }

.cg-gloss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cg-gloss { display: flex; gap: 11px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: var(--bg-soft-2); }
.cg-gloss__ic { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--c) 26%, #0b1118), #0a0f15); border: 1px solid var(--line); }
.cg-gloss__ic svg { width: 22px; height: 22px; color: var(--c); }
.cg-gloss__body { min-width: 0; }
.cg-gloss__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cg-gloss__top b { font-size: .82rem; }
.cg-gloss__meta { font-family: var(--mono); font-size: .62rem; color: var(--muted-2); white-space: nowrap; }
.cg-gloss__type { font-family: var(--mono); font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c); margin: 2px 0 5px; }
.cg-gloss__ab { color: #f43f5e; font-style: normal; }
.cg-gloss p { margin: 0; font-size: .76rem; line-height: 1.45; color: var(--muted); }

/* =================================================== MODALE "DETTAGLIO CARTA" */
.cg-modal--card .cg-modal__panel { max-width: 460px; }
.cg-det__top { display: flex; gap: 14px; align-items: center; margin: 6px 0 14px; }
.cg-det__ic { flex: none; width: 66px; height: 66px; border-radius: 13px; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--c) 28%, #0b1118), #0a0f15); border: 1px solid var(--line); }
.cg-det__ic svg { width: 38px; height: 38px; color: var(--c); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 55%, transparent)); }
.cg-det__meta { min-width: 0; }
.cg-det__name { font-family: var(--font); font-weight: 800; font-size: 1.18rem; line-height: 1.15; }
.cg-det__chip { margin: 6px 0; }
.cg-det__stat { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.cg-det__stat b { color: var(--text); }
.cg-det__desc { color: var(--muted); font-size: .92rem; line-height: 1.6; margin: 0 0 4px; }
.cg-det__sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.cg-det__sec h4 { margin: 0 0 7px; font-size: .98rem; display: flex; align-items: center; gap: 8px; }
.cg-det__sec > p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.cg-det__combos { list-style: none; margin: 0; padding: 0; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.cg-det__combos li { padding: 4px 0; }
.cg-det__combos li b { color: var(--text); }
.cg-det__combos li.is-active { color: var(--accent); }
.cg-det__combos li.is-active b { color: var(--accent); }
.cg-det__on { font-family: var(--mono); font-size: .72rem; font-weight: 700; color: var(--accent); }
.cg-det__eff { margin-top: 14px; font-size: .84rem; color: var(--muted); line-height: 1.5;
  background: var(--bg-soft-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.cg-det__eff b { color: var(--text); }

/* =================================================================== ANIMAZIONI */
.cg-deal { animation: cgDeal .26s cubic-bezier(.2,.8,.3,1) both; }
@keyframes cgDeal { from { opacity: 0; transform: translateY(12px) rotateX(-12deg) scale(.96); } to { opacity: 1; transform: none; } }

/* flip d'ingresso della minaccia */
.cg-flip { animation: cgFlip .5s cubic-bezier(.3,.9,.3,1) both; }
@keyframes cgFlip { from { transform: rotateY(90deg) scale(.94); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }

/* minaccia: glow d'allerta in loop */
.tcard--threat { animation: cgThreat 2.6s ease-in-out infinite; }
@keyframes cgThreat { 0%,100% { filter: drop-shadow(0 0 0 rgba(244,63,94,0)); } 50% { filter: drop-shadow(0 0 14px rgba(244,63,94,.4)); } }

/* flash arena su esito */
.cg-arena.is-ok::after, .cg-arena.is-hit::after { content: ""; position: absolute; inset: -8px; border-radius: 16px; pointer-events: none; z-index: 0; }
.cg-arena.is-ok::after  { animation: cgFlashOk .7s ease-out; }
.cg-arena.is-hit::after { animation: cgFlashHit .7s ease-out; }
@keyframes cgFlashOk  { 0% { box-shadow: inset 0 0 0 9999px rgba(52,211,153,.16); } 100% { box-shadow: inset 0 0 0 9999px rgba(52,211,153,0); } }
@keyframes cgFlashHit { 0% { box-shadow: inset 0 0 0 9999px rgba(244,63,94,.18); } 100% { box-shadow: inset 0 0 0 9999px rgba(244,63,94,0); } }

.cg-arena.is-ok .cg-vs__mit, .cg-arena.is-hit .cg-vs__imp { animation: cgBump .45s ease-out; display: inline-block; }
@keyframes cgBump { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes cgFloat { 0% { opacity: 0; transform: translate(-50%,6px) scale(.8); } 25% { opacity: 1; transform: translate(-50%,-2px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%,-34px) scale(1); } }

.cg-hud--hit { animation: cgShake .5s ease-in-out; }
@keyframes cgShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.cg-msg { animation: cgPop .3s ease-out; }
@keyframes cgPop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.cg-over { animation: cgFade .3s ease-out; }
.cg-over__box { animation: cgOverIn .4s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes cgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cgOverIn { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
.cg-dot.on { animation: cgDot .4s ease-out; }
@keyframes cgDot { from { transform: scale(.6); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .cg-deal, .cg-flip, .tcard--threat, .cg-arena.is-ok::after, .cg-arena.is-hit::after, .cg-float,
  .cg-hud--hit, .cg-msg, .cg-over, .cg-over__box, .cg-dot.on, .cg-modal, .cg-modal__panel,
  .cg-arena.is-ok .cg-vs__mit, .cg-arena.is-hit .cg-vs__imp { animation: none !important; }
  .tcard { transition: none !important; }
}

/* ---- barra azione fissa (mobile): mitigazione/impatto + pulsante ---- */
.cg-actionbar { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
  align-items: center; gap: 12px; padding: 9px 12px 9px 16px; border-radius: 14px;
  background: var(--bg-glass); backdrop-filter: blur(12px) saturate(150%); -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.cg-actionbar__vs { font-family: var(--mono); font-weight: 800; font-size: 1.25rem; white-space: nowrap; line-height: 1; }
.cg-actionbar .cg-vs__sep { font-size: .9rem; margin: 0 2px; }
.cg-actionbar .btn { flex: 1; padding: 11px 16px; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .cg-arena { grid-template-columns: 1fr; gap: 14px; }
  .cg-mid { padding-top: 4px; gap: 7px; }
  .cg-mid .cg-resolve { display: none; }            /* il pulsante vive nella barra fissa */
  .cg-staged { min-height: 0; }
  .cg-staged.is-empty { min-height: 78px; }
  .cg-col--threat { display: flex; flex-direction: column; align-items: center; }
  .cg-hand, .cg-staged, .cg-col--threat { perspective: none; }
  .cg-gloss-grid { grid-template-columns: 1fr; }

  /* barra azione fissa visibile su mobile */
  .cg-actionbar { display: flex; }
  /* ...ma non quando è aperto il banner cookie (eviterebbe la sovrapposizione in basso) */
  body.cc-banner-open .cg-actionbar { display: none; }
  /* spazio per non finire sotto la barra fissa */
  .cg { padding-bottom: 78px; }

  /* HUD compatto */
  .cg-hud { padding: 11px 13px; gap: 9px 14px; margin-bottom: 16px; }
  .cg-hp { flex: 1 1 100%; }
  .cg-stat b { font-size: 1.05rem; }
  .cg-help { position: absolute; top: 11px; right: 13px; }

  /* mano: strip orizzontale con swipe + snap, invece di impilare */
  .cg-hand { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 12px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; padding: 4px 2px 8px;
    scrollbar-width: thin; }
  .cg-hand .tcard { flex: 0 0 auto; scroll-snap-align: center; }
  .cg-hand-wrap { padding: 12px 12px 8px; }

  /* difese schierate: strip orizzontale anche queste */
  .cg-staged:not(.is-empty) { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .cg-staged .tcard { flex: 0 0 auto; }
}
@media (max-width: 420px) {
  .tcard { width: 128px; min-height: 188px; }
  .tcard__layer { min-height: 188px; }
  .cg-vs { font-size: 1.7rem; }
}
