/* =====================================================================================
   1.0n R6: the CHESTS page (public/js/nl-chests.js). Spec: UI-REDESIGN-SPEC.md "CHESTS", mockup chests.html.
   Colours are the game's own tokens (index.html :root, home.css --ch-*, navigation-city.css --nav-*), restated as values.
   Everything sits under html.nl-R6, so switching R6 off brings the old page back untouched.
   ===================================================================================== */

/* ---------- the page: a sky screen (page gradient + rooftop skyline), the old pieces step aside ---------- */
html.nl-R6 #chestsScr{background:radial-gradient(ellipse at 78% 8%,#d9f8fc50,transparent 47%),
  linear-gradient(175deg,#187ca9 0%,#126796 48%,#072f55 100%);background-color:#072f55;
  padding-left:clamp(8px,3.4vw,14px);padding-right:clamp(8px,3.4vw,14px);}
html.nl-R6 #chestsScr::after{content:"";position:fixed;left:-18%;right:-18%;bottom:0;height:46%;opacity:.32;z-index:-1;pointer-events:none;
  background:url('../art/ui/home-city-rooftop-v1.svg') center bottom/auto 100% no-repeat;}
html.nl-R6 #chestsScr > .scrSub,
html.nl-R6 #chestsScr > #chestTotLine,
html.nl-R6 #chestsScr > .backBtn,
html.nl-R6 #chestRows > .chpRow:not(.chpPrem){display:none !important;}
html.nl-R6 #chestsScr > .scrTitle{font-family:'Bangers',cursive;font-size:30px;letter-spacing:1.5px;line-height:1;color:#fff;
  -webkit-text-stroke:0;text-shadow:0 2px 0 #082942,0 3px 0 #082942;margin:4px 0 10px;min-height:36px;display:flex;align-items:center;}
html.nl-R6 #chestsScr > .topBack{min-height:44px;font-size:20px;box-shadow:0 3px 0 #1b1430;}
/* polish B4: the bar behind BACK and ODDS is solid sky once the page scrolls, so the pill never sits over a half-hidden title */
html.nl-R6 #chestsScr > .ccScrim{background:#177aa7;height:calc(58px + var(--sa-top,0px));box-shadow:0 2px 0 #0b4f7a;}
/* ODDS: the money module's own door, moved to the top-right corner (one tap, same handler) */
html.nl-R6 #chestsScr > #muOddsChests{position:fixed;top:calc(6px + var(--sa-top,0px));right:8px;z-index:60;margin:0;
  min-height:44px;min-width:64px;padding:0 14px;border-radius:22px;background:#082b49;border:2px solid #8ccbe0;color:#e3f1ff;
  font-family:'Bangers',cursive;font-size:17px;letter-spacing:1px;box-shadow:0 3px 0 #062949;}

html.nl-R6 #chestRows{width:min(520px,100%);gap:10px;padding-bottom:calc(92px + env(safe-area-inset-bottom,0px));}
#chestRows .nlchNum{font-variant-numeric:tabular-nums;white-space:nowrap;}
.nlchIc{display:inline-grid;place-items:center;flex:0 0 auto;line-height:0;}
.nlchIc svg{display:block;}

/* ---------- count chip ---------- */
.nlchTot{display:flex;justify-content:center;margin-top:-4px;}
.nlchTotPill{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 15px;border-radius:16px;background:#082b49cc;
  border:2px solid #ffd23f88;font-family:'Bangers',cursive;font-size:19px;letter-spacing:1px;color:#ffd23f;white-space:nowrap;}

/* ---------- buttons ---------- */
#chestRows .nlchBtn{display:flex;align-items:center;justify-content:center;min-height:44px;border-radius:13px;border:2px solid #082942;
  box-shadow:0 3px 0 #082942;font-family:'Bangers',cursive;font-size:18px;letter-spacing:1px;padding:0 12px;white-space:nowrap;cursor:pointer;
  -webkit-tap-highlight-color:transparent;}
#chestRows .nlchBtn:active{transform:translateY(2px);box-shadow:0 1px 0 #082942;}
.nlchCyan{background:linear-gradient(180deg,#7fe6f6,#46d5ed);color:#082942;}
.nlchGreen{background:linear-gradient(180deg,#8ce99a,#51cf66);color:#0b3a1a;}

/* ---------- PREMIUM GIFT (the old row, dressed in place) ---------- */
html.nl-R6 #chestRows .chpRow.chpPrem.nlchPg{display:block;position:relative;padding:10px 12px 10px 16px;min-height:78px;border-radius:16px;
  border:3px solid #ffd23f;background:linear-gradient(110deg,#5a3d00,#2e2358 70%);box-shadow:0 4px 0 #0f0b22,0 0 18px #ffd23f44;opacity:1;}
html.nl-R6 .nlchPg .chpIco,
html.nl-R6 .nlchPg .chpPremReady,
html.nl-R6 .nlchPg #chpPremNext{display:none !important;}
html.nl-R6 .nlchPg:not(.nlchPgOff) .chpPays{display:none;}
html.nl-R6 .nlchPg .chpBody{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;align-items:center;min-height:52px;}
html.nl-R6 .nlchPg .chpTop{grid-column:1;}
html.nl-R6 .nlchPg .chpName{font-size:clamp(19px,6vw,23px);color:#ffd23f !important;letter-spacing:1px;}
html.nl-R6 .nlchPg .chpPays,
html.nl-R6 .nlchPg .chpPremDays{grid-column:1;font-size:11.5px;line-height:1.25;color:#f1e6c8;margin-top:4px;font-weight:800;letter-spacing:.3px;}
html.nl-R6 .nlchPg .chpFree{grid-column:2;grid-row:1 / span 3;margin:0;flex-wrap:nowrap;justify-content:flex-end;}
html.nl-R6 .nlchPg .chpFree .chpClaim,
html.nl-R6 .nlchPg .chpFree .chpClaim1{flex:0 0 auto;min-height:46px;padding:0 14px;border-radius:13px;font-size:19px;letter-spacing:1px;
  border:2px solid #1b1430;box-shadow:0 3px 0 #1b1430;}
html.nl-R6 .nlchPg .chpFree .nlchGold{background:linear-gradient(180deg,#ffe577,#ffd23f);color:#082942;}
html.nl-R6 .nlchPg .chpFree .nlchGhost{background:#1b1430cc;color:#ffd23f;border-color:#ffd23f88;box-shadow:0 3px 0 #0f0b22;font-size:16px;}
html.nl-R6 .nlchPg.nlchPgOff{border-color:#ffd23f88;box-shadow:0 4px 0 #0f0b22;}
.nlchNext{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 10px;border-radius:12px;background:#1b1430cc;border:2px solid #ffd23f66;}
.nlchNext small{font-size:11px;font-weight:800;letter-spacing:.6px;color:#d0c8f5;white-space:nowrap;}
.nlchNext b{font-family:'Bangers',cursive;font-weight:400;font-size:21px;letter-spacing:1px;line-height:1;color:#fff;}
/* states with a sentence (link this account, recover, a pair owed, unavailable): the action goes under the words */
html.nl-R6 .nlchPg.nlchPgWide .chpBody{grid-template-columns:minmax(0,1fr);}
html.nl-R6 .nlchPg.nlchPgWide .chpFree{grid-column:1;grid-row:auto;flex-wrap:wrap;justify-content:flex-start;margin-top:6px;}
html.nl-R6 .nlchPg.nlchPgWide .chpCap{flex:1 0 100%;font-size:11.5px;color:#f1e6c8;}
html.nl-R6 .nlchPg.nlchPgWide .chpFree .chpClaim{white-space:normal;}
/* the other doors the page can hold (holiday gift letter, a chest to finish collecting): full-width gold buttons */
html.nl-R6 #chestRows > .bigBtn{width:100%;margin:0;min-height:48px;}

/* ---------- FREE strip ---------- */
.nlchFree{display:flex;align-items:center;gap:10px;min-height:66px;padding:6px 10px;border-radius:16px;
  background:linear-gradient(110deg,#1d5b85,#123f65);border:2px solid #b8eafb;box-shadow:0 4px 0 #062949;min-width:0;}
.nlchFreeArt{width:52px;height:52px;object-fit:contain;flex:0 0 52px;filter:drop-shadow(0 2px 0 #062949);}
.nlchFreeTx{flex:1 1 auto;min-width:0;text-align:left;}
.nlchFreeTx b{display:block;font-family:'Bangers',cursive;font-weight:400;font-size:clamp(18px,5.6vw,22px);letter-spacing:.8px;line-height:1;color:#fff;white-space:nowrap;}
.nlchFreeTx small{display:block;margin-top:5px;font-size:11.5px;font-weight:800;letter-spacing:.3px;color:#c3e2f5;}
.nlchFree .nlchBtn{flex:0 0 auto;font-size:19px;min-height:46px;}
.nlchFree:not(.ready) .nlchFreeArt{opacity:.75;}

/* ---------- chest grid ---------- */
.nlchGrid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;}
.nlchTile{position:relative;min-width:0;display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 8px 4px;border-radius:16px;
  background:linear-gradient(180deg,#1d5b85,#123f65);border:2px solid #b8eafb;box-shadow:0 4px 0 #062949;text-align:center;}
/* polish B4: the art box is reserved (width and height) so nothing jumps when the painting arrives */
.nlchArt{display:block;flex:0 0 auto;width:clamp(76px,25vw,98px);height:clamp(60px,20vw,78px);max-width:100%;object-fit:contain;filter:drop-shadow(0 3px 0 #062949);}
.nlchCnt{position:absolute;right:7px;top:7px;z-index:1;height:26px;min-width:36px;padding:0 7px;border-radius:13px;background:#082b49;
  border:2px solid #ffd23f;color:#ffd23f;font-family:'Bangers',cursive;font-size:17px;letter-spacing:.5px;line-height:22px;text-align:center;}
.nlchName{display:block;max-width:100%;font-family:'Bangers',cursive;font-weight:400;font-size:clamp(16px,5.2vw,21px);letter-spacing:.8px;line-height:1.05;color:#fff;
  text-wrap:balance;}
.nlchPays{display:block;max-width:100%;min-height:28px;text-wrap:balance;font-size:11px;font-weight:800;line-height:1.25;letter-spacing:.2px;color:#c3e2f5;}
.nlchTile .nlchOpen{width:100%;margin-top:auto;font-size:19px;}
.nlchAll{min-height:44px;width:100%;padding:0 4px;border:0;background:none;color:#46d5ed;font-family:'Bangers',cursive;font-size:16px;letter-spacing:.8px;
  white-space:nowrap;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px;cursor:pointer;-webkit-tap-highlight-color:transparent;}
.nlchAll:active{transform:translateY(1px);}
.nlchAllGap{display:block;height:44px;flex:0 0 44px;}
.nlchWon{display:flex;align-items:center;justify-content:center;width:100%;min-height:44px;margin-top:auto;padding:0 6px;border-radius:13px;
  background:#0a2a4899;border:2px dashed #5fa6c9;color:#c3e2f5;font-size:11px;font-weight:900;letter-spacing:.4px;line-height:1.15;white-space:normal;}
.nlchWon[data-free]{white-space:nowrap;}
.nlchTile.empty .nlchArt{opacity:.55;filter:grayscale(.35) drop-shadow(0 3px 0 #062949);}
.nlchTile.empty{padding-bottom:10px;}
.nlchTile.empty{border-color:#8ccbe0;}

/* ---------- motion: transform only, never under REDUCE MOTION ---------- */
@keyframes nlchPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
.nlchPulse{animation:nlchPulse 1.6s ease-in-out infinite;}
@media (prefers-reduced-motion:reduce){.nlchPulse{animation:none !important;}}
html[data-anim="none"] .nlchPulse,body.cc-rm .nlchPulse{animation:none !important;}

/* ---------- narrow phones ---------- */
@media (max-width:340px){
  .nlchTile{padding:9px 6px 4px;}
  .nlchAll{font-size:15px;}
  html.nl-R6 .nlchPg .chpFree .chpClaim{padding:0 10px;font-size:17px;}
  .nlchNext{padding:5px 7px;}
  .nlchNext b{font-size:19px;}
}
