/* FormyDog v42 · visual limpio, móvil compacto y efectos sin tocar Phaser */
:root{
  --fd42-blue:#126fd1;
  --fd42-cyan:#6ed7ff;
  --fd42-violet:#9277ff;
  --fd42-green:#56d39b;
  --fd42-yellow:#ffd86a;
  --fd42-coral:#ff806f;
  --fd42-ink:#124466;
  --fd42-card:rgba(255,255,255,.86);
  --fd42-line:rgba(88,181,230,.24);
}

html,body{
  background:
    radial-gradient(circle at 12% 8%,rgba(110,215,255,.18),transparent 24%),
    radial-gradient(circle at 88% 16%,rgba(146,119,255,.12),transparent 22%),
    radial-gradient(circle at 82% 82%,rgba(86,211,155,.12),transparent 24%),
    linear-gradient(180deg,#eefaff 0%,#f8fcff 48%,#edf4ff 100%)!important;
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:0;
  opacity:.18;
  background-image:radial-gradient(circle,rgba(18,111,209,.22) 1px,transparent 1.2px);
  background-size:28px 28px;
}

.app{position:relative;z-index:1}

.topbar,
.goals,
.boosters,
.status,
.fd-game-share,
.fd-pet-tools{
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.topbar{
  background:linear-gradient(180deg,rgba(255,255,255,.94),rgba(245,251,255,.9))!important;
  border:1px solid var(--fd42-line)!important;
  box-shadow:0 12px 30px rgba(20,77,120,.10),inset 0 1px rgba(255,255,255,.95)!important;
}

.resource{
  background:var(--fd42-card)!important;
  border:1px solid var(--fd42-line)!important;
  box-shadow:0 5px 14px rgba(31,88,126,.08)!important;
}
.resources .resource:nth-child(1){background:linear-gradient(180deg,rgba(255,247,220,.96),rgba(255,239,192,.9))!important}
.resources .resource:nth-child(2){background:linear-gradient(180deg,rgba(227,246,255,.96),rgba(211,239,255,.9))!important}
.resources .resource:nth-child(3){background:linear-gradient(180deg,rgba(255,234,238,.96),rgba(255,218,226,.9))!important}

.fd-header-tools button,
.booster,
.mini-btn,
.fd-game-share button,
.fd-pet-tools button{
  border:1px solid rgba(75,171,222,.22)!important;
  box-shadow:0 6px 15px rgba(17,80,124,.09),inset 0 1px rgba(255,255,255,.94)!important;
  transition:transform .16s ease,box-shadow .16s ease,filter .16s ease!important;
}
.fd-header-tools button:active,
.booster:active,
.mini-btn:active,
.fd-game-share button:active,
.fd-pet-tools button:active{transform:scale(.97)!important}

.board-shell{
  position:relative!important;
  overflow:visible!important;
  background:
    radial-gradient(circle at 20% 15%,rgba(110,215,255,.16),transparent 30%),
    radial-gradient(circle at 80% 78%,rgba(146,119,255,.12),transparent 34%),
    linear-gradient(180deg,rgba(255,255,255,.45),rgba(230,246,255,.2))!important;
  border:1px solid rgba(98,196,239,.28)!important;
  box-shadow:0 16px 36px rgba(15,73,115,.14),0 0 0 1px rgba(255,255,255,.55) inset!important;
}
.board-shell::before{
  content:"";
  position:absolute;
  inset:-7px;
  border-radius:inherit;
  z-index:-1;
  pointer-events:none;
  background:linear-gradient(120deg,rgba(110,215,255,.22),rgba(146,119,255,.12),rgba(86,211,155,.18));
  filter:blur(15px);
  opacity:.7;
  animation:fd42BoardGlow 4.5s ease-in-out infinite alternate;
}
.board-shell::after{
  content:"";
  position:absolute;
  left:8%;right:8%;top:-2px;height:2px;
  pointer-events:none;
  border-radius:999px;
  background:linear-gradient(90deg,transparent,#fff,rgba(110,215,255,.8),#fff,transparent);
  opacity:.78;
  animation:fd42Sweep 3.8s ease-in-out infinite;
}
.board-mount,.board-mount canvas{background:transparent!important}

.booster img{filter:drop-shadow(0 4px 7px rgba(12,83,127,.2)) saturate(1.08) brightness(1.05)}
.booster.active{
  border-color:rgba(18,111,209,.55)!important;
  box-shadow:0 0 0 3px rgba(18,111,209,.10),0 9px 22px rgba(18,111,209,.14)!important;
}

.toast{
  background:linear-gradient(135deg,#146fd0,#4b9fe8)!important;
  color:#fff!important;
  border:1px solid rgba(255,255,255,.28)!important;
  box-shadow:0 12px 30px rgba(7,55,96,.24)!important;
}

@keyframes fd42BoardGlow{from{opacity:.48;transform:scale(.995)}to{opacity:.82;transform:scale(1.008)}}
@keyframes fd42Sweep{0%,20%{transform:translateX(-12%);opacity:.2}50%{opacity:.9}80%,100%{transform:translateX(12%);opacity:.2}}

@media(max-width:900px){
  html,body{min-height:100%;overflow-x:hidden!important}
  body{overflow-y:auto!important}
  html body .app{
    min-height:100dvh!important;
    height:auto!important;
    overflow:visible!important;
    padding:5px 6px calc(66px + env(safe-area-inset-bottom))!important;
    gap:5px!important;
  }

  html body .app>.topbar{
    width:100%!important;
    min-height:62px!important;
    height:auto!important;
    padding:5px 6px!important;
    border-radius:16px!important;
    display:grid!important;
    grid-template-columns:minmax(92px,1.05fr) 60px minmax(116px,1.2fr)!important;
    grid-template-rows:28px 27px!important;
    gap:3px 5px!important;
    align-items:center!important;
  }
  html body .app>.topbar .brand{
    grid-column:1!important;grid-row:1!important;
    min-width:0!important;gap:5px!important;
  }
  html body .app>.topbar .brand-avatar{width:25px!important;height:25px!important;min-width:25px!important}
  html body .app>.topbar .brand h1{font-size:9px!important;line-height:1!important;white-space:nowrap!important}
  html body .app>.topbar .brand p{font-size:6.5px!important;line-height:1!important;margin-top:2px!important;white-space:nowrap!important}

  html body .app>.topbar #fdLevelChip{
    grid-column:2!important;grid-row:1!important;
    min-width:0!important;width:60px!important;height:27px!important;
    padding:2px 4px!important;border-radius:10px!important;
    display:grid!important;grid-template-columns:auto auto!important;grid-template-rows:1fr 1fr!important;
    align-items:center!important;justify-content:center!important;column-gap:3px!important;
  }
  html body .app>.topbar #fdLevelChip span{font-size:6px!important;grid-column:1!important;grid-row:1!important}
  html body .app>.topbar #fdLevelChip b{font-size:11px!important;grid-column:2!important;grid-row:1!important;line-height:1!important}
  html body .app>.topbar #fdLevelChip small{font-size:5.5px!important;grid-column:1/-1!important;grid-row:2!important;line-height:1!important}

  html body .app>.topbar .fd-header-tools{
    grid-column:3!important;grid-row:1!important;
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:3px!important;min-width:0!important;width:100%!important;
  }
  html body .app>.topbar .fd-header-tools button{
    min-width:0!important;width:100%!important;height:27px!important;min-height:27px!important;
    padding:2px!important;border-radius:9px!important;font-size:6px!important;line-height:1!important;
    overflow:hidden!important;text-overflow:ellipsis!important;
  }

  html body .app>.topbar .resources{
    grid-column:1/-1!important;grid-row:2!important;
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important;width:100%!important;min-width:0!important;
  }
  html body .app>.topbar .resource{
    min-width:0!important;width:100%!important;height:27px!important;min-height:27px!important;
    padding:2px 5px!important;border-radius:10px!important;
    display:grid!important;grid-template-columns:18px auto 1fr!important;grid-template-rows:1fr!important;
    align-items:center!important;gap:4px!important;
  }
  html body .app>.topbar .resource img{width:17px!important;height:17px!important;object-fit:contain!important}
  html body .app>.topbar .resource b{font-size:10px!important;line-height:1!important;min-width:0!important}
  html body .app>.topbar .resource span{font-size:5.8px!important;line-height:1!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}

  html body .app>.game-layout{
    width:100%!important;
    min-height:0!important;
    height:auto!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:auto auto auto auto!important;
    gap:5px!important;
    overflow:visible!important;
  }
  html body .app>.game-layout>.goals{
    grid-column:1!important;grid-row:1!important;
    width:100%!important;min-height:38px!important;height:auto!important;
    padding:4px 6px!important;border-radius:13px!important;
    display:grid!important;grid-template-columns:minmax(0,1fr) 76px!important;grid-template-rows:auto auto!important;
    gap:3px 5px!important;
  }
  html body .app>.game-layout>.goals .side-title{grid-column:1/-1!important;min-height:10px!important;margin:0!important}
  html body .app>.game-layout>.goals .goal-box{grid-column:1!important;padding:3px 6px!important;min-height:27px!important;border-radius:9px!important}
  html body .app>.game-layout>.goals .goal-box img{width:24px!important;height:24px!important}
  html body .app>.game-layout>.goals .goal-box strong{font-size:13px!important}
  html body .app>.game-layout>.goals .goal-box span{font-size:6px!important}
  html body .app>.game-layout>.goals .moves-box{grid-column:2!important;padding:3px 5px!important;min-height:27px!important;border-radius:9px!important}
  html body .app>.game-layout>.goals .moves-box strong{font-size:14px!important}
  html body .app>.game-layout>.goals .moves-box span{font-size:5.8px!important}
  html body .app>.game-layout>.goals .progress-row,
  html body .app>.game-layout>.goals .how{display:none!important}

  html body .app>.game-layout>.center{
    grid-column:1!important;grid-row:2!important;
    width:100%!important;min-width:0!important;margin:0 auto!important;
    display:flex!important;flex-direction:column!important;align-items:center!important;gap:4px!important;
  }
  html body .app>.game-layout>.center .board-shell{
    width:min(95vw,58dvh,520px)!important;
    max-width:calc(100vw - 12px)!important;
    max-height:none!important;
    aspect-ratio:1/1!important;
    margin:0 auto!important;border-radius:20px!important;
  }
  html body .app>.game-layout>.center .status{
    width:min(95vw,520px)!important;min-height:25px!important;height:auto!important;
    padding:4px 7px!important;border-radius:10px!important;font-size:7px!important;line-height:1.15!important;
  }
  html body .app>.game-layout>.center .fd-game-share,
  html body .app>.game-layout>.center .fd-pet-tools{display:none!important}

  html body .app>.game-layout>.fd-board-ad{
    grid-column:1!important;grid-row:3!important;
    width:max-content!important;max-width:92vw!important;min-height:20px!important;
    margin:0 auto!important;padding:3px 10px!important;border-radius:99px!important;font-size:6.5px!important;
  }

  html body .app>.game-layout>.boosters{
    position:fixed!important;
    left:5px!important;right:5px!important;bottom:max(5px,env(safe-area-inset-bottom))!important;
    z-index:1800!important;
    width:auto!important;min-height:54px!important;height:54px!important;
    margin:0!important;padding:4px!important;border-radius:16px!important;
    display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:1fr!important;
    gap:3px!important;
    background:rgba(248,253,255,.94)!important;
    border:1px solid rgba(78,174,225,.28)!important;
    box-shadow:0 10px 28px rgba(10,67,107,.18)!important;
    backdrop-filter:blur(12px)!important;
  }
  html body .app>.game-layout>.boosters .side-title{display:none!important}
  html body .app>.game-layout>.boosters .booster,
  html body .app>.game-layout>.boosters .mini-btn{
    min-width:0!important;width:100%!important;height:46px!important;min-height:46px!important;
    margin:0!important;padding:3px!important;border-radius:11px!important;
  }
  html body .app>.game-layout>.boosters .booster{
    display:grid!important;grid-template-columns:1fr!important;grid-template-rows:30px 10px!important;
    place-items:center!important;position:relative!important;
  }
  html body .app>.game-layout>.boosters .booster img{width:29px!important;height:29px!important;grid-row:1!important}
  html body .app>.game-layout>.boosters .booster>span{grid-row:2!important;min-width:0!important}
  html body .app>.game-layout>.boosters .booster>span b{display:block!important;font-size:5.7px!important;line-height:1!important;white-space:nowrap!important}
  html body .app>.game-layout>.boosters .booster>span small{display:none!important}
  html body .app>.game-layout>.boosters .booster em{
    position:absolute!important;right:4px!important;top:3px!important;
    min-width:15px!important;height:15px!important;padding:0 3px!important;border-radius:99px!important;
    display:grid!important;place-items:center!important;font-size:7px!important;line-height:1!important;
    background:#fff!important;color:var(--fd42-blue)!important;box-shadow:0 2px 7px rgba(5,63,105,.14)!important;
  }
  html body .app>.game-layout>.boosters .mini-btn{
    font-size:6px!important;line-height:1.05!important;white-space:normal!important;
  }

  .fd-pet-cameo{bottom:max(66px,calc(env(safe-area-inset-bottom) + 60px))!important}
  .toast{bottom:max(68px,calc(env(safe-area-inset-bottom) + 62px))!important}
}

@media(max-width:380px){
  html body .app>.topbar{grid-template-columns:minmax(82px,1fr) 52px minmax(105px,1.15fr)!important}
  html body .app>.topbar #fdLevelChip{width:52px!important}
  html body .app>.topbar .resource{grid-template-columns:16px auto 1fr!important;padding-inline:3px!important}
  html body .app>.topbar .resource img{width:15px!important;height:15px!important}
  html body .app>.topbar .resource b{font-size:9px!important}
  html body .app>.topbar .resource span{font-size:5.2px!important}
  html body .app>.game-layout>.center .board-shell{width:min(96vw,56dvh)!important}
}

@media(prefers-reduced-motion:reduce){
  .board-shell::before,.board-shell::after{animation:none!important}
  .fd-header-tools button,.booster,.mini-btn,.fd-game-share button,.fd-pet-tools button{transition:none!important}
}
