.premium-game{--game-header:linear-gradient(112deg,#2a4b41,#1d3a32);--game-surround:#dce7de}
.shop-board{position:relative;isolation:isolate;container-type:inline-size;display:grid;grid-template-rows:minmax(0,1fr) auto;flex:1;min-height:0;overflow:hidden;background:#f6ecd8;color:#2e392d}
.dark .shop-board{background:#222b23;color:#fff2dc}
.shop-scene{display:grid;grid-template-rows:minmax(0,1fr) minmax(0,.65fr);min-height:0;gap:clamp(4px,1dvh,13px);padding:clamp(5px,1.3dvh,16px) clamp(5px,2cqw,23px);background:repeating-linear-gradient(172deg,#fff4 0 1px,transparent 1px 11px),linear-gradient(145deg,#e8cba3,#f4e0bf 50%,#dbb985)}
.dark .shop-scene{background:repeating-linear-gradient(174deg,#ffffff08 0 1px,transparent 1px 11px),linear-gradient(145deg,#4f3d31,#372c25)}
.shop-transaction{display:grid;grid-template-columns:1.1fr .9fr;gap:clamp(4px,1.8cqw,14px);min-height:0}
.shop-product,.shop-payment{min-width:0;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;justify-items:center;text-align:center;border-radius:clamp(.44rem,3cqw,1rem);padding:clamp(3px,1.65cqw,13px);border:1px solid #a5805f85}
.shop-product{background:radial-gradient(ellipse at 50% 23%,#fffcf1,#f5e0bd)}
.shop-payment{background:radial-gradient(ellipse at 50% 23%,#edf6e9,#d7e6cc);border-color:#819b81}
.dark .shop-product{color:#ffedce;background:radial-gradient(ellipse at 50% 23%,#6d533d,#4b382b)}
.dark .shop-payment{color:#e8f8e1;background:radial-gradient(ellipse at 50% 23%,#48685a,#2f4c40)}
.shop-product-pic,.shop-payment>img{width:100%;height:100%;display:grid;place-items:center;min-height:0;min-width:0;object-fit:contain}
.shop-product-pic img{display:block;min-width:0;width:100%;max-width:168px;height:100%;object-fit:contain;filter:drop-shadow(0 3px 2px #4a281f3a)}
.shop-payment>img{max-width:142px;filter:drop-shadow(0 3px 2px #204e3c35)}
.shop-product-pic span{font-size:clamp(1.3rem,min(17cqw,10dvh),5.4rem);line-height:1}
.shop-product-price,.shop-payment>div{display:grid;justify-items:center;min-width:0;max-width:100%;line-height:1.06}
.shop-product-price span{font-size:clamp(.71rem,3.65cqw,1.18rem);font-weight:900;overflow-wrap:anywhere;text-wrap:balance}
.shop-product-price small,.shop-payment small{font-size:clamp(.56rem,2.9cqw,.83rem);font-weight:850;margin-top:.15em}
.shop-product-price b,.shop-payment b,.shop-total{font-size:clamp(.96rem,5.45cqw,1.72rem);font-weight:950;font-variant-numeric:tabular-nums;white-space:nowrap}
.shop-tray{position:relative;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);gap:2px;border-radius:.65rem;overflow:hidden;border:1px solid #795935;background:#5a412e;box-shadow:inset 0 1px 2px #fff5;isolation:isolate}
.shop-tray-heading{display:flex;align-items:center;justify-content:space-between;gap:.38em;padding:.13rem .45rem;background:#4e3626;color:#fff0d7;font-size:clamp(.66rem,3.5cqw,1.03rem);font-weight:900;line-height:1.13}
.shop-total{color:#ffe2a4}
.shop-pocket{min-height:0;min-width:0;overflow:hidden auto;overscroll-behavior:contain;scrollbar-width:thin;background:#ad8355 url(../art/tray.webp) center / 100% 100% no-repeat;color:#392719}
.shop-pieces{--coin-size:clamp(22px,min(11.5cqw,5.3dvh),48px);box-sizing:border-box;min-height:100%;display:flex;flex-wrap:wrap;align-content:center;align-items:center;gap:5px 3px;padding:clamp(5px,1dvh,12px) clamp(5px,4cqw,20px)}
.shop-piece{flex:0 0 auto;width:min(100%,var(--coin-size));height:var(--coin-size);min-width:0}
.shop-piece[data-kind="banknote"]{width:min(100%,calc(1.95 * var(--coin-size)))}
.shop-piece-image{display:grid;place-items:center;width:100%;height:100%;min-height:0;overflow:hidden}
.shop-empty{display:grid;min-height:100%;place-items:center;color:#442b1b;font-weight:850;font-size:clamp(.69rem,3.2cqw,1rem)}
.shop-money{display:block;object-fit:contain;max-height:100%;max-width:100%;min-height:0;min-width:0}
.shop-piece-image .shop-money{width:100%;height:100%}
/* The coin sprite includes transparent padding. Match its visible edge to its slot. */
.shop-piece[data-denomination="1_tl"] .shop-money{transform:scale(1.22)}
.shop-piece[data-denomination="5_tl_coin"] .shop-money{transform:scale(1.02)}
.shop-till{display:grid;gap:clamp(3px,.6dvh,8px);padding:clamp(4px,.7dvh,8px);background:#dfebdf;border-top:1px solid #acc0ae}
.dark .shop-till{background:#253d33}
.shop-bank{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(3px,1.5cqw,8px)}
.shop-bank button{display:grid;grid-template-rows:minmax(0,1fr) auto;place-items:center;height:clamp(36px,7.6dvh,77px);min-width:0;padding:3px 2px 1px;border:1px solid #93a991;border-radius:.42rem;background:#fdf9e9;color:#263f33;box-shadow:0 2px 0 #7a94785c;touch-action:manipulation}
.shop-bank button:hover{background:#fff0c9}
.shop-bank span{font-size:clamp(.59rem,3cqw,.9rem);font-weight:900;line-height:1.02;white-space:nowrap}
.shop-bank .shop-money{height:100%;width:100%}
.shop-controls{display:grid;grid-template-columns:.85fr .85fr 1.3fr;gap:clamp(3px,1.3cqw,8px)}
.shop-controls button{min-height:clamp(29px,5dvh,50px);border-radius:.42rem;background:#f8f5e7;border:1px solid #869c87;font-size:clamp(.64rem,3.3cqw,1rem);font-weight:900;color:#2c483b;line-height:1.02}
.shop-controls button:disabled{opacity:.5}.shop-controls .shop-check{background:#276549;border-color:#236046;color:#fff}
.shop-thinking{margin:0;padding:.4rem;text-align:center;font-weight:850}
.shop-flight{position:absolute;pointer-events:none;z-index:4;top:0;left:0;width:min(24cqw,85px);height:min(11cqw,48px);opacity:0}
.shop-flight .shop-money{width:100%;height:100%;filter:drop-shadow(0 5px 6px #1a251c73)}
@media(orientation:landscape) and (max-height:580px){
  .premium-panels:is([data-count="1"],[data-count="2"]) .shop-board{grid-template:minmax(0,1fr)/minmax(0,1fr) minmax(120px,.73fr)}
  .premium-panels:is([data-count="1"],[data-count="2"]) .shop-till{align-content:center}
}

[data-money-mode="pocket"] { --game-header:linear-gradient(115deg,#26464d,#19373a); --game-surround:#dfe9e6; }
[data-money-mode="equivalent"] { --game-header:linear-gradient(115deg,#344461,#27344e); --game-surround:#e3e8ee; }
[data-money-mode="missing"] { --game-header:linear-gradient(115deg,#5c4730,#344335); --game-surround:#eee7da; }
[data-money-mode="shopping"] { --game-header:linear-gradient(115deg,#315744,#213e34); --game-surround:#dfeadf; }

.shop-scene {
  grid-template-rows:auto minmax(0,1.25fr) minmax(0,.75fr);
  grid-template-columns:minmax(0,1fr);
}
.shop-task {
  margin:0; display:flex; align-items:center; justify-content:center; gap:clamp(4px,1.5cqw,12px);
  min-width:0; min-height:clamp(23px,4.5dvh,44px); font-weight:900; line-height:1.1;
  text-align:center; font-size:clamp(.76rem,4.1cqw,1.27rem); text-wrap:balance;
}
.shop-task img { flex:none; width:clamp(20px,7cqw,38px); height:clamp(20px,4.2dvh,37px); object-fit:contain; }
.shop-single { min-height:0; display:grid; grid-template-columns:minmax(0,1fr); }
.shop-single .shop-product {
  grid-template: minmax(0,1fr) / minmax(0,1fr) minmax(0,.85fr);
  align-items:center; padding:clamp(4px,2cqw,18px);
}
.shop-single .shop-product-pic img { max-width:min(100%,250px); }
.shop-single .shop-product-price span { font-size:clamp(.86rem,4.6cqw,1.6rem); }
.shop-single .shop-product-price b { font-size:clamp(1.23rem,7.5cqw,2.45rem); }
.shop-payment small { font-size:clamp(.62rem,3.6cqw,1rem); }
.shop-basket {
  display:grid; grid-template: minmax(0,1fr) / repeat(2,minmax(0,1fr)); min-height:0;
  gap:clamp(3px,1.35cqw,10px);
}
.shop-basket:is([data-products="3"],[data-products="4"]) { grid-template-rows:repeat(2,minmax(0,1fr)); }
.shop-basket .shop-product {
  grid-template:minmax(0,1fr) / minmax(0,.9fr) minmax(0,1.1fr);
  align-items:center; column-gap:2px; padding:clamp(3px,1.15cqw,9px);
}
.shop-basket .shop-product-price span { font-size:clamp(.62rem,3.35cqw,1.08rem); }
.shop-basket .shop-product-price b { font-size:clamp(.72rem,4.15cqw,1.3rem); }
.shop-reference {
  display:grid; grid-template-rows:auto minmax(0,1fr); overflow:hidden; min-height:0;
  border:1px solid #879db6; border-radius:.75rem; background:#e8f1f8;
  box-shadow:inset 0 0 0 3px #fff7; text-align:center;
}
.shop-reference h3 {
  font-size:clamp(.67rem,3.5cqw,1.05rem); color:#243f5d; font-weight:900; margin:0;
  background:#cfdfed; padding:.24em .45em;
}
.dark .shop-reference { border-color:#54718e; background:#293f54; box-shadow:inset 0 0 0 3px #a2c8ec15; }
.dark .shop-reference h3 { background:#3d5570; color:#eff6ff; }
.shop-reference .shop-pieces {
  --coin-size:clamp(16px,min(10cqw,5.4dvh),52px);
  min-height:0; overflow:hidden auto; justify-content:center; padding:clamp(2px,1.1cqw,8px);
}
.shop-pocket { position:relative; }
.shop-hint {
  position:sticky; bottom:0; margin:0; padding:3px 5px; background:#fff3d7;
  font-size:clamp(.61rem,3.1cqw,.94rem); line-height:1.17; font-weight:900;
  color:#583619; text-align:center;
}
@media(max-height:490px) {
  .shop-scene { gap:3px; padding:4px; }
  .shop-task { min-height:20px; }
  .shop-task img { width:20px; height:20px; }
  .shop-basket .shop-product-price span { font-size:.62rem; }
  .shop-basket .shop-product-price b { font-size:.79rem; }
}
