/* Uygulama kabuğu: üst bar, lobi yerleşimi, masalar, sohbet, oyuncular, giriş. */

/* ===== Üst bar ===== */
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; font-size: 1rem; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; }
.nav { display: flex; gap: 2px; align-items: center; }
.nav-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 10px; border: 0; background: transparent; color: var(--dim); font-weight: 600; font-size: .84rem; }
.nav-btn:hover { background: var(--hover); color: var(--text); }
.balance { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.balance b { color: var(--accent); }
.me-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.me-chip .avatar { width: 30px; height: 30px; }
.me-chip b { font-size: .84rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.switcher { position: relative; }
.switcher-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: .85rem; }
.switcher-btn:hover { border-color: var(--line-strong); }
.switcher .dotc { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.menu { position: absolute; top: 44px; left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; text-align: left; text-decoration: none; font-size: .86rem; }
.menu a:hover, .menu button:hover, .menu .on { background: var(--hover); }
.menu .soon { opacity: .55; cursor: default; }
.menu small { margin-left: auto; color: var(--dim); font-size: .7rem; }

/* ===== Lobi ===== */
.lobby { padding: var(--gap); }
.grid { display: grid; grid-template-columns: 340px minmax(0, 1fr) 310px; gap: var(--gap); height: calc(100vh - var(--topbar) - 2 * var(--gap)); min-height: 520px; }

/* Masalar */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px 12px; }
.quick button { display: grid; gap: 4px; justify-items: start; padding: 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); text-align: left; }
.quick button:hover { border-color: var(--accent); }
.quick b { font-size: .8rem; } .quick small { color: var(--dim); font-size: .68rem; line-height: 1.25; }
.quick .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.table-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px; margin: 0 6px 8px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.table-card:hover { border-color: var(--line-strong); }
.table-title { font-weight: 700; font-size: .92rem; }
.table-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table-side { grid-row: 1 / span 2; grid-column: 2; display: grid; justify-items: end; align-content: space-between; gap: 6px; }
.seats { display: inline-flex; gap: 4px; align-items: center; }
.seat { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); } .seat.f { background: var(--accent); }
.join-row { display: flex; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.join-row .input { height: 34px; }
.empty { color: var(--dim); font-size: .84rem; padding: 18px 10px; text-align: center; }

/* Sohbet */
.chat-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.chat-tab { height: 42px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--dim); font-weight: 650; font-size: .84rem; white-space: nowrap; }
.chat-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.notice { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: .82rem; }
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; padding: 3px 0; font-size: .88rem; word-break: break-word; }
.msg .msg-rep { background: none; border: 0; padding: 0 3px; margin-left: 2px; color: var(--dim); font-size: .78rem; cursor: pointer; opacity: 0; transition: opacity .12s; vertical-align: baseline; }
.msg:hover .msg-rep, .msg .msg-rep:focus-visible { opacity: .8; }
.msg .msg-rep:hover { color: var(--danger, #dc2626); opacity: 1; }
@media (hover: none) { .msg .msg-rep { opacity: .35; } }
.rep-quote { margin: 4px 0 8px; padding: 6px 10px; border-left: 3px solid var(--danger, #dc2626); background: var(--surface-2, rgba(127, 127, 127, .12)); border-radius: 6px; font-size: .86rem; word-break: break-word; }
.msg time { color: var(--dim); font-size: .72rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.msg .nick { font-weight: 700; cursor: pointer; background-color: transparent; border: 0; padding: 0; }   /* background-color: efekt sınıfının (gökkuşağı) degrade görseli silinmesin */ .msg .nick:hover { text-decoration: underline; }
.msg.sys { color: var(--dim); font-style: italic; }
.composer { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.composer .input { flex: 1; }
.send { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.send:disabled { opacity: .5; }

/* Oyuncular */
.search { margin: 0 16px 10px; position: relative; }
.search .input { height: 36px; padding-left: 34px; font-size: .84rem; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--dim); }
.pills.pad { padding: 0 16px 10px; }
.player { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.player:hover { background: var(--hover); }
.player .who { min-width: 0; flex: 1; display: grid; }
.player .who b { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .who small { color: var(--dim); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .chips { font-size: .72rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.section-label { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.section-label small { font-weight: 700; opacity: .8; }
.sheet-grab { display: none; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.players-panel .panel-head { position: sticky; top: 0; background: var(--surface); z-index: 2; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Mobil alt çubuk */
.tabbar { display: none; }
@media (max-width: 1180px) {
  .grid { grid-template-columns: 320px minmax(0, 1fr); }
  .players-panel { display: none; }
  /* Oyuncular: alttan açılan sayfa (nick menüsüyle aynı dil) */
  .players-panel.open { display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0 auto; width: min(520px, 100%); height: min(82vh, 720px); z-index: 70; border-radius: 22px 22px 0 0; box-shadow: var(--shadow), 0 0 0 1px var(--line-strong); animation: sheet-up .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
  .players-panel .sheet-grab { display: block; }
  .nav-btn .lbl { display: none; }
}
@media (max-width: 760px) {
  .lobby { padding: 8px 8px 70px; }
  .grid { grid-template-columns: 1fr; height: calc(100vh - var(--topbar) - 78px); min-height: 0; }
  .grid > .panel { display: none; }
  .grid[data-view="tables"] > .tables-panel, .grid[data-view="chat"] > .chat-panel { display: flex; }
  /* Oyuncular paneli sekme değil alttan açılan sayfadır: dar ekranda da .open ile görünmeli. */
  .grid > .players-panel.open { display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: 86vh; z-index: 70; border-radius: 22px 22px 0 0; }
  .player { min-height: 54px; padding: 8px 12px; }
  .player .avatar { width: 40px; height: 40px; }
  .search .input, .pills.pad .pill { min-height: 40px; }
  .pills.pad .pill { height: 36px; padding: 0 14px; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; bottom: 0; left: 0; right: 0; height: 58px; background: var(--surface); border-top: 1px solid var(--line); z-index: 45; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; gap: 2px; font-size: .7rem; font-weight: 700; padding: 6px 0; }
  .tabbar button.on { color: var(--accent); }
  .nav, .brand-name, .balance .lbl, .me-chip b { display: none; }
  .quick { grid-template-columns: 1fr; } .quick button { grid-template-columns: auto 1fr; align-items: center; }
  .topbar { gap: 8px; padding: 0 10px; }
  /* Tek sayfa görünümü: üst çubuk, sekme içeriği ve alt çubuk kartsız, kenarsız tek yüzey; aralarında yalnızca ince çizgi */
  .lobby { padding: 0 0 58px; background: var(--surface); }
  .grid { height: calc(100vh - var(--topbar) - 58px); height: calc(100dvh - var(--topbar) - 58px); }
  .grid > .tables-panel, .grid > .chat-panel { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .topbar { border-bottom-color: var(--line-strong); }
  .tabbar { border-top-color: var(--line-strong); }
}
.backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(2, 6, 23, .55); }

/* ===== Giriş ===== */
.auth { min-height: calc(100vh - var(--topbar)); display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 26px; display: grid; gap: 18px; }
.auth-card h1 { margin: 0; font-size: 1.4rem; letter-spacing: -.02em; }
.auth-card .lead { margin: 4px 0 0; color: var(--dim); font-size: .9rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg button { height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font-weight: 700; font-size: .84rem; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.auth-form { display: grid; gap: 12px; }

/* ===== Masa ekranı (tam ekran, lobinin üstünde) ===== */
.table-screen { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: var(--bg); }
.table-body { flex: 1; min-height: 0; }
.table-title { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; }
.msg.sys.room { font-style: normal; color: var(--text); align-items: center; }
.msg.sys.room span { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Lobi sohbetinde canlı masa daveti kartı */
.table-invite { margin: 6px 0; padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface)); display: grid; gap: 8px; }
.ti-top { display: flex; justify-content: space-between; align-items: center; }
.ti-badge { font-size: .68rem; font-weight: 800; letter-spacing: .06em; color: var(--accent); }
.ti-top time { color: var(--dim); font-size: .72rem; }
.ti-title { font-size: .9rem; line-height: 1.35; } .ti-title strong { color: var(--accent); }
.ti-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: .8rem; color: var(--dim); }
.ti-meta b { color: var(--text); }
.ti-join { height: 38px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: .03em; cursor: pointer; }
.ti-join:hover { filter: brightness(1.08); }
/* Masa üst çubuğu: dar ekranda taşmasın */
@media (max-width: 700px) {
  .table-screen .topbar { gap: 8px; padding-inline: 10px; }
  .table-screen .brand-name, .table-screen .table-title .tag { display: none; }
  .table-screen .table-title { min-width: 0; flex: 1; }
  .table-screen .table-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
  .table-screen .topbar .btn { white-space: nowrap; padding-inline: 12px; }
}@media (max-width: 700px) {
  .table-screen .topbar { overflow: hidden; }
  .table-screen .topbar .icon-btn { display: none; }
  .table-screen .topbar .btn { flex: none; font-size: .8rem; height: 34px; }
  .table-screen .topbar .lbl { display: none; }
  .table-screen .topbar .btn.rx-btn, .table-screen .topbar .btn:not(.tb-leave) { padding-inline: 9px; }
}
.tb-leave .sh { display: none; }
@media (max-width: 700px) { .tb-leave .lg { display: none; } .tb-leave .sh { display: inline; } }
/* Dar telefonda lobi üst çubuğu sığsın (sayfa yatay taşmasın) */
@media (max-width: 480px) {
  .topbar { gap: 6px; padding: 0 8px; overflow: hidden; }
  .topbar .spacer { min-width: 0; }
  .switcher-btn { padding: 0 8px; gap: 5px; font-size: .8rem; }
  .balance { padding: 0 8px; font-size: .84rem; }
  .topbar .icon-btn { width: 32px; height: 32px; }
  .me-chip { padding: 0 4px; }
}
/* Telefon (tüm oyunlar ve Sohbet uygulaması): Oyuncular sayfası alt çubuğun ÜSTÜNDE açılır; alt çubuk görünür ve dokunulabilir kalır (Masalar/Sohbet/Oyuncular'a basınca kapanır),
 * üstte karartılmış alan kalır (oraya dokunmak da kapatır). Yükseklik dvh ile görünen alana göre hesaplanır: tarayıcı çubuğu yüzünden ✕ ekran dışına taşmaz. */
@media (max-width: 760px) {
  .lobby .grid > .players-panel.open { bottom: calc(58px + env(safe-area-inset-bottom)); height: min(66vh, 560px); height: min(66dvh, 560px); max-height: calc(100vh - 58px - 72px); max-height: calc(100dvh - 58px - 72px); padding-bottom: 0; border-radius: 22px 22px 0 0; }
  .lobby ~ .tabbar { z-index: 72; }
  .lobby ~ .backdrop { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .players-panel .sheet-grab { position: relative; cursor: pointer; }
  .players-panel .sheet-grab::after { content: ''; position: absolute; inset: -12px -70px -10px; }   /* geniş dokunma alanı: tıkla/aşağı çek → kapanır */
}

/* sohbet: mesaj işlemleri (yanıtla / tepki / şikâyet), alıntı, tepki çipleri, arama, eski mesajlar */
.msg .msg-acts { display: inline-flex; gap: 0; vertical-align: baseline; }
.msg .msg-act { background: none; border: 0; padding: 0 4px; color: var(--dim); font-size: .82rem; cursor: pointer; opacity: 0; transition: opacity .12s; line-height: 1; }
.msg:hover .msg-act, .msg .msg-act:focus-visible { opacity: .85; }
.msg .msg-act:hover { color: var(--accent); opacity: 1; }
.msg .msg-act.msg-rep:hover { color: var(--danger, #dc2626); }
@media (hover: none) { .msg .msg-act { opacity: .4; } }
.msg-quote { display: block; max-width: 100%; text-align: left; margin: 0 0 3px; padding: 2px 8px; border: 0; border-left: 3px solid var(--accent); background: var(--surface-2, rgba(127, 127, 127, .12)); color: var(--dim); font: inherit; font-size: .8rem; border-radius: 0 6px 6px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-quote b { color: var(--text); }
.msg-rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.rx-chip { border: 1px solid var(--line, rgba(127, 127, 127, .3)); background: var(--surface-2, rgba(127, 127, 127, .1)); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: .78rem; cursor: pointer; line-height: 1.5; }
.rx-chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.rx-chip:disabled { cursor: default; }
.cx-pop { position: fixed; z-index: 90; display: flex; gap: 2px; padding: 5px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong, rgba(127, 127, 127, .4)); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.cx-pop button { border: 0; background: none; font-size: 1.25rem; padding: 3px 5px; border-radius: 8px; cursor: pointer; transition: transform .1s; }
.cx-pop button:hover { transform: scale(1.25); } .cx-pop button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.msg.flash { animation: msg-flash 1.4s ease-out; }
@keyframes msg-flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 4px; padding: 5px 10px; border-left: 3px solid var(--accent); background: var(--surface-2, rgba(127, 127, 127, .12)); border-radius: 0 8px 8px 0; font-size: .82rem; color: var(--dim); }
.reply-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .reply-bar b { color: var(--text); } .reply-bar[hidden] { display: none; }
.chat-find { display: flex; gap: 6px; align-items: center; margin: 0 0 6px; } .chat-find[hidden] { display: none; } .chat-find .input { flex: 1; min-width: 0; }
.chat-older, .chat-more { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; font-size: .8rem; color: var(--dim); }
.chat-more { justify-content: center; width: 100%; }
.msg.hit time { white-space: nowrap; }
.msg.hit mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.msg.hit { grid-template-columns: 86px minmax(0, 1fr); }
.cx-pop { width: max-content; flex-wrap: nowrap; }
.msg-quote.static { cursor: default; white-space: normal; }

/* mesaj menüsü (uzun basış / sağ tık): telefonda alttan sayfa, masaüstünde imleç yanında; dokunmatikte satır içi düğmeler daha büyük */
.msg { -webkit-touch-callout: none; }
@media (hover: none) { .msg .msg-act { opacity: .6; font-size: 1.05rem; padding: 2px 8px; } .msg .msg-rep { opacity: .6; } }
.msg-menu { position: fixed; z-index: 500; display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line-strong, rgba(127, 127, 127, .4)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); }
.msg-menu:not(.pop) { left: 0; right: 0; bottom: 0; border-radius: 18px 18px 0 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); animation: mm-up .18s ease-out; }
.msg-menu.pop { min-width: 220px; max-width: 320px; border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .3); }
@keyframes mm-up { from { transform: translateY(30px); opacity: 0; } }
.mm-title { padding: 4px 10px 8px; font-size: .8rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line, rgba(127, 127, 127, .25)); margin-bottom: 4px; }
.mm-rx { display: flex; justify-content: space-around; padding: 4px 2px 8px; border-bottom: 1px solid var(--line, rgba(127, 127, 127, .25)); margin-bottom: 4px; }
.mm-rx button { border: 0; background: none; font-size: 1.6rem; padding: 4px 8px; border-radius: 12px; cursor: pointer; }
.mm-rx button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); } .mm-rx button:active { transform: scale(1.2); }
.mm-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; color: var(--text); font: inherit; font-size: .98rem; padding: 12px 10px; border-radius: 10px; cursor: pointer; }
.mm-item:hover { background: var(--surface-2, rgba(127, 127, 127, .12)); } .mm-item:disabled { opacity: .5; cursor: default; }
.mm-item.danger { color: var(--danger, #dc2626); } .mm-ic { width: 22px; text-align: center; font-size: 1.1rem; }
.mm-item small { display: block; color: var(--dim); font-size: .74rem; } .mm-cancel { justify-content: center; margin-top: 4px; color: var(--dim); }
