/* 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 time { color: var(--dim); font-size: .72rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.msg .nick { font-weight: 700; cursor: pointer; background: none; border: 0; padding: 0; } .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; }
}
.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; }
}
/* 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; }
}