/* Yerdeki ganimet: sahnede duran sikke ve sandık, ve sandığın üstünde açılan küçük menü (ui/ground-loot.js).
   Çerçeveler oyunun altın temasını (theme-gold.css) kullanır; kademe rengi yalnızca ışımada ve başlıkta geçer. */

/* ---------------------------------------------------------------- Sahnedeki ganimet
   Katman sahneyi kaplar ama dokunuşu yalnızca ganimetin kendisi yakalar. Figürlerin (z-index 3) üstünde,
   alt düğme bölgesinin (z-index 4) altındadır. */
#scene-wrapper > .scene-ground-loot{position:absolute;inset:0;z-index:3;pointer-events:none}
#scene-wrapper .ground-loot-item{
  --loot-glow:rgba(255,210,74,.55);
  position:absolute;translate:-50% 0;width:13%;aspect-ratio:1;padding:0;border:0;background:none;cursor:pointer;
  pointer-events:auto;-webkit-tap-highlight-color:transparent;touch-action:manipulation;
  /* Bitince dönüşüm bırakılır: ganimet haritayla kayarken satır içi transform kullanır. */
  animation:ground-loot-drop .42s cubic-bezier(.3,1.5,.5,1) backwards;
}
/* Sikke ve sandık sahnede küçük durur, haritayı kalabalıklaştırmaz; dokunma alanı aşağıda 44 pikselde kalır. */
#scene-wrapper .ground-loot-item.ground-loot-coin{width:6.5%}
#scene-wrapper .ground-loot-item.ground-loot-chest{width:7.5%}
/* Harita akmadığında ganimet kendi başına bir adım geriye kayar. */
#scene-wrapper .ground-loot-item.sliding{transition:left .9s ease-in-out}
/* Geride kalan ganimet dokunulmaz olur ve solarak kaybolur. */
#scene-wrapper .ground-loot-item.behind{pointer-events:none;opacity:0;transition:opacity 2.2s ease-in .2s,left .9s ease-in-out}
/* Dokunma alanı küçük görselin çevresine taşar: en az 44 piksel. */
#scene-wrapper .ground-loot-item::before{content:"";position:absolute;left:50%;top:50%;translate:-50% -50%;width:max(100%,44px);height:max(100%,44px)}
#scene-wrapper .ground-loot-item img,
#scene-wrapper .ground-loot-sprite{
  position:relative;display:block;width:100%;height:100%;object-fit:contain;image-rendering:pixelated;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.7));
}
/* Sikke hafifçe süzülür; sandık yerde durur. */
#scene-wrapper .ground-loot-item img{animation:ground-loot-bob 1.6s ease-in-out .45s infinite}
/* Sandık tablosu: 9 kare yan yana. Kapalıyken ilk kare; dokununca kapak açılır ve ışıklı karede (7.) kalır. */
#scene-wrapper .ground-loot-sprite{background-repeat:no-repeat;background-size:900% 100%;background-position:0 0}
#scene-wrapper .ground-loot-chest.opening .ground-loot-sprite{animation:ground-loot-open .46s steps(6) forwards}
#scene-wrapper .ground-loot-glow{
  position:absolute;left:50%;bottom:-8%;translate:-50% 0;width:120%;height:50%;border-radius:50%;
  background:radial-gradient(ellipse at center,var(--loot-glow),transparent 68%);animation:ground-loot-pulse 1.6s ease-in-out infinite;
}
/* Sıradan ganimetin ışığı kısıktır; nadir ve efsanevi sandık fark edilir kalır. */
#scene-wrapper .ground-loot-item.tier-normal .ground-loot-glow{animation-name:ground-loot-pulse-soft}
#scene-wrapper .ground-loot-item.tier-rare{--loot-glow:rgba(90,170,255,.7)}
#scene-wrapper .ground-loot-item.tier-legendary{--loot-glow:rgba(255,150,40,.85)}
#scene-wrapper .ground-loot-chest.tier-rare .ground-loot-sprite{filter:drop-shadow(0 3px 3px rgba(0,0,0,.7)) drop-shadow(0 0 4px rgba(90,170,255,.8))}
#scene-wrapper .ground-loot-chest.tier-legendary .ground-loot-sprite{filter:drop-shadow(0 3px 3px rgba(0,0,0,.7)) drop-shadow(0 0 6px rgba(255,150,40,.95))}
#scene-wrapper .ground-loot-item:active{scale:.94}
#scene-wrapper .ground-loot-item.leaving{animation:ground-loot-leave .26s ease-in both;pointer-events:none}
@keyframes ground-loot-drop{from{opacity:0;transform:translateY(-55%) scale(.6)}to{opacity:1;transform:none}}
@keyframes ground-loot-open{to{background-position:75% 0}}
@keyframes ground-loot-bob{0%,100%{transform:none}50%{transform:translateY(-6%)}}
@keyframes ground-loot-pulse{0%,100%{opacity:.55}50%{opacity:1}}
@keyframes ground-loot-pulse-soft{0%,100%{opacity:.25}50%{opacity:.55}}
@keyframes ground-loot-leave{to{opacity:0;transform:translateY(-40%) scale(.7)}}
@media (prefers-reduced-motion:reduce){
  #scene-wrapper .ground-loot-item,#scene-wrapper .ground-loot-item img,#scene-wrapper .ground-loot-glow{animation:none}
  #scene-wrapper .ground-loot-chest.opening .ground-loot-sprite{animation:none;background-position:75% 0}
}

/* ---------------------------------------------------------------- Sandık menüsü
   Sandığın üstünde açılan küçük kutu. Sahneyi karartmaz, sandığı örtmez; görünmez katman yalnızca dışarıya
   dokunulduğunda menüyü kapatmak içindir. Konumu ui/ground-loot.js hesaplar (left, bottom, max-height, ok). */
#game-screen .ground-loot-overlay{
  --loot-tone:var(--theme-gold-hi,#d2a64d);
  position:fixed;inset:0;z-index:1200;background:none;
}
#game-screen .ground-loot-overlay.tier-rare{--loot-tone:#6fb6ff}
#game-screen .ground-loot-overlay.tier-legendary{--loot-tone:#ffa23a}
#game-screen .ground-loot-dialog{
  --loot-arrow-x:50%;
  position:fixed;box-sizing:border-box;width:min(calc(100vw - 16px),212px);display:flex;flex-direction:column;
  padding:6px;border:1px solid var(--theme-gold,#8f6b2d);border-radius:4px;
  background:linear-gradient(180deg,rgba(82,48,38,0.97),rgba(70,40,30,0.98));box-shadow:0 6px 0 rgba(0,0,0,.55);
  color:#e6dcc6;font:500 12px/1.3 'Unseen Gövde','Pixelify Sans',monospace;animation:ground-loot-fade .14s ease-out both;
}
/* Ok sandığı gösterir. */
#game-screen .ground-loot-dialog::after{
  content:"";position:absolute;left:var(--loot-arrow-x);bottom:-6px;translate:-50% 0;width:9px;height:9px;rotate:45deg;
  border:solid var(--theme-gold,#8f6b2d);border-width:0 1px 1px 0;background:#5e3c2b;
}
#game-screen .ground-loot-dialog.below::after{bottom:auto;top:-6px;border-width:1px 0 0 1px;background:#6a4433}
#game-screen .ground-loot-head{display:flex;align-items:center;gap:6px;padding:0 0 4px 2px;border-bottom:1px solid rgba(143,107,45,.45)}
#game-screen .ground-loot-head > div{flex:1;min-width:0}
#game-screen .ground-loot-head h3{margin:0;color:var(--loot-tone);font:800 12px/1.2 'Unseen Gövde','Pixelify Sans',monospace;letter-spacing:.04em;text-transform:uppercase}
#game-screen .ground-loot-head p{margin:1px 0 0;color:#a89c84;font-size:10.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Kapatma düğmesi küçük görünür; dokunma alanı 44 piksele taşar. */
#game-screen .ground-loot-close{
  flex:none;position:relative;width:24px;height:24px;padding:0;border:1px solid var(--theme-gold,#8f6b2d);border-radius:4px;
  background:#6a4433;color:var(--theme-gold-hi,#d2a64d);font:700 16px/1 'Unseen Gövde','Pixelify Sans',monospace;cursor:pointer;
}
#game-screen .ground-loot-close::before{content:"";position:absolute;left:50%;top:50%;translate:-50% -50%;width:44px;height:44px}
#game-screen .ground-loot-list{flex:1;min-height:0;margin:5px 0 0;padding:0;list-style:none;overflow-y:auto;display:flex;flex-direction:column;gap:3px}
#game-screen .ground-loot-row{
  display:flex;align-items:center;gap:6px;min-height:34px;padding:2px 6px 2px 4px;cursor:pointer;
  border:1px solid rgba(143,107,45,.35);border-radius:4px;background:rgba(255,255,255,.02);
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
}
#game-screen .ground-loot-row.selected{border-color:var(--theme-gold-hi,#d2a64d);background:rgba(210,166,77,.12)}
#game-screen .ground-loot-row.special .ground-loot-row-text strong{color:#ffa23a}
/* Seçim kutucuğu yalnızca gösterge; satırın tamamı dokunma alanıdır. */
#game-screen .ground-loot-check{
  flex:none;position:relative;box-sizing:border-box;width:16px;height:16px;
  border:2px solid var(--theme-gold,#8f6b2d);border-radius:3px;background:#5e3c2b;
}
#game-screen .ground-loot-check[aria-checked="true"]{border-color:var(--theme-gold-hi,#d2a64d);background:#6b4f1f}
#game-screen .ground-loot-check[aria-checked="true"]::after{
  content:"";position:absolute;left:50%;top:50%;width:4px;height:8px;translate:-50% -62%;rotate:45deg;
  border:solid #ffe9b0;border-width:0 2px 2px 0;
}
#game-screen .ground-loot-row-icon{flex:none;width:24px;height:24px;display:flex;align-items:center;justify-content:center}
#game-screen .ground-loot-row-icon img{max-width:100%;max-height:100%;object-fit:contain;image-rendering:pixelated}
#game-screen .ground-loot-row-text{flex:1;min-width:0;display:flex;flex-direction:column}
#game-screen .ground-loot-row-text strong{color:#f1e6cc;font-size:12px;font-weight:700;overflow-wrap:anywhere}
#game-screen .ground-loot-row-text small{color:#a89c84;font-size:10px;line-height:1.25;overflow-wrap:anywhere}
#game-screen .ground-loot-hint{margin:4px 0 0;color:#c98d5a;font-size:10px;line-height:1.25;text-align:center}
#game-screen .ground-loot-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-top:5px}
/* Sürüde birden çok sandık: "Hepsini Al (n sandık)" iki sütunu kaplar (01.11). */
#game-screen .ground-loot-btn-wide{grid-column:1 / -1}
#game-screen .ground-loot-btn{
  box-sizing:border-box;min-height:38px;padding:0 4px;border-radius:4px;cursor:pointer;
  border:1px solid var(--theme-gold,#8f6b2d);background:linear-gradient(180deg,#2b2318,#6a4433);
  color:var(--theme-gold-hi,#d2a64d);font:800 10.5px/1.1 'Unseen Gövde','Pixelify Sans',monospace;letter-spacing:.02em;text-transform:uppercase;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
}
#game-screen .ground-loot-btn.primary{border-color:var(--theme-gold-hi,#d2a64d);background:linear-gradient(180deg,#6b4f1f,#3a2a10);color:#ffe9b0}
#game-screen .ground-loot-btn:active:not(:disabled){transform:translateY(1px);filter:brightness(1.15)}
#game-screen .ground-loot-btn:disabled{opacity:.42;cursor:default}
@keyframes ground-loot-fade{from{opacity:0}to{opacity:1}}
