/* ============================================================
   BAHÇE (fix36): ana menüdeki tabela, bahçe tuvali, bahçenin üst çubuğu (GERİ + coin).
   Kurallar: tek font, blur 0, sert offset gölge, hücre = tam sayıda ekran pikseli (--bs JS'te yuvarlanır).
   ============================================================ */

/* bahçe tuvali: menü öğelerinin ÜSTÜNDE (geçişte karakter kartların önünden koşar); menü sahnesi (gök, tepeler) altta kalır */
.bh-cv{ position:fixed; inset:0; width:100%; height:100%; z-index:40; display:block; touch-action:none; outline:none; -webkit-tap-highlight-color:transparent; }
.bh-cv[hidden], .bh-top[hidden], .bh-chat[hidden], .bh-count[hidden], .bh-card[hidden], .bh-card [hidden]{ display:none !important; }
/* menünün çocuklarına verilen giriş animasyonu (overlayIn: solarak + büyüyerek gelme) bahçe tuvaline uygulanmaz: geçişin ilk karelerinde karakter soluk çıkıyordu */
#select > .bh-cv{ animation:none; }
#select.bh-in .bh-cv{ cursor:pointer; }

/* geçişte ve bahçedeyken menü öğeleri tıklanmaz; bahçedeyken çizilmez de (ekran dışındalar) */
#select.bh-move > :not(.bh-keep), #select.bh-in > :not(.bh-keep){ pointer-events:none; }
#select.bh-in > :not(canvas):not(.bh-keep){ visibility:hidden; }
/* perf: bahçedeyken menü bir ekran solda ve gizli; animasyonları her kare stil hesabı yaptırıyordu (telefonda kasma) → dondurulur */
#select.bh-in > :not(.bh-keep), #select.bh-in > :not(.bh-keep) *{ animation-play-state:paused; }
/* geçiş boyunca kayan öğeler kendi katmanında: her kare yeniden boyanmaz, yalnız yer değiştirir */
#select.bh-move > :not(canvas):not(.bh-keep), #select.bh-move > .side-stack > *{ will-change:translate; }

/* ---------- ana menü: zemine dikili tabela + sağa giden patika ---------- */
.bh-sign{
  --bs:3; position:absolute; z-index:2; display:block; margin:0; padding:0; border:0; background:none; cursor:pointer;
  font:inherit; color:inherit; line-height:0; -webkit-tap-highlight-color:transparent;
}
.bh-sign canvas{ display:block; image-rendering:pixelated; width:calc(var(--w) * var(--bs) * 1px); height:calc(var(--h) * var(--bs) * 1px); }
.bh-sign-cv{ position:relative; z-index:1; transform-origin:45% 100%; transition:translate .16s cubic-bezier(.3,1.6,.5,1), rotate .16s ease-out; }
.bh-path{ position:absolute; left:58%; bottom:0; height:0; width:0; }
.bh-stone{ position:absolute; bottom:0; left:calc(var(--i) * 13 * var(--bs) * 1px); }
.bh-sign:hover .bh-sign-cv{ translate:0 calc(var(--bs) * -1px); }
.bh-sign:active .bh-sign-cv{ translate:0 calc(var(--bs) * 1px); }
.bh-sign:focus-visible{ outline:3px solid #ffd24d; outline-offset:4px; border-radius:6px; }
/* dokunma alanı: görünen tabeladan geniş (en az 44 px) */
.bh-sign::after{ content:''; position:absolute; inset:-8px; }
/* telefon: zemin arayüzün altında kalır; tabela liderlik kartının üst kenarına dikilidir, patika yok */
.bh-sign.on-card .bh-path{ display:none; }
/* bahçeye hiç girmemiş oyuncu: tabela sıcak bir haleyle nefes alır, arada bir sallanır (ilk girişte kalkar) */
.bh-sign.bh-new .bh-sign-cv{ animation:bhSignGlow 2.4s ease-in-out infinite, bhSignWiggle 4.8s ease-in-out infinite; }
@keyframes bhSignGlow{
  0%,100%{ filter:drop-shadow(0 0 0 rgba(255,214,90,0)) drop-shadow(0 0 0 rgba(255,240,180,0)); }
  50%{ filter:drop-shadow(0 0 calc(var(--bs) * 2px) rgba(255,214,90,.95)) drop-shadow(0 0 calc(var(--bs) * 5px) rgba(255,240,180,.55)); }
}
@keyframes bhSignWiggle{ 0%,82%,100%{ rotate:0deg; } 86%{ rotate:-3deg; } 90%{ rotate:2.5deg; } 94%{ rotate:-1.2deg; } }

/* ---------- bahçenin üst çubuğu ---------- */
.bh-top{ position:fixed; left:max(16px, env(safe-area-inset-left)); top:14px; z-index:41; display:flex; align-items:center; gap:12px; font-family:'Press Start 2P',monospace; }
.bh-back, .bh-coin, .bh-count{
  --bh-fr:var(--frame-on-light,#4a2645); --bh-sh:var(--shadow-on-light,#6b3d61);
  display:inline-flex; align-items:center; gap:8px; height:44px; border:3px solid var(--bh-fr); border-radius:12px; box-shadow:4px 4px 0 var(--bh-sh);
}
.bh-back{ padding:0 16px 0 10px; cursor:pointer; font-family:inherit; font-size:11px; letter-spacing:1px; color:#2b2330; background:#fff8fb;
  transition:translate .08s, box-shadow .08s; -webkit-tap-highlight-color:transparent; }
.bh-back .si{ width:16px; height:16px; image-rendering:pixelated; }
.bh-back:active{ translate:3px 3px; box-shadow:1px 1px 0 var(--bh-sh); }
.bh-back:focus-visible{ outline:3px solid #ffd24d; outline-offset:3px; }
.bh-coin{ padding:0 14px 0 10px; font-size:14px; color:#ffd24d; background:#2b2330; }
.bh-coin b{ font-weight:normal; }
.bh-coin .coin-ic, .bh-coin .coin-ic .si{ width:16px; height:16px; display:inline-block; image-rendering:pixelated; }
.bh-coin.pop{ animation:bhCoinPop .22s ease-out; }
@keyframes bhCoinPop{ 35%{ scale:1.14; } }
body.dark .bh-back, body.dark .bh-coin, body.dark .bh-count{ --bh-fr:#1d1428; --bh-sh:#0b0712; }
body.dark .bh-back{ color:#f2eaf8; background:#2a1d3a; }
body.dark .bh-coin{ background:#120c1c; }
@media (prefers-reduced-motion:reduce){ .bh-sign .bh-sign-cv{ transition:none; } .bh-sign.bh-new .bh-sign-cv{ animation:none; filter:drop-shadow(0 0 calc(var(--bs) * 2px) rgba(255,214,90,.9)); } .bh-coin.pop{ animation:none; } }

/* ---------- fix38: bahçedeki oyuncu sayısı + sohbet ---------- */
.bh-count{ padding:0 12px 0 8px; font-size:12px; color:#2b2330; background:#fff8fb; }
.bh-count b{ font-weight:normal; }
.bh-count .si{ width:16px; height:16px; image-rendering:pixelated; }
body.dark .bh-count{ color:#f2eaf8; background:#2a1d3a; }
/* sohbet: zeminin toprak bandında (sol alt), durakları örtmez. Günlük yalnız mesaj varken görünür. */
.bh-chat{ position:fixed; left:16px; bottom:12px; z-index:41; width:min(360px, 44vw); display:flex; flex-direction:column; gap:6px; font-family:'Press Start 2P',monospace;
  --bh-fr:var(--frame-on-light,#4a2645); --bh-sh:var(--shadow-on-light,#6b3d61); }
body.dark .bh-chat{ --bh-fr:#1d1428; --bh-sh:#0b0712; }
.bh-log{ max-height:86px; overflow-y:auto; overscroll-behavior:contain; padding:6px 8px; display:flex; flex-direction:column; gap:5px; font-size:8px; line-height:1.5;
  color:#f2eaf8; background:#1d1428; border:3px solid var(--bh-fr); border-radius:10px; scrollbar-width:thin; }
.bh-log:empty{ display:none; }
/* günlük kapalı: yer kaplamaz (yükseklik ve saydamlık yumuşak geçer) */
.bh-log{ transition:max-height .18s ease-out, opacity .18s ease-out, padding .18s ease-out; }
.bh-chat.log-off .bh-log{ max-height:0; opacity:0; padding-top:0; padding-bottom:0; border-width:0; pointer-events:none; }
.bh-tog{ position:relative; flex:none; width:40px; height:36px; display:inline-flex; align-items:center; justify-content:center; padding:0; cursor:pointer; color:#2b2330;
  background:#fff8fb; border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); transition:translate .08s, box-shadow .08s; -webkit-tap-highlight-color:transparent; }
.bh-tog .si{ width:16px; height:16px; image-rendering:pixelated; }
.bh-tog:active{ translate:2px 2px; box-shadow:1px 1px 0 var(--bh-sh); }
.bh-tog[aria-expanded="true"]{ color:#fff; background:#7a4fc0; }
body.dark .bh-tog{ color:#f2eaf8; background:#2a1d3a; }
body.dark .bh-tog[aria-expanded="true"]{ color:#fff; background:#7a4fc0; }
.bh-dot{ position:absolute; right:-5px; top:-5px; width:10px; height:10px; background:#ff4d6d; border:2px solid #1d1428; display:none; }
.bh-chat.unread .bh-dot{ display:block; }
.bh-tog:focus-visible, .bh-send:focus-visible{ outline:3px solid #ffd24d; outline-offset:2px; }
.bh-line{ margin:0; overflow-wrap:anywhere; text-align:left; }
.bh-who{ display:inline; margin:0 6px 0 0; padding:0; border:0; background:none; font:inherit; color:#ffd24d; cursor:pointer; }
.bh-line.me .bh-who{ color:#ff8fc4; cursor:default; }
.bh-who.off{ color:#7a6a8c; text-decoration:line-through; }
.bh-who.off + .bh-txt{ color:#7a6a8c; }
.bh-say{ display:flex; gap:6px; margin:0; }
.bh-say input{ flex:1; min-width:0; height:36px; padding:0 10px; font-family:inherit; font-size:10px; color:#2b2330; background:#fff8fb;
  border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); outline:none; }
.bh-say input::placeholder{ color:#a58aa6; }
.bh-say input:focus{ border-color:#e8539a; }
body.dark .bh-say input{ color:#f2eaf8; background:#2a1d3a; }
body.dark .bh-say input::placeholder{ color:#8f7ba6; }
.bh-send{ flex:none; width:40px; height:36px; display:inline-flex; align-items:center; justify-content:center; padding:0; cursor:pointer; color:#fff;
  background:#e8539a; border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); transition:translate .08s, box-shadow .08s; -webkit-tap-highlight-color:transparent; }
.bh-send .si{ width:16px; height:16px; image-rendering:pixelated; }
.bh-send:active{ translate:2px 2px; box-shadow:1px 1px 0 var(--bh-sh); }
.bh-say.wait{ animation:bhWait .28s ease-in-out; }
@keyframes bhWait{ 25%{ translate:-3px 0; } 75%{ translate:3px 0; } }
/* alçak pencere: toprak bandı kısa → günlük iki satır (çimenin üstüne taşmasın) */
@media (max-height:820px){ .bh-log{ max-height:46px; } }
@media (prefers-reduced-motion:reduce){ .bh-say.wait{ animation:none; } .bh-log{ transition:none; } }

/* ---------- fix40: sohbet SAĞ ALTTA; yazarken büyür ---------- */
.bh-chat{ left:auto; right:16px; width:min(360px, 40vw); transition:width .16s ease-out; }
.bh-chat.big{ width:min(560px, 62vw); }
.bh-chat.big .bh-log{ max-height:min(260px, 38vh); opacity:1; padding:8px 10px; border-width:3px; pointer-events:auto; font-size:10px; line-height:1.6; }
.bh-chat.big .bh-say input{ height:44px; font-size:12px; }
.bh-chat.big .bh-send, .bh-chat.big .bh-tog{ height:44px; width:46px; }
@media (max-height:820px){ .bh-chat.big .bh-log{ max-height:min(220px, 40vh); } }
@media (prefers-reduced-motion:reduce){ .bh-chat{ transition:none; } }

/* ---------- fix40: üst çubukta "kartım" düğmesi ---------- */
.bh-mine{ --bh-fr:var(--frame-on-light,#4a2645); --bh-sh:var(--shadow-on-light,#6b3d61); display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:0; cursor:pointer;
  color:#2b2330; background:#fff8fb; border:3px solid var(--bh-fr); border-radius:12px; box-shadow:4px 4px 0 var(--bh-sh); transition:translate .08s, box-shadow .08s; -webkit-tap-highlight-color:transparent; }
.bh-mine .si{ width:18px; height:18px; image-rendering:pixelated; }
.bh-mine:active{ translate:3px 3px; box-shadow:1px 1px 0 var(--bh-sh); }
.bh-mine:focus-visible{ outline:3px solid #ffd24d; outline-offset:3px; }
body.dark .bh-mine{ --bh-fr:#1d1428; --bh-sh:#0b0712; color:#f2eaf8; background:#2a1d3a; }

/* ---------- fix40: KARTVİZİT ---------- */
.bh-card{ position:fixed; inset:0; z-index:44; display:flex; align-items:center; justify-content:center; font-family:'Press Start 2P',monospace; }
.bc-scrim{ position:absolute; inset:0; background:rgba(20,12,30,.45); }
.bc-box{ --bc:#ff6fae; --bh-fr:var(--frame-on-light,#4a2645); --bh-sh:var(--shadow-on-light,#6b3d61);
  position:relative; width:min(400px, calc(100vw - 32px)); max-height:calc(100vh - 32px); max-height:calc(100dvh - 32px); overflow:auto; padding:0 16px 16px; color:#2b2330; background:#fff8fb;
  border:3px solid var(--bh-fr); border-radius:14px; box-shadow:6px 6px 0 var(--bh-sh); animation:bcIn .2s cubic-bezier(.3,1.5,.5,1); }
@keyframes bcIn{ from{ scale:.9; opacity:0; } }
body.dark .bc-box{ --bh-fr:#1d1428; --bh-sh:#0b0712; color:#f2eaf8; background:#2a1d3a; }
/* üst bant: karakterin kimlik rengi (kartın tek renkli alanı) */
.bc-top{ display:flex; align-items:flex-end; gap:14px; margin:0 -16px 12px; padding:16px 16px 12px; background:var(--bc); border-bottom:3px solid var(--bh-fr); border-radius:10px 10px 0 0; }
.bc-pic{ flex:none; width:96px; height:96px; image-rendering:pixelated; border:3px solid var(--bh-fr); border-radius:10px; background:#fcdcef; box-shadow:3px 3px 0 var(--bh-sh); }
.bc-id{ min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding-bottom:4px; }
.bc-name{ font-weight:normal; font-size:16px; line-height:1.2; color:#fff; text-shadow:2px 2px 0 #1d1428; overflow-wrap:anywhere; }
.bc-tt, .bc-lv{ font-size:8px; line-height:1; padding:5px 7px; color:#1d1428; background:#fff8fb; border:2px solid #1d1428; border-radius:6px; }
.bc-lv{ color:#fff8fb; background:#1d1428; }
.bc-x{ position:absolute; right:8px; top:8px; z-index:1; width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; padding:0; cursor:pointer; color:#1d1428; background:#fff8fb; border:3px solid #1d1428; border-radius:8px; }
.bc-x .si{ width:14px; height:14px; image-rendering:pixelated; }
.bc-x:focus-visible, .bc-btn:focus-visible, .bc-frb:focus-visible{ outline:3px solid #ffd24d; outline-offset:2px; }
.bc-stats{ display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; }
.bc-st{ display:flex; flex-direction:column; align-items:center; gap:6px; padding:8px 2px; border:2px solid var(--bh-fr); border-radius:8px; background:rgba(74,38,69,.06); }
body.dark .bc-st{ background:#1d1428; }
.bc-st b{ font-weight:normal; font-size:11px; color:#e8539a; }
body.dark .bc-st b{ color:#ffd24d; }
.bc-st i{ font-style:normal; font-size:6px; letter-spacing:.5px; opacity:.75; }
.bc-mo{ margin:12px 0 0; padding:10px 12px; font-size:9px; line-height:1.6; text-align:left; border-left:4px solid var(--bc); background:rgba(74,38,69,.06); overflow-wrap:anywhere; }
body.dark .bc-mo{ background:#1d1428; }
.bc-edit{ display:flex; gap:6px; margin:12px 0 0; }
.bc-edit input{ flex:1; min-width:0; height:36px; padding:0 10px; font-family:inherit; font-size:9px; color:#2b2330; background:#fff; border:3px solid var(--bh-fr); border-radius:10px; outline:none; }
.bc-edit input:focus{ border-color:#e8539a; }
body.dark .bc-edit input{ color:#f2eaf8; background:#1d1428; }
.bc-edit button{ flex:none; height:36px; padding:0 10px; font-family:inherit; font-size:8px; cursor:pointer; color:#fff; background:#2f9e56; border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); }
.bc-edit.saved button{ animation:bcSaved .4s ease-out; }
@keyframes bcSaved{ 40%{ scale:1.12; } }
.bc-act{ display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.bc-btn{ flex:1 1 auto; min-height:40px; padding:0 10px; font-family:inherit; font-size:9px; letter-spacing:.5px; cursor:pointer; color:#fff; background:#7a4fc0;
  border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); transition:translate .08s, box-shadow .08s; -webkit-tap-highlight-color:transparent; }
.bc-btn.go{ flex-basis:100%; min-height:46px; font-size:11px; background:#2f9e56; }
.bc-btn.ok{ background:#e8539a; }
.bc-btn.mute{ color:#2b2330; background:#fff8fb; }
body.dark .bc-btn.mute{ color:#f2eaf8; background:#3a2a52; }
.bc-btn:active{ translate:2px 2px; box-shadow:1px 1px 0 var(--bh-sh); }
.bc-btn:disabled{ cursor:default; opacity:.55; box-shadow:none; translate:0 0; }
.bc-fr{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:14px; padding-top:12px; border-top:2px dashed var(--bh-fr); }
.bc-frh{ flex-basis:100%; font-weight:normal; font-size:8px; letter-spacing:.5px; text-align:left; opacity:.8; }
.bc-fre{ font-style:normal; font-size:8px; line-height:1.5; opacity:.7; text-align:left; }
.bc-frb{ padding:6px 8px; font-family:inherit; font-size:8px; color:inherit; background:none; border:2px solid var(--bh-fr); border-radius:8px; opacity:.5; }
.bc-frb.here{ cursor:pointer; opacity:1; color:#fff; background:#e8539a; }
@media (prefers-reduced-motion:reduce){ .bc-box{ animation:none; } .bc-edit.saved button{ animation:none; } }

/* ---------- fix40: soru kutusu (arkadaşlık isteği, yarış çağrısı) ---------- */
.bh-ask{ position:fixed; left:50%; top:70px; translate:-50% 0; z-index:43; display:flex; flex-direction:column; align-items:center; gap:8px; font-family:'Press Start 2P',monospace; pointer-events:none; }
.bh-q{ --bh-fr:var(--frame-on-light,#4a2645); --bh-sh:var(--shadow-on-light,#6b3d61); pointer-events:auto; display:flex; align-items:center; gap:10px; max-width:calc(100vw - 24px); padding:10px 12px; font-size:9px; line-height:1.5;
  color:#2b2330; background:#fff8fb; border:3px solid var(--bh-fr); border-radius:12px; box-shadow:4px 4px 0 var(--bh-sh); animation:bqIn .22s cubic-bezier(.3,1.5,.5,1); }
@keyframes bqIn{ from{ translate:0 -14px; opacity:0; } }
body.dark .bh-q{ --bh-fr:#1d1428; --bh-sh:#0b0712; color:#f2eaf8; background:#2a1d3a; }
.bh-q span{ text-align:left; overflow-wrap:anywhere; }
.bh-q button{ flex:none; height:34px; padding:0 10px; font-family:inherit; font-size:9px; cursor:pointer; border:3px solid var(--bh-fr); border-radius:10px; box-shadow:3px 3px 0 var(--bh-sh); }
.bq-y{ color:#fff; background:#2f9e56; }
.bq-n{ color:#2b2330; background:#fff8fb; }
body.dark .bq-n{ color:#f2eaf8; background:#3a2a52; }
@media (prefers-reduced-motion:reduce){ .bh-q{ animation:none; } }

/* fix40: kartvizit masaüstünde bir boy iri (yazılar okunur) */
body:not(.is-mobile) .bc-box{ width:min(470px, calc(100vw - 32px)); padding:0 20px 20px; }
body:not(.is-mobile) .bc-top{ margin:0 -20px 14px; padding:20px 20px 14px; gap:16px; }
body:not(.is-mobile) .bc-pic{ width:120px; height:120px; }
body:not(.is-mobile) .bc-name{ font-size:20px; }
body:not(.is-mobile) .bc-tt, body:not(.is-mobile) .bc-lv{ font-size:9px; padding:6px 8px; }
body:not(.is-mobile) .bc-st{ padding:10px 2px; gap:8px; }
body:not(.is-mobile) .bc-st b{ font-size:13px; }
body:not(.is-mobile) .bc-st i{ font-size:7px; }
body:not(.is-mobile) .bc-mo{ font-size:10px; }
body:not(.is-mobile) .bc-edit input{ height:40px; font-size:10px; }
body:not(.is-mobile) .bc-edit button{ height:40px; font-size:9px; padding:0 12px; }
body:not(.is-mobile) .bc-btn{ min-height:44px; font-size:10px; }
body:not(.is-mobile) .bc-btn.go{ min-height:50px; font-size:12px; }
body:not(.is-mobile) .bc-frh, body:not(.is-mobile) .bc-fre, body:not(.is-mobile) .bc-frb{ font-size:9px; }

/* fix41: bağlanırken / kopukken oyuncu sayısı çipi soluk */
.bh-count.off{ opacity:.5; }
