/* Bóveda (José, 29 nov: «cada cofre tenga su apartado personal en grande» · «en general arregla toda la Bóveda»).
   Sizes are layer px (the 720 px layer is scaled to the phone). The art comes from files: chests ui/cofres/ (José's Myl2D
   chests, preparar_cofres.py) and banners ui/b/UI-B0x (Codex, PENDIENTE). CSS only places, animates and writes the text. */

/* zone anchors: a heading that only feeds the zone bar (zoneMenu reads every h2.gh); the banner shows the name */
#layer .screen .gh.vz{height:0;min-height:0;margin:-11px 0;padding:0;border:0;overflow:hidden;font-size:0;flex:none;align-self:stretch}
#layer .screen .gh.vz::before,#layer .screen .gh.vz::after{display:none}

/* one big section per chest */
.vchest,#layer .keyrow.kshop.vkshop{display:flex;flex-direction:column;gap:14px;width:100%;flex:none;padding:0 0 18px;border-radius:22px;overflow:hidden;
  background:linear-gradient(180deg,color-mix(in srgb,var(--cc,#6b5137) 18%,#1a120f),#120c0a 55%);
  border:2px solid color-mix(in srgb,var(--cc,#6b5137) 60%,#6b5137);box-shadow:0 10px 26px #000b}
.vbanner{position:relative;width:100%;aspect-ratio:3/2;flex:none;overflow:hidden;
  background:linear-gradient(180deg,#000a 0%,#0000 30%,#0000 78%,#000b 100%),var(--bg) center/cover no-repeat,radial-gradient(90% 70% at 50% 80%,color-mix(in srgb,var(--cc,#6b5137) 45%,#1a120f),#0e0907)}
.vbanner .vbchest{position:absolute;left:50%;bottom:22%;height:52%;width:auto;max-width:74%;object-fit:contain;transform:translateX(-50%);
  filter:drop-shadow(0 16px 12px #000d) drop-shadow(0 0 26px color-mix(in srgb,var(--cc,#c8955a) 55%,transparent));animation:vbfloat 3.8s ease-in-out infinite}
@keyframes vbfloat{50%{transform:translateX(-50%) translateY(-2.5%)}}
.vbanner .vbname{position:absolute;left:0;right:0;top:0;padding:14px 18px 0;text-align:center;pointer-events:none}
.vbanner .vbname b{display:block;font:700 42px var(--serif,serif);line-height:1.1;color:#ffe7a8;text-shadow:0 2px 0 #000,0 0 18px #000,0 0 30px color-mix(in srgb,var(--cc,#c8955a) 70%,transparent)}
.vbanner .vbname small{display:inline-block;margin-top:6px;padding:3px 14px;border-radius:14px;font-size:21px;color:#f3e9d6;background:#000a;border:1px solid color-mix(in srgb,var(--cc,#6b5137) 70%,#6b5137)}
.vprog{height:12px;margin:-4px 18px 0;border-radius:6px;background:#000a;overflow:hidden;border:1px solid #6b513788;flex:none}
.vprog i{display:block;height:100%;min-width:4px;border-radius:6px;background:linear-gradient(90deg,var(--cc,#c8955a),#ffe7a8)}
.vdesc{margin:0 18px;font-size:22px;line-height:1.3;color:#e8dcc4;text-align:center}.vdesc b{color:#ffe7a8}

/* odds per quality: normal key and mythic key */
.vodds{margin:0 18px;width:calc(100% - 36px);border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:21px;text-align:center;background:#0008;border:1px solid #6b513788;border-radius:14px;overflow:hidden}
.vodds th{padding:8px 2px 6px;font-size:17px;font-weight:700;color:var(--qc,#e8dcc4)}
.vodds th:first-child,.vodds td:first-child{width:54px}
.vodds td{padding:7px 2px;color:#f3e9d6;border-top:1px solid #6b513755}
.vodds td .ic{height:34px;width:auto;vertical-align:middle}
.vodds tr.mit td{color:#e2ccff;background:#3a1f5c44}

/* a peek of what the chest can give */
.vpeek{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin:0 18px;align-items:end}
.vpk{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:6px 4px 4px;border-radius:12px;border:2px solid var(--qc,#6b5137);background:radial-gradient(circle at 50% 30%,color-mix(in srgb,var(--qc,#6b5137) 30%,#1a120f),#0e0907)}
.vpk .colprev{width:100%;height:auto;aspect-ratio:1;border-radius:6px;background-size:cover;background-position:center;position:relative}
.vpk .colprev.colTAP{aspect-ratio:2/3}.vpk .colprev.colREV,.vpk .colprev.colFUN{aspect-ratio:5/7}
.vpk .colprev.colICO,.vpk .colprev.colFIC{background-size:contain}
.vpk .qtag{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}

/* open rows: 1 · 3 · 5 · 10 with each key */
.vkrow{display:flex;flex-direction:column;gap:8px;margin:0 18px;padding:12px;border-radius:16px;background:#0008;border:1px solid #6b513788}
.vkrow.mit{background:#1f123099;border-color:#a77bff88}
.vkrow>span{display:flex;align-items:center;flex-wrap:wrap;gap:6px;font-size:22px;color:#e8dcc4}.vkrow>span b{color:#ffe7a8}.vkrow.mit>span b{color:#e2ccff}
.vkrow>span .ic{height:38px;width:auto}
#layer .vkrow .keybuy{display:flex;gap:8px}
#layer .vkrow .keybuy .btn{flex:1;min-width:0;min-height:80px;font-size:25px;padding:4px}
#layer .kshop.vkshop{gap:14px}
#layer .kshop.vkshop .kbanner{border-top:2px solid #8a6a3e;margin-top:4px}
#layer .kshop.vkshop.mit .kbanner{border-top-color:#a77bff}

/* chest opening: 10 frames in a sprite sheet (frame 1 shakes; on .open the rest play once) */
.chestanim.v2 .chsprw{position:absolute;inset:5%;display:grid;place-items:center}
.chestanim.v2 .chspr{height:100%;aspect-ratio:420/439;max-width:100%;background-repeat:no-repeat;background-size:1000% 100%;background-position:0 0;animation:chshake 1.1s ease-in-out infinite;filter:drop-shadow(0 18px 16px #000c)}
.chestanim.v2.open .chspr{animation:chplay 1.1s steps(10,jump-none) forwards}
.chestanim.v2.noanim .chspr{animation:none}.chestanim.v2.open.noanim .chspr{background-position:100% 0}
@keyframes chplay{from{background-position:0 0}to{background-position:100% 0}}
.chestanim.v2 .chray{z-index:0}.chestanim.v2 .chsprw{z-index:1}
.chestanim.v2.open .chray{transition:opacity .3s .55s,transform .9s .55s ease-out}
.chestanim.v2[class*="qb"] .chray{background:radial-gradient(circle,#ffffffdd 0%,color-mix(in srgb,var(--qc) 75%,transparent) 26%,color-mix(in srgb,var(--qc) 30%,transparent) 46%,transparent 68%)}
.chestanim.v2.qb5 .chray{background:radial-gradient(circle,#ffffffee 0%,#8ff5e6aa 22%,#ff9be477 38%,#ffe08a44 52%,transparent 70%)}

/* results of several chests: collectibles inside the grid */
.chestgrid .chestit.col{gap:6px}
.chestgrid .chestit .colprev{width:118px;height:118px;aspect-ratio:auto;border-radius:8px;background-size:cover;background-position:center;position:relative;flex:none}
.chestgrid .chestit .colprev.colTAP{width:92px;height:138px}
.chestgrid .chestit .colprev.colREV,.chestgrid .chestit .colprev.colFUN{width:96px;height:134px}
.chestgrid .chestit .colprev.colICO,.chestgrid .chestit .colprev.colFIC{background-size:contain}
.chestgrid .chestit .qtag{font-size:16px}
#layer .chestgrid{max-height:none;overflow:visible}

/* Sobres tab */
#layer .vchest .vgo{align-self:stretch;margin:0 18px;min-height:104px;font-size:34px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
#layer .vchest .vgo small{font-size:20px;font-weight:normal;opacity:.9}
#layer .vpack .vkrow{flex-direction:row;align-items:center;justify-content:space-between}
#layer .vpack .vkrow .keybuy{flex:none;width:58%}
#layer .vpack .vkrow .keybuy .btn{min-height:72px}
#layer .odds.vfold{width:auto;margin:0 18px;padding:12px 16px;font-size:22px}
.odds.vfold summary{cursor:pointer;font-weight:bold;color:#ffe7a8;list-style:none;min-height:44px;display:flex;align-items:center;gap:8px}
.odds.vfold summary::-webkit-details-marker{display:none}
.odds.vfold summary::before{content:'▸';transition:transform .2s}.odds.vfold[open] summary::before{transform:rotate(90deg)}
#layer .pkpick button.sel .pkenv{filter:drop-shadow(0 0 14px #ffd36a) drop-shadow(0 10px 14px #000c)}
#layer .pkpick.off button,#layer .temas.off button{filter:grayscale(.6) brightness(.7)}

/* desktop: sections keep a readable width */
body.wide #scr>.vchest,body.wide #scr>.keyrow.kshop.vkshop{max-width:760px;margin-left:auto;margin-right:auto}
@media (prefers-reduced-motion:reduce){.vbanner .vbchest{animation:none}}

/* Bóveda header order: title, Sobres/Cofres tabs, then the pinned wallet and the zone bar (the DOM keeps wallet + bar together) */
#layer .screen:has(>.vtabs)>.title{order:-3}
#layer .screen:has(>.vtabs)>.vtabs{order:-2;margin:0}
#layer .screen:has(>.vtabs)>.wallet,#layer .screen:has(>.vtabs)>.esttabs{order:-1}
#layer .vodds th{font-size:15px;letter-spacing:-.2px}
#layer .vpk .qtag{font-size:12px;white-space:normal;text-align:center;line-height:1.05;min-height:26px;display:flex;align-items:center}
/* chest overlays: a darker veil so the screen behind does not show through; 7+ prizes in four columns (fits small phones) */
#layer .overlay:has(>.chestanim),#layer .overlay:has(>.chestgrid),#layer .overlay:has(>.ccout){background:#060403f5}
#layer .chestgrid.many{grid-template-columns:repeat(4,1fr);gap:8px}
#layer .chestgrid.many .chestit{padding:6px 4px}
#layer .chestgrid.many .chestit b{font-size:17px;line-height:1.1}
#layer .chestgrid.many .chestit .qtag{font-size:14px}
#layer .chestgrid.many .chestit em{font-size:12px;top:2px;right:2px;padding:1px 4px}
#layer .chestgrid.many .chestit .colprev{width:104px;height:104px}
#layer .chestgrid.many .chestit .colprev.colTAP{width:84px;height:126px}
#layer .chestgrid.many .chestit .colprev.colREV,#layer .chestgrid.many .chestit .colprev.colFUN{width:88px;height:123px}
#layer .chestgrid.many .chestit img{width:80px}

/* pack reveal: one pack (5 cards) in a 3 + 2 layout with bigger cards; several packs keep 5 per row with smaller labels */
#layer .screen.pkopen .pack:not(:has(.pk-card:nth-child(6))){grid-template-columns:repeat(6,1fr);gap:16px}
#layer .screen.pkopen .pack:not(:has(.pk-card:nth-child(6))) .pk-card{grid-column:span 2}
#layer .screen.pkopen .pack:not(:has(.pk-card:nth-child(6))) .pk-card:nth-child(4):nth-last-child(2){grid-column:2/span 2}
#layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-rar{font-size:15px;padding:2px 0}
#layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-ess{font-size:13px;padding:2px 0}
#layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-card .new{font-size:13px;padding:1px 6px}

/* Sobres: the wheel of packs (José, 29 nov: «un círculo de sobres con la carta del héroe atrás», turn it to change the
   pack). ui.js places each pack on the circle (inline transform, opacity, z-index); CSS draws and animates. Art of the
   packs: juego/sobre/ (preparar_sobre.py, PENDIENTE). */
.pkring{position:relative;width:100%;flex:none;display:flex;flex-direction:column;align-items:center;gap:4px;padding:14px 0 14px;overflow:hidden;
  touch-action:pan-y;user-select:none;-webkit-user-select:none;outline:0;
  background:linear-gradient(180deg,#000b 0%,#0000 24%,#0000 62%,#000d 100%),var(--bg) center/cover no-repeat,radial-gradient(90% 70% at 50% 60%,color-mix(in srgb,var(--cc,#6b5137) 45%,#1a120f),#0e0907)}
.pkring::before{content:'';position:absolute;left:8%;right:8%;top:150px;height:400px;pointer-events:none;border-radius:50%;
  background:radial-gradient(closest-side,color-mix(in srgb,var(--cc,#c8955a) 55%,transparent),transparent);opacity:.75;transition:background .4s}
.pkring:focus-visible{box-shadow:inset 0 0 0 4px #ffe7a8}
.pkring .vbname{position:relative;padding:0 18px;z-index:1}
.pkring .vbname{text-align:center;pointer-events:none}
.pkring .vbname b{display:block;font:700 34px var(--serif,serif);line-height:1.1;color:#ffe7a8;text-shadow:0 2px 0 #000,0 0 18px #000}
.pkring .vbname small{display:inline-block;margin-top:6px;padding:3px 14px;border-radius:14px;font-size:20px;color:#f3e9d6;background:#000a;border:1px solid color-mix(in srgb,var(--cc,#6b5137) 70%,#6b5137)}
.pkrstage{position:relative;width:100%;height:470px;flex:none;perspective:1300px}
#layer .pkritem{position:absolute;left:50%;top:50%;width:310px;height:430px;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:inherit;cursor:pointer;
  transition:transform .45s cubic-bezier(.22,.8,.3,1),opacity .45s;will-change:transform;-webkit-tap-highlight-color:transparent}
#layer .pkring.drag .pkritem{transition:none}
.pkritem:focus-visible .pkenv{outline:4px solid #ffe7a8;outline-offset:4px;border-radius:10px}
.pkritem .pkrin{position:absolute;inset:0;display:block}
.pkritem.front .pkrin{animation:pkrfloat 3.8s ease-in-out infinite}
@keyframes pkrfloat{50%{transform:translateY(-2.2%)}}
#layer .pkritem .pkcard{position:absolute;right:1%;top:3%;width:60%;height:auto;aspect-ratio:5/7;display:block;transform:rotate(8deg);transition:transform .35s;filter:drop-shadow(0 6px 10px #000a)}
#layer .pkritem.front .pkcard{transform:rotate(11deg) translate(5%,-3%)}
#layer .pkritem .pkcard>*{display:block;width:100%;height:100%;border-radius:8px;object-fit:cover}
#layer .pkritem .pkenv{position:absolute;left:5%;bottom:0;height:81%;width:auto;transform:rotate(-5deg);filter:drop-shadow(0 12px 14px #000c);pointer-events:none}
#layer .pkritem.front .pkenv{filter:drop-shadow(0 0 16px color-mix(in srgb,var(--cc,#ffd36a) 75%,#ffe7a8)) drop-shadow(0 12px 14px #000c)}
#layer .pkrarr{position:absolute;top:340px;z-index:120;width:88px;height:120px;min-height:0;margin:0;padding:0 0 10px;transform:translateY(-50%);border:0;background:none;box-shadow:none;
  color:#ffe7a8;font:700 66px/1 var(--serif,serif);text-shadow:0 2px 6px #000;cursor:pointer;display:grid;place-items:center}
.pkrarr::before{content:'';position:absolute;left:10px;top:26px;width:68px;height:68px;border-radius:50%;background:#000b;border:2px solid #c8955a;z-index:-1}
.pkrarr:active::before{background:#3a2a1ccc}
.pkrarr.l{left:2px}.pkrarr.r{right:2px}
.pkrname{position:relative;z-index:1;text-align:center;padding:0 18px;min-height:86px}
.pkrname b{display:block;font:700 40px var(--serif,serif);line-height:1.1;color:#ffe7a8;text-shadow:0 2px 0 #000,0 0 18px #000}
.pkrname small{display:block;margin-top:4px;font-size:21px;line-height:1.2;color:#f3e9d6;text-shadow:0 1px 3px #000}
.pkrdots{display:flex;gap:12px;justify-content:center;margin-top:4px}
.pkrdots i{width:14px;height:14px;border-radius:50%;background:#0009;border:2px solid var(--c,#c8955a);transition:transform .25s,background .25s}
.pkrdots i.on{background:var(--c,#c8955a);transform:scale(1.35);box-shadow:0 0 8px var(--c,#c8955a)}
.still .pkritem,.still .pkritem .pkcard,.still .pkrdots i{transition:none!important}.still .pkritem.front .pkrin{animation:none}
@media (prefers-reduced-motion:reduce){#layer .pkritem,#layer .pkritem .pkcard,.pkrdots i{transition:none}.pkritem.front .pkrin{animation:none}}

/* «Comprar sobres en la Tienda» under the open button (José, 29 nov: both ways between Tienda and Bóveda) */
#layer .pkshop{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;margin-top:10px;min-height:56px;font-size:22px}
#layer .pkshop img{width:40px;height:40px;filter:drop-shadow(0 2px 3px #000)}
