/* OkeyDeck oyun dışı sayfalar: üst çubuk, giriş, lobi (masa listesi) ve cüzdan penceresi.
   Düz yüzeyler, ince çizgiler, tek vurgu rengi (fildişi) ve sistem yazı tipi. Oyun masaları bu dosyadan etkilenmez. */

:root {
  --h-bg: #0d1417;
  --h-surface: #121b1f;
  --h-raised: #18242a;
  --h-line: #22333a;
  --h-line-2: #2f444c;
  --h-text: #e8edeb;
  --h-muted: #8d9fa5;
  --h-faint: #647a81;
  --h-ivory: #f1e9d4;
  --h-ink: #141a1c;
  --h-live: #78cf98;
  --h-bad: #e5736b;
  --h-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
html { background: var(--h-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

body:not(.in-game) {
  background: var(--h-bg);
  color: var(--h-text);
  font: 15px/1.5 var(--h-sans);
  -webkit-font-smoothing: antialiased;
  perspective: none;
}
body:not(.in-game) main { max-width: 1200px; padding: 0 24px 72px; }
body:not(.in-game) :focus-visible { outline: 2px solid var(--h-ivory); outline-offset: 2px; }

/* ---------- Üst çubuk ---------- */
body:not(.in-game) .topbar {
  position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; gap: 16px 24px;
  min-height: 64px; padding: 0 max(24px, calc((100% - 1200px) / 2 + 24px));
  background: rgba(13, 20, 23, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--h-line); box-shadow: none;
}
body:not(.in-game) .topbar::after { content: none; }
body:not(.in-game) .topbar .brand { display: flex; align-items: center; flex: none; line-height: 0; }
body:not(.in-game) .topbar .brand img { display: block; height: 34px; width: auto; max-width: none; filter: none; }
body:not(.in-game) .topbar .userbox { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Bakiyeler: tek ince grup; her coin küçük simge + kısa sayı, aralarında ince ayraç */
body:not(.in-game) .topbar .balances { display: flex; align-items: center; flex-wrap: nowrap; min-width: 0; height: 34px; padding: 0 2px; border: 1px solid var(--h-line); border-radius: 10px; background: var(--h-surface); }
body:not(.in-game) .topbar .bal {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; border: 0; border-radius: 0; background: none;
  color: var(--h-text); font-size: 12.5px; font-weight: 500; letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: none;
}
body:not(.in-game) .topbar .bal + .bal::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 1px; background: var(--h-line); }
body:not(.in-game) .topbar .bal .coin { width: 16px; height: 16px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

body:not(.in-game) .topbar .pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px; border-radius: 999px;
  background: transparent; border: 1px solid var(--h-line); color: var(--h-text); font-size: 13px; font-weight: 600; box-shadow: none;
}
body:not(.in-game) .topbar .pill .avatar { width: 24px; height: 24px; font-size: 13px; }
.me-name { min-width: 0; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Üst çubuk düğmeleri: hepsi 34 px; yardımcılar (Nasıl oynanır, Davet et, Çıkış) çerçevesiz ve sakin, Cüzdan çerçeveli */
body:not(.in-game) .topbar .btn { min-height: 34px; height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; }
body:not(.in-game) .topbar .rules-btn, body:not(.in-game) .topbar #refBtn, body:not(.in-game) .topbar #logout { border-color: transparent; color: var(--h-muted); }
body:not(.in-game) .topbar .rules-btn:hover:not(:disabled), body:not(.in-game) .topbar #refBtn:hover:not(:disabled), body:not(.in-game) .topbar #logout:hover:not(:disabled) { border-color: transparent; color: var(--h-text); }
body:not(.in-game) .topbar #refBtn { color: var(--od-brass, #e0b24e); }
body:not(.in-game) .topbar #refBtn:hover:not(:disabled) { color: var(--od-brass-hi, #fbe7a3); }
body:not(.in-game) .topbar:has(#userbox[hidden]) .rules-btn { border-color: var(--h-line-2); color: var(--h-text); } /* giriş yapılmamışken tek düğme: çerçeveli */

/* Masaüstü (1121 px üstü): tek satır — logo · bakiyeler · Cüzdan │ Nasıl oynanır · Davet et │ hesap · Çıkış */
@media (min-width: 1121px) {
  body:not(.in-game) .topbar:not(.compact) { gap: 6px; }
  body:not(.in-game) .topbar:not(.compact) .brand { margin-right: auto; }
  body:not(.in-game) .topbar:not(.compact) .userbox { display: contents; }
  body:not(.in-game) .topbar:not(.compact) .userbox[hidden] { display: none; }
  body:not(.in-game) .topbar:not(.compact) #balances { order: 1; flex: none; }
  body:not(.in-game) .topbar:not(.compact) #walletBtn { order: 2; }
  body:not(.in-game) .topbar:not(.compact) .rules-btn { order: 3; margin: 0 0 0 14px; position: relative; }
  body:not(.in-game) .topbar:not(.compact) #refBtn { order: 4; }
  body:not(.in-game) .topbar:not(.compact) #me { order: 5; margin-left: 14px; position: relative; }
  body:not(.in-game) .topbar:not(.compact) #logout { order: 6; }
  body:not(.in-game) .topbar:not(.compact) .rules-btn::before, body:not(.in-game) .topbar:not(.compact) #me::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 1px; background: var(--h-line); }
  body:not(.in-game) .topbar:not(.compact):has(#userbox[hidden]) .rules-btn { margin-left: 0; }
  body:not(.in-game) .topbar:not(.compact):has(#userbox[hidden]) .rules-btn::before { content: none; }
  body:not(.in-game).table-active .topbar:not(.compact) #me { margin-left: 10px; }
  body:not(.in-game).table-active .topbar:not(.compact) #me::before { left: -8px; }
}

/* ---------- Düğmeler ---------- */
body:not(.in-game) .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--h-line-2); border-radius: 8px; background: transparent; color: var(--h-text);
  font: 600 14px/1 var(--h-sans); letter-spacing: 0; cursor: pointer; box-shadow: none; text-shadow: none; transition: background-color .15s, border-color .15s, color .15s;
}
body:not(.in-game) .btn:hover:not(:disabled) { background: var(--h-raised); border-color: var(--h-faint); filter: none; transform: none; }
body:not(.in-game) .btn:disabled { opacity: .4; cursor: not-allowed; }
body:not(.in-game) .btn.primary { min-height: 48px; padding: 0 22px; border-color: var(--h-ivory); border-radius: 10px; background: var(--h-ivory); color: var(--h-ink); font-size: 15px; font-weight: 700; }
body:not(.in-game) .btn.primary:hover:not(:disabled) { background: #fff8e4; border-color: #fff8e4; }
body:not(.in-game) .btn.primary:active:not(:disabled) { background: #e5dbc0; }

/* ---------- Bildirim ---------- */
body:not(.in-game) .toast { top: 76px; max-width: min(92vw, 560px); padding: 11px 16px; border-radius: 10px; background: #2a1618; border: 1px solid #6b2d31; color: #ffd9d5; font: 600 14px/1.4 var(--h-sans); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
body:not(.in-game) .toast.note { background: #12281f; border-color: #2c6a4b; color: #d6f5e3; }

/* ---------- Giriş (ana sayfa) ---------- */
.home { padding-top: clamp(36px, 7vw, 84px); }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.home h1 { margin: 0; max-width: 16ch; font: 650 clamp(32px, 4.6vw, 52px)/1.08 var(--h-sans); letter-spacing: -.025em; color: #f4f1e8; }
.home-lead { margin: 20px 0 0; max-width: 46ch; color: var(--h-muted); font-size: 18px; line-height: 1.55; }
.home-facts { margin: 40px 0 0; padding: 0; max-width: 560px; }
.home-facts > div { display: grid; grid-template-columns: 108px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--h-line); }
.home-facts > div:last-child { border-bottom: 1px solid var(--h-line); }
.home-facts dt { color: var(--h-faint); font-weight: 600; font-size: 14px; }
.home-facts dd { margin: 0; color: var(--h-text); font-size: 15px; }
.home-login { padding: 28px; border: 1px solid var(--h-line); border-radius: 14px; background: var(--h-surface); }
.home-login h2 { margin: 0; font: 650 22px/1.2 var(--h-sans); letter-spacing: -.01em; }
.home-login > p { margin: 6px 0 22px; color: var(--h-muted); font-size: 14px; }
.wallet-list { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; gap: 10px; }
body:not(.in-game) .btn.wallet { justify-content: flex-start; min-height: 52px; padding: 0 16px; font-size: 15px; background: var(--h-bg); }
body:not(.in-game) .btn.wallet img { width: 24px; height: 24px; border-radius: 6px; }
body:not(.in-game) .btn.wallet-connect { width: 100%; min-height: 52px; font-size: 16px; }
.wallet-options { display: grid; gap: 8px; }
.wallet-empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--h-line-2); border-radius: 10px; color: var(--h-muted); font-size: 14px; }
.wallet-empty p { margin: 0; }
.wallet-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px !important; }
.wallet-links a { color: var(--h-ivory); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.wallet-demo { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--h-line); }
.wallet-demo-title { margin: 0 0 12px; color: var(--h-faint); font-size: 13px; font-weight: 600; }
.wallet-demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
body:not(.in-game) .btn.wallet.demo { min-height: 40px; padding: 0 10px; gap: 8px; font-size: 13px; background: transparent; }
body:not(.in-game) .btn.wallet.demo .avatar { width: 22px; height: 22px; font-size: 12px; flex: none; }
.home-board { margin-top: clamp(48px, 8vw, 96px); }
.home-board-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 24px; margin-bottom: 14px; }
.home-board-head h2 { margin: 0; font: 650 20px/1.2 var(--h-sans); letter-spacing: -.01em; }
.home-board-head p { margin: 0; color: var(--h-muted); font-size: 14px; }

/* ---------- Lobi ---------- */
.lb { padding-top: 28px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; padding-bottom: 20px; border-bottom: 1px solid var(--h-line); }
/* Okey / Poker: belirgin sekme butonları (seçili olan dolu fildişi) */
.lb-tabs { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--h-line-2); border-radius: 12px; background: var(--h-surface); }
.lb-tab { appearance: none; min-width: 112px; height: 38px; margin: 0; padding: 0 24px; border: 0; border-radius: 9px; background: transparent; color: var(--h-muted); font: 650 15px/1 var(--h-sans); letter-spacing: .01em; cursor: pointer; transition: background-color .15s, color .15s; }
.lb-tab:hover:not(.on) { background: var(--h-raised); color: var(--h-text); }
.lb-tab.on { background: var(--h-ivory); color: var(--h-ink); }
.lb-coin { display: flex; align-items: center; gap: 12px; padding: 0; }
.lb-coin-label { color: var(--h-faint); font-size: 13px; font-weight: 600; }
.lb-seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--h-line); border-radius: 12px; background: var(--h-surface); }
.lb-coinbtn { appearance: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--h-muted); font: 600 13px/1 var(--h-sans); cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s; }
.lb-coinbtn:hover { color: var(--h-text); }
.lb-coinbtn.on { background: var(--h-raised); color: var(--h-text); box-shadow: inset 0 0 0 1px rgba(241, 233, 212, .5); }
.lb-coinbtn .coin { width: 18px; height: 18px; font-size: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

.lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; margin-top: 22px; }
.lb-main { min-width: 0; }
.lb-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.lb-filters[hidden] { display: none; }
.lb-filter { appearance: none; height: 34px; padding: 0 14px; border: 1px solid var(--h-line); border-radius: 999px; background: transparent; color: var(--h-muted); font: 600 13px/1 var(--h-sans); cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.lb-filter:hover { color: var(--h-text); border-color: var(--h-line-2); }
.lb-filter.on { background: var(--h-raised); border-color: var(--h-ivory); color: var(--h-text); }

.lb-list { border: 1px solid var(--h-line); border-radius: 12px; background: var(--h-surface); overflow: hidden; }
.lb-row { position: relative; display: grid; align-items: center; gap: 12px 20px; padding: 10px 18px; border-top: 1px solid var(--h-line); cursor: pointer; transition: background-color .12s; }
.lb-list-static .lb-row { cursor: default; }
.lb-row:first-child { border-top: 0; }
.lb-poker .lb-row, .lb-list-static .lb-row { grid-template-columns: minmax(120px, 1.1fr) minmax(120px, 1fr) minmax(150px, 1fr) auto; }
.lb-okey .lb-row { grid-template-columns: minmax(0, 1fr) auto; }
.lb-list-static .lb-row > :last-child { width: 258px; }
.lb-row:not(.lb-row-head):hover { background: rgba(255, 255, 255, .025); }
.lb-row.on { background: var(--h-raised); }
.lb-row.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tcv, var(--h-ivory)); }
.lb-row-head { min-height: 40px; padding-top: 0; padding-bottom: 0; background: rgba(255, 255, 255, .02); color: var(--h-faint); font-size: 13px; font-weight: 600; cursor: default; }
.lb-poker .lb-row-head span:last-child, .lb-list-static .lb-row-head span:last-child { width: 258px; }
.lb-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-name b { font-size: 16px; font-weight: 650; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row { --tcv: color-mix(in srgb, var(--tc, #8a9a9f) 62%, #ffffff); }
.lb-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tcv); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tcv) 24%, transparent); }
.lb-name-block { display: grid; gap: 2px; }
.lb-name-block small { color: var(--h-muted); font-size: 13px; font-weight: 400; }
.lb-v { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--h-text); white-space: nowrap; }
.lb-muted { color: var(--h-faint); }
.lb-sizes { display: flex; gap: 6px; }
.lb-size {
  appearance: none; width: 60px; min-height: 46px; padding: 6px 4px; display: grid; align-content: center; justify-items: center; gap: 1px;
  border: 1px solid var(--h-line-2); border-radius: 8px; background: transparent; color: var(--h-text); cursor: pointer; font-family: var(--h-sans);
  transition: background-color .12s, border-color .12s, color .12s;
}
.lb-size b { font-size: 16px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lb-size small { font-size: 11px; line-height: 1.2; color: var(--h-faint); font-weight: 600; }
.lb-size small.live { color: var(--h-live); }
.lb-size:hover { border-color: var(--h-muted); background: rgba(255, 255, 255, .04); }
.lb-size.on { background: var(--h-ivory); border-color: var(--h-ivory); color: var(--h-ink); }
.lb-size.on small, .lb-size.on small.live { color: rgba(20, 26, 28, .72); }
.lb-size.lb-wide { width: 100%; }
.lb-okey-stakes .lb-sizes { width: 258px; }
.lb-filters-mode { margin-top: -4px; }
.lb-amount { width: 84px; min-height: 40px; }
.lb-amount b { font-size: 15px; }

/* seçim özeti */
.lb-panel { position: sticky; top: 84px; padding: 22px; border: 1px solid var(--h-line); border-radius: 12px; background: var(--h-surface); }
.lb-panel-top h2 { margin: 0; font: 650 21px/1.25 var(--h-sans); letter-spacing: -.015em; }
.lb-panel-sub { margin: 4px 0 0; color: var(--h-muted); font-size: 14px; }
.lb-facts { margin: 18px 0 0; padding: 0; }
.lb-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--h-line); font-size: 14px; }
.lb-facts dt { margin: 0; color: var(--h-faint); font-weight: 600; flex: none; }
.lb-facts dd { margin: 0; color: var(--h-text); text-align: right; font-variant-numeric: tabular-nums; }
.lb-quote { margin: 14px 0 18px; padding-top: 14px; border-top: 1px solid var(--h-line); color: var(--h-muted); font-size: 13px; line-height: 1.55; }
.lb-panel .btn.primary { width: 100%; }

/* ---------- Alt bilgi ---------- */
.site-foot { display: none; }
body:not(.in-game) .site-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px;
  max-width: 1200px; margin: 0 auto; padding: 22px 24px 36px; border-top: 1px solid var(--h-line); color: var(--h-faint); font-size: 13px;
}
body:not(.in-game) .site-foot img { display: block; height: 22px; width: auto; opacity: .85; }

/* ---------- Cüzdan penceresi ---------- */
.modal { background: rgba(5, 9, 11, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal .modal-body { padding: 26px; border: 1px solid var(--h-line-2); border-radius: 14px; background: var(--h-surface); color: var(--h-text); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); font-family: var(--h-sans); }
.modal .modal-body h2 { margin: 0 0 14px; font: 650 22px/1.2 var(--h-sans); letter-spacing: -.01em; color: #f4f1e8; }
.modal .row input, .modal .row select { min-height: 40px; padding: 0 12px; border: 1px solid var(--h-line-2); border-radius: 8px; background: var(--h-bg); color: var(--h-text); font: 14px var(--h-sans); }
.modal .row input:focus, .modal .row select:focus { outline: 2px solid var(--h-ivory); outline-offset: 1px; }
.modal .txs { border: 1px solid var(--h-line); border-radius: 8px; background: var(--h-bg); color: var(--h-muted); }
.modal .btn { min-height: 38px; padding: 0 14px; border: 1px solid var(--h-line-2); border-radius: 8px; background: transparent; color: var(--h-text); font: 600 14px/1 var(--h-sans); box-shadow: none; text-shadow: none; }
.modal .btn:hover:not(:disabled) { background: var(--h-raised); filter: none; transform: none; }
.modal .btn.primary { border-color: var(--h-ivory); background: var(--h-ivory); color: var(--h-ink); font-weight: 700; }
.modal .btn.primary:hover:not(:disabled) { background: #fff8e4; }

/* ---------- Poker masası üst şeridi (okey dışı masalar) ---------- */
body:not(.in-game) .tablebar { flex-wrap: nowrap; justify-content: flex-start; }
body:not(.in-game) .tablebar .infos { flex: 1 1 0; min-width: 0; flex-wrap: wrap; }
body:not(.in-game) .tablebar .timer, body:not(.in-game) .tablebar .btn { flex: none; }

/* ---------- Tablet ve telefon ---------- */
@media (max-width: 1060px) {
  .lb-body { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
  .lb-poker .lb-row, .lb-list-static .lb-row { grid-template-columns: minmax(110px, 1fr) minmax(96px, .9fr) auto; }
  .lb-poker .lb-row > .lb-cell:nth-of-type(3), .lb-list-static .lb-row > .lb-cell:nth-of-type(3) { display: none; }
  .lb-poker .lb-row-head span:nth-child(3), .lb-list-static .lb-row-head span:nth-child(3) { display: none; }
}
/* Üst çubuk: 1120 px altında iki satır — 1. satır: logo · Nasıl oynanır · Davet et · hesap · Çıkış, 2. satır: bakiyeler · Cüzdan (sağ kenarlar hizalı) */
@media (max-width: 1120px) {
  body:not(.in-game) .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 8px 6px; padding: 10px 24px; min-height: 56px; }
  body:not(.in-game) .topbar .brand { grid-column: 1; grid-row: 1; }
  body:not(.in-game) .topbar .brand img { height: 30px; }
  body:not(.in-game) .topbar .userbox { display: contents; }
  body:not(.in-game) .topbar .userbox[hidden] { display: none; }
  body:not(.in-game) .topbar .rules-btn { grid-column: 3; grid-row: 1; margin: 0; }
  body:not(.in-game) .topbar:has(#userbox[hidden]) .rules-btn { grid-column: 2 / -1; justify-self: end; }
  body:not(.in-game) .topbar #refBtn { grid-column: 4; grid-row: 1; }
  body:not(.in-game) .topbar #me { grid-column: 5; grid-row: 1; margin-left: 8px; }
  body:not(.in-game) .topbar #logout { grid-column: 6; grid-row: 1; }
  body:not(.in-game) .topbar #balances { grid-column: 1 / 6; grid-row: 2; justify-self: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  body:not(.in-game) .topbar #balances::-webkit-scrollbar { display: none; }
  body:not(.in-game) .topbar #walletBtn { grid-column: 6; grid-row: 2; justify-self: end; }
}
/* Bakiyeler çok genişse (JS tek satıra sığmadığını görünce .compact ekler) aynı iki satırlı düzen */
@media (min-width: 1121px) {
  body:not(.in-game) .topbar.compact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 8px 6px; padding: 10px max(24px, calc((100% - 1200px) / 2 + 24px)); min-height: 56px; }
  body:not(.in-game) .topbar.compact .brand { grid-column: 1; grid-row: 1; }
  body:not(.in-game) .topbar.compact .brand img { height: 30px; }
  body:not(.in-game) .topbar.compact .userbox { display: contents; }
  body:not(.in-game) .topbar.compact .userbox[hidden] { display: none; }
  body:not(.in-game) .topbar.compact .rules-btn { grid-column: 3; grid-row: 1; margin: 0; }
  body:not(.in-game) .topbar.compact:has(#userbox[hidden]) .rules-btn { grid-column: 2 / -1; justify-self: end; }
  body:not(.in-game) .topbar.compact #refBtn { grid-column: 4; grid-row: 1; }
  body:not(.in-game) .topbar.compact #me { grid-column: 5; grid-row: 1; margin-left: 8px; }
  body:not(.in-game) .topbar.compact #logout { grid-column: 6; grid-row: 1; }
  body:not(.in-game) .topbar.compact #balances { grid-column: 1 / 6; grid-row: 2; justify-self: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  body:not(.in-game) .topbar.compact #balances::-webkit-scrollbar { display: none; }
  body:not(.in-game) .topbar.compact #walletBtn { grid-column: 6; grid-row: 2; justify-self: end; }
}
/* Telefon dikey (640 px altı): 1. satır logo · Kurallar · Davet et · Cüzdan · hesap · Çıkış, 2. satır tam genişlikte bakiyeler */
@media (max-width: 640px) and (orientation: portrait), (max-width: 640px) and (min-height: 521px) {
  body:not(.in-game):not(.table-active) .topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 8px 16px 10px; }
  body:not(.in-game):not(.table-active) .topbar .brand { order: 1; margin-right: auto; }
  body:not(.in-game):not(.table-active) .topbar .userbox { display: contents; }
  body:not(.in-game):not(.table-active) .topbar .userbox[hidden] { display: none; }
  body:not(.in-game):not(.table-active) .topbar .rules-btn { order: 2; }
  body:not(.in-game):not(.table-active) .topbar #refBtn { order: 3; }
  body:not(.in-game):not(.table-active) .topbar #walletBtn { order: 4; }
  body:not(.in-game):not(.table-active) .topbar #me { order: 5; margin: 0; gap: 0; padding: 0 4px; font-size: 0; } /* yalnız avatar: yer kazanılır */
  body:not(.in-game):not(.table-active) .topbar #logout { order: 6; }
  body:not(.in-game):not(.table-active) .topbar #balances { order: 7; flex: 1 1 100%; justify-self: auto; max-width: none; }
  body:not(.in-game):not(.table-active) .topbar #balances .bal { flex: 1 1 0; justify-content: center; min-width: 0; padding: 0 6px; gap: 5px; }
}
@media (max-width: 520px) and (orientation: portrait), (max-width: 520px) and (min-height: 521px) {
  body:not(.in-game):not(.table-active) .topbar { gap: 8px 4px; }
  body:not(.in-game):not(.table-active) .topbar .btn { padding: 0 8px; font-size: 12.5px; }
}
@media (max-width: 380px) and (orientation: portrait), (max-width: 380px) and (min-height: 521px) {
  body:not(.in-game):not(.table-active) .topbar { padding-left: 12px; padding-right: 12px; }
  body:not(.in-game):not(.table-active) .topbar .btn { padding: 0 6px; }
}
@media (max-width: 900px) {
  body:not(.in-game) .topbar { padding: 10px 16px; }
  body:not(.in-game) main { padding: 0 16px 48px; }
  body:has(#lobby:not([hidden])) .site-foot { padding-bottom: 170px; }
  body:not(.in-game) .tablebar { flex-wrap: wrap; }
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .home-copy { display: contents; }
  .home h1 { order: 1; max-width: none; }
  .home-lead { order: 2; margin-top: -8px; }
  .home-login { order: 3; max-width: 560px; }
  .home-facts { order: 4; max-width: none; margin-top: 4px; }
  .lb { padding-top: 18px; }
  .lb-head { padding-bottom: 16px; }
  .lb-body { display: block; margin-top: 16px; }
  .lb-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 25; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 14px 14px 0 0; background: rgba(18, 27, 31, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .4);
  }
  .lb-panel-top { min-width: 0; }
  .lb-panel-top h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lb-panel-sub { font-size: 13px; }
  .lb-facts { display: none; }
  .lb-quote { grid-column: 1 / -1; order: 3; margin: 6px 0 0; padding-top: 8px; font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .lb-panel .btn.primary { width: auto; min-height: 44px; padding: 0 18px; }
}
@media (max-width: 640px) {
  .lb-head { align-items: stretch; flex-direction: column; gap: 12px; }
  .lb-tabs { display: flex; }
  .lb-tab { flex: 1 1 0; min-width: 0; padding: 0 12px; }
  .lb-coin { width: 100%; }
  .lb-seg { flex: 1 1 auto; }
  .lb-coinbtn { flex: 1 1 0; justify-content: center; padding: 0 6px; gap: 5px; }
  .lb-poker .lb-row, .lb-list-static .lb-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; gap: 10px 12px; }
  .lb-poker .lb-row > .lb-cell:nth-of-type(2), .lb-list-static .lb-row > .lb-cell:nth-of-type(2) { grid-column: 2; grid-row: 1; text-align: right; }
  .lb-poker .lb-sizes, .lb-list-static .lb-row > :last-child { grid-column: 1 / -1; }
  .lb-poker .lb-sizes .lb-size { flex: 1 1 0; width: auto; }
  .lb-okey-stakes .lb-sizes { width: auto; }
  .lb-poker .lb-row-head, .lb-list-static .lb-row-head { display: none; }
  .lb-okey .lb-row { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
  .lb-okey .lb-sizes .lb-size { flex: 1 1 0; width: auto; }
  .lb-okey .lb-row-head { display: none; }
  .wallet-demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-facts > div { grid-template-columns: 88px 1fr; }
  body:not(.in-game) .site-foot { padding: 18px 16px 28px; }
}
@media (prefers-reduced-motion: reduce) { .lb-row, .lb-size, .lb-filter, .lb-coinbtn, .lb-tab, body:not(.in-game) .btn { transition: none; } }

/* Yönetim duyuru / bakım şeridi */
.status-bar { position: sticky; top: 0; z-index: 11000; padding: 8px 16px; text-align: center; font: 600 13.5px/1.4 var(--h-sans, system-ui, sans-serif); color: #d6ecf7; background: #0d3550; border-bottom: 1px solid #1f6a96; }
.status-bar[hidden] { display: none; }
.status-bar.warn { color: #3a2a00; background: #f2c14b; border-color: #c89a1c; }
.status-bar.crit { color: #ffe3df; background: #7a1d22; border-color: #b8353c; }

/* Davet (referans) penceresi */
.ref-btn { color: var(--od-brass, #e0b24e); }
.topbar .btn { white-space: nowrap; flex: none; } /* dar yatay ekranda "Davet et" iki satıra bölünmesin; sıkışan yer bakiyelerden alınır */
.ref-body { width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; }
.ref-content { display: grid; gap: 16px; margin-bottom: 14px; }
.ref-hero { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--od-line, rgba(224, 178, 78, .28)); border-radius: 12px; background: linear-gradient(135deg, rgba(224, 178, 78, .13), rgba(15, 74, 104, .35)); }
.ref-hero strong { flex: none; font: 700 40px/1 var(--od-serif, Georgia, serif); color: var(--od-brass-hi, #fbe7a3); letter-spacing: -.02em; }
.ref-hero p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--h-text, #dbe5e9); }
.ref-hero b { color: #fff; }
.ref-field { display: grid; gap: 6px; }
.ref-field > span { font-size: 12.5px; font-weight: 600; color: var(--h-muted, #9db3bd); }
.ref-copy { display: flex; gap: 8px; }
.ref-copy input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--h-line-2, #2b4757); border-radius: 8px; background: var(--h-bg, #07161f); color: var(--h-text, #dbe5e9); font: 14px ui-monospace, Consolas, monospace; }
.ref-code input { font-size: 18px; letter-spacing: .18em; font-weight: 700; text-align: center; }
.ref-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--h-line-2, #2b4757); border-radius: 10px; overflow: hidden; }
.ref-stats > div { padding: 10px 12px; border-right: 1px solid var(--h-line-2, #2b4757); }
.ref-stats > div:last-child { border-right: 0; }
.ref-stats b { display: block; font: 700 20px/1.2 var(--h-sans, system-ui); font-variant-numeric: tabular-nums; }
.ref-stats span { font-size: 12px; color: var(--h-muted, #9db3bd); }
.ref-list { margin: 0; padding: 0; list-style: none; max-height: 190px; overflow-y: auto; border: 1px solid var(--h-line, #1d4156); border-radius: 10px; }
.ref-list li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--h-line, #1d4156); font-size: 13.5px; }
.ref-list li:last-child { border-bottom: 0; }
.ref-list .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-list time { color: var(--h-muted, #9db3bd); font-size: 12px; }
.ref-state { padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: rgba(157, 179, 189, .15); color: var(--h-muted, #9db3bd); white-space: nowrap; }
.ref-state.paid { background: rgba(76, 195, 138, .16); color: #6fdcaa; }
.ref-state.review { background: rgba(240, 152, 63, .16); color: #f5b068; }
.ref-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--h-muted, #9db3bd); }
.ref-empty { padding: 16px; text-align: center; color: var(--h-muted, #9db3bd); font-size: 13.5px; }
@media (max-width: 520px) { .ref-hero strong { font-size: 32px; } .ref-stats b { font-size: 17px; } }
@media (max-width: 520px) { body:not(.in-game) .topbar .me-name { max-width: 9ch; } body:not(.in-game) .topbar .pill { padding-right: 9px; gap: 6px; } }

/* Ücretsiz fiş modu: Google / Facebook girişi ve Fişlerim penceresi */
.social-google { min-height: 44px; display: flex; justify-content: center; }
.social-google > div { width: 100%; }
.wallet-list .btn.social-fb { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; border: 0; border-radius: 6px; background: #1877f2; color: #fff; font: 600 15px/1 var(--h-sans, system-ui); cursor: pointer; }
.wallet-list .btn.social-fb:hover { background: #166fe5; }
.social-fb-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #1877f2; font: 800 17px/1 Arial, sans-serif; padding-top: 3px; box-sizing: border-box; }
.social-or { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; color: var(--h-muted, #8d999f); font-size: 12px; }
.social-or::before, .social-or::after { content: ""; flex: 1; border-top: 1px solid var(--h-line, rgba(255,255,255,.12)); }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.chips-row .muted { font-size: 13px; }
.chips-send { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--h-line, rgba(255,255,255,.12)); border-radius: 12px; }
.chips-send h3 { margin: 0; font-size: 15px; }
.chips-send .row { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-send input { flex: 1 1 120px; min-height: 40px; padding: 0 12px; border: 1px solid var(--h-line-2, rgba(255,255,255,.18)); border-radius: 8px; background: var(--h-bg, #0d1114); color: var(--h-text, #e8e4d8); font: 14px var(--h-sans, system-ui); }
.chips-send small { font-size: 12.5px; line-height: 1.45; }
.chips-delete { justify-self: start; font-size: 12.5px; opacity: .75; }

/* Profil: fotoğraf, profil penceresi */
.avatar.avatar-photo { object-fit: cover; padding: 0; background: #1b2328; border-radius: 50%; }
#me { cursor: pointer; }
#me:focus-visible { outline: 2px solid #f3dfb0; outline-offset: 2px; border-radius: 999px; }
.profile-modal .profile-top { display: flex !important; flex-direction: row; gap: 16px; align-items: center; margin-bottom: 8px; padding: 0; border: 0; background: none; }
.profile-modal .profile-top > div { display: flex !important; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 0; border: 0; background: none; }
.profile-modal .profile-top strong { font-size: 19px; overflow: hidden; text-overflow: ellipsis; }
.profile-modal .profile-top .row { margin: 0; }
.profile-modal .avatar.profile-pic { width: 84px !important; height: 84px !important; font-size: 40px; flex: none; display: grid; place-items: center; }
.twofa-setup { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.twofa-setup code { word-break: break-all; font-size: 13px; }
.me-level { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #f3dfb0; color: #1a1408; font: 700 11px/1.6 var(--h-sans, system-ui); }
.level-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin: 8px 0 6px; }
.level-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d9b45a, #f3dfb0); border-radius: inherit; }

/* Bitirme: taş desteye sürüklenirken deste parlar */
#okeyView .deck-stack.finish-ready { box-shadow: 0 0 0 2px rgba(243,223,176,.45), 0 0 18px rgba(243,223,176,.25); transition: transform .15s, box-shadow .15s; }
#okeyView .deck-stack.finish-hover { transform: scale(1.08); box-shadow: 0 0 0 3px #ffd34d, 0 0 30px rgba(255,211,77,.7); }
/* Kazanma kutlaması */
.celebrate { position: fixed; inset: 0; z-index: 9999; pointer-events: auto; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(255,211,77,.18), rgba(0,0,0,.35) 60%); animation: celebIn .3s ease-out; }
.celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.celebrate-box { position: relative; text-align: center; color: #fff8e4; text-shadow: 0 4px 24px rgba(0,0,0,.6); animation: celebPop .6s cubic-bezier(.2,1.6,.4,1); }
.celebrate-box strong { display: block; font: 800 clamp(44px, 9vw, 96px)/1 var(--h-sans, system-ui); letter-spacing: -.02em; background: linear-gradient(180deg, #fff3c4, #ffc93c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.celebrate-box span { display: block; margin-top: 10px; font: 600 clamp(16px, 2.6vw, 22px)/1.3 var(--h-sans, system-ui); }
@keyframes celebIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes celebPop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* Okey: tekrar oyna çubuğu */
.rematch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; width: min(560px, calc(100vw - 24px)); border: 1px solid rgba(243,223,176,.45); border-radius: 14px; background: rgba(13,17,20,.95); box-shadow: 0 14px 40px rgba(0,0,0,.55); position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9000; }
.rematch-bar[hidden] { display: none; }
.rematch-info { flex: 1 1 100%; text-align: center; color: #e8e4d8; font-weight: 600; }
.rematch-bar .btn { min-width: 150px; }

/* Fişlerim: sosyal medya ödülleri */
.social-rewards .social-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.social-rewards .social-label { flex: 1; min-width: 0; }
.social-rewards .social-prize { color: #ffd34d; white-space: nowrap; }
.social-rewards .btn { min-width: 110px; }

/* masada profil fotoğrafı */
.avatar.has-photo { background-size: cover; background-position: center; background-color: #222; font-size: 0; }
