/* Meta-screen shell for もぐもぐ防衛隊. Shared tokens and safe-area variables live in style.css. */

.screen{ position:absolute; inset:0; display:none; flex-direction:column; }
.screen.active{ display:flex; }
.screen.scroll{ overflow-y:auto; -webkit-overflow-scrolling:touch; }
.screen.scroll.active{ display:block; }
.screen:not(#screen-battle){ background:linear-gradient(160deg,#fff3e0,#ffe0ec 55%,#e9dcff); }

.hidden{ display:none !important; }
.btn-soft{ font:inherit;font-weight:800;font-size:14px;color:#7a4a2a;background:linear-gradient(#fff8ec,#ffe6c4);
  border:none;border-radius:14px;padding:11px 16px;box-shadow:0 4px 0 #d8a866;cursor:pointer; }
#btn-privacy-policy{ display:block;box-sizing:border-box;text-align:center;text-decoration:none; }
.btn-soft:active{ transform:translateY(3px); box-shadow:0 1px 0 #d8a866; }
.btn-soft.danger{ color:#b23; background:linear-gradient(#fff0f0,#ffd7d7); box-shadow:0 4px 0 #d88; }
.btn-primary.big{ font-size:22px; padding:15px 40px; }
.btn-primary.sticky{ position:sticky; bottom:10px; margin:12px auto 0; display:block; }

/* ---------- top bar ---------- */
#topbar{ position:absolute; top:0; left:0; right:0; height:calc(50px + var(--safe-t)); box-sizing:border-box; z-index:30; display:flex; align-items:center; gap:8px;
  padding:var(--safe-t) calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l)); background:linear-gradient(#ffcf8f,#f6b25f); box-shadow:0 3px 8px rgba(0,0,0,.2); }
.tb-btn{ font-size:26px; line-height:1; width:40px; height:38px; border:none; border-radius:12px; color:#fff;
  background:rgba(255,255,255,.25); cursor:pointer; }
.tb-btn:active{ transform:scale(.92); }
#topbar-title{ font-size:16px; color:#5a3d2b; font-weight:900; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tb-cur{ display:flex; align-items:center; gap:4px; background:rgba(255,255,255,.55); border-radius:999px; padding:4px 10px; font-size:14px; color:#6b4410; }
.tb-ico{ width:19px;height:19px;display:inline-block; background:center/contain no-repeat; }
.tb-ico.medal{ background-image:url('../assets/img/ui_coin.webp'); }
.tb-ico.gem{ background-image:url('../assets/img/ui_medal.webp'); }

/* ---------- title (game homepage) ---------- */
#screen-title{ padding:0; overflow:hidden; background:#2a1810; }
.title-bg{ position:absolute; inset:-4%; background:#2a1810 center/cover no-repeat;
  background-image:url('../assets/img/title_bg.webp'); animation:titleZoom 20s ease-in-out infinite alternate; }
@keyframes titleZoom{ 0%{ transform:scale(1.04) } 100%{ transform:scale(1.15) translateY(-2%) } }
.title-shade{ position:absolute; inset:0; background:linear-gradient(to bottom, rgba(20,10,6,.12) 0%, rgba(20,10,6,0) 28%, rgba(20,10,6,.12) 58%, rgba(20,10,6,.74) 100%); }
.title-content{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:space-between;
  padding:calc(46px + var(--safe-t)) calc(20px + var(--safe-r)) calc(30px + var(--safe-b)) calc(20px + var(--safe-l)); }
.title-logo-wrap{ text-align:center; animation:logoDrop .8s cubic-bezier(.2,1.4,.4,1) both; }
.title-logo-img{ width:min(84%,352px); height:auto; display:block; margin:0 auto; filter:drop-shadow(0 7px 6px rgba(0,0,0,.45)); animation:logoBob 3.6s ease-in-out .85s infinite; }
@keyframes logoBob{ 0%,100%{transform:translateY(0) rotate(-.6deg)} 50%{transform:translateY(-7px) rotate(.6deg)} }
.title-logo{ font-weight:900; line-height:.9; letter-spacing:1px; filter:drop-shadow(0 6px 5px rgba(0,0,0,.4)); }
.title-logo span{ display:block; -webkit-text-stroke:7px #fff; paint-order:stroke fill; }
.tl-1{ font-size:46px; color:#ff8bd0; transform:rotate(-3deg); }
.tl-2{ font-size:64px; color:#ffb340; margin-top:-4px; transform:rotate(1deg); }
.title-sub{ margin-top:14px; display:inline-block; font-size:13px; font-weight:800; color:#fff; background:rgba(201,86,46,.9);
  max-width:100%; padding:5px 15px; border-radius:999px; border:2px solid #fff; box-shadow:0 3px 6px rgba(0,0,0,.35);
  line-height:1.35; word-break:keep-all; }
@keyframes logoDrop{ 0%{ transform:translateY(-40px) scale(.7); opacity:0 } 100%{ transform:none; opacity:1 } }
.title-actions{ display:flex; flex-direction:column; align-items:center; gap:18px; }
.btn-play{ font:inherit; font-weight:900; font-size:26px; color:#fff; padding:16px 58px; border:4px solid #fff; border-radius:22px;
  background:linear-gradient(#ff9c4b,#f5601f); box-shadow:0 7px 0 #b8461a,0 12px 22px rgba(0,0,0,.45); cursor:pointer;
  animation:playPulse 1.5s ease-in-out infinite; }
.btn-play:active{ transform:translateY(5px); box-shadow:0 2px 0 #b8461a,0 6px 12px rgba(0,0,0,.4); animation:none; }
@keyframes playPulse{ 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.03) } }
.title-menu{ display:flex; gap:16px; justify-content:center; }
.menu-ico{ border:none; background:none; font:inherit; display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; color:#fff; }
.menu-ico .mi{ width:54px; height:54px; border-radius:16px; background:#fff3e0 center/74% no-repeat;
  box-shadow:0 4px 0 #d79a5a,0 6px 10px rgba(0,0,0,.22); border:2px solid #fff; transition:transform .08s,box-shadow .08s; }
.menu-ico:active .mi{ transform:translateY(3px); box-shadow:0 1px 0 #d79a5a,0 2px 6px rgba(0,0,0,.22); }
.menu-ico .mi-lbl{ font-size:12px; font-weight:800; text-shadow:0 1px 3px rgba(0,0,0,.7); }
.title-ver{ position:absolute; right:calc(12px + var(--safe-r)); bottom:calc(8px + var(--safe-b)); font-size:11px; color:rgba(255,255,255,.75); text-shadow:0 1px 2px rgba(0,0,0,.6); }
/* tap-cue */
.tap-cue{ font-size:13px; font-weight:800; letter-spacing:1px; color:#fff; text-shadow:0 2px 4px rgba(0,0,0,.6); animation:tapBlink 1.3s ease-in-out infinite; }
@keyframes tapBlink{ 0%,100%{ opacity:.35; transform:translateY(0) } 50%{ opacity:1; transform:translateY(-2px) } }
/* floating sparkles */
.title-fx{ position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:1; }
.title-fx i{ position:absolute; width:8px; height:8px; border-radius:50%; background:radial-gradient(circle,#fff,rgba(255,220,150,.6) 60%,transparent 70%);
  opacity:0; animation:sparkleRise linear infinite; }
.title-fx i:nth-child(1){ left:12%; animation-duration:7s; animation-delay:0s; }
.title-fx i:nth-child(2){ left:24%; animation-duration:9s; animation-delay:1.4s; width:6px; height:6px; }
.title-fx i:nth-child(3){ left:38%; animation-duration:6.5s; animation-delay:.6s; width:10px; height:10px; }
.title-fx i:nth-child(4){ left:52%; animation-duration:8.5s; animation-delay:2.2s; }
.title-fx i:nth-child(5){ left:64%; animation-duration:7.5s; animation-delay:3.1s; width:6px; height:6px; }
.title-fx i:nth-child(6){ left:76%; animation-duration:9.5s; animation-delay:1s; width:11px; height:11px; }
.title-fx i:nth-child(7){ left:86%; animation-duration:6.8s; animation-delay:2.7s; }
.title-fx i:nth-child(8){ left:46%; animation-duration:10s; animation-delay:4s; width:7px; height:7px; }
@keyframes sparkleRise{ 0%{ transform:translateY(105vh) scale(.4); opacity:0 } 12%{ opacity:.9 } 88%{ opacity:.9 } 100%{ transform:translateY(-8vh) scale(1); opacity:0 } }

/* ---------- world map (illustrated, Battle-Cats style) ---------- */
#screen-map{ padding:calc(50px + var(--safe-t)) 0 calc(62px + var(--safe-b)); background:#241a24; }
.map-section{ position:relative; width:100%; aspect-ratio:887/1774; background:center top/cover no-repeat; }
.chapter-banner{ position:sticky; top:8px; z-index:6; width:max-content; margin:0 auto; text-align:center;
  padding:7px 24px; border-radius:14px; background:linear-gradient(#ffb0d8,#c86ab0); color:#fff; border:3px solid #fff;
  box-shadow:0 4px 12px rgba(0,0,0,.4); white-space:nowrap; }
.cb-num{ display:block; font-size:11px; opacity:.92; letter-spacing:1px; }
.cb-name{ font-size:18px; font-weight:900; text-shadow:0 2px 2px rgba(0,0,0,.3); }
.map-pin{ position:absolute; transform:translate(-50%,-50%); z-index:2; display:flex; flex-direction:column; align-items:center; justify-content:center;
  width:56px; height:56px; border:none; border-radius:50%; cursor:pointer; font:inherit;
  background:radial-gradient(circle at 40% 34%,#fff8e8,#ffcf6e); box-shadow:0 4px 0 #cf9b3e,0 0 0 4px #fff,0 7px 14px rgba(0,0,0,.45); }
.map-pin:active{ transform:translate(-50%,-50%) translateY(3px); }
.map-pin.cleared{ background:radial-gradient(circle at 40% 34%,#eaffea,#8fd07f); box-shadow:0 4px 0 #5fa050,0 0 0 4px #fff,0 7px 14px rgba(0,0,0,.45); }
.map-pin.locked{ width:44px; height:44px; background:radial-gradient(circle at 40% 34%,#f0f0f0,#b6b0aa); box-shadow:0 3px 0 #8a857f,0 0 0 3px #fff,0 5px 10px rgba(0,0,0,.45); cursor:default; }
.map-pin.next{ animation:pinPulse 1.2s ease-in-out infinite; }
@keyframes pinPulse{ 0%,100%{ box-shadow:0 4px 0 #cf9b3e,0 0 0 4px #fff,0 7px 14px rgba(0,0,0,.45),0 0 0 rgba(255,205,90,0) } 50%{ box-shadow:0 4px 0 #cf9b3e,0 0 0 4px #fff,0 7px 14px rgba(0,0,0,.45),0 0 22px 7px rgba(255,205,90,.95) } }
.pin-num{ font-size:20px; font-weight:900; color:#7a4e14; line-height:1; }
.pin-num.lock{ color:#7a756f; font-size:18px; }
.pin-stars{ display:flex; gap:2px; margin-top:2px; }
.ns{ width:9px; height:9px; display:inline-block; background:rgba(255,255,255,.75);
  clip-path:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); filter:drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.ns.on{ background:#ffcf3f; }
.chapter-gate{ position:relative; width:100%; aspect-ratio:887/640; background:center/cover no-repeat #2a1f2e;
  display:flex; align-items:center; justify-content:center; }
.cg-scrim{ position:absolute; inset:0; background:radial-gradient(circle at 50% 45%,rgba(20,10,20,.15),rgba(20,10,20,.72)); }
.cg-label{ position:relative; z-index:1; text-align:center; font-size:22px; font-weight:900; color:#fff;
  text-shadow:0 2px 8px rgba(0,0,0,.7),0 0 16px rgba(0,0,0,.5); letter-spacing:2px; }
.cg-hint{ display:block; margin-top:6px; font-size:12px; font-weight:700; color:#ffe0c0; letter-spacing:1px; }

/* ---------- formation & unit cards ---------- */
#screen-dex{ padding:calc(58px + var(--safe-t)) 12px 20px; }
/* Formation is two real rows: one scrollport for all formation content, then a fixed CTA row.
 * A sticky CTA inside the page scroll overlapped the last unit row by ~40px on the 360x800 test
 * viewport and scrolled away at the end. Keeping it outside the scrollport makes both boundaries
 * explicit: every card can reach the bottom of the upper row, and 出撃 never covers content. */
#screen-formation{ padding:0; overflow:hidden; }
#screen-formation.active{ display:grid; grid-template-rows:minmax(0,1fr) auto; }
.formation-scroll{
  min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch;
  touch-action:pan-y; overscroll-behavior:contain;
  padding:calc(56px + var(--safe-t)) calc(12px + var(--safe-r)) 16px calc(12px + var(--safe-l));
}
.formation-top{ display:block; }
#formation-roster{ align-content:start; margin:2px 0 0; padding:2px; }
#screen-formation #btn-sortie{
  position:relative; z-index:4; width:auto;
  margin:8px calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  box-shadow:0 6px 0 var(--c-orange-lip), 0 -10px 14px 10px rgba(255,238,214,.92);
}
.panel-head{ display:flex; justify-content:space-between; align-items:center; font-size:18px; font-weight:900; color:#8a4b8a; margin:6px 4px 12px; }
.formation-team{ display:grid; grid-template-columns:repeat(5,1fr); gap:6px; margin-bottom:8px; }
.formation-team.shake{ animation:trayShake .4s ease; }
@keyframes trayShake{0%,100%{transform:translateX(0)}20%{transform:translateX(-7px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(3px)}}
.team-slot{ position:relative; aspect-ratio:1/1; border-radius:14px;
  background:repeating-linear-gradient(45deg,rgba(255,235,205,.6) 0 8px,rgba(255,220,180,.6) 8px 16px);
  border:2px dashed #d0a870; display:flex; align-items:center; justify-content:center; }
.team-slot.filled{ border-style:solid; border-color:#fff; background:#fff6e6; box-shadow:0 3px 0 #d8a866; display:block; padding:3px; }
.team-slot .uface{ width:100%; }
.slot-empty{ font-size:20px; font-weight:900; color:#caa878; opacity:.65; }
.ts-x{ position:absolute; top:-4px; right:-4px; z-index:2; width:18px; height:18px; line-height:16px; text-align:center;
  font-size:11px; font-weight:900; color:#fff; background:linear-gradient(#ff8080,#e04b4b); border-radius:50%;
  border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.formation-hint{ font-size:12px; color:#8a6a50; text-align:center; margin:6px 0 12px; } .formation-hint b{ color:#c7562e; font-size:14px; }
#btn-sortie sub{ display:block; font-size:11px; font-weight:700; opacity:.9; vertical-align:baseline; margin-top:1px; }
.btn-primary.disabled{ background:linear-gradient(#c9bcae,#a99b8c); box-shadow:0 5px 0 #8b7d6e; color:#f0ece6; }
.unit-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.unit-card{ border:none; border-radius:14px; padding:6px 4px 4px; font:inherit; cursor:pointer;
  background:linear-gradient(#fff8ee,#ffe9cf); box-shadow:0 3px 0 #d8a866; }
.unit-card:active{ transform:translateY(2px); }
.unit-card.picked{ outline:3px solid #ff9c4b; }
.unit-card.unowned{ filter:grayscale(1) brightness(.9); opacity:.55; box-shadow:0 3px 0 #aaa; }
.dex-card.unowned{ filter:none; opacity:1; box-shadow:0 3px 0 #cabfa9; }
.uface.silh{ background:linear-gradient(#d7cbb7,#bfae95); }
.uface.silh .uface-img{ filter:brightness(0) opacity(.6); }
.dex-card.unowned .uc-name{ color:#a2937c; letter-spacing:2px; }
.dex-rardot{ font-size:11px; color:#c7a24a; letter-spacing:1px; opacity:.65; margin-top:-1px; }
/* dex completion meter */
#dex-meter{ margin:2px 4px 12px; }
.dm-bar{ position:relative; height:16px; border-radius:9px; background:#e7d8c2; overflow:hidden; box-shadow:inset 0 1px 3px rgba(0,0,0,.2); }
.dm-fill{ height:100%; border-radius:9px; background:linear-gradient(90deg,#ffcf5a,#ff8fd0,#c98aff); transition:width .6s cubic-bezier(.3,1.3,.5,1); box-shadow:0 0 8px rgba(255,160,120,.5); }
.dm-pct{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:900; color:#5a3d2b; text-shadow:0 1px 2px rgba(255,255,255,.5); }
.dm-tags{ display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-top:8px; }
.dm-tag{ font-size:11px; font-weight:800; color:#fff; padding:2px 9px; border-radius:8px; opacity:.9; } .dm-tag b{ font-weight:900; }
.dm-tag.r1{ background:#6fb8ec } .dm-tag.r2{ background:#5fc06a } .dm-tag.r3{ background:#f5a623 } .dm-tag.r4{ background:#ff5fb0 }
.dm-tag.done{ box-shadow:0 0 0 2px #fff,0 0 8px currentColor; }
.dm-comp{ font-size:12px; font-weight:900; color:#c7562e; padding:2px 4px; }
.uc-name{ font-size:11px; font-weight:800; color:#6a4a2a; margin-top:2px; }
.uc-meta{ display:flex; align-items:center; justify-content:center; gap:5px; margin-top:1px; }
.uc-rar{ font-size:9px; color:#f5a623; letter-spacing:-1px; }
.uc-cost{ display:inline-flex; align-items:center; gap:2px; font-size:10px; font-weight:800; color:#a86a2a; background:#fff3dd; border-radius:8px; padding:0 6px 0 3px; }
.uc-cost .i-coin{ width:11px; height:11px; }
.uface{ position:relative; aspect-ratio:1/1; border-radius:12px; overflow:hidden; background:linear-gradient(140deg,var(--rc1,#eee),var(--rc2,#ccc)); }
.uface.r1{ box-shadow:inset 0 0 0 2px var(--rc,#9fd3ff); }
.uface.r2{ box-shadow:inset 0 0 0 2px var(--rc,#a8e6a0); }
.uface.r3{ box-shadow:inset 0 0 0 2.5px rgba(255,205,80,.95); }
.uface.r4{ box-shadow:inset 0 0 0 2.5px rgba(255,110,195,.95),0 0 9px rgba(255,110,195,.55); }
.uface-img{ position:absolute; inset:4px; background:center/contain no-repeat; }
.uface.locked{ display:flex; align-items:center; justify-content:center; font-size:26px; color:#fff; background:#c9b8a0; }
.uface-lv{ position:absolute; right:2px; bottom:2px; font-size:9px; background:rgba(0,0,0,.55); color:#fff; padding:0 4px; border-radius:6px; }
.uface-evo{ position:absolute; left:2px; top:2px; font-size:8px; background:linear-gradient(#ff8fd0,#c94ea0); color:#fff; padding:0 3px; border-radius:5px; font-weight:900; }
.dd-evohint{ text-align:center; color:#a9885f; font-size:12px; padding:8px; width:min(88%,360px); margin:0 auto; background:#fff9ee; }
#dd-evo.evo{ display:block; border-radius:14px; margin:8px auto 0; width:min(88%,360px); background:linear-gradient(#ffd6f0,#ff9ecb); color:#7a2b5a; box-shadow:0 4px 0 #c96a9a; }
.g-pity{ font-size:11px; color:#8a6a50; margin-top:4px; }
/* new-companion celebration: this is a major progress beat and used to be one small line of text */
.rew.newunit{ margin-top:10px; padding:10px 8px; border-radius:14px; color:#c7562e; font-weight:900;
  background:linear-gradient(#fff6dd,#ffe6b8); border:2.5px solid #ffd27a; box-shadow:0 3px 10px rgba(0,0,0,.14);
  animation:nuPop .5s var(--ease-pop,cubic-bezier(.2,1.5,.4,1)) both; }
.nu-h{ display:block; font-size:13px; margin-bottom:6px; }
.nu-one{ display:inline-flex; flex-direction:column; align-items:center; gap:2px; margin:0 5px; }
.nu-one b{ font-size:11px; color:#8a5a2b; }
.rew.newunit .uface{ width:56px; height:56px; animation:nuGlow 1.4s ease-in-out infinite; }
@keyframes nuPop{ from{ opacity:0; transform:scale(.7) translateY(8px);} to{ opacity:1; transform:none; } }
@keyframes nuGlow{ 0%,100%{ box-shadow:0 0 0 0 rgba(255,210,122,.9);} 50%{ box-shadow:0 0 0 7px rgba(255,210,122,0);} }

/* ---------- battle retreat ---------- */
.retreat-btn{ position:absolute; top:calc(6px + var(--safe-t)); right:calc(8px + var(--safe-r)); z-index:8; width:44px; height:44px; border-radius:50%;
  background:rgba(20,12,8,.4); color:#fff; border:2px solid rgba(255,255,255,.6); font-size:15px; line-height:1;
  cursor:pointer; box-shadow:0 2px 6px rgba(0,0,0,.3); }
.retreat-btn:active{ transform:scale(.9); }
.pause-btn{ position:absolute; top:calc(6px + var(--safe-t)); right:calc(58px + var(--safe-r)); z-index:8; width:44px; height:44px; border-radius:50%;
  background:rgba(20,12,8,.4); color:#fff; border:2px solid rgba(255,255,255,.6); font-size:13px; line-height:1; cursor:pointer; box-shadow:0 2px 6px rgba(0,0,0,.3); }
.pause-btn:active{ transform:scale(.9); }

/* ---------- result ---------- */
#screen-result{ align-items:stretch; justify-content:flex-start; overflow-y:auto; -webkit-overflow-scrolling:touch;
  touch-action:pan-y; overscroll-behavior:contain;
  padding:calc(12px + var(--safe-t)) calc(8px + var(--safe-r)) calc(16px + var(--safe-b)) calc(8px + var(--safe-l));
  background:radial-gradient(120% 90% at 50% 25%,#fff2cf,#e9dcff); }
.result-card{ flex:0 0 auto; width:84%; max-width:340px; text-align:center; padding:26px 22px; border-radius:26px; margin:auto;
  background:linear-gradient(#fff9ee,#ffeccb); border:4px solid #fff; box-shadow:0 14px 0 rgba(0,0,0,.15),0 22px 40px rgba(0,0,0,.35); }
.result-card h1{ font-size:26px; color:#c7562e; margin:8px 0; }
.res-ribbon{ display:inline-block; font-weight:900; font-size:15px; letter-spacing:2px; color:#fff; padding:5px 22px;
  border-radius:6px; transform:rotate(-3deg); box-shadow:0 4px 8px rgba(0,0,0,.25); }
.res-ribbon.win{ background:linear-gradient(#7ed957,#4fa832); }
.res-ribbon.lose{ background:linear-gradient(#9aa0aa,#667); font-size:13px; }
.overlay-emoji{ min-height:auto; }
.result-stars{ display:flex; justify-content:center; gap:16px; margin:8px 0 12px; }
.rslot{ display:flex; flex-direction:column; align-items:center; gap:2px; }
.rstar{ font-size:38px; line-height:1; color:#dccdb0; display:inline-block; }
.rstar.off{ color:#e7ddc9; opacity:.55; }
.rstar.on{ color:#f5a623; animation:starPop .4s ease backwards; text-shadow:0 0 12px #ffd27a; }
.rslot-l{ font-size:9px; font-weight:800; color:#9a7a55; letter-spacing:.3px; }
.rew.miss{ font-size:12px; font-weight:700; color:#c98a3a; background:#fff4e0; border-radius:9px; padding:4px 10px; display:inline-block; margin:2px auto; }
@keyframes starPop{0%{transform:scale(0) rotate(-40deg);opacity:0}70%{transform:scale(1.3)}100%{transform:scale(1)}}
.result-rewards{ margin:10px 0 18px; } .rew{ font-size:15px; color:#7a5a44; margin:4px 0; } .rew b{ color:#c7562e; }
.rew.gem b{ color:#c94ea0; }
.result-btns{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }

/* ---------- gacha ---------- */
#screen-gacha{ align-items:center; justify-content:center; padding:calc(50px + var(--safe-t)) 0 calc(62px + var(--safe-b)); box-sizing:border-box; }
.gacha-wrap{ text-align:center; padding:18px; width:100%; max-width:420px; }
.gacha-machine{ width:124px; height:124px; margin:0 auto 10px; background:url('../assets/img/ui_gacha.webp') center/contain no-repeat;
  filter:drop-shadow(0 6px 8px rgba(0,0,0,.2)); animation:gachaBob 3s ease-in-out infinite; }
@keyframes gachaBob{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
.gacha-machine.shake{ animation:gachaShake .55s ease; }
@keyframes gachaShake{0%,100%{transform:rotate(0)}20%{transform:rotate(-12deg) scale(1.05)}40%{transform:rotate(12deg)}60%{transform:rotate(-8deg)}80%{transform:rotate(8deg)}}
/* pity gauge */
.gacha-pity{ width:min(84%,300px); margin:0 auto 6px; }
.gacha-pity-bar{ height:10px; border-radius:6px; background:#e7d8c2; overflow:hidden; box-shadow:inset 0 1px 3px rgba(0,0,0,.2); }
#gacha-pity-fill{ height:100%; width:0%; border-radius:6px; background:linear-gradient(90deg,#ffcf5a,#ff8fd0); transition:width .5s cubic-bezier(.3,1.4,.5,1); box-shadow:0 0 8px rgba(255,160,120,.6); }
.gacha-pity-lbl{ font-size:11px; color:#8a6a50; margin-top:3px; font-weight:700; } .gacha-pity-lbl b{ color:#c7562e; }
.gacha-result{ min-height:clamp(110px,24dvh,180px); display:flex; align-items:center; justify-content:center; position:relative; }
/* button row */
.gacha-btns{ display:flex; gap:10px; justify-content:center; }
.gacha-btns{ display:flex; gap:10px; justify-content:center; align-items:stretch; }
.gacha-btns button{ flex:1; max-width:170px; margin:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; padding:11px 8px; font-size:19px; }
.gb-cost{ font-size:12px; font-weight:800; opacity:.92; display:inline-flex; align-items:center; gap:2px; }
.btn-gold{ border:none; border-radius:16px; color:#7a4a12; font-weight:900; cursor:pointer;
  background:linear-gradient(#ffe08a,#ffb43c); box-shadow:0 5px 0 #d98a1e,0 8px 16px rgba(210,130,20,.4); transition:transform .08s,box-shadow .08s; }
.btn-gold:active{ transform:translateY(4px); box-shadow:0 1px 0 #d98a1e,0 3px 8px rgba(210,130,20,.4); }
/* single reveal */
.g-charge{ width:120px; height:120px; border-radius:50%; background:radial-gradient(circle,#fff,var(--cc,#ffe6a8) 55%,transparent 72%); animation:chargePulse .56s ease-out; }
.g-charge.r2{ --cc:#bfe6ff } .g-charge.r3{ --cc:#ffe08a } .g-charge.r4{ --cc:#ffc0e6 }
@keyframes chargePulse{0%{transform:scale(.2);opacity:.2}55%{transform:scale(1.15);opacity:1}100%{transform:scale(2.2);opacity:0}}
.g-pop{ position:relative; background:linear-gradient(#fffdf7,#fff2da); border:3px solid var(--rc,#fff); border-radius:22px; padding:16px 26px 14px; box-shadow:0 8px 24px rgba(0,0,0,.25); animation:gPop .5s cubic-bezier(.2,1.5,.4,1); }
@keyframes gPop{0%{transform:scale(0) rotate(-12deg);opacity:0}70%{transform:scale(1.12)}100%{transform:scale(1)}}
.g-rays{ position:absolute; inset:-40% ; z-index:-1; background:conic-gradient(from 0deg,transparent 0 8deg,var(--rc,#fff) 8deg 12deg,transparent 12deg 30deg); opacity:.35; border-radius:50%; animation:raySpin 9s linear infinite; }
@keyframes raySpin{to{transform:rotate(360deg)}}
.g-pop .uface{ width:100px; margin:0 auto; }
.g-name{ font-size:19px; font-weight:900; color:#5a3d2b; margin-top:8px; }
.g-tag{ font-size:13px; font-weight:900; color:#c7562e; } .g-rar{ color:#f5a623; letter-spacing:2px; margin-top:2px; }
.g-pop.r4{ border-color:#ff9ecb; box-shadow:0 0 30px rgba(255,150,210,.7),0 8px 24px rgba(0,0,0,.25); }
.g-pop.r4 .g-name{ background:linear-gradient(90deg,#ff6fae,#ffb43c,#ff6fae); -webkit-background-clip:text; background-clip:text; color:transparent; }
.g-msg{ color:#b23; font-weight:800; font-size:15px; }
/* 10-pull grid */
.g10-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:6px; width:100%; }
.g10-cell{ position:relative; background:linear-gradient(#fffdf7,#fff1d6); border:2px solid var(--rc,#ddd); border-radius:10px; padding:4px 3px 3px; animation:gCell .34s cubic-bezier(.2,1.5,.4,1); }
.g10-cell.r1{ --rc:#9fd3ff } .g10-cell.r2{ --rc:#a8e6a0 } .g10-cell.r3{ --rc:#ffd27a } .g10-cell.r4{ --rc:#ff9ecb }
.g10-cell.hidden{ opacity:0; transform:scale(.4); }
@keyframes gCell{0%{transform:scale(.4) rotate(-8deg);opacity:0}70%{transform:scale(1.1)}100%{transform:scale(1)}}
.g10-cell .uface{ width:100%; }
.g10-rar{ display:block; font-size:10px; color:#f5a623; letter-spacing:1px; line-height:1.1; }
.g10-new{ position:absolute; top:-4px; right:-4px; font-size:8px; font-weight:900; color:#fff; background:linear-gradient(#ff6fae,#c94ea0); padding:1px 4px; border-radius:6px; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.g10-cell.r4{ box-shadow:0 0 14px rgba(255,150,210,.8); animation:gCell .34s cubic-bezier(.2,1.5,.4,1),g4Glow 1.2s ease-in-out infinite .34s; }
@keyframes g4Glow{0%,100%{box-shadow:0 0 10px rgba(255,150,210,.6)}50%{box-shadow:0 0 20px rgba(255,150,210,1)}}
.g10-close{ grid-column:1/-1; margin-top:10px; }
.g10-wrap{ width:100%; }
/* fullscreen rare flash */
.screen-flash{ position:fixed; inset:0; z-index:60; pointer-events:none;
  background:radial-gradient(circle,#fff,rgba(255,225,120,.55) 55%,transparent 75%); animation:flashOut .62s ease forwards; }
@keyframes flashOut{0%{opacity:0}18%{opacity:1}100%{opacity:0}}

/* ---------- dex ---------- */
.dex-count{ font-size:14px; color:#8a6a50; }
.dex-detail{ position:fixed; inset:0; z-index:40; background:rgba(30,18,12,.6); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center; padding:20px; }
.dex-detail.hidden{ display:none; }
.dd-card{ width:min(92%,360px); max-height:88%; overflow-y:auto; background:linear-gradient(#fff9ee,#fff3e0);
  border-radius:22px; border:3px solid #fff; box-shadow:0 16px 44px rgba(0,0,0,.45); padding:16px; }
.dd-head{ display:flex; gap:12px; align-items:center; margin-bottom:12px; }
.dd-head .uface{ width:78px; flex:0 0 auto; }
.dd-title h3{ font-size:20px; color:#c7562e; } .dd-rar{ color:#f5a623; font-size:14px; letter-spacing:1px; }
.dd-badge{ display:inline-block; font-size:12px; font-weight:900; letter-spacing:1px; color:#fff; padding:2px 11px; border-radius:8px; margin-top:2px; box-shadow:0 2px 4px rgba(0,0,0,.2); }
.dd-badge.r1{ background:linear-gradient(#8fd0f5,#4a9fd8); }
.dd-badge.r2{ background:linear-gradient(#86d97e,#3fa84e); }
.dd-badge.r3{ background:linear-gradient(#ffd27a,#f5a623); color:#7a4a12; }
.dd-badge.r4{ background:linear-gradient(#ff9ecb,#ff5fb0); box-shadow:0 2px 9px rgba(255,95,176,.55); }
.dd-role{ color:#8a6a50; font-size:12px; font-weight:800; margin-top:3px; }
.dd-stats{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.stat{ display:flex; align-items:center; gap:8px; }
.stat-l{ width:42px; font-size:12px; font-weight:800; color:#5a3d2b; }
.stat-track{ position:relative; flex:1; height:12px; border-radius:6px; background:rgba(0,0,0,.1); overflow:hidden; }
.stat-ghost{ position:absolute; left:0; top:0; bottom:0; border-radius:6px; opacity:.34;
  background:repeating-linear-gradient(45deg, currentColor 0 4px, transparent 4px 8px); color:#3a2a1a; }
.stat-fill{ position:relative; z-index:1; display:block; height:100%; border-radius:6px; transition:width .3s ease; }
.stat-v{ width:62px; text-align:right; font-size:12px; font-weight:900; color:#5a3d2b; white-space:nowrap; }
.stat-up{ margin-left:3px; font-size:10px; font-weight:900; color:#3fa84e; }
.dd-nums{ display:flex; flex-wrap:wrap; gap:4px 12px; font-size:12px; color:#7a5a44; margin-bottom:8px; }
.dd-nums b{ color:#c7562e; }
.dd-desc{ font-size:12.5px; color:#7a5a44; line-height:1.55; margin-bottom:10px; background:rgba(255,255,255,.55); padding:8px 10px; border-radius:10px; }
/* base / evo segmented control */
.dd-seg{ display:flex; gap:4px; background:#eaddc8; border-radius:12px; padding:3px; margin:0 0 10px; }
.dd-seg-b{ flex:1; border:none; background:none; font:inherit; font-weight:900; font-size:13px; color:#9a7a55; padding:6px 0; border-radius:9px; cursor:pointer; transition:.12s; }
.dd-seg-b.on{ background:#fff; color:#c7562e; box-shadow:0 2px 5px rgba(0,0,0,.15); }
.dd-locknote{ text-align:center; font-size:12px; font-weight:800; color:#a86ec0; background:#f6ecff; border-radius:10px; padding:6px 8px; margin-bottom:10px; }
.dd-card.evoview{ background:linear-gradient(#fff4fb,#ffe9f5); }
.dd-btn{ display:flex; align-items:center; justify-content:center; gap:5px; width:100%; border-radius:14px; margin-bottom:8px; font-size:15px; }
.dd-btn sub{ font-size:11px; font-weight:700; opacity:.85; vertical-align:baseline; }
.btn-evo{ border:none; color:#7a2b5a; font-weight:900; cursor:pointer; padding:12px; font:inherit;
  background:linear-gradient(#ffd6f0,#ff9ecb); box-shadow:0 5px 0 #c96a9a,0 8px 14px rgba(201,106,154,.35); transition:transform .08s,box-shadow .08s; }
.btn-evo:active{ transform:translateY(4px); box-shadow:0 1px 0 #c96a9a; }
.dd-max{ text-align:center; color:#8a3; font-weight:900; margin-bottom:8px; }
#dd-close{ display:block; width:100%; }
/* formation card info button */
.unit-card{ position:relative; }
.uc-info{ position:absolute; top:0; right:0; width:40px; height:40px; display:flex; align-items:center; justify-content:center;
  border:0; border-radius:50%; background:transparent; color:#fff; font:inherit; font-size:0; z-index:2; cursor:pointer; }
.uc-info::before{ content:"i"; width:24px; height:24px; line-height:24px; text-align:center; border-radius:50%;
  background:rgba(90,60,40,.82); color:#fff; font-size:13px; font-weight:900; font-style:italic;
  box-shadow:0 1px 3px rgba(0,0,0,.25); }
.uc-info:focus-visible{ outline:3px solid #4b8fe8; outline-offset:-2px; }

/* ---------- bottom nav ---------- */
#bottomnav{ position:absolute; left:0; right:0; bottom:0; height:calc(62px + var(--safe-b)); box-sizing:border-box; padding-bottom:var(--safe-b); z-index:35; display:flex;
  background:linear-gradient(#fff6e6,#ffe0bd); box-shadow:0 -3px 10px rgba(0,0,0,.18); }
.nav-btn{ flex:1; border:none; background:none; font:inherit; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; color:#6f513b; cursor:pointer; }
.nav-btn .nav-ico{ width:27px; height:27px; background:center/contain no-repeat; }
.nav-btn .nav-lbl{ font-size:11px; font-weight:800; white-space:nowrap; }
.nav-btn.on{ color:#a63f24; } .nav-btn.on .nav-ico{ transform:scale(1.15); }
.nav-btn:active{ transform:scale(.93); }
#screen-dex, #screen-kitchen{ padding-bottom:calc(76px + var(--safe-b)); }

/* ---------- kitchen ---------- */
#screen-kitchen{ padding:calc(58px + var(--safe-t)) 0 calc(76px + var(--safe-b)); }
.kitchen-note{ font-size:12px; color:#8a6a50; margin:0 14px 12px; }
#kitchen-list{ padding:0 12px; }
.kitchen-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; padding:12px 14px; border-radius:16px;
  background:linear-gradient(#fff8ee,#ffedd2); box-shadow:0 3px 0 #e0b070; }
.kt-ico{ width:40px; height:40px; border-radius:12px; display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:16px; font-weight:900; box-shadow:0 2px 0 rgba(0,0,0,.2); flex:0 0 auto; text-shadow:0 1px 2px rgba(0,0,0,.3); }
.kt-mid{ flex:1; }
.kt-name{ font-size:14px; font-weight:900; color:#5a3d2b; } .kt-name b{ color:#c7562e; }
.kt-eff{ font-size:12px; color:#8a6a50; margin-top:2px; }
.kt-pips{ display:flex; gap:3px; margin-top:6px; }
.kt-pip{ flex:1; max-width:20px; height:6px; border-radius:3px; background:#e7dac6; }
.kt-pip.on{ background:var(--kc,#e0925a); box-shadow:0 1px 2px rgba(0,0,0,.18); }
.kt-up{ font-size:13px; padding:9px 13px; white-space:nowrap; }
.kt-max{ font-size:13px; font-weight:900; color:#8a3; padding:0 10px; }

/* ---------- settings ---------- */
#screen-settings{ padding:calc(58px + var(--safe-t)) 16px calc(58px + var(--safe-b)); }
.settings-list{ display:flex; flex-direction:column; gap:14px; max-width:360px; margin:10px auto; }
.set-row{ display:flex; justify-content:space-between; align-items:center; font-size:16px; font-weight:800; color:#5a3d2b;
  background:#fff8ee; padding:14px 18px; border-radius:16px; box-shadow:0 3px 0 #e0b070; }
.set-row input{ width:22px; height:22px; }

/* ================= POLISH PASS (VISUAL_POLISH_SPEC Phase 0) ================= */
/* unified button press physics */
.btn-primary{ transition:transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out); }
.btn-soft{ transition:transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out); }
.btn-soft:active{ transform:translateY(3px); box-shadow:0 1px 0 var(--c-cream-lip); }
.tb-btn:active,.nav-btn:active,.menu-ico:active{ transform:scale(.92); }
/* hub background (kills flatness; excludes battle + illustrated map) */
.screen:not(#screen-battle):not(#screen-map){
  background:radial-gradient(120% 80% at 50% 0%, #fff6e6 0%, transparent 55%),
             linear-gradient(165deg,#fff3e0 0%,#ffe1ea 48%,#f3e4ff 100%); }
.screen:not(#screen-battle):not(#screen-map)::before{ content:""; position:absolute; inset:0;
  background:url('../assets/img/bg_sprinkles.webp') repeat; background-size:190px; opacity:.32; pointer-events:none; z-index:0; }
.panel-head,.unit-grid,#kitchen-list,.settings-list,.gacha-wrap,#dex-grid,#formation-roster,.formation-team,.formation-hint,.kitchen-note,
#bonus-list,.bn-block,#formation-boost,#dex-meter,#formation-rule,#formation-stars,#formation-enemies,#formation-air{ position:relative; z-index:1; }
/* headings terracotta */
.panel-head{ color:var(--c-orange-ink); font-size:var(--fs-title); }
.ns.on{ background:var(--c-star); }
/* inline currency icons */
.i-coin,.i-medal,.i-shard{ width:15px; height:15px; display:inline-block; vertical-align:-3px; margin-right:2px; background:center/contain no-repeat; }
.i-coin{ background-image:url('../assets/img/ui_coin.webp'); }
.i-medal{ background-image:url('../assets/img/ui_medal.webp'); }
.i-shard{ background-image:url('../assets/img/ui_shard.webp'); }
.i-crown{ width:16px; height:16px; display:inline-block; vertical-align:-3px; margin-right:3px; background:center/contain no-repeat; background-image:url('../assets/img/ui_crown.webp'); }
.i-sp{ color:var(--sp-d); font-size:10px; margin-right:1px; }
.i-sp::before{ content:"◆"; }
@media (prefers-reduced-motion:reduce){
  .btn-play,.map-pin.next,.gacha-machine,.overlay-emoji,.title-bg,#sp-fill::after,.cannon-btn.ready,.title-logo-img{ animation:none !important; }
  *{ transition-duration:.01ms !important; } }

/* A 568px phone loses roughly one Banner plus its safety gap in production, leaving about the same
 * usable height as a 480–520px viewport. Keep the two gacha CTAs above the bottom navigation there;
 * reveal cards may grow, so the screen remains vertically scrollable instead of clipping them. */
@media (max-height:640px){
  #screen-gacha{ justify-content:flex-start; overflow-y:auto; -webkit-overflow-scrolling:touch; }
  .gacha-wrap{ padding:10px 14px 16px; }
  .gacha-machine{ width:92px; height:92px; margin-bottom:6px; }
  .gacha-result{ min-height:90px; }
  .result-card{ width:min(92%,340px); padding:18px 16px; }
  .res-mascot{ width:74px; height:74px; }
  .result-card h1{ font-size:22px; margin:5px 0; }
  .result-stars{ margin:5px 0 8px; }
  .rstar{ font-size:32px; }
  .result-rewards{ margin:7px 0 12px; }
}

/* ---------- result polish (§8) ---------- */
/* stack mascot + ribbon tightly — reset the inherited .overlay-emoji font-size:56px that otherwise
   gives the inline-block ribbon a huge line-box and a big gap under the mascot */
#result-emoji{ display:flex; flex-direction:column; align-items:center; gap:8px; font-size:14px; line-height:1.2; }
.res-mascot{ width:92px; height:92px; margin:0; background:center/contain no-repeat; animation:floaty 2.4s ease-in-out infinite; }
.res-ribbon.lose{ background:linear-gradient(#ffb877,#f59c4b); font-size:14px; }
.result-card{ position:relative; z-index:1; animation:cardPop .5s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes cardPop{ 0%{ transform:scale(.7); opacity:0 } 100%{ transform:scale(1); opacity:1 } }
#screen-result.win::before{ content:""; position:absolute; top:50%; left:50%; width:640px; height:640px; margin:-320px 0 0 -320px; z-index:0;
  background:repeating-conic-gradient(from 0deg, rgba(255,214,120,.20) 0 11deg, transparent 11deg 22deg); border-radius:50%;
  animation:sunburst 16s linear infinite; pointer-events:none; }
@keyframes sunburst{ to{ transform:rotate(360deg) } }
.result-btns{ display:flex; gap:8px; justify-content:center; align-items:stretch; margin-top:4px; }
.result-btns button{ flex:1 1 0; min-width:0; margin:0; padding:13px 4px; font-size:14px; line-height:1.15; white-space:nowrap; border-radius:14px; }
.result-btns button .arrow{ font-size:11px; }
.confetti{ position:absolute; top:-24px; width:9px; height:14px; border-radius:2px; z-index:6; animation:confettiFall 1.9s ease-in forwards; }
@keyframes confettiFall{ 0%{ transform:translateY(-24px) rotate(0deg); opacity:1 } 100%{ transform:translateY(760px) rotate(560deg); opacity:.55 } }

/* ---------- first-battle coach marks ---------- */
#coach{ position:fixed; inset:0; z-index:50; }
#coach.hidden{ display:none; }
.coach-spot{ position:absolute; border-radius:14px; border:2.5px solid #ffd27a;
  box-shadow:0 0 0 9999px rgba(10,6,4,.72); pointer-events:none; animation:coachPulse 1.2s ease-in-out infinite; }
@keyframes coachPulse{ 0%,100%{ box-shadow:0 0 0 9999px rgba(10,6,4,.72),0 0 0 0 rgba(255,210,120,.5) }
  50%{ box-shadow:0 0 0 9999px rgba(10,6,4,.72),0 0 18px 4px rgba(255,210,120,.9) } }
.coach-bubble{ position:absolute; left:50%; transform:translateX(-50%); width:min(86%,340px);
  background:#fff9ee; border:3px solid #fff; border-radius:16px; padding:13px 16px; font-size:14px; font-weight:700;
  color:#5a3d2b; line-height:1.55; box-shadow:0 8px 24px rgba(0,0,0,.4); }
.coach-cue{ margin-top:8px; font-size:12px; font-weight:900; color:#f5601f; text-align:center; animation:tapBlink 1.2s ease-in-out infinite; }

/* ---------- themed yes/no confirm ---------- */
#confirm-modal{ position:fixed; inset:0; z-index:70; display:flex; align-items:center; justify-content:center; background:rgba(20,10,6,.55); }
#confirm-modal.hidden{ display:none; }
.cm-card{ width:min(84%,320px); background:linear-gradient(#fff9ee,#ffeccb); border:4px solid #fff; border-radius:22px;
  padding:22px 20px 18px; text-align:center; box-shadow:0 16px 40px rgba(0,0,0,.4); animation:cmPop .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes cmPop{ 0%{ transform:scale(.7); opacity:0 } 100%{ transform:scale(1); opacity:1 } }
.cm-msg{ font-size:15px; font-weight:800; color:#5a3d2b; line-height:1.6; margin-bottom:16px; }
.cm-btns{ display:flex; gap:10px; } .cm-btns button{ flex:1; }
.btn-primary.danger{ background:linear-gradient(#ff8a8a,#e04b4b); box-shadow:0 5px 0 #b83636; }
.rew-2x{ font-size:11px; font-weight:900; color:#fff; background:linear-gradient(#ff8fd0,#e04b9a); border-radius:8px; padding:1px 7px; margin-left:4px; box-shadow:0 2px 4px rgba(0,0,0,.2); }

/* ---------- formation: stage enemy preview ---------- */
#formation-enemies{ margin:0 2px 10px; }
.fe-label{ font-size:11px; font-weight:800; color:#8a6a50; margin-bottom:4px; letter-spacing:1px; }
.fe-row{ display:flex; flex-wrap:wrap; gap:6px; }
.fe-ico{ position:relative; width:42px; height:42px; border-radius:10px; background:linear-gradient(#fff2df,#ffe0c0); border:2px solid #fff; box-shadow:0 2px 4px rgba(0,0,0,.15); }
.fe-img{ position:absolute; inset:3px; background:center/contain no-repeat; }
.fe-ico.boss{ width:50px; height:50px; border-color:#ff6b8a; box-shadow:0 0 8px rgba(255,80,110,.5); background:linear-gradient(#ffe0e8,#ffc0cf); }
.fe-boss{ position:absolute; bottom:-4px; left:50%; transform:translateX(-50%); font-size:8px; font-weight:900; color:#fff; background:#e0405f; border-radius:5px; padding:0 4px; letter-spacing:.5px; }

/* ---------- full-screen premium gacha reveal ---------- */
#gacha-stage{ position:fixed; inset:0; z-index:80; display:flex; align-items:center; justify-content:center; overflow:hidden; }
#gacha-stage.hidden{ display:none !important; }
.gs-bg{ position:absolute; inset:0; background:radial-gradient(circle at 50% 42%, #452a52, #130912 72%); }
.gs-aura{ position:absolute; top:42%; left:50%; width:180vmax; height:180vmax; transform:translate(-50%,-50%);
  background:repeating-conic-gradient(from 0deg, transparent 0 5deg, rgba(255,255,255,.05) 5deg 7deg, transparent 7deg 22deg);
  animation:gsSpin 16s linear infinite; }
@keyframes gsSpin{ to{ transform:translate(-50%,-50%) rotate(360deg) } }
/* rarity-coloured light beam rising from the bottom during charge */
.gs-beam{ position:absolute; bottom:0; left:50%; transform:translateX(-50%); width:min(46%,190px); height:0;
  border-radius:120px 120px 0 0; filter:blur(11px); opacity:0; mix-blend-mode:screen; animation:gsBeam var(--dur) ease-out forwards; }
.gs-beam.r2{ background:linear-gradient(#dff4ff,#5bb8ff); }
.gs-beam.r3{ background:linear-gradient(#fff3c0,#ffb42e); }
.gs-beam.r4{ background:linear-gradient(#ffd6f4,#c79bff 38%,#ffdca6 68%,#9bffe4); }
@keyframes gsBeam{ 0%{ height:0; opacity:0 } 25%{ opacity:.95 } 100%{ height:108%; opacity:.85 } }
/* charging orb */
.gs-orb{ position:relative; width:132px; height:132px; border-radius:50%;
  background:radial-gradient(circle at 42% 36%, #fff, var(--oc) 56%, rgba(255,255,255,0) 74%);
  box-shadow:0 0 55px 10px var(--oc); animation:gsOrb var(--dur) cubic-bezier(.4,0,.7,1) forwards; }
.gs-orb::after{ content:""; position:absolute; inset:-16px; border-radius:50%; border:2.5px solid var(--oc); opacity:.55; animation:gsRing 1s ease-out infinite; }
@keyframes gsOrb{ 0%{ transform:scale(.2); opacity:.3 } 55%{ transform:scale(1); opacity:1 } 82%{ transform:scale(1.18) } 100%{ transform:scale(2); opacity:0 } }
@keyframes gsRing{ 0%{ transform:scale(.55); opacity:.65 } 100%{ transform:scale(1.7); opacity:0 } }
/* r4 charge tints the whole stage */
#gacha-stage.charging .gs-bg{ animation:gsChargeTint var(--dur,1.5s) ease-in; }
@keyframes gsChargeTint{ 0%,60%{ background:radial-gradient(circle at 50% 42%,#452a52,#130912 72%) } 100%{ background:radial-gradient(circle at 50% 42%,#6a3a6e,#1a0a1c 72%) } }
/* reveal: spinning rays + white burst behind the card */
.gs-rays{ position:absolute; top:50%; left:50%; width:170vmax; height:170vmax; transform:translate(-50%,-50%); opacity:.55;
  background:repeating-conic-gradient(from 0deg, var(--rr,rgba(255,255,255,.14)) 0 2.5deg, transparent 2.5deg 9deg); animation:gsSpin 22s linear infinite; }
.gs-rays.r2{ --rr:rgba(150,210,255,.16) } .gs-rays.r3{ --rr:rgba(255,210,120,.22) } .gs-rays.r4{ --rr:rgba(255,180,240,.26) }
.gs-burst{ position:absolute; top:50%; left:50%; width:18px; height:18px; transform:translate(-50%,-50%); border-radius:50%; background:#fff; animation:gsBurst .55s ease-out forwards; }
@keyframes gsBurst{ 0%{ opacity:1; box-shadow:0 0 0 6px #fff } 100%{ opacity:0; box-shadow:0 0 0 340px rgba(255,255,255,0) } }
/* the reveal card */
.gs-card{ position:relative; z-index:2; width:min(74%,282px); padding:22px 18px 16px; border-radius:26px; text-align:center;
  background:linear-gradient(#fffdf7,#fff2da); border:4px solid var(--rc,#fff); box-shadow:0 0 44px var(--rc,#fff),0 16px 44px rgba(0,0,0,.5);
  animation:gsCard .55s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes gsCard{ 0%{ transform:scale(0) rotate(-14deg); opacity:0 } 65%{ transform:scale(1.12) } 100%{ transform:scale(1) } }
.gs-card.r4{ animation:gsCard .55s cubic-bezier(.2,1.6,.4,1) both, gsGlow4 1.5s ease-in-out .55s infinite; }
@keyframes gsGlow4{ 0%,100%{ box-shadow:0 0 30px #ff9ecb,0 16px 44px rgba(0,0,0,.5) } 50%{ box-shadow:0 0 60px #ff5fb0,0 16px 44px rgba(0,0,0,.5) } }
.gs-card .uface{ width:134px; margin:0 auto; }
.gs-badge{ display:inline-block; margin-top:8px; font-size:13px; font-weight:900; letter-spacing:1px; color:#fff; padding:2px 14px; border-radius:9px; box-shadow:0 2px 5px rgba(0,0,0,.25); }
.gs-badge.r2{ background:linear-gradient(#86d97e,#3fa84e) } .gs-badge.r3{ background:linear-gradient(#ffd27a,#f5a623); color:#7a4a12 } .gs-badge.r4{ background:linear-gradient(#ff9ecb,#ff5fb0) }
.gs-name{ font-size:22px; font-weight:900; color:#5a3d2b; margin-top:5px; }
.gs-rar{ font-size:21px; color:#f5a623; letter-spacing:3px; margin-top:1px; animation:gsStars .5s ease .22s backwards; }
@keyframes gsStars{ 0%{ letter-spacing:22px; opacity:0 } 100%{ letter-spacing:3px; opacity:1 } }
.gs-tag{ font-size:14px; font-weight:900; color:#c7562e; margin-top:2px; }
/* UR holographic foil sweep */
.gs-foil{ position:absolute; inset:0; border-radius:26px; overflow:hidden; pointer-events:none; }
.gs-foil::before{ content:""; position:absolute; top:-50%; left:-70%; width:55%; height:200%;
  background:linear-gradient(115deg, transparent, rgba(255,255,255,.6), rgba(190,225,255,.35), transparent); transform:rotate(8deg); animation:gsFoil 2.4s ease-in-out infinite; }
@keyframes gsFoil{ 0%{ left:-70% } 55%,100%{ left:140% } }
.gs-tapcue{ position:absolute; bottom:calc(42px + var(--safe-b)); left:0; right:0; text-align:center; color:rgba(255,255,255,.82); font-size:13px; font-weight:800; letter-spacing:2px; animation:tapBlink 1.2s ease-in-out infinite; }

/* ---------- enemy info (formation preview → detail) ---------- */
.fe-ico{ position:relative; width:44px; height:44px; padding:0; border:2px solid #fff; border-radius:10px; cursor:pointer;
  background:linear-gradient(#fff2df,#ffe0c0); box-shadow:0 2px 4px rgba(0,0,0,.15); }
.fe-ico:active{ transform:translateY(2px); }
.fe-i{ position:absolute; top:-5px; right:-5px; width:15px; height:15px; line-height:15px; text-align:center; font-size:10px; font-weight:900; font-style:italic;
  color:#fff; background:#8a6ac0; border-radius:50%; border:1.5px solid #fff; }
.fe-hint{ font-size:10px; font-weight:600; color:#a98; }
.ei-face{ width:78px; height:78px; flex:0 0 auto; border-radius:14px; position:relative; overflow:hidden; background:linear-gradient(#f2e2d0,#e0cbb2); }
.dd-badge.ei-k{ background:linear-gradient(#c9b4a0,#a98f78); }
.ei-traits{ display:flex; flex-wrap:wrap; gap:6px; margin:2px 0 12px; }
.ei-trait{ font-size:12px; font-weight:800; color:#fff; background:var(--tc,#9a8a6a); border-radius:9px; padding:4px 10px; box-shadow:0 2px 4px rgba(0,0,0,.18); }

/* ---------- main-story card ---------- */
#story-card{ position:fixed; inset:0; z-index:85; overflow:hidden; cursor:pointer; }
#story-card.hidden{ display:none !important; }
.sc-bg{ position:absolute; inset:0; background:url('../assets/img/bg_story.webp') center/cover no-repeat #2a1830; }
.sc-tint{ position:absolute; inset:0; background:var(--sc-tint,transparent); }
.sc-tint::after{ content:""; position:absolute; inset:0; background:linear-gradient(to bottom, rgba(18,8,18,.38), transparent 20%, transparent 52%, rgba(18,8,18,.6)); }
.sc-portrait{ position:absolute; bottom:128px; height:56%; width:min(58%,255px); background:center bottom/contain no-repeat; filter:drop-shadow(0 8px 16px rgba(0,0,0,.55)); animation:scRise .3s ease both; }
.sc-portrait.left{ left:1%; }
.sc-portrait.right{ right:0; width:min(64%,290px); animation:scRise .3s ease both, scBreathe 4s ease-in-out .35s infinite; }
@keyframes scRise{ 0%{ transform:translateY(26px); opacity:0 } 100%{ transform:translateY(0); opacity:1 } }
@keyframes scBreathe{ 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.022) } }
.sc-plate{ position:absolute; left:calc(12px + var(--safe-l)); right:calc(12px + var(--safe-r)); bottom:calc(18px + var(--safe-b)); min-height:108px; padding:20px 18px 16px; border-radius:20px;
  background:linear-gradient(#fff9ee,#ffeecb); border:3px solid #6b4a2a; box-shadow:0 8px 24px rgba(0,0,0,.5),inset 0 0 0 2px #fff;
  animation:scPlate .35s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes scPlate{ 0%{ transform:translateY(22px) scale(.96); opacity:0 } 100%{ transform:none; opacity:1 } }
.sc-name{ position:absolute; top:-14px; left:16px; font-size:14px; font-weight:900; color:#fff; padding:3px 16px; border-radius:8px; box-shadow:0 3px 6px rgba(0,0,0,.3); }
.sc-name.h{ background:linear-gradient(#ffcf5a,#f5a623); color:#6b4410; }
.sc-name.v{ background:linear-gradient(#b07de0,#7a44b0); }
.sc-text{ font-size:15px; font-weight:700; line-height:1.75; color:#4a3320; min-height:2.6em; }
.sc-next{ position:absolute; right:16px; bottom:9px; font-size:14px; color:#c7562e; animation:tapBlink 1s ease-in-out infinite; }
.sc-skip{ position:absolute; top:calc(14px + var(--safe-t)); right:calc(12px + var(--safe-r)); z-index:2; font:inherit; font-size:12px; font-weight:800; color:#fff;
  background:rgba(20,10,20,.42); border:1.5px solid rgba(255,255,255,.4); border-radius:999px; padding:5px 14px; cursor:pointer; }

/* ---- gacha sub-actions: drop-rate disclosure + かけら exchange (audit M3/M5) ---- */
.gacha-sub{ display:flex; gap:8px; justify-content:center; margin:8px 0 2px; }
.gacha-sub-btn{ background:linear-gradient(#fff6e6,#ffe1c0); border:2px solid #fff; color:#8a5a2b; font-weight:900; font-size:12px;
  padding:6px 12px; border-radius:14px; cursor:pointer; display:inline-flex; align-items:center; gap:4px; box-shadow:0 2px 6px rgba(0,0,0,.2); }
.gacha-sub-btn:active{ transform:scale(.96); }
.gacha-sub-btn b{ color:#c94ea0; margin-left:2px; }

/* drop-rate modal */
.go-card{ text-align:left; max-height:78vh; overflow-y:auto; }
.go-title,.ex-title{ font-size:17px; font-weight:900; color:#8a5a2b; text-align:center; margin-bottom:10px; }
.go-row{ display:flex; justify-content:space-between; align-items:center; margin-top:8px; font-weight:900; }
.go-r{ font-size:14px; color:#5a3d2b; } .go-r.r4{ color:#c94ea0; } .go-r.r3{ color:#e0912a; } .go-r.r2{ color:#3f9a4a; }
.go-pct{ font-size:16px; color:#5a3d2b; }
.go-units{ font-size:11px; font-weight:700; color:#7a6a58; line-height:1.5; margin:2px 0 6px; }
.go-note{ font-size:11px; color:#8a7a66; margin-top:12px; line-height:1.6; }

/* exchange-shop modal */
.ex-card{ text-align:left; max-height:80vh; overflow-y:auto; }
.ex-have{ display:flex; align-items:center; gap:4px; justify-content:center; font-weight:900; color:#7a5a2b; margin-bottom:10px; }
.ex-have b{ color:#c94ea0; font-size:16px; margin-left:2px; }
.ex-list{ display:flex; flex-direction:column; gap:8px; }
.ex-row{ display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.55); border-radius:14px; padding:6px 8px; }
.ex-face{ width:44px; height:44px; flex:0 0 auto; position:relative; }
.ex-face .uface{ width:44px; height:44px; }
.ex-mid{ flex:1 1 auto; min-width:0; }
.ex-name{ font-weight:900; color:#5a3d2b; font-size:13px; }
.ex-rar{ font-size:11px; font-weight:800; } .ex-rar.r4{ color:#c94ea0; } .ex-rar.r3{ color:#e0912a; }
.ex-buy{ flex:0 0 auto; font-size:13px; display:inline-flex; align-items:center; gap:3px; white-space:nowrap; }
.ex-buy.cant{ opacity:.5; }
.ex-empty{ text-align:center; font-weight:800; color:#7a6a58; padding:16px 0; }
.ex-note{ font-size:11px; color:#8a7a66; margin-top:10px; line-height:1.6; text-align:center; }

/* evolution cinematic — the biggest payoff moment, previously a silent instant swap */
#gacha-stage.evo-seq{ display:flex; align-items:center; justify-content:center; }
.evo-wrap{ position:relative; z-index:2; display:flex; flex-direction:column; align-items:center; gap:14px; }
.evo-label{ font-size:26px; font-weight:900; color:#fff; letter-spacing:4px;
  text-shadow:0 3px 0 #c94ea0,0 6px 16px rgba(0,0,0,.5); animation:evoPulse 1s ease-in-out infinite; }
.evo-face{ width:150px; height:150px; position:relative; transition:transform .28s var(--ease-pop,cubic-bezier(.2,1.5,.4,1)); }
.evo-face .uface{ width:150px; height:150px; }
#gacha-stage.charging-evo .evo-face{ animation:evoShake .1s linear infinite; }
#gacha-stage.revealed-evo .evo-face{ transform:scale(1.12); }
.evo-name{ font-size:19px; font-weight:900; color:#fff; text-shadow:0 2px 0 #c94ea0,0 5px 14px rgba(0,0,0,.5); }
@keyframes evoPulse{ 0%,100%{ transform:scale(1);} 50%{ transform:scale(1.08);} }
@keyframes evoShake{ 0%{transform:translate(-2px,1px)} 25%{transform:translate(2px,-1px)} 50%{transform:translate(-1px,-2px)} 75%{transform:translate(1px,2px)} 100%{transform:translate(0,0)} }

/* star conditions, shown BEFORE the sortie so a first run can actually aim for them */
#formation-stars{ margin:0 0 8px; padding:7px 10px; border-radius:12px; background:rgba(255,255,255,.55); border:2px solid #ffd27a; }
.fs-h{ font-size:11px; font-weight:900; color:#8a5a2b; margin-bottom:3px; }
.fs-row{ font-size:11px; font-weight:700; color:#7a6a58; line-height:1.6; }
.fs-row.got{ color:#c7562e; }
.fs-star{ color:#d8cbb8; margin-right:4px; } .fs-row.got .fs-star{ color:#f5a623; }

/* one-time health / photosensitivity notice */
#health-notice{ position:fixed; inset:0; z-index:80; display:flex; align-items:center; justify-content:center;
  background:rgba(20,12,18,.72); padding:20px; }
.hn-card{ width:min(94%,340px); background:linear-gradient(#fff9ee,#ffeccb); border:4px solid #fff; border-radius:22px;
  padding:20px 18px; box-shadow:var(--shadow-modal,0 16px 44px rgba(0,0,0,.45)); text-align:center; }
.hn-title{ font-size:16px; font-weight:900; color:#8a5a2b; margin-bottom:10px; }
.hn-body{ font-size:12px; font-weight:700; color:#5a3d2b; line-height:1.9; margin-bottom:16px; text-align:left; }

/* air layer: anti-air marker on unit cards + "no answer to flyers" pre-sortie warning */
.uc-aa{ position:absolute; top:4px; left:4px; width:17px; height:17px; line-height:17px; text-align:center;
  border-radius:50%; background:linear-gradient(#8fd0ff,#3aa0ff); color:#fff; font-size:10px; font-weight:900;
  border:1.5px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.3); z-index:2; }
#formation-air{ display:flex; align-items:center; gap:8px; margin:0 0 8px; padding:7px 10px; border-radius:12px;
  background:linear-gradient(#e6f2ff,#c8e2ff); border:2px solid #4bb3ff; font-size:11px; font-weight:700; color:#1c5a86; line-height:1.5; }
.fa-ico{ flex:0 0 auto; font-size:17px; }
#formation-air b{ color:#c7562e; }
.dd-aa{ margin:6px 0; padding:6px 10px; border-radius:10px; background:linear-gradient(#e6f2ff,#cfe6ff);
  border:1.5px solid #4bb3ff; font-size:11.5px; font-weight:700; color:#1c5a86; }
.dd-aa b{ color:#0f74b8; }

/* The one thing that justifies ¥500 against a free competitor — say it on the title screen */
.title-badge{ display:inline-block; margin-top:7px; padding:4px 12px; border-radius:999px;
  background:rgba(255,255,255,.92); color:#c7562e; font-size:10.5px; font-weight:900; letter-spacing:.3px;
  border:2px solid #ffd27a; box-shadow:0 2px 6px rgba(0,0,0,.25); }

/* loss post-mortem on the result screen */
.lr{ background:rgba(255,255,255,.6); border-radius:14px; padding:10px 12px; margin:6px 0; text-align:left; }
.lr-row{ display:flex; justify-content:space-between; font-size:12px; font-weight:800; color:#6a4a34; padding:2px 0; }
.lr-row b{ color:#c7562e; }
.lr-tip{ margin-top:7px; padding-top:7px; border-top:1.5px dashed #e0c8a8; font-size:11.5px; font-weight:700; color:#5a3d2b; line-height:1.6; }
.lr-tip b{ color:#c94ea0; }

/* ending sequence */
#story-card.ending .ed-wrap{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; padding:calc(20px + var(--safe-t)) 18px calc(20px + var(--safe-b)); text-align:center; overflow-y:auto; }
.ed-title{ font-size:38px; font-weight:900; color:#fff; text-shadow:0 3px 0 #c7562e,0 6px 14px rgba(0,0,0,.4); }
.ed-sub{ font-size:13px; font-weight:800; color:#fff6e6; text-shadow:0 2px 5px rgba(0,0,0,.5); }
.ed-parade{ display:flex; flex-wrap:wrap; justify-content:center; gap:5px; max-width:100%; margin:4px 0; }
.ed-u{ width:38px; height:38px; display:block; opacity:0; animation:edPop .5s var(--ease-pop,cubic-bezier(.2,1.5,.4,1)) forwards; }
.ed-u .uface{ width:38px; height:38px; }
@keyframes edPop{ from{ opacity:0; transform:scale(.3) translateY(10px);} to{ opacity:1; transform:none; } }
.ed-stats{ display:flex; gap:14px; font-size:13px; font-weight:900; color:#fff; text-shadow:0 2px 5px rgba(0,0,0,.5); }
.ed-stats b{ color:#ffd27a; }
.ed-thanks{ font-size:12px; font-weight:800; color:#fff; line-height:1.7; text-shadow:0 2px 5px rgba(0,0,0,.5); }
.ed-thanks span{ font-size:11px; color:#ffe6a8; }
#story-card.ending .ed-close{ margin-top:6px; padding:12px 30px; }

/* 修行の塔 — endless mode entry, sits at the top of the world map */
.tower-card{ display:flex; align-items:center; gap:10px; margin:10px 12px; padding:12px; border-radius:18px;
  background:linear-gradient(150deg,#3a2b5a,#6a4a8a); border:3px solid #ffd27a; box-shadow:0 6px 18px rgba(0,0,0,.35); }
.tw-ico{ font-size:34px; flex:0 0 auto; filter:drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.tw-mid{ flex:1 1 auto; min-width:0; }
.tw-name{ font-size:16px; font-weight:900; color:#ffe6a8; }
.tw-sub{ font-size:11px; font-weight:700; color:#d8c8ea; line-height:1.4; }
.tw-rec{ font-size:11px; font-weight:800; color:#fff; margin-top:3px; } .tw-rec b{ color:#ffd27a; font-size:14px; }
.tower-card .tw-start{ flex:0 0 auto; padding:10px 14px; font-size:14px; }
.tw-floor{ text-align:center; font-size:15px; font-weight:800; color:#5a3d2b; margin:6px 0; } .tw-floor b{ font-size:26px; color:#c94ea0; }
.tw-best{ text-align:center; font-size:13px; font-weight:900; color:#e0912a; margin-bottom:6px; }
.tw-best.sub{ color:#8a7a66; font-weight:700; font-size:11px; }
.tw-rew{ text-align:center; font-size:14px; font-weight:900; color:#5a3d2b; margin:8px 0; }
.tw-warn{ text-align:center; font-size:11px; color:#8a7a66; margin-bottom:8px; }

/* おかわり盛り: per-stage rule badge (map pin) + pre-sortie banner (formation) */
.pin-rule{ position:absolute; top:-6px; right:-6px; width:18px; height:18px; line-height:18px; text-align:center;
  border-radius:50%; background:linear-gradient(#ff8f5a,#e8452a); color:#fff; font-size:11px; font-weight:900;
  border:2px solid #fff; box-shadow:0 2px 5px rgba(0,0,0,.3); }
#formation-rule{ display:flex; align-items:center; gap:8px; margin:0 0 8px; padding:7px 10px; border-radius:12px;
  background:linear-gradient(#fff1e0,#ffdcc4); border:2px solid #ff9c6b; }
.fr-tag{ flex:0 0 auto; background:linear-gradient(#ff8f5a,#e8452a); color:#fff; font-size:11px; font-weight:900;
  padding:3px 9px; border-radius:999px; white-space:nowrap; }
.fr-desc{ font-size:11px; font-weight:700; color:#8a4a2b; line-height:1.4; }
.cannon-btn.locked{ filter:grayscale(1) brightness(.75); }

/* backup-code dialog — a lost save with no recovery path is the worst outcome for a paid game */
.bk-card{ text-align:left; }
.bk-note{ font-size:11px; color:#8a7a66; line-height:1.6; margin-bottom:10px; }
.bk-code{ width:100%; font-family:ui-monospace,Menlo,monospace; font-size:10px; line-height:1.4; padding:8px;
  border:2px solid #e6d3b4; border-radius:10px; background:#fffdf7; color:#5a3d2b; resize:none;
  user-select:text; -webkit-user-select:text; }
.bk-card .cm-btns{ margin:10px 0; }

/* first-battle coach skip (audit UX minor) */
.coach-skip{ position:fixed; top:calc(10px + var(--safe-t)); right:calc(10px + var(--safe-r)); z-index:52;
  background:rgba(20,12,8,.5); color:#fff; border:1.5px solid rgba(255,255,255,.55); font:inherit; font-weight:800; font-size:12px;
  padding:5px 12px; border-radius:14px; cursor:pointer; }
