/* iOS Safari'de 1vh "büyük görünüm alanı"na (adres çubukları gizliyken) göre hesaplanır; yatay telefonda görünen alan ~300px iken
   vh ile ölçülen her şey (zd, kartlar, levhalar) şişip üst üste biniyordu. dvh görünen alanı verir; desteklemeyen tarayıcıda vh'ye düşer. */
:root { --vh: 1vh; }
@supports (height: 1dvh) { :root { --vh: 1dvh; } }

/* ==========================================================================
   OkeyDeck telefon yatay görünümü (en son yüklenir).
   Koşul: yatay yön + en çok 520px yükseklik + en çok 1000px genişlik (telefonlar; tablet ve masaüstü etkilenmez).
   Fikir: masa tüm ekranı kaplar, üstte ince bir şerit (menü düğmesi, masa adı, çanak), altta eylem şeridi ya da ıstaka,
   sohbet ve menü sol/sağ çekmece olarak açılır. Tüm çizimler bu projeye özgüdür.
   ========================================================================== */

/* ---- Her ekranda: telefon menüsüne ait öğeler masaüstünde görünmez ---- */
.table-menu { display: contents; }
body .menu-btn, body .table-menu .menu-extra, body .menu-scrim { display: none; } /* body:not(.in-game) .btn (home.css) kadar özgül olmalı */

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  :root { --pl-bar: 46px; --pl-gap: 8px; --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
  html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
  body { min-height: 100dvh; }

  /* ------------------------------------------------------------------ Üst çubuk (lobi, giriş) */
  body:not(.table-active) .topbar {
    display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-height: 44px; padding: 4px max(12px, var(--safe-l)) 4px max(12px, var(--safe-r));
  }
  body:not(.table-active) .topbar .brand img { height: 26px; }
  body:not(.table-active) .topbar .userbox { display: flex; flex: 1 1 auto; justify-content: flex-end; gap: 6px; min-width: 0; }
  body:not(.table-active) .topbar .userbox[hidden] { display: none; }
  body:not(.table-active) .topbar #balances { flex: 0 1 auto; height: 30px; }
  body:not(.table-active) .topbar .bal { height: 28px; gap: 5px; padding: 0 9px 0 8px; font-size: 12px; }
  body:not(.table-active) .topbar .bal + .bal::before { top: 7px; bottom: 7px; }
  body:not(.table-active) .topbar .bal .coin { width: 15px; height: 15px; }
  body:not(.table-active) .topbar .userbox { flex-wrap: nowrap; }
  body:not(.table-active) .topbar #me { margin-left: 0; gap: 0; padding: 0 3px; font-size: 0; } /* yatay telefonda yalnız avatar */
  body:not(.table-active) .topbar .rules-btn .long { display: none; }
  body:not(.table-active) .topbar .rules-btn .short { display: inline; }
  body:not(.table-active) .topbar #balances { overflow-x: auto; scrollbar-width: none; }
  body:not(.table-active) .topbar #balances::-webkit-scrollbar { display: none; }
  body:not(.table-active) .topbar .pill { height: 28px; padding: 0 8px 0 3px; font-size: 12px; }
  body:not(.table-active) .topbar .pill .avatar { width: 22px; height: 22px; font-size: 12px; }
  body:not(.table-active) .topbar .btn { min-height: 28px; height: 28px; padding: 0 10px; font-size: 12px; }
  body:not(.table-active) .topbar #walletBtn, body:not(.table-active) .topbar #logout, body:not(.table-active) .topbar #me { grid-column: auto; grid-row: auto; }
  body:not(.table-active) main { padding: 0 max(12px, var(--safe-r)) 24px max(12px, var(--safe-l)); }
  body:not(.table-active) .site-foot { display: none; }
  body:not(.table-active) .toast { top: 50px; }

  /* ------------------------------------------------------------------ Giriş sayfası */
  .home { padding-top: 14px; }
  .home-hero { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 20px; align-items: start; }
  .home-copy { display: block; }
  .home h1 { order: 0; max-width: 18ch; font-size: 26px; }
  .home-lead { margin: 8px 0 0; font-size: 14px; }
  .home-facts { margin: 14px 0 0; }
  .home-facts > div { padding: 8px 0; grid-template-columns: 84px 1fr; }
  .home-facts dd, .home-facts dt { font-size: 13px; }
  .home-login { order: 0; padding: 16px; }
  .home-login h2 { font-size: 18px; }
  .home-login > p { margin-bottom: 12px; }
  .home-board { margin-top: 26px; }

  /* ------------------------------------------------------------------ Lobi: sol liste, sağ özet */
  .lb { padding-top: 6px; }
  .lb-head { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 10px 16px; padding-bottom: 8px; border-bottom: 1px solid var(--h-line); }
  .lb-tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; }
  .lb-tab { flex: none; min-width: 84px; height: 30px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
  .lb-coin { width: auto; flex: none; padding: 0; gap: 8px; }
  .lb-coin-label { display: none; }
  .lb-seg { flex: none; gap: 2px; padding: 2px; border-radius: 10px; }
  .lb-coinbtn { flex: none; height: 30px; padding: 0 10px 0 7px; gap: 5px; border-radius: 8px; font-size: 12px; }
  .lb-coinbtn .coin { width: 16px; height: 16px; }
  .lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 12px; margin-top: 10px; align-items: start; }
  .lb-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; margin-bottom: 8px; padding-bottom: 2px; }
  .lb-filters::-webkit-scrollbar { display: none; }
  .lb-filter { flex: none; height: 30px; padding: 0 12px; font-size: 12px; }
  .lb-filters-mode { margin-top: 0; }
  .lb-list { border-radius: 10px; }
  .lb-row { padding: 8px 12px; gap: 8px 12px; }
  .lb-poker .lb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lb-poker .lb-row > .lb-cell { display: none; }
  .lb-poker .lb-row-head { display: none; }
  .lb-poker .lb-sizes { grid-column: auto; }
  .lb-poker .lb-sizes .lb-size { flex: none; width: 52px; min-height: 40px; }
  .lb-okey .lb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lb-okey .lb-row-head { display: none; }
  .lb-okey .lb-sizes .lb-size { flex: none; width: 52px; min-height: 40px; }
  .lb-okey-stakes .lb-sizes { width: auto; }
  .lb-okey-stakes .lb-sizes .lb-size { width: auto; min-width: 70px; min-height: 36px; padding: 3px 10px; }
  .lb-okey-stakes .lb-size b, .lb-okey-stakes .lb-size small { white-space: nowrap; }
  .lb-name b { font-size: 14px; }
  .lb-name-block small { font-size: 11px; }
  .lb-size b { font-size: 14px; }
  .lb-size small { font-size: 10px; }
  .lb-panel {
    position: sticky; top: 52px; left: auto; right: auto; bottom: auto; z-index: 2; display: block; padding: 12px 14px; border-width: 1px; border-radius: 12px;
    background: var(--h-surface); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
  }
  .lb-panel-top h2 { font-size: 16px; white-space: normal; }
  .lb-panel-sub { font-size: 12px; }
  .lb-facts { display: block; margin-top: 8px; }
  .lb-facts > div { padding: 5px 0; font-size: 12px; gap: 8px; }
  .lb-facts > div:nth-child(n+5) { display: none; }
  .lb-quote { display: block; margin: 8px 0 10px; padding-top: 8px; font-size: 11px; line-height: 1.4; -webkit-line-clamp: unset; overflow: visible; }
  .lb-panel .btn.primary { width: 100%; min-height: 42px; font-size: 14px; }
  body:has(#lobby:not([hidden])) .site-foot { padding-bottom: 0; }

  /* ------------------------------------------------------------------ Masa kabuğu: tüm ekran */
  body.table-active { overflow: hidden; background: #050d16; }
  body.table-active .topbar, body.table-active .site-foot { display: none; }
  body.table-active #mainContent, body.table-active main.playing-table {
    position: fixed; inset: 0; z-index: 1; width: auto; max-width: none; height: auto; min-height: 0; margin: 0; padding: 0; overflow: hidden; display: block; background: none; border: 0; box-shadow: none;
  }
  body.table-active #table:not([hidden]) { position: absolute; inset: 0; display: block; min-height: 0; }
  body.table-active #okeyView:not([hidden]), body.table-active #pokerView:not([hidden]) { position: absolute; inset: 0; display: block; margin: 0; padding: 0; gap: 0; }

  /* ------------------------------------------------------------------ Üst şerit (HUD) */
  body.table-active .tablebar {
    position: absolute; z-index: 40; top: 0; left: 0; right: 0; display: flex; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-start; gap: 8px; margin: 0;
    padding: max(6px, env(safe-area-inset-top, 0px)) max(10px, var(--safe-r)) 0 max(10px, var(--safe-l)); border: 0; background: none; box-shadow: none; pointer-events: none;
  }
  body.table-active .tablebar > *, body.table-active .tablebar .menu-btn { pointer-events: auto; }
  body.table-active .menu-btn {
    order: -3; display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%;
    background: rgba(8, 15, 26, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); cursor: pointer;
  }
  body.table-active .menu-btn i, body.table-active .menu-btn i::before, body.table-active .menu-btn i::after { display: block; width: 16px; height: 2px; border-radius: 2px; background: #eef3f8; content: ""; }
  body.table-active .menu-btn i { position: relative; }
  body.table-active .menu-btn i::before { position: absolute; top: -5px; left: 0; }
  body.table-active .menu-btn i::after { position: absolute; top: 5px; left: 0; }
  body.table-active .menu-btn:active { transform: scale(.94); }
  body.table-active .tablebar .infos { order: -2; flex: 0 1 auto; flex-wrap: nowrap; min-width: 0; gap: 4px; overflow: hidden; } /* home.css'teki `.tablebar .infos {flex: 1 1 0}` kuralını geçer */
  body.table-active .infos .tag { flex: none; padding: 3px 8px; font-size: 11px; line-height: 1.25; background: rgba(8, 15, 26, .6); border: 1px solid rgba(255, 255, 255, .16); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  body.table-active .infos .tag.gold { border-color: rgba(240, 195, 90, .55); }
  body.table-active .infos .tag:nth-child(n+3) { display: none; }
  body.table-active #table[data-kind="poker"] .infos .tag:nth-child(1) { display: none; }
  body.table-active #table[data-kind="poker"] .infos .tag:nth-child(3) { display: inline-flex; }
  body.table-active .timer { order: -1; flex: none; width: 34px; height: 34px; min-width: 34px; font-size: 13px; }
  /* Poker: "El #… · Blind …" bilgisi krupiyenin başına binmesin → krupiyenin sağına, çanağın soluna yaslanır (kalan alana sığmazsa "…" ile kısalır).
     Masa adı solda kalır, süre sayacı krupiyenin soluna oturur. --jp-w çanak göstergesinin genişliğidir (app.js ölçer). */
  body.table-active #table[data-kind="poker"] .tablebar .infos { display: contents; }
  body.table-active #table[data-kind="poker"] .infos .tag:nth-child(2) { order: -1; }
  body.table-active #table[data-kind="poker"] .tablebar .timer { position: absolute; top: max(6px, env(safe-area-inset-top, 0px)); left: calc(50% - 92px); }
  body.table-active #table[data-kind="poker"] .infos .tag:nth-child(3) {
    position: absolute; top: max(6px, env(safe-area-inset-top, 0px)); right: calc(max(10px, var(--safe-r)) + var(--jp-w, 118px) + 8px);
    display: block; max-width: calc(50% - 48px - max(10px, var(--safe-r)) - var(--jp-w, 118px) - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  body.table-active .screen-size-controls { display: none; }
  body.table-active .okey-jackpot { margin-left: auto; }

  /* ---- Sol çekmece menüsü ---- */
  body.table-active .table-menu {
    position: fixed; z-index: 11000; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; width: min(268px, 42vw);
    padding: 10px 14px 10px max(14px, var(--safe-l)); background: linear-gradient(180deg, #121b26, #0a1119); border-right: 1px solid rgba(255, 255, 255, .12); box-shadow: 10px 0 30px rgba(0, 0, 0, .55);
    transform: translateX(-104%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; pointer-events: auto;
  }
  body.table-active.menu-open .table-menu { transform: none; visibility: visible; transition: transform .22s ease; }
  body.table-active .table-menu .btn {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 44px; margin: 0; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px;
    background: rgba(255, 255, 255, .06); color: #f2f6fa; font: 700 15px/1.2 system-ui, sans-serif; text-align: left; box-shadow: none; text-shadow: none;
  }
  body.table-active .playing-table .table-menu #leave, body.table-active .playing-table .table-menu #stand, body.table-active .table-menu #leave, body.table-active .table-menu #stand {
    height: auto; min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px;
  }
  body.table-active .table-menu .btn[hidden] { display: none; }
  body.table-active .table-menu .btn:disabled { opacity: .45; }
  body.table-active .table-menu #leave { order: 9; border-color: rgba(240, 98, 98, .55); color: #ffb4b0; background: rgba(210, 60, 60, .14); }
  body.table-active .table-menu .sfx-toggle { order: 1; }
  body.table-active .table-menu .sfx-toggle::after { content: " Ses"; margin-left: 8px; font-size: 15px; }
  body.table-active .table-menu #stand { order: 2; }
  body.table-active .table-menu .menu-extra { display: flex; order: 3; }
  body.table-active .table-menu .menu-extra[hidden] { display: none; }
  body.table-active .menu-scrim { position: fixed; inset: 0; z-index: 39; display: block; background: rgba(0, 0, 0, .5); }
  body.table-active .menu-scrim[hidden] { display: none; }

  /* ---- Bildirim, sonuç ---- */
  body.table-active .toast { top: 8px; z-index: 12000; max-width: min(70vw, 520px); padding: 8px 14px; font-size: 13px; }
  body.table-active .result {
    position: absolute; z-index: 45; left: 50%; bottom: calc(var(--pl-bar) + 8px); transform: translateX(-50%); width: max-content; max-width: min(86vw, 640px); margin: 0; padding: 7px 14px;
    border: 1px solid rgba(240, 195, 90, .5); border-radius: 12px; background: rgba(8, 15, 26, .88); color: #fff4d4; font: 700 12px/1.4 system-ui, sans-serif; white-space: normal; text-align: center; pointer-events: none;
  }
  body.table-active .result:empty { display: none; }

  /* ---- Sohbet: sağdan çekmece; kapalıyken yalnızca yuvarlak düğme ---- */
  body.table-active .chat-box { display: flex; }
  body.table-active #okeyView .chat-box, body.table-active #pokerView .chat-box, body.table-active #pokerView .chat-box.side {
    position: fixed; z-index: 11000; top: 8px; right: max(8px, var(--safe-r)); bottom: 8px; left: auto; width: min(320px, 46vw); height: auto; padding: 8px;
    transition: transform .2s ease;
  }
  body.table-active .chat-box .chat-log { font-size: 12px; }
  body.table-active .chat-box .chat-form input { height: 30px; font-size: 14px; }
  body.table-active .chat-box .chat-send { width: 38px; height: 30px; }
  body.table-active .chat-box .chat-chip { padding: 5px 11px; font-size: 12px; }
  body.table-active .chat-box .chat-toggle { top: 4px; right: 6px; width: 24px; height: 24px; font-size: 20px; line-height: 20px; }
  body.table-active #okeyView .chat-box.collapsed, body.table-active #pokerView .chat-box.collapsed, body.table-active #pokerView .chat-box.side.collapsed {
    top: auto; bottom: calc(var(--pl-bar) + 8px + var(--safe-b)); right: max(10px, var(--safe-r)); left: auto; width: 40px; height: 40px; padding: 0; background: none;
  }
  body.table-active .chat-box.collapsed .chat-toggle {
    position: static; display: block; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(255, 255, 255, .24); border-radius: 50%; font-size: 0; color: transparent;
    background: rgba(8, 15, 26, .7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8l-5 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z' fill='none' stroke='%23eef3f8' stroke-width='1.7' stroke-linejoin='round'/%3E%3Cpath d='M7.5 10h9M7.5 13h6' stroke='%23eef3f8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 22px no-repeat;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  }
  /* sohbet açıkken üst şeritteki çanak/krupiye sohbetin üstünde kalmasın */
  body.table-active:has(.chat-box:not(.collapsed):not([hidden])) .tablebar .okey-jackpot,
  body.table-active:has(.chat-box:not(.collapsed):not([hidden])) .tablebar .okey-dealer { visibility: hidden; }
  body.table-active .chat-box.collapsed.unread .chat-toggle::after { position: absolute; top: 4px; right: 4px; margin: 0; }
  body.table-active .chat-box.collapsed .chat-toggle { position: relative; }
}

/* ==========================================================================
   Poker masası (telefon yatay)
   Sahne tüm ekranı kaplar (altta eylem şeridi hariç); masa geniş ve basık bir oval. Koltuk elipsi app.js içindeki ZP_PHONE ile aynıdır.
   ========================================================================== */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  body #pokerView .zp { position: absolute; inset: 0; width: auto; padding: 0; --zd: calc(14 * var(--vh)); }
  body #pokerView .zp[data-n="6"] { --zd: calc(13 * var(--vh)); }
  body #pokerView .zp[data-n="9"] { --zd: calc(10.6 * var(--vh)); }
  body #pokerView .zp-stage { position: absolute; left: 0; right: 0; top: 0; bottom: calc(var(--pl-bar) + var(--safe-b)); width: auto; aspect-ratio: auto; margin: 0; border-radius: 0; }
  body #pokerView .zp-stage::before { border-radius: 0; box-shadow: inset 0 0 60px rgba(2, 8, 24, .6); }
  body #pokerView .zp-table { left: 7.5%; right: 7.5%; top: 15.5%; bottom: 13.5%; }
  body #pokerView .zp-rail { box-shadow: 0 0 0 1px var(--ring-1, #c9d0dc), 0 0 0 3px var(--ring-2, #545b69), 0 0 0 4px var(--ring-3, #20242d), 0 10px 20px rgba(0, 0, 0, .6), inset 0 2px 3px rgba(255, 255, 255, .22), inset 0 -5px 8px rgba(0, 0, 0, .65); }
  body #pokerView .zp-felt { box-shadow: inset 0 0 22px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .55), 0 0 0 2px var(--felt-edge, #e6c068); }
  body #pokerView .zp-felt::after { width: 20%; }

  /* orta: havuz, ortak kartlar, bilgi */
  body #pokerView .zp-pot { top: 64%; flex-direction: row; min-height: 0; }
  body #pokerView .zp-handname { top: 26%; font-size: clamp(9px, calc(2.8 * var(--vh)), 13px); padding: 2px 10px; }
  body #pokerView .zp-pot .zp-pot-amt { padding: 2px 10px; font-size: clamp(10px, calc(3 * var(--vh)), 13px); }
  body #pokerView .zp-pot-wait { font-size: clamp(10px, calc(3 * var(--vh)), 13px); padding: 3px 12px; }
  body #pokerView .zp-board { top: 45%; gap: calc(.8 * var(--vh)); min-height: 0; transform: translate(-50%, calc(-50% - var(--board-lift, 0px))); }
  body #pokerView .zp-board .pcard { width: calc(9.4 * var(--vh)); height: calc(13.2 * var(--vh)); border-radius: 4px; }
  body #pokerView .zp-board .pcard[data-r] span:last-child { font-size: calc(6 * var(--vh)); }
  body #pokerView .zp-board .pcard[data-r]::before, body #pokerView .zp-board .pcard[data-r]::after { font-size: calc(2.6 * var(--vh)); }
  body #pokerView .zp-info { top: 88%; font-size: clamp(9px, calc(2.6 * var(--vh)), 11px); }

  /* koltuklar */
  body #pokerView .zp-seat .avatar.big { box-shadow: 0 0 0 2px var(--gold), 0 0 0 3px var(--gold-d), 0 0 8px 1px color-mix(in srgb, var(--gold) 45%, transparent), inset 0 -3px 5px rgba(0, 0, 0, .3); }
  body #pokerView .zp-plate:not(.bare) { min-width: calc(var(--zd) * 1.5); padding: 2px 8px 3px; font-size: clamp(9px, calc(2.7 * var(--vh)), 12px); box-shadow: 0 2px 5px rgba(0, 0, 0, .55), inset 0 1px rgba(255, 255, 255, .12); }
  body #pokerView .zp-tag { font-size: clamp(8px, calc(2.3 * var(--vh)), 11px); }
  body #pokerView .zp-tag.win, body #pokerView .zp-tag.jp { font-size: clamp(8px, calc(2.3 * var(--vh)), 11px); }
  body #pokerView .zp-float { font-size: clamp(12px, calc(3.6 * var(--vh)), 18px); }
  body #pokerView .zp-bet .zp-bet-amt { padding: 1px 7px; background: linear-gradient(180deg, #5fe05a, #1f9d2a); border-color: #b8f7b0; font-size: clamp(9px, calc(2.6 * var(--vh)), 11px); }
  body #pokerView .zp-seat.empty .avatar.big.ghost { border-width: 1.5px; }
  body #pokerView .zp-opp .pcard { border-radius: 3px; }
  body #pokerView .zp-hole .pcard { width: calc(var(--zd) * .82); height: calc(var(--zd) * 1.16); border-radius: 4px; }
  body #pokerView .zp-hole .pcard[data-r] span:last-child { font-size: calc(var(--zd) * .52); }
  body #pokerView .zp-hole .pcard[data-r]::before, body #pokerView .zp-hole .pcard[data-r]::after { font-size: calc(var(--zd) * .2); }

  /* çip yığınları */
  body .cs { --cw: clamp(13px, calc(4.2 * var(--vh)), 20px); }
  body .cs.lg { --cw: clamp(15px, calc(5 * var(--vh)), 24px); }

  /* krupiye */
  body #pokerView .zp-dealer { height: 27%; }
  body #pokerView .zp-dealer .tip-btn { top: 80%; width: clamp(14px, calc(4.6 * var(--vh)), 22px); height: clamp(14px, calc(4.6 * var(--vh)), 22px); }
  body #pokerView .zp-dealer .dealer-say { font-size: clamp(10px, calc(3 * var(--vh)), 13px); }

  /* çanak: sağ üst köşe, menü düğmesinin karşısı */
  body #pokerView .zp-jackpot { left: auto; right: max(10px, var(--safe-r)); top: max(8px, env(safe-area-inset-top, 0px)); bottom: auto; gap: 6px; padding: 3px 12px 3px 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
  body #pokerView .zp-jackpot .jp-ico { width: 22px; height: 22px; }
  body #pokerView .zp-jackpot .jp-lbl { font-size: 8px; }
  body #pokerView .zp-jackpot .jp-amt { font-size: 14px; }
  body #pokerView .zp-jackpot .jp-tip { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); width: min(280px, 50vw); padding: 8px 10px; font-size: 11px; }
  body #pokerView .zp-jp-banner { top: 36%; padding: 6px 22px 8px; border-width: 2px; border-radius: 14px; }
  body #pokerView .zp-jp-banner .jp-b-title { font-size: 18px; }
  body #pokerView .zp-jp-banner .jp-b-name { font-size: 14px; max-width: 200px; }
  body #pokerView .zp-jp-banner .jp-b-hand { font-size: 11px; }
  body #pokerView .zp-jp-banner .jp-b-amt { font-size: 15px; }

  /* eylem şeridi: tam genişlik, dikdörtgen büyük düğmeler */
  body #pokerView .zp-actions {
    position: absolute; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: nowrap; align-items: stretch; justify-content: flex-end; gap: 6px; width: auto; height: calc(var(--pl-bar) + var(--safe-b)); margin: 0;
    padding: 4px max(10px, var(--safe-r)) calc(4px + var(--safe-b)) max(10px, var(--safe-l)); background: linear-gradient(180deg, rgba(4, 8, 18, .55), rgba(4, 8, 18, .92)); border-top: 1px solid rgba(255, 255, 255, .1);
  }
  body #pokerView .zp-raisebox input[type=range] { height: clamp(80px, 34vh, 150px); }
  body #pokerView #allin { background: linear-gradient(180deg, #9b52e6, #561a9e); }
  body #pokerView #allin .lbl { font-size: 13px; }
  body #pokerView .zp-act {
    flex: 0 0 auto; display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 5px; width: clamp(96px, 17vw, 132px); height: auto; padding: 0 6px; border-width: 1px; border-radius: 10px; white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset 0 2px 3px rgba(255, 255, 255, .35), inset 0 -4px 7px rgba(0, 0, 0, .3);
  }
  body #pokerView .zp-act b { font-size: 15px; }
  body #pokerView .zp-act .lbl { font-size: 13px; white-space: nowrap; }
  body #pokerView #fold { background: linear-gradient(180deg, #e2434c, #9e1620); }
  body #pokerView #callBtn { background: linear-gradient(180deg, #38b852, #166f2d); }
  body #pokerView #raiseBtn { background: linear-gradient(180deg, #f3a02e, #b0600a); }
  body #pokerView .zp-act:not(:disabled):hover { transform: none; }
  body #pokerView .watch-hint { position: absolute; z-index: 31; left: 50%; bottom: calc(var(--pl-bar) + 8px); transform: translateX(-50%); width: max-content; max-width: 74vw; margin: 0; padding: 6px 14px; font-size: 12px; }
  body #pokerView .lasthand { display: none; }
}

/* ==========================================================================
   Okey masası (telefon yatay)
   Masa (yeşil keçe) tüm ekranı kaplar; ıstaka altta tam genişlikte iki sıra. Çift diz / seri diz / toplam ıstakanın iki yanında.
   ========================================================================== */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  body.table-active #okeyView:not([hidden]) {
    --rw: clamp(360px, min(calc(100vw - 180px), calc(130 * var(--vh))), 640px);
    --cap: 10px;
    position: absolute; inset: 0; display: grid; margin: 0; padding: 0; gap: 0;
    grid-template-rows: minmax(0, 1fr) calc(var(--rowh) * 2 + var(--groove) + var(--lip) + 8px + var(--safe-b));
    grid-template-columns: minmax(0, 1fr);
  }
  body.table-active #okeyView .okey-arena { height: 100%; min-height: 0; margin: 0; border-width: 0 0 0 0; border-radius: 0; padding: 0; }
  body.table-active #okeyView .rack-panel { padding: 0 0 var(--safe-b); }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  body.table-active #okeyView:not([hidden]) { background: linear-gradient(180deg, #46290f, #25150a 90%); }

  /* üst sağ: çanak, krupiye, bahşiş (kompakt) */
  body.table-active .okey-jackpot { padding: 2px 10px 2px 4px; gap: 5px; }
  body.table-active .okey-jackpot .jp-ico { width: 20px; height: 20px; }
  body.table-active .okey-jackpot .jp-lbl { font-size: 8px; }
  body.table-active .okey-jackpot .jp-amt { font-size: 13px; }
  body.table-active .okey-jackpot .jp-tip { left: auto; right: 0; width: min(280px, 56vw); font-size: 11px; }
  body.table-active .okey-dealer { gap: 5px; }
  body.table-active .okey-dealer .dealer-fig { width: 32px; height: 32px; }
  body.table-active .okey-dealer .tip-btn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 50%; }
  body.table-active .okey-dealer .tip-btn span:last-child { display: none; }
  body.table-active .okey-dealer .dealer-say { left: auto; right: 0; font-size: 11px; }

  /* oyuncu levhaları */
  body #okeyView .okey-seat .seat-top { min-width: 140px; height: 36px; gap: 6px; }
  body #okeyView .okey-seat .avatar-frame, body #okeyView .okey-seat .avatar.big { width: 30px; height: 30px; font-size: 17px; }
  body #okeyView .okey-seat .who b { font-size: 13px; }
  body #okeyView .okey-seat.position-top { top: 6px; }
  body #okeyView .okey-seat.position-bottom { bottom: 4px; }
  body #okeyView .okey-seat.position-left, body #okeyView .okey-seat.position-right { top: 100px; bottom: 60px; max-height: none; transform: none; justify-content: center; }
  body #okeyView .okey-seat.position-left { left: 8px; }
  body #okeyView .okey-seat.position-right { right: 8px; left: auto; }
  body #okeyView .okey-seat.position-left .seat-top, body #okeyView .okey-seat.position-right .seat-top { width: 38px; min-height: 84px; padding: 3px 3px 5px; gap: 4px; }
  body #okeyView .okey-seat.position-left .avatar-frame, body #okeyView .okey-seat.position-right .avatar-frame,
  body #okeyView .okey-seat.position-left .avatar.big, body #okeyView .okey-seat.position-right .avatar.big { width: 26px; height: 26px; font-size: 15px; }
  body #okeyView .okey-seat.position-left .who b, body #okeyView .okey-seat.position-right .who b { max-height: 70px; font-size: 12px; }

  /* her oyuncunun attığı taş yığını: köşelerde, üst köşeler HUD'un altında */
  body #okeyView .seat-pile { width: 42px; height: 54px; border-radius: 7px; }
  body #okeyView .seat-pile .tile { width: 32px; height: 44px; padding: 1px; font-size: 19px; }
  body #okeyView .seat-pile .pile-count { top: -6px; right: -7px; min-width: 17px; padding: 2px 4px; font-size: 10px; }
  body #okeyView .seat-pile.pile-bottom { right: 14px; bottom: 4px; }
  body #okeyView .seat-pile.pile-left { left: 14px; bottom: 4px; }
  body #okeyView .seat-pile.pile-right { right: 14px; top: 46px; }
  body #okeyView .seat-pile.pile-top { left: 14px; top: 46px; }

  /* orta: deste ve gösterge biraz küçük */
  body #okeyView .deck-stack { width: 38px; min-height: 52px; }
  body #okeyView .deck-stack b { top: -8px; right: -9px; min-width: 22px; padding: 3px 5px; font-size: 11px; }
  body #okeyView .last-discard-tile { min-width: 38px; min-height: 52px; }
  body #okeyView .last-discard-tile .tile, body #okeyView .indicator-wrap .tile { width: 38px; height: 52px; font-size: 22px; }

  /* masadaki perler ve çiftler */
  body #okeyView .meld-board, body #okeyView .discard-board { top: 46px; bottom: 50px; height: auto; }
  body #okeyView .discard-board::before { display: none; }

  /* ıstaka yan kutuları */
  body #okeyView .rack-totals { top: 2px; width: 66px; height: 52px; padding: 5px 2px 2px; gap: 1px; border-radius: 8px; }
  body #okeyView .rack-totals .rt-label { font-size: 9px; line-height: 1.1; }
  body #okeyView .rack-totals .rt-main b { margin-top: 0; font-size: 19px; }
  body #okeyView .rack-totals .rt-hint { font-size: 9px; }
  body #okeyView #sortSeries { top: 58px; bottom: 5px; width: 66px; }
  body #okeyView #sortPairs { top: 6px; bottom: 6px; width: 66px; }
  body #okeyView .sort-btn { font-size: 11px; }

  /* hamle düğmeleri: oyuncu levhasının iki yanında, ince ve alt alta */
  body #okeyView .rack-panel .draw-actions, body #okeyView .rack-panel .turn-actions { bottom: calc(100% + 6px); flex-direction: column; flex-wrap: nowrap; gap: 4px; max-width: none; }
  body #okeyView .rack-panel .draw-actions { right: calc(50% + 80px); left: auto; align-items: flex-end; justify-content: flex-end; }
  body #okeyView .rack-panel .turn-actions { left: auto; right: calc(max(14px, var(--safe-r)) + 52px); align-items: flex-end; justify-content: flex-end; }
  body #okeyView .rack-panel .okey-actions .btn { min-height: 30px; max-width: 128px; padding: 3px 11px; font-size: 12px; line-height: 1.15; }
  body #okeyView .rack-panel .okey-actions .check { padding: 3px 8px; font-size: 11px; }

  /* sohbet düğmesi: ıstakanın üstünde, sol alt taş yığınının yanında */
  body.table-active #okeyView .chat-box.collapsed {
    top: auto; right: auto; left: calc(max(14px, var(--safe-l)) + 58px);
    bottom: calc(var(--rowh) * 2 + var(--groove) + var(--lip) + 8px + var(--safe-b) + 8px);
  }
}

/* dar telefonlar (640px civarı): üst şerit biraz daha sıkı */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 720px) {
  body.table-active .infos .tag { padding: 3px 6px; font-size: 10px; }
  body.table-active .infos { gap: 3px; }
  body.table-active .timer { width: 30px; height: 30px; min-width: 30px; font-size: 12px; }
  body.table-active #table[data-kind="okey"] .infos .tag:nth-child(1) { display: none; }
}

/* dar yatay telefon: marka yazısı küçülür, ödeme birimleri sıkışır (4 bakiye + cüzdan + hesap tek satırda) */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) {
  body:not(.table-active) .topbar { gap: 4px; padding-left: max(8px, var(--safe-l)); padding-right: max(8px, var(--safe-r)); }
  body:not(.table-active) .topbar .brand img { height: 22px; }
  body:not(.table-active) .topbar .bal { gap: 3px; padding: 0 6px 0 5px; font-size: 10.5px; }
  body:not(.table-active) .topbar .bal .coin { width: 13px; height: 13px; }
  body:not(.table-active) .topbar .userbox { gap: 3px; }
  body:not(.table-active) .topbar .btn { padding: 0 6px; }
  body:not(.table-active) .topbar .pill { padding: 0 6px 0 3px; }
}

/* ===================================================================================================
   DİKEY TELEFON: masa üst bilgileri sıkı ve yan yana (üst şerit tek satır, bilgi hapları + düğmeler iki satır)
   =================================================================================================== */
@media (max-width: 760px) and (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
  /* üst şerit: logo + bakiyeler + cüzdan + hesap tek satırda */
  body.table-active .topbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 5px 8px; min-height: 0; }
  body.table-active .topbar .brand { flex: 0 0 auto; }
  body.table-active .topbar .brand img { width: 28px; height: 28px; }
  body.table-active .topbar #userbox { display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 4px; }
  body.table-active .topbar #userbox[hidden] { display: none; }
  body.table-active .topbar #balances { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; height: 24px; padding: 0; border-radius: 8px; overflow: hidden; }
  body.table-active .topbar .bal { height: 22px; gap: 3px; padding: 0 6px 0 5px; font-size: 10px; white-space: nowrap; }
  body.table-active .topbar .bal + .bal::before { top: 5px; bottom: 5px; }
  body.table-active .topbar .bal .coin { width: 14px; height: 14px; }
  body.table-active .topbar #walletBtn { flex: none; min-height: 0; height: 22px; padding: 0 7px; font-size: 10px; }
  body.table-active .topbar #logout { display: none; }
  body.table-active .topbar #me { flex: none; gap: 0; padding: 1px; font-size: 0; min-height: 0; }
  body.table-active .topbar #me .avatar { width: 22px; height: 22px; font-size: 12px; }

  /* tablo çubuğu: üstte bilgi hapları yan yana, altta süre + düğmeler */
  body.table-active .tablebar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; padding: 4px 6px; margin: 0 0 4px; }
  body.table-active .tablebar #info { order: 1; flex: 1 1 100%; max-width: none; display: flex; flex-wrap: wrap; gap: 4px; }
  body.table-active .tablebar #info .tag { padding: 2px 7px; font-size: 10.5px; line-height: 1.35; white-space: nowrap; }
  body.table-active #mainContent:has(#pokerView:not([hidden])) { padding: 6px 10px 12px; }
  body.table-active .tablebar #screenSizeControls { display: none; } /* Tam/Orta/Küçük masaüstü görünümü içindir */
  body.table-active .tablebar #okeyJackpot { padding: 3px 10px; transform-origin: right center; }
  body.table-active .tablebar #info .tag.kind,
  body.table-active .tablebar #info .tag.fee,
  body.table-active .tablebar #info .tag.state { display: none; }
  body.table-active .tablebar #timer { order: 2; width: 30px; height: 30px; min-width: 30px; font-size: 12px; border-width: 2px; margin-right: auto; }
  body.table-active .tablebar #sfxToggle { order: 3; min-height: 0; height: 30px; width: 34px; padding: 0; font-size: 14px; }
  body.table-active .tablebar #stand, body.table-active .tablebar #leave { order: 3; min-height: 0; height: 30px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
  body.table-active .tablebar #okeyJackpot, body.table-active .tablebar #okeyDealer { order: 4; }

  /* poker eylemleri: dört düğme yan yana, bahis kaydırıcısı Raise'in üstünde dikey */
  body.table-active #pokerView .zp-actions { justify-content: center; gap: 8px 12px; margin-top: 8px; padding: 0; width: 100%; }
}

/* çok dar telefonlar (≤380px): cüzdan düğmesi masada gizlenir, bakiyeler tam görünsün */
@media (max-width: 380px) and (orientation: portrait) {
  body.table-active .topbar #walletBtn { display: none; }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  body #pokerView .zp-name-top { font-size: clamp(9px, calc(2.7 * var(--vh)), 12px); }
  body #pokerView .zp-plate.bare { font-size: clamp(9px, calc(2.7 * var(--vh)), 12px); }
}
