:root {
  --accent: #4fa3ff;
  --bg0: #04050b;
  --bg1: #171233;
  --card: rgba(255, 255, 255, .06);
  --card-brd: rgba(255, 255, 255, .12);
  --text: #eaeaf5;
  --muted: #9aa0c0;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
html, body { margin: 0; height: 100%; touch-action: manipulation; -ms-touch-action: manipulation; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 90% at 50% -10%, var(--bg1), var(--bg0) 60%);
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}

/* campo stellare di sfondo */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 60%, #fff, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    radial-gradient(1px 1px at 85% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 15% 65%, #fff, transparent),
    radial-gradient(1px 1px at 90% 85%, #fff, transparent);
  background-size: 100% 100%;
  opacity: .5; animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .3; } to { opacity: .7; } }

#app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto; height: 100%;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0) 14px 0;
}

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px 6px; }
.pet-name { font-weight: 700; font-size: 17px; }
/* home: stelline a sinistra, nome al centro, opzioni a destra */
.topbar .pet-name#petName { flex: 1; text-align: center; }
/* stelle: nessun badge; icona dello stesso colore (dorato) del numero */
.credits { background: none; border: 0; padding: 5px 2px; font-size: 15px; }
.credits i, .credits b { color: #ffe066; }
.icon-btn { background: var(--card); border: 1px solid var(--card-brd); color: var(--text); width: 36px; height: 36px; border-radius: 12px; font-size: 17px; line-height: 1; flex: none; cursor: pointer; display: grid; place-items: center; }
.icon-btn:active { transform: scale(.92); }
.back { background: var(--card); border: 1px solid var(--card-brd); color: var(--text); width: 36px; height: 36px; border-radius: 12px; font-size: 22px; line-height: 1; }

/* ---- stage (astronauta) ---- */
.stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 24px; margin: 4px 0;
  background:
    radial-gradient(90% 70% at 50% 40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--card);
  border: 1px solid var(--card-brd); overflow: hidden;
}
/* nome del pianeta: mostrato a destra dell'icona, in alto a destra (vedi .stage-icon) */

/* statistiche circolari impilate, in alto a sinistra del riquadro */
.stat-orbits { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; flex-direction: column; gap: 9px; }
.orbit {
  --v: 100; width: 42px; height: 42px; border-radius: 50%; position: relative;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), rgba(255,255,255,.14) 0);
  transition: background .4s ease;
}
.orbit::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #0a0b16; }
.orbit i { position: relative; z-index: 1; font-size: 16px; color: var(--c); }
.orbit.low { animation: blink 1s infinite; }
.orbit.low::before { box-shadow: 0 0 0 1.5px rgba(255,122,122,.7); }

/* pianeti nel riquadro, in alto a destra: icona + nome del pianeta alla sua destra */
.stage-icon {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  height: 34px; padding: 0 12px 0 10px; border-radius: 999px; cursor: pointer;
  background: rgba(0,0,0,.32); border: 1px solid var(--card-brd); color: var(--text);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
  max-width: 60%;
}
.stage-icon i { font-size: 16px; color: #fff; }
.stage-icon span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-icon:active { transform: scale(.94); }
/* nuvoletta: nel flusso, subito sopra la testa dell'astronauta */
.bubble {
  position: relative; z-index: 3; margin: 0 0 10px; background: #fff; color: #1a1a2e; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 14px; max-width: 80%; text-align: center; animation: floatb 3s ease-in-out infinite;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.bubble::after { content: ""; position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #fff; border-bottom: 0; }
.bubble.pop { animation: none; opacity: 0; transform: scale(.85) translateY(-6px); transition: opacity .18s ease, transform .18s ease; }
@keyframes floatb { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* occhi che seguono il dito (spostamento del gruppo eyes) */
.astro-eyes { transition: transform .13s ease-out; }
@media (prefers-reduced-motion: reduce) { .astro-eyes { transition: none; } }

.astro-wrap { position: relative; width: 62%; max-width: 240px; animation: float 3.5s ease-in-out infinite; filter: drop-shadow(0 12px 18px rgba(0,0,0,.5)); }
.dirt-layer { position: absolute; inset: 0; pointer-events: none; }
.smudge {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 46% 54% 55% 45% / 52% 46% 54% 48%;
  background: radial-gradient(circle at 40% 35%, rgba(120,88,54,.95), rgba(84,60,38,.72) 55%, rgba(60,45,30,0) 72%);
  filter: blur(.4px); transition: opacity .15s, transform .2s;
}
.smudge.gone { opacity: 0 !important; transform: translate(-50%, -50%) scale(.3); }
.crumb-layer { position: absolute; inset: 0; pointer-events: none; }
.crumb {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 44% 56% 60% 40% / 55% 45% 55% 45%;
  background: radial-gradient(circle at 40% 35%, #edb87a, #b9793f 72%);
  box-shadow: 0 1px 2px rgba(0,0,0,.45);
  animation: crumbIn .3s ease; transition: opacity .15s, transform .2s;
}
.crumb.gone { opacity: 0 !important; transform: translate(-50%, -50%) scale(.3); }
@keyframes crumbIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.2); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.astro { width: 100%; height: auto; display: block; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-14px) rotate(1.5deg); } }
.astro-wrap.bounce { animation: bounce .5s ease; }
@keyframes bounce { 0%,100% { transform: scale(1); } 40% { transform: scale(1.12); } }
.astro-wrap.eating { animation: chew .5s ease; }
@keyframes chew { 0%,100% { transform: scale(1) rotate(0); } 25% { transform: scale(1.1,.9) rotate(-3deg); } 60% { transform: scale(.94,1.08) rotate(3deg); } }
.astro-wrap.sick { filter: drop-shadow(0 12px 18px rgba(0,0,0,.5)) saturate(.6); }
.astro-wrap.sleeping { animation: floatslow 5s ease-in-out infinite; }
@keyframes floatslow { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(0); } }
.astro-wrap.target { filter: drop-shadow(0 0 16px var(--accent)) drop-shadow(0 12px 18px rgba(0,0,0,.5)); transform: scale(1.06); transition: transform .12s; }
.ground { position: absolute; bottom: 0; width: 140%; height: 60px; background: radial-gradient(60% 100% at 50% 100%, color-mix(in srgb, var(--accent) 40%, #222), transparent 70%); }

/* ---- stat ---- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 10px 2px; }
.stat-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.bar { height: 9px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.stat.low .stat-top { color: #ff7a7a; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

/* ---- azioni ---- */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 0 12px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 0; color: var(--text);
  border-radius: 16px; padding: 12px 4px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform .1s;
}
.act span { font-size: 24px; }
.act:active { transform: scale(.93); }
.act.primary { background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7a3fff)); }

/* ---- tabbar ---- */
.tabbar { display: flex; padding-bottom: calc(6px + var(--safe-b)); padding-top: 4px; border-top: 1px solid var(--card-brd); }
.tabbar button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; }
.tabbar button small { font-size: 10px; }
.tabbar button.on { color: var(--text); }
.tabbar button.on small { color: var(--text); }

/* ---- scroll pagine ---- */
.scroll { flex: 1; overflow-y: auto; padding: 8px 2px 16px; -webkit-overflow-scrolling: touch; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 4px 2px 14px; }

/* ---- cibo ---- */
.food-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.food { background: var(--card); border: 0; border-radius: 18px; padding: 14px 8px; color: var(--text); cursor: pointer; transition: transform .1s; }
.food:active { transform: scale(.95); }
.food:disabled { opacity: .4; }
.food-emoji { font-size: 40px; }
.food-name { font-size: 13px; font-weight: 600; margin: 6px 0 3px; }
.food-cost { font-size: 12px; color: #ffe066; }

/* ---- giochi ---- */
.game-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 0; border-radius: 18px; padding: 14px; color: var(--text); margin-bottom: 10px; cursor: pointer; }
.game-card:active { transform: scale(.98); }
.game-emoji { font-size: 34px; }
.game-info { flex: 1; }
.game-planet { display: block; font-size: 11px; color: var(--accent); margin-top: 1px; }
.game-info small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.game-best { font-size: 11px; color: #ffe066; }
.game-card.locked { opacity: .55; }

/* ---- pianeti ---- */
.planet-list { display: flex; flex-direction: column; gap: 10px; }
.planet-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 0; border-radius: 18px; padding: 12px 14px; cursor: pointer; }
.planet-row.locked { opacity: .5; cursor: default; }
.planet-row.cantbuy { opacity: .62; }
.planet-row.here { box-shadow: 0 0 0 2px var(--accent) inset; }
.planet-dot { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.planet-meta { flex: 1; }
.planet-meta small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.planet-cta { font-size: 13px; color: var(--muted); }
.planet-cta .go { color: var(--accent); font-weight: 600; }

/* ---- form / bottoni ---- */
.field { display: block; margin: 8px 2px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; background: var(--card); border: 1px solid var(--card-brd); border-radius: 12px; padding: 12px; color: var(--text); font-size: 16px; }
.btn { width: 100%; border: 0; border-radius: 14px; padding: 13px; font-size: 15px; font-weight: 600; margin: 8px 0; cursor: pointer; color: #fff; }
.btn.primary { background: linear-gradient(160deg, var(--accent), #7a3fff); }
.btn.ghost { background: var(--card); border: 1px solid var(--card-brd); color: var(--text); }
.btn.danger { background: rgba(255,90,90,.15); border: 1px solid rgba(255,90,90,.4); color: #ff8a8a; }
.about { background: var(--card); border: 1px solid var(--card-brd); border-radius: 16px; padding: 14px; margin: 16px 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.about b { color: var(--text); }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #fff; color: #1a1a2e; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= MINIGIOCHI ================= */
.game-host { position: absolute; inset: 0; z-index: 40; background: var(--bg0); }
.mg { position: absolute; inset: 0; display: flex; flex-direction: column; }
.mg-hud { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top,0)) 16px 8px; font-weight: 700; font-size: 18px; z-index: 2; }
.mg-hud #mgScore { color: #ffe066; }
.mg-quit { margin-left: auto; background: var(--card); border: 1px solid var(--card-brd); color: var(--text); width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
#mgCanvas, .mg-canvas { flex: 1; width: 100%; height: 100%; min-height: 0; touch-action: none; display: block; }
.mg-hint { position: absolute; bottom: calc(16px + var(--safe-b)); left: 0; right: 0; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }

.mg-over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(6,8,18,.86); backdrop-filter: blur(4px); z-index: 3; padding: 24px; }
.mg-over h2 { font-size: 30px; margin: 0; }
.mg-final { font-size: 40px; font-weight: 800; color: #ffe066; margin: 4px 0; }
.mg-sub { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.mg-over .btn { max-width: 260px; }

/* memory */
.mg-mem { padding: 0 14px; }
.mem-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; align-content: center; padding: 10px 0 calc(20px + var(--safe-b)); }
.mem-card { position: relative; aspect-ratio: 3/4; border: 0; background: none; cursor: pointer; perspective: 600px; }
.mem-back, .mem-front { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 14px; font-size: 30px; backface-visibility: hidden; transition: transform .4s; border: 1px solid var(--card-brd); }
.mem-back { background: linear-gradient(160deg, #2a2350, #171233); transform: rotateY(0); }
.mem-front { background: var(--card); transform: rotateY(180deg); }
.mem-card.flipped .mem-back { transform: rotateY(180deg); }
.mem-card.flipped .mem-front { transform: rotateY(0); }
.mem-card.done .mem-front { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }

/* ================= TRANSIZIONI SCHERMATE ================= */
.anim-fwd  { animation: inFwd .26s ease both; }
.anim-back { animation: inBack .26s ease both; }
.anim-fade { animation: inFade .22s ease both; }
@keyframes inFwd  { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes inBack { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes inFade { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }

/* ================= MODALITÀ NOTTE / SONNO ================= */
.stage.night { background: radial-gradient(90% 70% at 50% 30%, rgba(60,80,160,.28), transparent 70%), linear-gradient(180deg, #0a1030, #05060f); }
.stage.night::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 78% 24%, rgba(255,255,255,.9) 0 2px, transparent 3px), radial-gradient(circle at 70% 20%, rgba(255,255,255,.5) 0 6px, transparent 7px); opacity: .0; }
.zzz { position: absolute; top: 62px; left: 58%; display: flex; gap: 4px; font-weight: 800; color: #cfe0ff; font-size: 20px; }
.zzz span { animation: zfloat 2.2s ease-in-out infinite; opacity: 0; }
.zzz span:nth-child(1) { animation-delay: 0s; font-size: 16px; }
.zzz span:nth-child(2) { animation-delay: .5s; font-size: 20px; }
.zzz span:nth-child(3) { animation-delay: 1s; font-size: 26px; }
@keyframes zfloat { 0% { opacity: 0; transform: translateY(6px) scale(.8); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px) scale(1.2); } }

/* ================= EFFETTO PAPPA ================= */
.nom { position: absolute; font-size: 30px; pointer-events: none; transform: translate(-50%,-50%); animation: nomUp .9s ease forwards; z-index: 5; }
@keyframes nomUp { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); } 25% { opacity: 1; transform: translate(-50%,-90%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%,-160%) scale(1); } }

/* ================= BOTTOM SHEET CIBO ================= */
.feeding .stage { z-index: 60; }
.sheet-layer { position: fixed; inset: 0; z-index: 55; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4,6,14,.45); opacity: 0; transition: opacity .3s; }
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 70;
  max-width: 480px; margin: 0 auto;
  background: linear-gradient(180deg, #1b1642, #12102b);
  border-radius: 24px 24px 0 0; border: 1px solid var(--card-brd); border-bottom: 0;
  padding: 8px 16px calc(20px + var(--safe-b));
  transform: translateY(105%); transition: transform .32s cubic-bezier(.25,.9,.3,1);
  box-shadow: 0 -12px 40px rgba(0,0,0,.5);
}
.sheet-layer.open .sheet { transform: translateY(0); }
.sheet-handle { width: 44px; height: 5px; border-radius: 999px; background: rgba(255,255,255,.28); margin: 4px auto 12px; cursor: pointer; }
.sheet-title { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.sheet-foods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.food-chip {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 0; border-radius: 16px;
  padding: 12px 4px 10px; color: var(--text); cursor: grab; touch-action: none;
  transition: transform .1s;
}
.food-chip:active { cursor: grabbing; transform: scale(.95); }
.food-chip:disabled { opacity: .35; }
.chip-emoji { font-size: 34px; pointer-events: none; }
.chip-name { font-size: 11px; font-weight: 600; pointer-events: none; }
.chip-cost { font-size: 11px; color: #ffe066; pointer-events: none; }

/* fantasma trascinato */
.drag-ghost {
  position: fixed; z-index: 100; font-size: 44px; pointer-events: none;
  transform: translate(-50%,-50%); filter: drop-shadow(0 6px 10px rgba(0,0,0,.5));
  transition: transform .1s;
}
.drag-ghost.hot { transform: translate(-50%,-50%) scale(1.25); }
.drag-ghost.drop-cancel { transition: opacity .2s, transform .2s; opacity: 0; transform: translate(-50%,-50%) scale(.5); }

@media (prefers-reduced-motion: reduce) {
  .anim-fwd, .anim-back, .anim-fade, .astro-wrap, .bubble { animation: none !important; }
}

/* ================= LAVAGGIO (spugna) ================= */
.wash-layer { position: fixed; inset: 0; z-index: 55; touch-action: none; }
.wash-backdrop { position: absolute; inset: 0; background: rgba(4,6,14,.18); }
.wash-tip {
  position: absolute; top: calc(58px + env(safe-area-inset-top, 0)); left: 16px; right: 16px;
  text-align: center; font-size: 13px; font-weight: 600; color: #eafaff;
  background: rgba(0,0,0,.3); padding: 8px 12px; border-radius: 999px;
}
.wash-done { position: absolute; bottom: calc(90px + var(--safe-b)); left: 50%; transform: translateX(-50%); width: auto; padding: 11px 26px; margin: 0; }
.sponge {
  position: fixed; z-index: 100; font-size: 46px; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) rotate(-12deg); transition: opacity .15s;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
}
.sponge.on { opacity: 1; }
.sponge.rub { animation: rub .25s ease-in-out infinite; }
@keyframes rub { 0%,100% { transform: translate(-50%,-50%) rotate(-16deg); } 50% { transform: translate(-50%,-50%) rotate(-6deg); } }
.clean-bubble {
  position: fixed; z-index: 99; width: 14px; height: 14px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(180,230,255,.6) 60%, rgba(180,230,255,0));
  animation: bub .72s ease forwards;
}
@keyframes bub { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-170%) scale(1); } }

/* ================= FONT AWESOME (light / solid / duotone) — solo icone usate ================= */
@font-face {
  font-family: "FA7Light";
  font-style: normal; font-weight: 300; font-display: block;
  src: url("./fonts/fa-light-300.woff2") format("woff2");
}
@font-face {
  font-family: "FA7Solid";
  font-style: normal; font-weight: 900; font-display: block;
  src: url("./fonts/fa-solid-900.woff2") format("woff2");
}
@font-face {
  font-family: "FA7Duotone";
  font-style: normal; font-weight: 900; font-display: block;
  src: url("./fonts/fa-duotone-900.woff2") format("woff2");
}
.fa, .fa-solid, .fa-duotone {
  display: inline-block; line-height: 1; text-rendering: auto; font-style: normal;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.fa { font-family: "FA7Light"; font-weight: 300; }
.fa-solid { font-family: "FA7Solid"; font-weight: 900; }
.fa-duotone { position: relative; font-family: "FA7Duotone"; font-weight: 900; }
.fa::before, .fa-solid::before { content: var(--fa); }
/* duotone: primaria (::before) + secondaria (::after) sovrapposte */
.fa-duotone::before { content: var(--fa); color: var(--fa-primary-color, currentColor); opacity: var(--fa-primary-opacity, 1); }
.fa-duotone::after  { content: var(--fa2, var(--fa)); color: var(--fa-secondary-color, currentColor); opacity: var(--fa-secondary-opacity, .4); position: absolute; left: 0; top: 0; }
.fa-user-astronaut { --fa: "\f4fb"; }
.fa-star          { --fa: "\f005"; }
.fa-utensils      { --fa: "\f2e7"; }
.fa-shower        { --fa: "\f2cc"; }
.fa-moon          { --fa: "\f186"; }
.fa-sun           { --fa: "\f185"; }
.fa-gamepad       { --fa: "\f11b"; }
.fa-house         { --fa: "\f015"; }
.fa-planet-ringed { --fa: "\e020"; }
.fa-gear          { --fa: "\f013"; }
.fa-rocket        { --fa: "\f135"; }
.fa-xmark         { --fa: "\f00d"; }
.fa-angle-left    { --fa: "\f104"; }
.fa-lock          { --fa: "\f023"; }
.fa-location-dot  { --fa: "\f3c5"; }
.fa-meteor        { --fa: "\f753"; }
.fa-brain         { --fa: "\f5dc"; }
.fa-burger        { --fa: "\f805"; }
.fa-bolt          { --fa: "\f0e7"; }
.fa-face-smile    { --fa: "\f118"; }
.fa-droplet       { --fa: "\f043"; }
.fa-wind          { --fa: "\f72e"; }
.fa-ring          { --fa: "\f70b"; }
.fa-gem           { --fa: "\f3a5"; }
.fa-diamond       { --fa: "\f219"; }
.fa-bullseye      { --fa: "\f140"; }
/* --- cibi --- */
.fa-apple-whole   { --fa: "\f5d1"; }
.fa-pizza-slice   { --fa: "\f818"; }
.fa-candy-cane    { --fa: "\f786"; }
.fa-leaf          { --fa: "\f06c"; }
.fa-glass-water   { --fa: "\e4f4"; }
/* --- menu / schermate --- */
.fa-hand-holding-heart { --fa: "\f4be"; }
.fa-vest          { --fa: "\e085"; }
.fa-store         { --fa: "\f54e"; }
.fa-music         { --fa: "\f001"; }
/* --- giochi / hud --- */
.fa-gas-pump      { --fa: "\f52f"; }
.fa-heart         { --fa: "\f004"; }
.fa-atom          { --fa: "\f5d2"; }
/* --- icone usate anche in duotone (primaria + secondaria \10fXXX) --- */
.fa-pause         { --fa: "\f04c"; --fa2: "\10f04c"; }
.fa-rocket        { --fa: "\f135"; --fa2: "\10f135"; }
.fa-trophy        { --fa: "\f091"; --fa2: "\10f091"; }
.fa-snowflake     { --fa: "\f2dc"; --fa2: "\10f2dc"; }
.fa-hurricane     { --fa: "\f751"; --fa2: "\10f751"; }
.fa-ghost         { --fa: "\f6e2"; --fa2: "\10f6e2"; }
.fa-burst         { --fa: "\e4dc"; --fa2: "\10e4dc"; }
.fa-gem           { --fa2: "\10f3a5"; }
.fa-meteor        { --fa2: "\10f753"; }
.fa-star          { --fa2: "\10f005"; }

/* ================= SIMON (Cristalli di Urano) ================= */
.mg-simon { padding: 0 16px calc(16px + var(--safe-b)); }
.simon-stage { flex: 1; display: flex; align-items: center; justify-content: center; }
.simon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(84vw, 330px); }
.simon-pad {
  aspect-ratio: 1; border: 0; border-radius: 22px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 30%, #12102b);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .08s, box-shadow .12s, background .12s;
}
.simon-pad.lit { background: var(--c); box-shadow: 0 0 26px var(--c), inset 0 0 0 3px #fff; transform: scale(1.05); }
.simon-pad:active { transform: scale(.97); }

/* ===== helper icone HUD / pausa ===== */
.gold { color: #ffe066; }
.fuel { color: #ff6b6b; }
.mg-hud { background: none; }
.mg-quit { background: none; border: 0; color: var(--text); }

/* ===== Urano: cristalli spaziali (Simon) ===== */
.mg-simon { position: relative; background: radial-gradient(120% 90% at 50% 8%, #1a1440, #05060f 70%); }
.mg-simon::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 24%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 72% 62%, #fff, transparent),
    radial-gradient(1px 1px at 40% 82%, #fff, transparent),
    radial-gradient(1px 1px at 86% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 14%, #cfe0ff, transparent),
    radial-gradient(1px 1px at 12% 66%, #fff, transparent);
}
.simon-stage, .simon-grid { position: relative; z-index: 1; }
.simon-pad {
  aspect-ratio: 1; border: 0; border-radius: 0; cursor: pointer; position: relative;
  clip-path: polygon(50% 0%, 100% 32%, 82% 100%, 18% 100%, 0% 32%);
  background: color-mix(in srgb, var(--c) 26%, #0b0a1e);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .1s, box-shadow .12s, background .12s, filter .12s;
}
.simon-pad::before {
  content: ""; position: absolute; left: 22%; right: 22%; top: 8%; height: 34%;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
}
.simon-pad.lit { background: var(--c); box-shadow: 0 0 30px var(--c), 0 0 64px color-mix(in srgb, var(--c) 60%, transparent); filter: brightness(1.25); transform: scale(1.06); }

/* ===== Memory: retro carta con icona FA ===== */
.mem-back { color: color-mix(in srgb, var(--accent) 70%, #ffffff); font-size: 34px; }
.mem-back .fa-solid { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent)); }
.mem-front svg { width: 68%; height: 68%; }

/* ===== menu "Cura": si apre dal basso, azioni impilate ===== */
.care-layer { position: fixed; inset: 0; z-index: 55; }
.care-backdrop { position: absolute; inset: 0; background: rgba(4,6,14,.5); opacity: 0; transition: opacity .28s; }
.care-layer.open .care-backdrop { opacity: 1; }
.care-menu { position: absolute; left: 0; right: 0; bottom: calc(86px + var(--safe-b)); max-width: 480px; margin: 0 auto; padding: 0 14px; display: flex; flex-direction: column; gap: 10px; }
.care-act { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(180deg, #1b1642, #12102b); border: 1px solid var(--card-brd); color: var(--text); border-radius: 16px; padding: 15px; font-size: 16px; font-weight: 600; cursor: pointer; transform: translateY(34px); opacity: 0; transition: transform .3s cubic-bezier(.2,.9,.3,1), opacity .3s; }
.care-act .fa { font-size: 22px; }
.care-act:active { filter: brightness(1.15); }
.care-layer.open .care-act { transform: none; opacity: 1; }
.care-layer.open .care-act:nth-child(1) { transition-delay: .03s; }
.care-layer.open .care-act:nth-child(2) { transition-delay: .08s; }
.care-layer.open .care-act:nth-child(3) { transition-delay: .13s; }

/* ===== cuoricini delle carezze ===== */
.pet-heart { position: fixed; z-index: 90; color: #ff6b8b; font-size: 22px; pointer-events: none; transform: translate(-50%,-50%); animation: petUp .95s ease-out forwards; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
@keyframes petUp {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.3); }
  25% { opacity: 1; transform: translate(-50%,-90%) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx,0px)), -200%) scale(.9); }
}

/* ===== interruttori stile iPhone (Opzioni) ===== */
.switches { background: var(--card); border: 1px solid var(--card-brd); border-radius: 16px; padding: 2px 14px; margin: 10px 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; font-size: 15px; font-weight: 600; }
.switch-row + .switch-row { border-top: 1px solid var(--card-brd); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider { position: absolute; inset: 0; background: rgba(255,255,255,.18); border-radius: 999px; transition: background .2s; }
.switch .slider::before { content: ""; position: absolute; width: 26px; height: 26px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 2px 5px rgba(0,0,0,.4); }
.switch input:checked + .slider { background: #34c759; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== Shop (placeholder) ===== */
.shop-empty { text-align: center; color: var(--muted); padding: 46px 20px; }
.shop-empty .fa-duotone { font-size: 62px; color: var(--accent); display: block; margin-bottom: 16px; }
.shop-empty p { font-size: 17px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.shop-empty small { font-size: 13px; }
