@font-face { font-family: "Lilita One"; src: url(../assets/fonts/LilitaOne.ttf) format("truetype"); font-display: block; }
@font-face { font-family: "Nunito"; font-weight: 800; src: url(../assets/fonts/Nunito-800.ttf) format("truetype"); font-display: block; }
:root {
  --ink: #0e1230; --navy: #1c2a8a; --navy2: #121a5c; --txt: #fff; --mut: #b9c3ff;
  --gold: #ffc72c; --gold2: #f09a00; --green: #3fdc5c; --red: #ff4d5a; --blue: #3b9dff; --purple: #b05cff;
  --font: "Lilita One", "Arial Black", Impact, sans-serif; --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--txt); font-family: var(--body); font-weight: 800; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; padding: 0; background: none; }
button:disabled { cursor: default; }
img, canvas { -webkit-user-drag: none; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.screen { position: fixed; inset: 0; display: none; overflow: hidden; }
.screen.active { display: block; }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }

/* testo "brawl": Lilita One con contorno scuro spesso */
.fz, h1, h2, h3, .btn, .chip b, .play-btn, .dname, .ribbon, .lvl-badge, .cname, .tag, .stat b { font-family: var(--font); font-weight: 400; letter-spacing: .4px; }
.st { -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.btn, .play-btn, .dname, .ribbon, .chip b, h1, h2, .cname, .stat b, .lvl-badge { -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 var(--ink); }

/* ───── sfondo animato ───── */
.bgfx { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 55%, #5a3fe0 0%, #2a249e 38%, #14165e 70%, #0a0c33 100%); }
.bgfx .rays { position: absolute; left: 50%; top: 58%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.085) 0 7deg, transparent 7deg 18deg); animation: spin 120s linear infinite; mask-image: radial-gradient(circle, #000 4%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 4%, transparent 55%); }
.bgfx .grid { position: absolute; inset: -80px; background: repeating-linear-gradient(135deg, rgba(255,255,255,.04) 0 36px, transparent 36px 72px); animation: slide 14s linear infinite; }
.bgfx .dots { position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(255,255,255,.9) 0 2px, transparent 3px), radial-gradient(circle, rgba(140,220,255,.8) 0 3px, transparent 4px), radial-gradient(circle, rgba(255,210,120,.8) 0 2px, transparent 3px); background-size: 210px 260px, 330px 310px, 270px 340px; background-position: 0 0, 90px 120px, 160px 60px; animation: rise 18s linear infinite; opacity: .55; }
.bgfx.shop { background: radial-gradient(ellipse at 50% 40%, #c44bd8 0%, #6a2bb8 38%, #261672 70%, #0a0c33 100%); }
.bgfx.dark { background: radial-gradient(ellipse at 50% 50%, #2e3bc4 0%, #1a1f80 42%, #0b0e3d 100%); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { to { transform: translate(72px, 72px); } }
@keyframes rise { to { background-position: 0 -260px, 90px -190px, 160px -280px; } }

/* ───── Loading ───── */
#loading { position: fixed; inset: 0; z-index: 99; background: radial-gradient(circle at 50% 40%, #5a3fe0, #0a0c33 72%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; transition: opacity .4s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .logo { font-family: var(--font); font-size: clamp(46px, 11vw, 110px); color: var(--gold); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink), 0 0 50px #ffc72c88; letter-spacing: 4px; animation: logo 2s ease-in-out infinite; }
@keyframes logo { 50% { transform: scale(1.04) rotate(-1deg); } }
.lbar { width: min(60vw, 380px); height: 22px; border-radius: 14px; background: var(--ink); overflow: hidden; border: 4px solid var(--ink); box-shadow: 0 0 0 3px #fff3; }
.lbar i { display: block; height: 100%; width: 0; background: linear-gradient(#fff08a, var(--gold2)); transition: width .15s; }

/* ───── componenti ───── */
.btn { --c1: #ffe36a; --c2: #f5a300; --lip: #a85a00; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .35em; padding: .55em 1.1em; border-radius: 16px; font-size: clamp(18px, 3vh, 26px); color: #fff; background: linear-gradient(var(--c1), var(--c2)); border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--lip), 0 6px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.6), inset 0 -5px 0 rgba(0,0,0,.16); margin-bottom: 8px; transition: transform .07s, filter .15s; }
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--lip), 0 1px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.6), inset 0 -5px 0 rgba(0,0,0,.16); }
.btn:disabled { filter: grayscale(.85) brightness(.7); }
.btn .ico { font-size: 1.15em; }
.btn.g { --c1: #8dff7a; --c2: #20b83e; --lip: #0f6a22; }
.btn.b { --c1: #7cc4ff; --c2: #2468e0; --lip: #123a8a; }
.btn.r { --c1: #ff8a8a; --c2: #e0223e; --lip: #8a0f22; }
.btn.p { --c1: #e0a8ff; --c2: #8a3ce0; --lip: #4a1a8a; }
.btn.k { --c1: #8a93c8; --c2: #4a5399; --lip: #242b66; }
.btn.big { font-size: clamp(22px, 4.4vh, 38px); padding: .5em 1.4em; }
.btn.glow { animation: btnglow 1.4s ease-in-out infinite; }
@keyframes btnglow { 50% { filter: brightness(1.18) drop-shadow(0 0 14px #ffe36a); } }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 4px 16px 4px 8px; border-radius: 24px; background: var(--ink); border: 4px solid var(--ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 4px 0 rgba(0,0,0,.3); font-size: clamp(16px, 2.8vh, 24px); }
.chip .ico { font-size: 1.5em; }
.chip b { font-size: 1.05em; -webkit-text-stroke: 3px #000; }
.sqbtn { width: clamp(44px, 7vh, 56px); height: clamp(44px, 7vh, 56px); border-radius: 15px; background: linear-gradient(#8a93c8, #4a5399); border: 4px solid var(--ink); box-shadow: 0 5px 0 #242b66, 0 5px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.5); font-size: clamp(22px, 3.6vh, 30px); display: grid; place-items: center; margin-bottom: 6px; }
.sqbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 #242b66, 0 1px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.5); }
.sqbtn.y { background: linear-gradient(#ffe36a, #f5a300); box-shadow: 0 5px 0 #a85a00, 0 5px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.6); }
.pbar { position: relative; height: clamp(22px, 3.6vh, 30px); border-radius: 16px; background: var(--ink); border: 4px solid var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,.2); overflow: hidden; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px; background: linear-gradient(#a8f4ff, #25b8e8 60%, #1a86c8); box-shadow: inset 0 3px 0 rgba(255,255,255,.55); transition: width .3s; }
.pbar.gold i { background: linear-gradient(#fff08a, #f5a300); } .pbar.green i { background: linear-gradient(#b6ff9a, #27b84a); }
.pbar b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font); font-weight: 400; font-size: clamp(13px, 2.2vh, 19px); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.panel { background: linear-gradient(#2f3fb8, #1c2685); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.22), inset 0 0 0 2px rgba(255,255,255,.06); }

/* ───── barra alta ───── */
.topbar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) calc(16px + var(--safe-r)) 10px calc(16px + var(--safe-l)); z-index: 5; }
.profile { display: flex; align-items: center; gap: 10px; padding: 4px 18px 4px 4px; border-radius: 40px; background: var(--ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 4px 0 rgba(0,0,0,.3); }
.avatar { position: relative; width: clamp(44px, 8vh, 62px); aspect-ratio: 1; flex: none; }
.avatar img { width: 100%; height: 100%; }
.avatar .lv { position: absolute; right: -8px; bottom: -6px; width: 1.9em; height: 1.9em; display: grid; place-items: center; font-size: clamp(13px, 2.2vh, 17px); font-family: var(--font); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.avatar .lv .ico { position: absolute; inset: 0; width: 100%; height: 100%; font-size: inherit; } .avatar .lv span { position: relative; margin-top: 2px; }
.pinfo { display: flex; flex-direction: column; gap: 4px; }
.pname { font-family: var(--font); font-weight: 400; font-size: clamp(16px, 2.8vh, 22px); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.xpbar { width: clamp(80px, 14vw, 150px); height: 10px; border-radius: 6px; background: #000a; overflow: hidden; border: 2px solid #ffffff30; }
.xpbar i { display: block; height: 100%; background: linear-gradient(#b8ff9a, #27b84a); }

/* ───── HOME ───── */
.stage { position: absolute; left: 50%; top: 9vh; bottom: 24vh; width: min(52vw, 640px); transform: translateX(-50%); }
.stage .aura { position: absolute; left: 50%; bottom: 0; width: 86%; aspect-ratio: 1; transform: translate(-50%, 36%); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 75%, #fff) 0%, color-mix(in srgb, var(--rc) 55%, transparent) 38%, transparent 66%); filter: blur(6px); opacity: .75; }
.stage .disc { position: absolute; left: 50%; bottom: -1%; width: 64%; height: 9%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, color-mix(in srgb, var(--rc) 55%, #fff) 0%, var(--rc) 48%, transparent 72%); border: 0; box-shadow: 0 0 40px var(--rc); }
.hero-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; filter: drop-shadow(0 10px 16px rgba(0,0,0,.45)); }
.hero-cv.dim { filter: grayscale(1) brightness(.5) drop-shadow(0 10px 16px rgba(0,0,0,.45)); }
.dock { position: absolute; left: 50%; bottom: calc(1.6vh + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 3; }
.modesel { display: flex; align-items: center; gap: 8px; }
.modesel .arr { width: 44px; height: 44px; padding: 0; }
.modesel .arr .ico { font-size: 22px; } .flip .ico { transform: scaleX(-1); }
.modebtn { display: flex; align-items: center; gap: 12px; min-width: min(46vw, 300px); padding: 6px 22px 6px 8px; border-radius: 26px; background: linear-gradient(#3a4ad2, #1c2685); border: 4px solid var(--ink); box-shadow: 0 5px 0 rgba(0,0,0,.4), inset 0 3px 0 rgba(255,255,255,.3); text-align: left; }
.modebtn:active { transform: translateY(3px); }
.modebtn .mi { width: clamp(42px, 7vh, 56px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 45%), var(--mc, #3b9dff); border: 4px solid var(--ink); display: grid; place-items: center; font-size: clamp(24px, 4vh, 32px); }
.modebtn b { display: block; font-family: var(--font); font-weight: 400; font-size: clamp(18px, 3.2vh, 26px); line-height: 1; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.modebtn small { color: var(--mut); font-size: clamp(11px, 1.8vh, 14px); }
.play-btn { padding: .22em 2.1em .3em; border-radius: 22px; font-size: clamp(34px, 7.4vh, 62px); color: #fff; background: linear-gradient(#ffec7a, #ffb000 55%, #ff9000); border: 5px solid var(--ink); box-shadow: 0 9px 0 #a85a00, 0 9px 0 5px var(--ink), inset 0 4px 0 rgba(255,255,255,.7), inset 0 -6px 0 rgba(0,0,0,.16), 0 0 50px #ffc72c88; -webkit-text-stroke: 5px var(--ink); animation: pulse 1.8s ease-in-out infinite; margin-bottom: 9px; letter-spacing: 3px; }
.play-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #a85a00, 0 2px 0 5px var(--ink), inset 0 4px 0 rgba(255,255,255,.7); }
@keyframes pulse { 50% { transform: scale(1.035); } }
.side-btn { position: absolute; top: 46%; transform: translateY(-50%); width: clamp(92px, 17vh, 140px); padding: 12px 6px 10px; border-radius: 22px; background: linear-gradient(#4a5af0, #2332b0); border: 4px solid var(--ink); box-shadow: 0 7px 0 #121a6a, 0 7px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.4); font-size: clamp(14px, 2.4vh, 21px); display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; font-family: var(--font); font-weight: 400; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.side-btn .ico { font-size: clamp(38px, 8vh, 66px); }
.side-btn.left { left: calc(2.5vw + var(--safe-l)); } .side-btn.right { right: calc(2.5vw + var(--safe-r)); }
.side-btn:active { transform: translateY(calc(-50% + 5px)); box-shadow: 0 2px 0 #121a6a, 0 2px 0 4px var(--ink), inset 0 3px 0 rgba(255,255,255,.4); }
.side-btn .badge { position: absolute; top: -8px; right: -8px; width: 30px; height: 30px; display: grid; place-items: center; font-size: 26px; animation: bob .8s ease-in-out infinite; }

/* ───── sub-schermate ───── */
.sub-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px; padding: calc(10px + var(--safe-t)) calc(16px + var(--safe-r)) 10px calc(16px + var(--safe-l)); z-index: 5; }
.sub-top h2 { margin: 0; font-size: clamp(26px, 5vh, 42px); } .sub-top h2 small { color: var(--mut); font-size: .55em; margin-left: 8px; font-family: var(--font); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.filters button { padding: 4px 14px 5px; border-radius: 16px; background: var(--ink); border: 3px solid var(--rc, #ffffff40); font-family: var(--font); font-weight: 400; font-size: clamp(13px, 2.2vh, 17px); color: var(--rc, #fff); }
.filters button.on { background: var(--rc, #fff); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.grid { position: absolute; left: 0; right: 0; top: calc(76px + var(--safe-t)); bottom: 0; overflow-y: auto; padding: 14px calc(18px + var(--safe-r)) 34px calc(18px + var(--safe-l)); display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 15vw, 190px), 1fr)); gap: 18px; align-content: start; }
.card { position: relative; border-radius: 20px; border: 5px solid var(--ink); background: radial-gradient(ellipse at 50% 38%, color-mix(in srgb, var(--rc) 55%, #fff) 0%, var(--rc) 40%, color-mix(in srgb, var(--rc) 55%, #000) 100%); box-shadow: 0 6px 0 rgba(0,0,0,.4), inset 0 0 0 3px color-mix(in srgb, var(--rc) 40%, #fff), inset 0 4px 0 3px rgba(255,255,255,.35); overflow: hidden; cursor: pointer; transition: transform .12s; height: 0; padding-bottom: 138%; }
.card::before { content: ""; position: absolute; inset: 0; background: repeating-conic-gradient(from 0deg at 50% 38%, rgba(255,255,255,.16) 0 8deg, transparent 8deg 20deg); }
.card:active { transform: scale(.96); } .card:hover { transform: translateY(-3px); }
.card > img.hero { position: absolute; left: 0; top: 4%; width: 100%; height: 82%; object-fit: cover; object-position: 50% 6%; filter: drop-shadow(0 4px 0 rgba(0,0,0,.25)); }
.card.locked > img.hero { filter: grayscale(1) brightness(.45); } .card.locked { background: radial-gradient(ellipse at 50% 38%, color-mix(in srgb, var(--rc) 28%, #6a7090), color-mix(in srgb, var(--rc) 18%, #1c2040) 80%); }
.card.sel { box-shadow: 0 6px 0 rgba(0,0,0,.4), 0 0 0 4px #fff, 0 0 30px 6px var(--rc), inset 0 4px 0 3px rgba(255,255,255,.35); }
.card .cname { position: absolute; left: 0; right: 0; bottom: 30px; padding: 22px 4px 3px; text-align: center; font-size: clamp(17px, 1.9vw, 23px); line-height: 1; background: linear-gradient(transparent, rgba(8,10,40,.85) 55%); }
.card.locked .cname { opacity: .6; }
.card .rolei { position: absolute; top: 7px; right: 7px; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; font-size: 19px; border: 2px solid #ffffff30; }
.card .lvbadge { position: absolute; top: 5px; left: 5px; width: 40px; height: 40px; display: grid; place-items: center; font-family: var(--font); font-size: 18px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.card .lvbadge .ico { position: absolute; inset: 0; width: 100%; height: 100%; } .card .lvbadge span { position: relative; margin-top: 3px; }
.card .lock { position: absolute; top: 6px; left: 7px; font-size: 32px; }
.card .up { position: absolute; bottom: 36px; right: 5px; font-size: 30px; animation: bob .8s ease-in-out infinite; z-index: 2; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.souls { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 22px; }
.souls .pbar { height: 20px; border-width: 3px; } .souls .pbar b { font-size: 12px; -webkit-text-stroke: 2.5px var(--ink); }
.souls img { position: absolute; left: -7px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; z-index: 2; }
.souls .pbar { margin-left: 18px; }

/* ───── Modal ───── */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(6,8,34,.82); display: flex; align-items: center; justify-content: center; padding: 14px; backdrop-filter: blur(3px); }
.modal-box { background: linear-gradient(#2f3fb8, #1c2685); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 9px 0 rgba(0,0,0,.4), inset 0 3px 0 rgba(255,255,255,.25); padding: 22px; max-height: 94vh; overflow-y: auto; width: min(960px, 100%); text-align: center; animation: pop .22s cubic-bezier(.3,1.4,.6,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal-box h2, .modal-box h1 { margin: 0 0 14px; font-size: clamp(28px, 5vh, 44px); color: var(--gold); -webkit-text-stroke: 5px var(--ink); }
.modal-box h3 { margin: 14px 0 10px; color: var(--mut); font-size: 22px; }
.mode-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mode-card { --mc: #3b9dff; background: linear-gradient(#1a2275, #10165a); border: 4px solid var(--ink); border-radius: 20px; padding: 14px 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; transition: transform .1s; box-shadow: 0 5px 0 rgba(0,0,0,.4), inset 0 0 0 3px color-mix(in srgb, var(--mc) 50%, transparent); }
.mode-card:hover { transform: translateY(-4px); } .mode-card.on { box-shadow: 0 5px 0 rgba(0,0,0,.4), inset 0 0 0 4px var(--gold), 0 0 24px #ffc72c88; }
.mode-card .mode-ico { width: 76px; height: 76px; border-radius: 50%; border: 4px solid var(--ink); background: radial-gradient(circle at 35% 28%, #fff9, transparent 45%), var(--mc); display: grid; place-items: center; font-size: 46px; margin-bottom: 4px; }
.mode-card b { font-family: var(--font); font-weight: 400; font-size: 22px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .mode-card em { color: var(--gold); font-style: normal; font-size: 14px; }
.mode-card p { font-size: 13px; color: var(--mut); margin: 6px 0 8px; line-height: 1.35; flex: 1; }
.king-pick { display: flex; flex-direction: column; gap: 4px; width: 100%; } .king-pick .btn { font-size: 15px; padding: .35em .6em; margin-bottom: 6px; }
.result h1.win { color: var(--gold); } .result h1.lose { color: #ff8a9a; }
.rw-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.rw { background: var(--ink); border-radius: 18px; padding: 10px 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 110px; } .rw .ico { font-size: 38px; } .rw b { font-family: var(--font); font-weight: 400; font-size: 24px; -webkit-text-stroke: 3px #000; paint-order: stroke fill; }
.levelup { margin: 14px auto 0; display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(#7cc4ff, #2468e0); border: 4px solid var(--ink); padding: 6px 22px; border-radius: 16px; font-family: var(--font); font-size: 26px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; animation: pulse 1s infinite; }
.drops, .tiles { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.drop, .tile { position: relative; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rc) 60%, #fff), var(--rc) 55%, color-mix(in srgb, var(--rc) 50%, #000)); border: 4px solid var(--ink); border-radius: 18px; padding: 12px 14px 8px; width: 128px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 5px 0 rgba(0,0,0,.35); }
.drop img, .tile img { width: 76px; height: 76px; } .drop b, .tile b { font-family: var(--font); font-weight: 400; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .drop span, .tile span { font-size: 13px; }
.drop em, .tile em { position: absolute; top: -10px; right: -8px; background: var(--red); border: 3px solid var(--ink); font-style: normal; font-family: var(--font); font-size: 13px; padding: 1px 10px; border-radius: 12px; transform: rotate(8deg); }
.tile { opacity: 0; animation: tilein .45s ease-out forwards; } @keyframes tilein { from { transform: scale(.3) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.dev { display: grid; gap: 8px; } .art-stat { color: var(--mut); margin: 0 0 10px; }
.audio-rows { display: grid; gap: 18px; margin: 8px 0 18px; text-align: left; min-width: min(380px, 80vw); }
.audio-rows label { display: flex; align-items: center; gap: 12px; font-family: var(--font); font-weight: 400; font-size: 22px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .audio-rows label .ico { font-size: 38px; }
.audio-rows input[type=range] { flex: 1; accent-color: var(--gold2); height: 30px; }

/* ───── scheda personaggio ───── */
#screen-detail .dgrid { position: absolute; left: 0; right: 0; top: calc(78px + var(--safe-t)); bottom: 0; display: grid; grid-template-columns: minmax(200px, 27%) 1fr minmax(240px, 34%); gap: 18px; padding: 0 calc(22px + var(--safe-r)) calc(14px + var(--safe-b)) calc(22px + var(--safe-l)); }
.d-left { display: flex; flex-direction: column; gap: 12px; padding-top: 4vh; min-width: 0; }
.dname { margin: 0; font-size: clamp(40px, 9vh, 84px); line-height: .95; -webkit-text-stroke: 7px var(--ink); text-shadow: 0 6px 0 var(--ink); color: #fff; word-break: break-word; }
.ribbon { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 4px 22px 6px 14px; font-size: clamp(18px, 3.4vh, 28px); background: linear-gradient(color-mix(in srgb, var(--rc) 60%, #fff), var(--rc) 60%, color-mix(in srgb, var(--rc) 75%, #000)); border: 4px solid var(--ink); border-radius: 12px 26px 26px 12px; box-shadow: 0 5px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.5); }
.rolepill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 3px 18px 4px 8px; border-radius: 22px; background: var(--ink); font-family: var(--font); font-size: clamp(16px, 3vh, 24px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); } .rolepill .ico { font-size: 1.6em; }
.descp { padding: 12px 16px; border-radius: 16px; background: rgba(8,10,48,.7); border: 3px solid rgba(255,255,255,.14); }
.descp h4 { margin: 0 0 4px; font-family: var(--font); font-weight: 400; font-size: clamp(16px, 2.6vh, 22px); color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.descp p { margin: 0; color: #dde2ff; font-size: clamp(13px, 2.1vh, 17px); line-height: 1.4; }
.d-mid { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.d-stage { position: relative; flex: 1; width: 100%; min-height: 0; }
.d-stage::before { content: ""; position: absolute; left: 50%; bottom: 3%; width: min(120%, 90vh); aspect-ratio: 1; transform: translate(-50%, 36%); border-radius: 50%; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 70%, #fff) 0 6deg, transparent 6deg 16deg); opacity: .32; mask-image: radial-gradient(circle, #000 10%, transparent 62%); -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 62%); animation: spin 90s linear infinite; }
.d-stage .aura { position: absolute; left: 50%; bottom: 8%; width: min(105%, 80vh); aspect-ratio: 1; transform: translate(-50%, 30%); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 85%, #fff) 0%, color-mix(in srgb, var(--rc) 65%, transparent) 36%, transparent 66%); opacity: .9; }
.d-stage .disc { position: absolute; left: 50%; bottom: 2%; width: 60%; height: 7%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, color-mix(in srgb, var(--rc) 55%, #fff) 0%, var(--rc) 48%, transparent 72%); box-shadow: 0 0 40px var(--rc); }
.d-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding-top: 6px; z-index: 2; }
.d-actions .btn { min-width: 0; width: 100%; padding-left: 10px; padding-right: 10px; font-size: clamp(18px, 3.6vh, 26px); white-space: nowrap; }
.arow { display: flex; gap: 10px; width: 100%; align-items: flex-start; justify-content: center; } .acol { display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; align-items: stretch; gap: 2px; } .acol .btn { margin-bottom: 4px; }
.soulrow { display: flex; align-items: center; gap: 0; width: 100%; padding-left: 10px; }
.soulrow img { width: clamp(40px, 7vh, 54px); height: clamp(40px, 7vh, 54px); margin-right: -14px; position: relative; z-index: 2; } .soulrow .pbar { flex: 1; }
.d-right { display: flex; flex-direction: column; gap: 10px; padding-top: 2vh; min-width: 0; overflow-y: auto; }
.d-right h3 { margin: 0; font-size: clamp(20px, 3.4vh, 28px); color: var(--gold); -webkit-text-stroke: 4px var(--ink); } .d-right h3 small { color: var(--mut); font-size: .7em; }
.atk-row { --c: #fff; position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: 16px; background: linear-gradient(rgba(14,18,70,.9), rgba(10,14,56,.9)); border: 4px solid var(--ink); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--c) 55%, transparent), 0 4px 0 rgba(0,0,0,.3); }
.atk-row .ai { flex: none; width: clamp(40px, 6.6vh, 54px); aspect-ratio: 1; border-radius: 50%; border: 4px solid var(--ink); background: radial-gradient(circle at 35% 28%, #fff9, transparent 45%), var(--c); display: grid; place-items: center; font-size: clamp(22px, 3.6vh, 30px); }
.a-main { flex: 1; min-width: 0; } .a-main b { display: block; font-family: var(--font); font-weight: 400; font-size: clamp(15px, 2.6vh, 20px); color: var(--c); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; line-height: 1.05; } .a-main small { color: #cdd4ff; font-size: clamp(11px, 1.8vh, 14px); line-height: 1.25; display: block; margin-top: 2px; }
.a-mana { display: flex; align-items: center; gap: 2px; font-family: var(--font); font-size: clamp(16px, 2.6vh, 22px); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; } .a-mana .ico { font-size: 1.3em; }
.statbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 2px; }
.stat { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 6px; border-radius: 16px; background: var(--ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,.16); } .stat .ico { font-size: clamp(26px, 4.4vh, 38px); } .stat b { font-size: clamp(20px, 3.6vh, 30px); -webkit-text-stroke: 3px #000; }
.locked-note { text-align: center; color: var(--mut); font-size: 14px; }

/* ───── shop ───── */
.shop-body { position: absolute; left: 0; right: 0; top: calc(80px + var(--safe-t)); bottom: 0; overflow-y: auto; padding: 14px calc(18px + var(--safe-r)) 30px calc(18px + var(--safe-l)); display: grid; gap: 16px; align-content: start; max-width: 940px; margin: 0 auto; }
.banner, .soon { padding: 20px; text-align: center; } .banner { background: linear-gradient(#8b3bd8, #4a1fa0); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.3); }
.banner h3 { margin: 0 0 6px; font-size: clamp(30px, 5.4vh, 46px); color: var(--gold); -webkit-text-stroke: 6px var(--ink); } .banner p, .soon p { color: #e8dcff; margin: 4px 0 10px; }
.rates { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; } .rates span { background: var(--ink); border: 3px solid var(--rc); color: var(--rc); border-radius: 14px; padding: 2px 12px 3px; font-family: var(--font); font-size: 15px; }
.soon { opacity: .6; background: linear-gradient(#2f3fb8, #1c2685); border: 4px solid var(--ink); border-radius: 22px; } .soon h3 { margin: 0; }

/* toast + rotate */
#toast { position: fixed; left: 50%; bottom: 14vh; transform: translateX(-50%) translateY(20px); background: var(--ink); border: 4px solid #ffffff30; padding: 10px 26px; border-radius: 20px; z-index: 80; opacity: 0; transition: .25s; pointer-events: none; font-family: var(--font); font-weight: 400; font-size: 20px; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#rotate { position: fixed; inset: 0; z-index: 90; background: var(--ink); display: none; align-items: center; justify-content: center; text-align: center; font-family: var(--font); font-size: 26px; color: var(--gold); flex-direction: column; gap: 14px; }
#rotate .ico { font-size: 80px; animation: spin 3s linear infinite; }
@media (orientation: portrait) and (max-width: 700px) { body[data-screen="battle"] #rotate { display: flex; } }

/* ───── BATTAGLIA ───── */
#screen-battle { background: #000; touch-action: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--font); font-weight: 400; }
#hud button { pointer-events: auto; touch-action: none; }
.b-top { position: absolute; top: calc(8px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; align-items: flex-start; gap: 10px; }
.b-btn { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(#8a93c8, #4a5399); border: 4px solid var(--ink); box-shadow: 0 5px 0 #242b66, inset 0 3px 0 rgba(255,255,255,.45); color: #fff; display: grid; place-items: center; font-size: 28px; }
.b-btn.down, .b-atk.down { filter: brightness(1.4); transform: translateY(3px) scale(.95); }
.b-info { flex: 1; text-align: center; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.b-title { font-size: clamp(16px, 2.8vh, 24px); letter-spacing: 3px; color: var(--gold); }
.b-sub { font-size: clamp(18px, 3.2vh, 28px); display: flex; gap: 8px; align-items: center; justify-content: center; } .b-sub .ico { font-size: 1.1em; }
.b-bars { display: grid; gap: 4px; width: min(340px, 90%); margin: 4px auto 0; }
.zb { display: grid; grid-template-columns: 110px 1fr 40px; gap: 6px; align-items: center; font-size: 14px; } .zb span { text-align: right; display: flex; justify-content: flex-end; gap: 4px; align-items: center; } .zb div { height: 14px; background: var(--ink); border-radius: 8px; overflow: hidden; border: 3px solid var(--ink); } .zb i { display: block; height: 100%; } .zb em { font-style: normal; text-align: left; }
.b-feed { width: 210px; font-size: 15px; text-align: right; display: grid; gap: 3px; justify-items: end; }
.b-feed div { background: var(--ink); border-radius: 12px; padding: 1px 12px 3px; animation: tilein .25s; display: flex; gap: 6px; align-items: center; } .b-feed .ico { font-size: 1.1em; }
.b-banner { position: absolute; top: 22%; left: 0; right: 0; text-align: center; font-size: clamp(34px, 9vh, 82px); text-shadow: 0 6px 0 var(--ink), 0 0 36px currentColor; opacity: 0; transform: scale(.7); transition: .2s; letter-spacing: 3px; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; }
.b-banner small { display: block; font-size: .34em; color: #fff; letter-spacing: 4px; -webkit-text-stroke: 4px var(--ink); }
.b-banner.show { opacity: 1; transform: scale(1); }
.b-bot { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); display: flex; align-items: flex-end; justify-content: space-between; }
.b-pad { display: none; gap: 14px; } .b-pad .b-btn { width: 80px; height: 80px; font-size: 40px; }
@media (pointer: coarse) { .b-pad { display: flex; } }
.b-mid { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); width: clamp(190px, 30vw, 440px); }
.b-mana { position: relative; height: 34px; border-radius: 18px; background: var(--ink); border: 4px solid var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,.22); overflow: hidden; }
.b-mana-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#f0a8ff, #b02cf0 55%, #8a14c8); transition: width .08s linear; box-shadow: inset 0 3px 0 rgba(255,255,255,.5); }
.b-mana-ticks { position: absolute; inset: 0; display: flex; } .b-mana-ticks i { flex: 1; border-right: 2px solid rgba(14,18,48,.7); } .b-mana-ticks i:last-child { border: 0; }
.b-mana-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; } .b-mana-num .ico { font-size: 1.2em; }
.b-right { display: flex; align-items: flex-end; gap: 12px; margin-left: auto; }
.b-move { display: grid; gap: 8px; } .b-move .b-btn { width: 68px; height: 68px; position: relative; font-size: 36px; } .b-move small { position: absolute; bottom: 1px; font-size: 10px; opacity: .85; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.b-move .b-btn.off { opacity: .5; }
.b-acts { display: grid; grid-template-columns: repeat(3, auto); gap: 9px; direction: rtl; } .b-acts > * { direction: ltr; }
.b-atk { position: relative; width: 78px; height: 78px; border-radius: 50%; background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.75) 0%, transparent 42%), radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c) 85%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 70%, #000)); border: 5px solid var(--ink); box-shadow: 0 5px 0 rgba(0,0,0,.4), inset 0 0 0 3px rgba(255,255,255,.35); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; transition: transform .06s, filter .12s; }
.b-atk .ai { font-size: 36px; margin-top: -4px; } .b-atk .n { display: none; }
.b-atk .m { position: absolute; top: 1px; right: 4px; display: flex; align-items: center; font-size: 17px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .b-atk .m .ico { font-size: .95em; }
.b-atk .k { position: absolute; bottom: 1px; font-size: 12px; opacity: .95; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.b-atk .cdov { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(14,18,48,.7); pointer-events: none; }
.b-atk.off { filter: grayscale(.85) brightness(.6); } .b-atk.ready { box-shadow: 0 5px 0 rgba(0,0,0,.4), inset 0 0 0 3px rgba(255,255,255,.35), 0 0 20px var(--c); }
.b-acts .b-atk[data-a="a0"] { width: 92px; height: 92px; } .b-acts .b-atk[data-a="a0"] .ai { font-size: 44px; }
.b-pause-ov { position: absolute; inset: 0; background: rgba(6,8,34,.8); display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.b-pause-box { display: grid; gap: 14px; text-align: center; } .b-pause-box h2 { margin: 0 0 6px; font-size: 56px; color: var(--gold); -webkit-text-stroke: 7px var(--ink); }
.b-pause-ov.hidden { display: none; }
.b-pause-snd { display: flex; gap: 12px; justify-content: center; }
.b-pause-snd button { display: flex; align-items: center; gap: 8px; padding: 8px 18px 10px; border-radius: 16px; background: linear-gradient(#8a93c8, #4a5399); border: 4px solid var(--ink); box-shadow: 0 5px 0 #242b66; color: #fff; font-size: 20px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .b-pause-snd button .ico { font-size: 1.5em; }
.b-pause-snd button.off { opacity: .5; }

@media (max-width: 900px) {
  #screen-detail .dgrid { grid-template-columns: minmax(150px, 26%) 1fr minmax(180px, 36%); gap: 10px; }
  .atk-row .a-main small { display: none; }
}
@media (max-width: 820px), (max-height: 520px) {
  .mode-row { grid-template-columns: repeat(2, 1fr); }
  .b-mid { bottom: calc(100px + var(--safe-b)); width: clamp(160px, 30vw, 300px); }
  .b-atk { width: 62px; height: 62px; } .b-acts .b-atk[data-a="a0"] { width: 74px; height: 74px; } .b-atk .ai { font-size: 30px; }
  .b-move .b-btn { width: 56px; height: 56px; font-size: 30px; } .b-pad .b-btn { width: 68px; height: 68px; font-size: 34px; }
  .b-feed { width: 140px; font-size: 12px; }
}
@media (max-width: 640px) and (orientation: portrait) {
  #screen-detail .dgrid { grid-template-columns: 1fr; grid-auto-rows: auto; overflow-y: auto; }
  .d-mid { min-height: 52vh; }
}
@media (pointer: fine) { .b-move small, .b-atk .k { display: block; } }
@media (pointer: coarse) { .b-atk .k, .b-move small { display: none; } }

/* ───── Profilo ───── */
.profile { cursor: pointer; transition: transform .1s; } .profile:hover { transform: translateY(-2px); }
#modal.profile .modal-box { width: min(880px, 100%); }
.phead { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; text-align: left; }
.avatar.big { width: clamp(70px, 14vh, 100px); }
.phead h2 { margin: 0 0 6px; }
.ptot { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: clamp(14px, 2.4vh, 18px); color: var(--mut); }
.ptot span { display: inline-flex; align-items: center; gap: 6px; } .ptot .ico { width: 1.5em; height: 1.5em; } .ptot b { font-family: var(--font); font-weight: 400; color: #fff; font-size: 1.25em; }
.plist { display: grid; gap: 10px; }
.prow { --mc: #3b9dff; display: grid; grid-template-columns: minmax(150px, 26%) 1fr; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; background: linear-gradient(#1a2275, #10165a); border: 4px solid var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 0 0 3px color-mix(in srgb, var(--mc) 50%, transparent); text-align: left; }
.pmode { display: flex; align-items: center; gap: 10px; } .pmode b { display: block; font-family: var(--font); font-weight: 400; font-size: clamp(17px, 3vh, 24px); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } .pmode small { color: var(--mut); font-size: 13px; }
.pmode .mi { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 35% 28%, #fff9, transparent 45%), var(--mc); display: grid; place-items: center; font-size: 28px; }
.pgrid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pst { min-width: 84px; flex: 1 1 84px; max-width: 130px; padding: 6px 8px; border-radius: 12px; background: rgba(8,10,48,.7); display: flex; flex-direction: column; align-items: center; gap: 0; }
.pst .ico { width: 1.5em; height: 1.5em; font-size: 18px; } .pst b { font-family: var(--font); font-weight: 400; font-size: clamp(18px, 3.2vh, 24px); } .pst small { color: var(--mut); font-size: 12px; }
@media (max-width: 820px), (max-height: 520px) { .prow { grid-template-columns: 1fr; } .pgrid { justify-content: flex-start; } }
