/* Bumpkin Legends - Stelle mitiche sulle icone (novembre 2026, richiesta del primo giocatore, approvata dal proprietario).
   Il segno del mitico e' il rombo ◆ (gia' nel nome: "★15◆7"): angoli a pixel viola, rombi che brillano, cometa di luce sul bordo.
   Gradini: t1 ◆1-5 Scintilla, t2 ◆6-10 Orbita, t3 ◆11-14 Prisma, t4 ◆15 Corona.
   Solo transform e opacity animati (niente filtri, niente box-shadow animati); i disegni (gradienti, ombre) restano fermi.
   Il nodo .myf lo crea public/js/mythfx.js (MythFX.on) come PRIMO figlio della casella: le targhette (+9, ★, 🔒) restano sopra. */

.myf-host { position: relative; }
.myf-host > img { position: relative; }            /* l'icona sopra il bagliore di fondo, sotto le targhette */

/* il bordo della casella diventa una "corda" mitica a strisce di pixel (diverse da ogni rarita', anche dal viola dell'Epico):
   copre l'arancione del Leggendario; filo scuro e alone fermi. Le strisce prendono un colore in piu' a ogni gradino. */
.myf {
  --c1: #d6adff; --c2: #ffffff; --c3: #5b2aa8; --cg: rgba(166, 104, 255, .55);
  --rope: repeating-linear-gradient(45deg, #5a22b8 0 3px, #d6adff 3px 6px);
  --ml: 1; --sp: calc(2.6s - var(--ml) * .07s);       /* piu' gradini = respiro piu' veloce */
  position: absolute; inset: -3px; pointer-events: none; border: 3px solid #7a3bdc; border-image: var(--rope) 3;
  contain: layout style; box-shadow: 0 0 0 1px #2a0f4d, inset 0 0 0 1px #2a0f4d, 0 0 9px 2px var(--cg);
}
.myf-t2 { --c1: #e0b8ff; --c3: #7a2fd0; --cg: rgba(186, 110, 255, .65);
  --rope: repeating-linear-gradient(45deg, #5a22b8 0 3px, #ff8fe6 3px 6px); }
.myf-t3 { --c1: #e8c8ff; --c3: #8c34e0; --cg: rgba(205, 120, 255, .7);
  --rope: repeating-linear-gradient(45deg, #5a22b8 0 3px, #ff8fe6 3px 6px, #5a22b8 6px 9px, #8ff0ff 9px 12px); }
.myf-t4 { --c1: #f6e2ff; --c3: #a13df0; --cg: rgba(232, 140, 255, .8);
  --rope: repeating-linear-gradient(45deg, #6a2bd0 0 3px, #ff8fe6 3px 6px, #ffffff 6px 9px, #8ff0ff 9px 12px); }

/* bagliore viola dal basso (t2+): gradiente fermo, pulsa solo l'opacita' */
.myf-t2::before, .myf-t3::before, .myf-t4::before {
  content: ''; position: absolute; inset: 0; border-radius: 3px;
  background: radial-gradient(ellipse 70% 55% at 50% 100%, var(--cg), transparent 70%);
  animation: myf-breath var(--sp) ease-in-out infinite;
}

/* angoli a L di 3 pixel con la punta bianca: otto barre + quattro punte, un solo elemento */
.myf-k {
  position: absolute; inset: -3px;
  --L: 10px; --W: 3px;
  background:
    linear-gradient(var(--c2) 0 0) 0 0 / var(--W) var(--W),
    linear-gradient(var(--c2) 0 0) 100% 0 / var(--W) var(--W),
    linear-gradient(var(--c2) 0 0) 0 100% / var(--W) var(--W),
    linear-gradient(var(--c2) 0 0) 100% 100% / var(--W) var(--W),
    linear-gradient(var(--c1) 0 0) 0 0 / var(--L) var(--W),
    linear-gradient(var(--c1) 0 0) 0 0 / var(--W) var(--L),
    linear-gradient(var(--c1) 0 0) 100% 0 / var(--L) var(--W),
    linear-gradient(var(--c1) 0 0) 100% 0 / var(--W) var(--L),
    linear-gradient(var(--c1) 0 0) 0 100% / var(--L) var(--W),
    linear-gradient(var(--c1) 0 0) 0 100% / var(--W) var(--L),
    linear-gradient(var(--c1) 0 0) 100% 100% / var(--L) var(--W),
    linear-gradient(var(--c1) 0 0) 100% 100% / var(--W) var(--L);
  background-repeat: no-repeat;
  animation: myf-breath var(--sp) ease-in-out infinite;
}
.myf-t2 .myf-k { --L: 13px; }
.myf-t3 .myf-k, .myf-t4 .myf-k { --L: 15px; }
/* t3+: secondo strato rosa-ghiaccio che si alterna al viola (dissolvenza incrociata = arcobaleno freddo) */
.myf-k2 { --c1: #8ff0ff; --c2: #ff8fe6; animation: myf-swap calc(var(--sp) * 1.6) ease-in-out infinite; }

/* t4 (◆15): cornice chiusa di 1 pixel su tutti e quattro i lati */
.myf-ring {
  position: absolute; inset: 0; border: 1px solid var(--c1); border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 230, .55);
  animation: myf-breath calc(var(--sp) * .8) ease-in-out infinite;
}

/* cometa: un pixel bianco con scia viola che corre lungo il bordo (container query: la strada e' grande quanto la casella) */
.myf-cr { position: absolute; inset: -3px; container-type: size; }
.myf-cm {
  position: absolute; left: 0; top: 0; width: 3px; height: 3px; background: #fff;
  box-shadow: 0 0 0 1px var(--c1), 0 0 6px 3px var(--cg);
  animation: myf-run calc(4.2s - var(--ml) * .12s) linear infinite;
}
.myf-cm + .myf-cm { animation-delay: calc((4.2s - var(--ml) * .12s) / -2); background: #bff8ff; }

/* rombi-scintilla a croce di pixel (◆ del mitico) */
.myf-s {
  position: absolute; width: 9px; height: 9px; margin: -4px 0 0 -4px; z-index: 1;
  background:
    linear-gradient(#fff 0 0) center / 3px 3px,
    linear-gradient(var(--c1) 0 0) center / 9px 1px,
    linear-gradient(var(--c1) 0 0) center / 1px 9px,
    linear-gradient(var(--c1) 0 0) center / 5px 3px,
    linear-gradient(var(--c1) 0 0) center / 3px 5px;
  background-repeat: no-repeat; opacity: 0; transform: scale(.2);
  animation: myf-tw calc(var(--sp) * 1.1) steps(6, end) infinite;
}
.myf-s:nth-of-type(1) { left: 16%; top: 18%; }
.myf-s:nth-of-type(2) { left: 84%; top: 76%; animation-delay: -.9s; }
.myf-s:nth-of-type(3) { left: 82%; top: 16%; animation-delay: -1.5s; }
.myf-s:nth-of-type(4) { left: 18%; top: 82%; animation-delay: -.4s; }
.myf-s:nth-of-type(5) { left: 50%; top: 6%; animation-delay: -2s; }

/* t3+: tre granelli che salgono dal fondo */
.myf-m {
  position: absolute; bottom: 6px; width: 2px; height: 2px; background: #fff; box-shadow: 0 0 0 1px var(--c3);
  opacity: 0; animation: myf-up 2.2s linear infinite;
}
.myf-m:nth-of-type(1) { left: 30%; }
.myf-m:nth-of-type(2) { left: 56%; animation-delay: -.75s; background: #bff8ff; }
.myf-m:nth-of-type(3) { left: 74%; animation-delay: -1.5s; background: #ffc4f1; }

/* t4: rombo-corona in cima al centro */
.myf-cw {
  position: absolute; left: 50%; top: -7px; width: 9px; height: 9px; margin-left: -4px;
  background: linear-gradient(135deg, #fff 0 30%, #ff9ff0 30% 60%, #a46bff 60%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: myf-bob 1.6s ease-in-out infinite;
}

@keyframes myf-breath { 0%, 100% { opacity: .62; } 50% { opacity: 1; } }
@keyframes myf-swap { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes myf-tw { 0% { opacity: 0; transform: scale(.2); } 40% { opacity: 1; transform: scale(1); } 70% { opacity: .9; transform: scale(.7); } 100% { opacity: 0; transform: scale(.2); } }
@keyframes myf-up { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes myf-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes myf-run {
  0%    { transform: translate(0, 0); }
  25%   { transform: translate(calc(100cqw - 3px), 0); }
  50%   { transform: translate(calc(100cqw - 3px), calc(100cqh - 3px)); }
  75%   { transform: translate(0, calc(100cqh - 3px)); }
  100%  { transform: translate(0, 0); }
}

/* il telefono chiede meno movimento: cornice e rombi fermi, niente cometa ne' granelli */
@media (prefers-reduced-motion: reduce) {
  .myf *, .myf::before { animation: none !important; }
  .myf-s { opacity: .9; transform: none; }
  .myf-k2, .myf-cr, .myf-m { display: none; }
}
