/* v99: shared button skin, floor screen nav, loot list that never hides under OK, enemy drain ghosts, chest mini-bursts */

/* ---- the skin: grain + a soft top light + a carved edge, over the button's own colour ---- */
.skn{background-image:linear-gradient(180deg,rgba(255,240,210,.16),rgba(255,255,255,0) 42%,rgba(0,0,0,.26)),url(../assets/ui/skin_grain.webp)!important;
  background-size:100% 100%,128px 128px!important;background-repeat:no-repeat,repeat!important;
  box-shadow:inset 0 1px 0 rgba(255,236,190,.22),inset 0 -2px 0 rgba(0,0,0,.32),0 1px 3px rgba(0,0,0,.35)}
.skn.skblank{background-color:#3b2664!important;border-color:rgba(212,175,55,.5)!important}
.skn.skblank:disabled,.skn.skblank.locked{background-color:#2a2238!important}
.skn:active:not(:disabled){filter:brightness(.92)}
/* the home tab bar: purple plates in a row */
.tabbar .btn.tab.skn{border-radius:12px;border:1px solid rgba(212,175,55,.42)!important}

/* ---- floor screen: Home / Hero plates and the Fight button ---- */
.hall1 .top{align-items:flex-start}
.hall1 .btn.nav14{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;width:58px;min-width:58px;min-height:56px;padding:4px 2px 3px;border-radius:12px;text-align:center;line-height:1}
.hall1 .nav14 .nic14 .ic14{width:28px;height:28px;display:block;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
.hall1 .nav14 .nl14{font-size:.68rem;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#ffe9b0;text-shadow:0 1px 0 #000}
.hall1 .nav14 .hpor14{position:relative;display:block;width:32px;height:32px;border-radius:50%;overflow:hidden;background:radial-gradient(circle at 50% 35%,#5b3d8a,#1d1430);box-shadow:0 0 0 1.5px #d4af37,0 1px 3px rgba(0,0,0,.6)}
.hall1 .nav14 .hpor14 .tav{position:absolute;left:50%;top:-4%;width:290%;height:290%;transform:translateX(-50%);pointer-events:none}
.hall1 .nav14 .hpor14 .tav>*{width:100%!important;height:100%!important}
.hall1 .nav14 .hpor14 .tav *{animation:none!important}
.hall1 .nav14.dot{position:relative}
.hall1 .nav14.dot::after{content:'';position:absolute;top:3px;right:5px;width:10px;height:10px;border-radius:50%;background:#ef4444;box-shadow:0 0 0 2px #1a1028,0 0 6px #ef4444}
.btn.fight14{display:flex;align-items:center;justify-content:center;gap:10px}
.btn.fight14 .fic14{display:inline-flex;width:34px;height:34px;flex:none;border-radius:50%;align-items:center;justify-content:center;
  background:radial-gradient(circle at 50% 35%,rgba(255,240,200,.25),rgba(0,0,0,.35));box-shadow:inset 0 0 0 1.5px rgba(255,214,120,.7),0 1px 2px rgba(0,0,0,.5)}
.btn.fight14 .fic14 .ic14{width:26px;height:26px;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
.btn.fight14 .fl14{font-size:1.08em;letter-spacing:.03em}

/* ---- loot sheet: the list scrolls in its own box, OK sits under it (never on top of the last row) ---- */
.dh .win.dhbox:has(.boxwin.open){overflow:hidden;display:flex;flex-direction:column}
.win.dhbox .boxwin.open{min-height:0;max-height:calc(100dvh - 34px - var(--safe-t,0px) - var(--safe-b,0px));display:flex;flex-direction:column;justify-content:flex-start}
.boxwin.open .lootscroll{flex:1 1 auto;min-height:0;width:100%;overflow-y:auto;overscroll-behavior:contain;display:grid;gap:5px;align-content:start;padding:2px 0 6px;
  -webkit-mask-image:linear-gradient(180deg,#000 calc(100% - 14px),transparent);mask-image:linear-gradient(180deg,#000 calc(100% - 14px),transparent)}
.boxwin.open .lootscroll:not(.lsmore){-webkit-mask-image:none;mask-image:none}
.boxwin.open .thumbbar{position:static!important;flex:none}
.boxwin.open .chest.c2{flex:none}

/* ---- chest mini-burst per rare+ item ---- */
.cbp.cring.mini14{width:34px;height:34px;margin:-17px;border-width:2px}
.loot.pop14{animation:pop14 .5s ease-out}
@keyframes pop14{0%{transform:scale(1)}35%{transform:scale(1.035);box-shadow:0 0 18px var(--rc,#fff)}100%{transform:scale(1)}}

/* ---- enemy drain ghost (same look as the hero's) ---- */
#fbox .bar.tx{position:relative}
#fbox .bar.tx .trail.ftrail{position:absolute;left:0;top:0;bottom:0;border-radius:inherit;background:linear-gradient(180deg,rgba(255,236,200,.92),rgba(255,170,110,.78));z-index:0}
#fbox .bar.tx>u{position:relative;z-index:1}
#fbox .bar.tx>span{z-index:2}

/* ---- overlap fixes found by the sweep ---- */
/* Ideas: the tab row fits the screen (wraps instead of running off the edge) */
.ideatabs2{flex-wrap:wrap!important;overflow:visible!important;row-gap:5px}
.ideatabs2 .itab{padding:0 9px!important;height:32px!important}
/* Items: slot names wrap to two short lines instead of being cut */
.gslot b{white-space:normal!important;text-overflow:clip!important;overflow-wrap:normal;word-break:normal;line-height:1.05;font-size:9.5px!important;max-height:2.2em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* ---- v99b: every chest uses the boss-crate build-up (same keyframes as .crate.op-crate) ---- */
.chest.c2.op-crate:not(.crate){animation:crumble 1.25s linear forwards}
.chest.c2.op-crate:not(.crate) .glow{animation:cbuild 1.25s ease-in forwards}
@media (prefers-reduced-motion:reduce){.chest.c2.op-crate{animation:none}}
.gslot{padding-left:2px!important;padding-right:2px!important}.gslot b{font-size:8.4px!important;letter-spacing:-.5px}
@media (max-width:380px){#cmds .cmd2 .cs{font-size:.6rem!important;letter-spacing:-.2px}}

/* ---- Items (v99b): cards inside the panel, buttons wrap under the text on narrow phones ---- */
.scroll.inv{overflow-x:hidden}
.scroll.inv>.loot{box-sizing:border-box;width:100%;max-width:100%;min-width:0;flex-wrap:wrap!important;row-gap:6px}
.scroll.inv>.loot>div:not(.iacts){flex:1 1 0;min-width:0}
@media (max-width:430px){.scroll.inv>.loot>.iacts{flex-basis:100%;justify-content:flex-end;margin-left:0}}
.scroll.inv>.loot>.iacts .btn.small{min-width:44px;min-height:36px}
/* filter + action rows: drawn icon over a word */
.itabs.itabs14{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin:6px 0 2px}
.itabs.itabs14 .btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:44px;padding:3px 2px;text-align:center;line-height:1}
.itabs.itabs14 .btn .ic14{width:22px;height:22px;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
.itabs.itabs14 .btn span{font-size:.66rem;font-weight:700;letter-spacing:.02em;white-space:nowrap}
.itabs.iacts14 .btn span{font-size:.62rem}
/* worn tiles: the gear's own picture, a small badge for elements/enchants, +N in its own chip, names on two whole-word lines */
.gslot{position:relative}
.gslot .lic .itico{width:24px;height:24px;object-fit:contain;display:block}
.gslot b{display:-webkit-box!important;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important;hyphens:none;text-overflow:clip!important}
.gslot .gsbadge{position:absolute;top:2px;right:2px;display:flex;gap:1px;padding:1px 3px;border-radius:7px;background:rgba(10,8,20,.85);border:1px solid rgba(212,175,55,.5);font-style:normal;font-size:8px;line-height:1.2}
.gslot .gsbadge .gsel{position:static!important;font-size:8px!important;transform:none!important;animation:none!important}
.gslot .gsplus{position:absolute;top:2px;left:2px;padding:0 3px;border-radius:6px;background:rgba(10,8,20,.85);color:#ffe9b0;font:800 8px/1.3 system-ui,sans-serif;font-style:normal}
/* the ☁ / ⚠ save dot stays out of the way of panels */
body:has(#modal .win) #syncdot{display:none}
#syncdot{left:auto;right:6px;bottom:calc(4px + env(safe-area-inset-bottom))}

/* ---- v99b: battle bar back to v97d (layout A: Attack | Skills | Items; Skills opens the 3-column menu) ---- */
.b1 #cmds .lyscroll{grid-auto-rows:42px}
.b1 #cmds .lyscroll .cmd2.small{height:42px;min-height:42px}
.b1 #cmds.ly-A.m-main{display:grid;flex-direction:row;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-height:92px;height:auto}
.b1 #cmds.ly-A.m-main>.cmd2{height:var(--cmdh,56px);min-height:44px}

/* ---- v99c: founders' "Try new art" icons ---- */
#cmds .cic.na14c>img.na14{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
img.itico.na14{object-fit:contain}

/* ---- v99c: chest reward screen: coins and OK float on the scene (no panel behind them); OK textured ---- */
.win.dhbox .boxwin.open .loot.coinsrow,.win.dhbox .boxwin.open .loot.potrow{background:none!important;background-color:transparent!important;border:0!important;box-shadow:none!important}
.win.dhbox .boxwin.open .loot.coinsrow b,.win.dhbox .boxwin.open .loot.potrow b{text-shadow:0 1px 2px #000,0 0 8px rgba(0,0,0,.8)}
.win.dhbox .boxwin.open .thumbbar{background:none!important;border:0!important;box-shadow:none!important}
.win.dhbox .boxwin.open #bok{background-image:linear-gradient(180deg,rgba(255,240,210,.18),rgba(255,255,255,0) 42%,rgba(0,0,0,.28)),url(../assets/ui/skin_grain.webp)!important;background-size:100% 100%,128px 128px!important;background-color:#4b2a86!important;border:1px solid #d4af37!important}
/* daily gift and other boxes: no 🎁 Open pill, a tap anywhere opens */
.win.dhbox #gopen{position:fixed;inset:0;width:100%;height:100%;opacity:0;z-index:5;min-height:0;border:0;background:none}
/* the boss banner never sits over a chest */
body:has(#modal .boxveil) .celeb{display:none}
input[type=range].rng14{-webkit-appearance:none;appearance:none;height:22px;background:transparent}
input[type=range].rng14::-webkit-slider-runnable-track{height:8px;border-radius:5px;background:linear-gradient(90deg,#d4af37 0,#f5d77a var(--p,50%),#2a2140 var(--p,50%));box-shadow:inset 0 1px 2px rgba(0,0,0,.6)}
input[type=range].rng14::-moz-range-track{height:8px;border-radius:5px;background:linear-gradient(90deg,#d4af37 0,#f5d77a var(--p,50%),#2a2140 var(--p,50%))}
input[type=range].rng14::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;margin-top:-7px;border-radius:50%;background:radial-gradient(circle at 40% 35%,#fff7d6,#d4af37 60%,#8a5a16);border:1px solid #1a1420;box-shadow:0 1px 3px rgba(0,0,0,.6)}
input[type=range].rng14::-moz-range-thumb{width:22px;height:22px;border-radius:50%;background:radial-gradient(circle at 40% 35%,#fff7d6,#d4af37 60%,#8a5a16);border:1px solid #1a1420}
/* with no Open button under it, lift the closed chest into the middle of the fight area */
.win.dhbox .boxwin:not(.open){transform:translateY(-7vh)}

/* ---- v99c: playing on another device ---- */
#elsewhere{position:fixed;inset:0;z-index:2147483000;display:grid;place-items:center;background:rgba(6,4,14,.86);backdrop-filter:blur(3px)}
#elsewhere .elsw{width:min(86vw,340px);padding:18px 16px;border-radius:16px;text-align:center;background:linear-gradient(180deg,#2a1a48,#160f28);border:1px solid #d4af37;box-shadow:0 10px 40px rgba(0,0,0,.6);color:#f3ecff}
#elsewhere b{display:block;font-size:1.05rem;color:#ffe9b0;margin-bottom:6px}
#elsewhere p{margin:0 0 12px;font-size:.88rem;color:#cfc6e6}
#elsewhere .btn{text-align:center}

/* ---- v99d: Home and Hero on the floor screen wear the same plate as Fight (purple grain, gold trim, same label font) ---- */
.hall1 .btn.nav14{background-color:var(--fight-bg,#4b2a86)!important;background-image:linear-gradient(180deg,rgba(255,240,210,.16),rgba(255,255,255,0) 42%,rgba(0,0,0,.26)),url(../assets/ui/skin_grain.webp)!important;
  background-size:100% 100%,128px 128px!important;border:1.5px solid #d4af37!important;border-radius:12px;box-shadow:inset 0 1px 0 rgba(255,236,190,.22),inset 0 -2px 0 rgba(0,0,0,.32),0 2px 6px rgba(0,0,0,.45)!important;
  width:64px;min-width:64px;min-height:60px;animation:none!important}
.hall1 .nav14 .nl14{font-family:inherit;font-size:.7rem;font-weight:800;letter-spacing:.06em;color:#fff4d6}
.hall1 .nav14 .hpor14{width:30px;height:30px;border-radius:50%;background:radial-gradient(circle at 50% 35%,rgba(255,240,200,.25),rgba(0,0,0,.35));box-shadow:inset 0 0 0 1.5px rgba(255,214,120,.7),0 1px 2px rgba(0,0,0,.5)}
.hall1 .nav14 .nic14{display:inline-flex;width:30px;height:30px;border-radius:50%;align-items:center;justify-content:center;background:radial-gradient(circle at 50% 35%,rgba(255,240,200,.25),rgba(0,0,0,.35));box-shadow:inset 0 0 0 1.5px rgba(255,214,120,.7),0 1px 2px rgba(0,0,0,.5)}
.hall1 .nav14 .nic14 .ic14{width:22px;height:22px}

/* ---- v99d: the opened chest is BIG and sits in the empty middle; the loot list and OK stay at the bottom ---- */
.win.dhbox .boxwin.open{justify-content:flex-start;height:calc(100dvh - 34px - var(--safe-t,0px) - var(--safe-b,0px));max-height:none;padding-top:0}
.win.dhbox .boxwin.open>.chest.c2{display:grid!important;place-items:center;flex:1 1 auto;min-height:120px;width:100%!important;height:auto!important;max-height:none;margin:0!important;overflow:visible}
.win.dhbox .boxwin.open>.chest.c2 .chest2,.win.dhbox .boxwin.open>.chest.c2 .crate2{transform:scale(var(--chs,1.35))!important;transform-origin:50% 50%!important}
.win.dhbox .boxwin.open>.chest.c2 img.chestart,.win.dhbox .boxwin.open>.chest.c2 .chestart{object-fit:contain}
.win.dhbox .boxwin.open .lootscroll{flex:0 1 auto;max-height:58%}
@media (max-height:700px){.win.dhbox .boxwin.open{--chs:1}.win.dhbox .boxwin.open .lootscroll{max-height:62%}}
.win.dhbox .boxwin.open .lootscroll>.loot{height:auto!important;min-height:max-content!important;flex:none}
.win.dhbox .boxwin.open .lootscroll{display:flex!important;flex-direction:column;gap:5px}
@media (max-height:700px){.win.dhbox .boxwin.open{--chs:1.2}}
/* daily gift and event gift boxes sit in the upper middle too */
.win.dhbox .giftwin{padding-bottom:44vh}
.win.dhbox .boxwin.open{--chs:1.65}
@media (max-height:700px){.win.dhbox .boxwin.open{--chs:1.4}}
.win.dhbox .boxwin.open{--chs:1.85}
@media (max-height:700px){.win.dhbox .boxwin.open{--chs:1.65}}
/* the loot list always gets its room; the chest fills what is left above it (scale set by Skin14 fit in stage14.js) */
.win.dhbox .boxwin.open .lootscroll{flex:0 0 auto!important;max-height:52%!important}
.win.dhbox .boxwin.open>.chest.c2{flex:1 1 0!important;min-height:80px!important}

/* v143: the opened chest stays modest so the loot list gets the room (fit() in stage14.js caps it at about 1.05x) */
.win.dhbox .boxwin.open{--chs:1.05}
@media (max-height:700px){.win.dhbox .boxwin.open{--chs:.95}}

/* v144: the opened chest stays exactly where the closed one was (same spot, same size); the loot list takes the room below it */
.win.dhbox .boxwin.open.cfix>.chest.c2{flex:none!important;min-height:0!important;height:var(--cpad,200px)!important;display:grid!important;place-items:end center!important;overflow:visible}
.win.dhbox .boxwin.open.cfix>.chest.c2 .chest2,.win.dhbox .boxwin.open.cfix>.chest.c2 .crate2{transform-origin:50% 100%!important}
.win.dhbox .boxwin.open.cfix .lootscroll{flex:1 1 0!important;max-height:none!important;min-height:70px}
