/* ============================================================
   TÜRK OKEY PLATFORMU - PREMIUM DESIGN SYSTEM
   ============================================================ */

:root {
  --bg-dark: #0a0e14;
  --bg-card: rgba(22, 28, 38, 0.85);
  --bg-card-border: rgba(212, 175, 55, 0.25);
  
  --primary: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.4);
  --gold: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.4);
  --gold-hover: #f39c12;
  
  --felt-dark: #062316;
  --felt-light: #0d462c;
  --wood-dark: #2c1a0e;
  --wood-light: #4a2d18;
  --wood-border: #734928;
  
  /* Taş Renkleri */
  --tile-bg: #fcf9f2;
  --tile-border: #dfd7c2;
  --tile-red: #be123c;
  --tile-blue: #0369a1;
  --tile-black: #1e293b;
  --tile-yellow: #946200;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --font-main: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh; /* Mobilde adres çubuğu payı: 100vh alt kısmı ekran dışına iter */
  overflow: hidden !important;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  user-select: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden !important;
}

.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ============================================================
   NAVBAR (ÜST BAR)
   ============================================================ */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 14, 20, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Oyun esnasında masaya tam ekran alan sağlamak için ana navbar gizlenir */
body.in-game .top-nav {
  display: none !important;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: linear-gradient(135deg, #d4af37, #f39c12);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-title span {
  color: var(--gold);
}

/* "OKEY 101 & TAVLA" dar ekranda tek satırda kalsın; PRO rozeti yer açmak için gizlenir. */
.brand-title { white-space: nowrap; }
@media (max-width: 600px) {
  .brand-badge { display: none; }
  .brand-title { font-size: 15px; letter-spacing: 0; }
  .nav-brand { margin-right: 8px; }
}

/* Dar ekranda navbar taşıp sağ yarıyı (Tavla, Giriş/Kayıt) kesiyordu:
   mod seçici alt satıra iner ve tam genişlik kullanır. */
@media (max-width: 760px) {
  .top-nav { padding: 10px 14px; }
  .nav-brand { flex: 1; min-width: 0; }
  .nav-actions { gap: 8px; }
  .nav-actions .icon-btn { width: 36px; height: 36px; }
  .nav-actions .btn { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  .user-badge { padding: 4px 10px; max-width: 160px; }
  .user-badge .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}

.game-mode-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  color: #1a1303;
  box-shadow: 0 2px 10px var(--gold-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-badge:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--gold);
}

.badge-edit-hint {
  font-size: 11px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.user-badge:hover .badge-edit-hint {
  opacity: 1;
}

.user-avatar {
  font-size: 16px;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gold);
}

.logout-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
}

.logout-link:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* REAL-TIME INPUT STATUS INDICATOR */
.input-with-status {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-status input {
  width: 100%;
  padding-right: 40px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-status .status-indicator-icon {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-status-text {
  font-size: 12px;
  margin-top: 5px;
  min-height: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.input-with-status.status-success input {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3);
}

.input-status-text.status-success {
  color: #10b981;
}

.input-with-status.status-error input {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}

.input-status-text.status-error {
  color: #ef4444;
}

.input-with-status.status-checking input {
  border-color: #f59e0b !important;
}

.input-status-text.status-checking {
  color: #f59e0b;
}

.input-with-status.status-info input {
  border-color: #38bdf8 !important;
}

.input-status-text.status-info {
  color: #38bdf8;
}

@keyframes spin-indicator {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.icon-spinning {
  display: inline-block;
  animation: spin-indicator 0.8s linear infinite;
}

/* ============================================================
   BUTONLAR & FORM ELEMANLARI
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  color: #1a1303;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-success {
  background: #16a34a;
  color: #fff;
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.glow {
  animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
  100% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.7); }
}

/* ============================================================
   GÖRÜNÜM VE SAYFA YÖNETİMİ
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view-section {
  display: none;
  flex: 1;
}

.view-section.active {
  display: flex;
  flex-direction: column;
}

/* Sayfa gövdesi oyun masası için sabit; lobi kendi alanında kayar (çubuk pencere kenarında). */
.main-content:has(> #lobbyScreen.active) {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* :has() desteklemeyen eski mobil tarayıcılarda lobi kaydırılamayıp yarıda kesiliyordu. */
body:not(.in-game) .main-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ============================================================
   LOBİ EKRANI
   ============================================================ */
#lobbyScreen {
  padding: 30px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.lobby-hero {
  margin-bottom: 35px;
}

.hero-card {
  background: linear-gradient(135deg, rgba(22, 28, 38, 0.95), rgba(15, 20, 28, 0.9));
  border: 1px solid var(--bg-card-border);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-card h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-card p {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.rooms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.rooms-header h3 {
  font-size: 22px;
  font-weight: 700;
}

.rooms-filter {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-chip {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.filter-chip.active {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
}

#refreshRoomsBtn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

#refreshRoomsBtn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(45deg);
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

@media (max-width: 600px) {
  #lobbyScreen { padding: 16px 12px; }
  .hero-card { padding: 24px 16px; }
  .hero-card h2 { font-size: 26px; }
  .rooms-header { flex-wrap: wrap; gap: 10px; }
  .rooms-filter { flex-wrap: wrap; }
  .rooms-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .rooms-filter { gap: 6px; }
  .filter-chip { padding: 5px 9px; font-size: 12px; }
  #refreshRoomsBtn { width: 28px; height: 28px; min-width: 28px; font-size: 12px; }
}

/* Lobi: çevrimiçi sayısı ve sohbet (geniş ekranda masaların sağında, dar ekranda altında) */
.hero-card .lobby-online { display: inline-flex; align-items: center; gap: 8px; margin: -12px 0 22px; padding: 4px 12px; border-radius: 999px; background: rgba(16, 185, 129, 0.12); color: #6ee7b7; font-size: 14px; font-weight: 600; }
.lobby-online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.lobby-online:has(.offline) { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); }
.lobby-online:has(.offline) .lobby-online-dot { background: var(--text-muted); box-shadow: none; }
/* Üst yarı: solda karşılama kartı, sağda sohbet/arkadaş paneli; dar ekranda alt alta. */
.lobby-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-bottom: 35px; }
.lobby-top .lobby-hero { margin-bottom: 0; }
@media (min-width: 1000px) {
  .lobby-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: clamp(400px, 50vh, 560px); }
  .lobby-top .lobby-hero, .lobby-top .hero-card { height: 100%; }
  .lobby-top .hero-card { display: flex; flex-direction: column; justify-content: center; box-sizing: border-box; }
}
.lobby-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--bg-card-border); border-radius: var(--radius-lg); background: var(--bg-card); overflow: hidden; }
.lobby-side-tabs { display: flex; border-bottom: 1px solid var(--bg-card-border); }
.lobby-side-tab { flex: 1; padding: 12px 10px; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.lobby-side-tab.active { color: #fcd34d; box-shadow: inset 0 -2px 0 var(--gold); }
.friend-badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; line-height: 18px; }
.friend-badge[hidden] { display: none; }
.lobby-chat, .lobby-friends { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; min-width: 0; padding: 14px 16px 16px; }
.lobby-chat[hidden], .lobby-friends[hidden] { display: none; }
.lobby-chat-messages { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 260px; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
@media (min-width: 1000px) { .lobby-chat-messages { min-height: 0; } }
.lobby-friends-list { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 200px; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 1000px) { .lobby-friends-list { min-height: 0; } }
.friend-section-title { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); }
.friend-row.pending { background: rgba(212, 175, 55, 0.12); }
.friend-name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text-main); font: inherit; font-weight: 600; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-name:hover { text-decoration: underline; }
.friend-row .btn { padding: 4px 10px; font-size: 13px; }
.rejoin-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--gold); border-radius: var(--radius-md); background: rgba(212, 175, 55, 0.12); color: var(--text-main); }
.rejoin-banner[hidden] { display: none; }
.room-card.my-table { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.room-card.full { opacity: 0.7; }
.lobby-chat-empty { margin: auto; color: var(--text-muted); font-size: 14px; text-align: center; }
.lobby-chat-message { padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); }
.lobby-chat-message.own { background: rgba(212, 175, 55, 0.12); }
.lobby-chat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lobby-chat-name { padding: 0; border: 0; background: none; color: #fcd34d; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-chat-name:hover, .lobby-chat-name:focus-visible { text-decoration: underline; }
.lobby-chat-time { flex-shrink: 0; color: var(--text-muted); font-size: 11px; }
.lobby-chat-text { margin: 2px 0 0; color: var(--text-main); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.lobby-chat-form { display: flex; gap: 8px; }
.lobby-chat-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #334155; border-radius: var(--radius-sm); background: #0f172a; color: var(--text-main); font: inherit; font-size: 14px; }
.lobby-chat-form input:disabled { opacity: 0.6; }
.lobby-chat-status { margin: 0; color: #fca5a5; font-size: 13px; }
.lobby-chat-note { margin: 0; color: var(--text-muted); font-size: 12px; }
#lobbyChatLogin[hidden] { display: none; }

.room-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.25s;
}

.room-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.room-title {
  font-weight: 700;
  font-size: 16px;
}

.room-code-tag {
  font-size: 11px;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gold);
}

.room-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.room-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ============================================================
   OYUN MASASI VE YEŞİL ÇUHA DÜZENİ (TAM EKRAN - SIFIR SCROLL)
   ============================================================ */
#tableScreen.active {
  flex: 1;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  background: #04120a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-table-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.table-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.table-title-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#micLevel { width: 42px; height: 14px; }
#microphoneSelect { max-width: 160px; min-width: 0; min-height: 48px; color: #fff; background: #263c34; border: 1px solid #829b8e; border-radius: 8px; }
.voice-icon-btn.receiving-sound { outline: 3px solid #55e492; box-shadow: 0 0 12px #55e492; }
.voice-controls { flex-wrap: wrap; }

.voice-icon-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.voice-icon-btn.muted {
  opacity: 0.4;
  filter: grayscale(1);
}

.voice-icon-btn:hover {
  transform: scale(1.15);
}

.table-badge {
  background: var(--gold);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.table-turn-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 20px;
}

.turn-name {
  color: var(--gold);
  font-weight: 700;
}

.turn-timer {
  background: #ef4444;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

/* ÇUHA MASA (TAM SIKILABİLİR - SIFIR SCROLL) */
.felt-table {
  flex: 1;
  min-height: 0;
  background: radial-gradient(circle at center, var(--felt-light) 0%, var(--felt-dark) 85%);
  border: 8px solid var(--wood-dark);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* OYUNCU SLOTS */
.player-slot {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar-card {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--gold);
}

.player-details {
  display: flex;
  flex-direction: column;
}

.seat-add-bot {
  min-height: 48px;
  margin-top: 4px;
}

.seat-name {
  font-size: 13px;
  font-weight: 700;
}

.seat-tiles-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* Konumlandırma */
.slot-top {
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
}

.slot-left {
  left: 20px;
  top: 45%;
  transform: translateY(-50%);
  flex-direction: column;
}

.slot-right {
  right: 20px;
  top: 45%;
  transform: translateY(-50%);
  flex-direction: column;
}

/* DİSCARD ZONES (Taş Atma Alanları - Yalnızca Son Atılan Taş) */
.discard-zone {
  min-width: 50px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.discard-zone .okey-tile {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 6px rgba(212, 175, 55, 0.35);
  transition: transform 0.15s ease;
  animation: tile-appear 0.18s ease-out;
}

@keyframes tile-appear {
  from {
    transform: scale(0.92);
    opacity: 0.6;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.my-discard-area {
  position: absolute;
  right: 60px;
  bottom: 20px;
  width: 140px;
  height: 90px;
  border: 2px dashed rgba(212, 175, 55, 0.4);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  cursor: pointer;
}

.my-discard-area.highlight {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.2);
}

.discard-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  pointer-events: none;
}

/* MASA ORTASI */
.table-meld {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin: 2px 0;
  padding: 4px;
  max-width: 100%;
  border: 1px solid rgba(212, 175, 55, .4);
  border-radius: 8px;
}

.match-history { overflow-x: auto; margin: 12px 0; }
.match-history table { width: 100%; border-collapse: collapse; font-size: 12px; }
.match-history th, .match-history td { padding: 6px; text-align: center; border: 1px solid rgba(255,255,255,.2); }
.result-card { max-height: 90vh; overflow-y: auto; }

[aria-pressed="true"] {
  outline: 2px solid var(--gold);
}

.table-center {
  position: absolute;
  inset: 80px clamp(110px, 14vw, 180px) 120px;
  display: grid;
  grid-template-columns: 64px 64px minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  gap: 10px;
  z-index: 10;
}

.table-melds-container { align-self: stretch; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.table-center:has(.table-melds-container.hidden) { display: flex; justify-content: center; }
.melds-header, .opening-threshold { flex: none; font-size: 11px; color: var(--gold); }
.melds-list { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.meld-owner-section h4 { margin: 6px 0 2px; font-size: 11px; overflow-wrap: anywhere; }
.meld-owner-groups { display: flex; flex-wrap: wrap; gap: 4px; }
.melds-list:has(.meld-owner-section:nth-child(3)) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 5px; }
.melds-list:has(.meld-owner-section:nth-child(3)) .meld-owner-section { min-width: 0; }
.melds-list:has(.meld-owner-section:nth-child(3)) .table-meld { padding: 2px; gap: 1px; }
.melds-list:has(.meld-owner-section:nth-child(3)) .okey-tile { width: 17px; height: 25px; }
.melds-list:has(.meld-owner-section:nth-child(3)) .tile-val { font-size: 15px; }
.table-meld .okey-tile { width: 22px; height: 32px; min-width: 0; flex-shrink: 1; }
.table-meld .tile-val, .table-meld .fake-star { font-size: 18px; }
.table-meld .btn { padding: 2px 5px; }

@media (max-width: 750px) {
  .table-center { inset: 70px 100px 105px; grid-template-columns: 46px minmax(0, 1fr); gap: 6px; }
  .table-center .indicator-box { display: none; }
}

.indicator-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.box-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}

.okey-info-pill {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

/* DESTE */
.draw-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
}

.draw-deck:hover {
  transform: scale(1.05);
}

.deck-stack {
  position: relative;
  width: 50px;
  height: 70px;
}

.deck-tile-back {
  width: 50px;
  height: 70px;
  background: #bf2e2e;
  border-radius: 6px;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  position: absolute;
}

.deck-tile-back:nth-child(1) { top: -4px; left: -2px; }
.deck-tile-back:nth-child(2) { top: -2px; left: -1px; }
.deck-tile-back:nth-child(3) { top: 0; left: 0; }

.deck-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--gold);
  color: #000;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  z-index: 5;
}

.deck-label {
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  color: #fff;
}

/* ============================================================
   KEMİK TAŞLAR (OKEY TILES)
   ============================================================ */
/* ============================================================
   KEMİK TAŞLAR (OKEY TILES)
   ============================================================ */
.okey-tile {
  width: 42px;
  height: 58px;
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
  border-bottom: 3px solid #b8af96;
  border-radius: 6px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  flex-shrink: 0;
  user-select: none;
}

.okey-tile:active {
  cursor: grabbing;
}

.okey-tile.dragging {
  opacity: 0.35;
  transform: scale(0.92);
}

.okey-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45);
}

.okey-tile.selected {
  outline: 3px solid #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.9), 0 8px 16px rgba(0, 0, 0, 0.6);
  transform: translateY(-8px) scale(1.06);
  z-index: 30;
  animation: pulse-selected 1.5s infinite alternate ease-in-out;
}

@keyframes pulse-selected {
  0% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.6), 0 6px 12px rgba(0, 0, 0, 0.5); }
  100% { box-shadow: 0 0 20px rgba(245, 158, 11, 1), 0 10px 20px rgba(0, 0, 0, 0.7); }
}

/* Ters Çevrilmiş Taş (Upside Down / Flipped) */
.okey-tile.is-flipped {
  transform: rotate(180deg);
  border: 1px solid rgba(212, 175, 55, 0.9);
  border-top: 3px solid #b8af96;
  border-bottom: 1px solid var(--tile-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 10px rgba(212, 175, 55, 0.5);
}

.okey-tile.is-flipped:hover {
  transform: translateY(-3px) rotate(180deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), 0 0 14px rgba(212, 175, 55, 0.7);
}

.okey-tile.is-flipped.selected {
  outline: 3px solid #f59e0b;
  transform: translateY(-8px) scale(1.06) rotate(180deg);
  z-index: 30;
}

.okey-tile.dragging.is-flipped {
  opacity: 0.35;
  transform: scale(0.92) rotate(180deg);
}

/* Okey Taşı Özel İşareti */
.okey-tile.is-okey-tile {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), 0 0 8px rgba(212, 175, 55, 0.4);
}

.okey-tile.is-okey-tile::after {
  content: '★';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  color: var(--gold);
  line-height: 1;
  pointer-events: none;
}

.okey-tile.is-okey-tile.is-flipped::after {
  transform: rotate(180deg);
  top: auto;
  bottom: 1px;
  right: auto;
  left: 2px;
}

/* Sürükleme esnasında alt elemanların eventleri engellememesi için */
.is-dragging-tile .okey-tile {
  pointer-events: none !important;
}

.is-dragging-tile .rack-slot {
  border: 1px dashed rgba(255, 255, 255, 0.3) !important;
}

.tile-val {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-main);
}

.tile-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 3px;
}

/* Taş Renk Sınıfları */
.tile-red .tile-val, .tile-red .fake-star { color: var(--tile-red); }
.tile-red .tile-dot { background-color: var(--tile-red); }

.tile-blue .tile-val, .tile-blue .fake-star { color: var(--tile-blue); }
.tile-blue .tile-dot { background-color: var(--tile-blue); }

.tile-black .tile-val, .tile-black .fake-star { color: var(--tile-black); }
.tile-black .tile-dot { background-color: var(--tile-black); }

.tile-yellow .tile-val, .tile-yellow .fake-star { color: var(--tile-yellow); }
.tile-yellow .tile-dot { background-color: var(--tile-yellow); }
.okey-tile * {
  pointer-events: none;
  user-select: none;
}

.fake-star {
  font-size: 20px;
}

/* ============================================================
   AHŞAP ISTAKA (26 YUVALI GERÇEK TÜRK OKEY ISTAKASI)
   ============================================================ */
.rack-and-controls {
  background: var(--wood-dark);
  padding: 4px 16px 8px;
  border-top: 3px solid var(--wood-border);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.rack-action-bar {
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}

.rack-tips {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rack-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wooden-rack {
  width: 100%;
  max-width: 920px;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood-dark) 100%);
  border: 3px solid var(--wood-border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: visible;
}

.rack-tier {
  height: 56px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  padding: 2px 4px;
  gap: 4px;
  overflow: visible;
}

/* Her Bir Istaka Yuvası (Slot) */
.rack-slot {
  height: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  position: relative;
  transition: all 0.15s ease;
  cursor: pointer;
  overflow: visible;
}

.rack-slot.empty:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
}

.game-notice {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 12px;
  border: 2px solid #f59e0b;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 4px 20px #0008;
}

.seat-requests {
  position: fixed;
  right: 12px;
  top: 80px;
  z-index: 210;
  width: min(320px, calc(100vw - 24px));
  max-height: min(45dvh, 400px);
  overflow: auto;
  padding: 8px;
  border: 2px solid #38bdf8;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
}

/* El sayısı önerisi/onayı: masa isteklerinin üstüne binmesin diye ortada, altın çerçeveli. */
.match-hands-panel {
  right: auto;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  border-color: #e6b95b;
  background: linear-gradient(90deg, #1a1405, #0f172a 50%, #10221f);
}

.match-hands-panel .seat-request-card {
  border-bottom: 0;
}

.match-hands-panel .seat-request-card button:first-of-type {
  background: linear-gradient(#f6c453, #d9922b);
  color: #2a1a04;
  border-color: #fde68a;
  font-weight: 700;
}

.seat-request-card {
  padding: 8px;
  border-bottom: 1px solid #64748b;
  overflow-wrap: anywhere;
}

.seat-request-card button {
  min-height: 44px;
  margin: 4px;
}

.game-notice p {
  overflow-wrap: anywhere;
  margin: 0 0 8px;
}

.game-notice button {
  min-height: 44px;
}

.rack-slot:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  z-index: 2;
}

.wooden-rack.has-selected-tile .rack-slot.empty {
  border: 1px dashed rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.08);
}

.wooden-rack.has-selected-tile .rack-slot.empty:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: #10b981;
  outline: 2px solid #10b981;
}

.wooden-rack.has-selected-tile .rack-slot.filled:not(.slot-selected):hover {
  outline: 2px dashed #0984e3;
  background: rgba(9, 132, 227, 0.25);
}

.rack-slot.drag-over {
  background: rgba(16, 185, 129, 0.4) !important;
  border-color: #10b981 !important;
  outline: 2px solid #10b981 !important;
  transform: scale(1.04);
}

.rack-slot .okey-tile {
  width: 100%;
  height: 100%;
  max-width: 58px;
  max-height: 50px;
}

.my-discard-area.drag-over {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.35) !important;
  outline: 2px solid #10b981 !important;
  transform: scale(1.05);
}

/* ============================================================
   MODALLAR
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-card {
  background: #151a23;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 440px;
  /* Sayfa kaydırılamadığından uzun pencere (profil istatistikleri) kendi içinde kayar. */
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  margin: -15px -15px 0 0;
  padding: 2px 8px;
  background: #151a23;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--gold);
  border-color: var(--gold);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
}

/* Açılır liste tarayıcının kendi penceresinde çizilir; beyaz yazının beyaz zeminde kaybolmaması için koyu düzen. */
.form-group select { color-scheme: dark; }
.form-group select option, .form-group select optgroup { background: #1e2633; color: #f8fafc; }
.form-group select option:checked { background: #2563eb; color: #fff; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-alert {
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid #ef4444;
}

.account-danger-zone {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(239, 68, 68, 0.35);
}

.account-delete-btn {
  color: #fca5a5;
  border-color: #ef4444;
}

.legal-links {
  margin-top: 10px;
  font-size: 12px;
  text-align: center;
  color: var(--text-muted, #94a3b8);
}

.legal-links a {
  color: inherit;
  text-decoration: underline;
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid #10b981;
}

.social-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 14px;
}

.social-divider::before,
.social-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.social-divider span {
  padding: 0 10px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}

.social-auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: all 0.2s ease;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.btn-google:hover {
  border-color: rgba(66, 133, 244, 0.6);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.btn-facebook:hover {
  border-color: rgba(24, 119, 242, 0.6);
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.2);
}

/* GOOGLE MODAL STYLES */
.google-modal-card {
  max-width: 440px;
  text-align: center;
}

.google-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.google-official-slot {
  display: flex;
  justify-content: center;
  margin: 15px 0 10px;
  min-height: 44px;
}

.google-official-slot:empty {
  display: none;
}

.google-quick-actions {
  margin-top: 10px;
}

.google-dev-details {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
}

.google-dev-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.dev-config-box {
  margin-top: 10px;
}

.user-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
}

.hidden {
  display: none !important;
}
/* Public gameplay profiles; tables remain scrollable on small screens. */
.profile-stats-scroll { overflow-x: auto; max-width: 100%; }
.profile-stats-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .6rem 0 1rem; }
.profile-stats-table th, .profile-stats-table td { padding: .4rem; text-align: center; border-bottom: 1px solid #64748b55; }
.profile-stats-table th:first-child { text-align: left; }
.player-profile-dialog { color: #f8fafc; background: #172536; border: 1px solid #64748b; border-radius: 16px; padding: 24px; width: min(560px, 90vw); max-height: 85vh; overflow: auto; }
.player-profile-dialog::backdrop { background: #0009; }
.player-profile-link { cursor: pointer; text-decoration: underline dotted; }
.player-profile-link:focus-visible { outline: 2px solid #fbbf24; outline-offset: 4px; }
/* Seat stats badge: one line on the table, details on hover/focus, full profile on click. */
.seat-stats { position: relative; display: inline-flex; align-self: flex-start; margin-top: 2px; padding: 1px 6px; border-radius: 999px; background: rgba(251, 191, 36, 0.14); color: #fcd34d; font-size: 11px; line-height: 1.5; white-space: nowrap; cursor: pointer; }
.seat-stats[hidden] { display: none; }
.seat-stats:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.seat-stats-card { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: none; flex-direction: column; gap: 2px; min-width: 210px; padding: 8px 10px; border: 1px solid #64748b; border-radius: 10px; background: #172536; color: #f8fafc; font-size: 12px; white-space: normal; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45); }
.seat-stats:hover .seat-stats-card, .seat-stats:focus-visible .seat-stats-card { display: flex; }
.seat-stats-card-title { font-weight: 700; color: #fcd34d; }
.seat-stats-card-muted { color: #94a3b8; }
.slot-right .seat-stats-card { left: auto; right: 0; }
.player-slot:has(.seat-stats:hover), .player-slot:has(.seat-stats:focus-visible) { z-index: 40; }
@media (hover: none) { .seat-stats-card { display: none !important; } }
.backgammon-screen { width: 100%; min-width: 0; box-sizing: border-box; margin: 0; padding: 8px 16px 16px; overflow: auto; }
.main-content:has(> .backgammon-screen:not(.hidden)) { flex: 1; min-height: 0; overflow: hidden; }
.backgammon-screen:not(.hidden) { flex: 1; min-height: 0; margin-top: 0; margin-bottom: 0; }
.backgammon-header, .backgammon-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.backgammon-header { margin-top: 0; }
.backgammon-header .voice-controls { flex-wrap: nowrap; }
/* Dikey: panel çözülür, öğeler tahtanın üstüne/altına sıralanır. */
.backgammon-body { display: flex; flex-direction: column; }
.backgammon-side { display: contents; }
.backgammon-side > .backgammon-player:first-child { order: 1; } .backgammon-status-row { order: 2; } .backgammon-hint { order: 3; }
.backgammon-board-wrap { order: 4; } .backgammon-side > .backgammon-player:nth-child(4) { order: 5; }
.backgammon-side > .backgammon-controls { order: 6; } .backgammon-side > :nth-child(6) { order: 7; } .backgammon-chat-box { order: 8; }
.backgammon-heading { flex: 1 1 160px; min-width: 0; }
.backgammon-heading h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.backgammon-heading small { color: #94a3b8; }
.backgammon-controls button, .backgammon-header button { min-height: 44px; }
.backgammon-controls .btn-primary { flex: 1 1 140px; }
.backgammon-controls button:disabled, .backgammon-header button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.backgammon-player { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 8px 0; border: 1px solid #334155; border-radius: 12px; background: #111827; }
.backgammon-player.active { border-color: #f59e0b; box-shadow: 0 0 0 1px #f59e0b inset; }
.backgammon-player > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.backgammon-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backgammon-player-info { color: #94a3b8; font-size: .82rem; }
.backgammon-player > .backgammon-checker { width: 22px; height: 22px; flex-shrink: 0; }
.backgammon-score { font-weight: bold; font-size: 1.1rem; color: #fbbf24; white-space: nowrap; }
.backgammon-status-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.backgammon-status { flex: 1; margin: 0; padding: 8px 12px; border: 1px solid #38bdf8; border-radius: 12px; background: #0f172ae6; font-weight: 600; }
.backgammon-status.mine { border-color: #f59e0b; }
.backgammon-clock { color: #fbbf24; font-weight: normal; white-space: nowrap; }
.backgammon-dice { display: flex; gap: 4px; }
.backgammon-die { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 34px; height: 34px; padding: 4px; box-sizing: border-box; border-radius: 7px; background: #f8fafc; box-shadow: 0 2px 4px #0008; }
.backgammon-die i { border-radius: 50%; margin: 1px; }
.backgammon-die i.pip { background: #1e293b; }
.backgammon-die.used { opacity: .3; }
.backgammon-hint { margin: 4px 0; color: #a7f3d0; font-size: .9rem; }
.backgammon-board { --gap: 2px; display: grid; grid-template-columns: repeat(6, 1fr) .85fr repeat(6, 1fr) .85fr; grid-template-rows: 1fr 1fr; gap: 10px var(--gap); aspect-ratio: 15 / 11; width: 100%; margin: 0 auto; box-sizing: border-box; padding: 6px; background: #68452d; border: 6px solid #38271d; border-radius: 12px; }
.backgammon-point, .backgammon-tray { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-width: 0; min-height: 0; padding: 2px 0; border: 0; border-radius: 0; color: white; background: transparent; cursor: default; overflow: hidden; font: inherit; }
.backgammon-point.bottom, .backgammon-tray.bottom { flex-direction: column-reverse; }
.backgammon-point::before { content: ''; position: absolute; inset: 0; background: #d4a36d; clip-path: polygon(0 0, 100% 0, 50% 88%); }
.backgammon-point.dark::before { background: #563421; }
.backgammon-point.bottom::before { clip-path: polygon(0 100%, 100% 100%, 50% 12%); }
.backgammon-point > *, .backgammon-tray > * { position: relative; z-index: 1; flex-shrink: 0; }
.backgammon-tray { background: #38271d; border-radius: 6px; justify-content: center; }
.backgammon-tray.top { justify-content: flex-start; } .backgammon-tray.bottom { justify-content: flex-start; }
.backgammon-tray.off { background: #2a1d15; }
.backgammon-label { font-size: .6rem; line-height: 1; opacity: .75; margin: 1px 0; }
.backgammon-point:disabled, .backgammon-tray:disabled { opacity: 1; cursor: default; }
.backgammon-point:not(:disabled), .backgammon-tray:not(:disabled) { cursor: pointer; }
.backgammon-point.source, .backgammon-tray.source { box-shadow: inset 0 0 0 2px #fbbf24; }
.backgammon-point.selected, .backgammon-tray.selected { box-shadow: inset 0 0 0 3px #38bdf8; }
.backgammon-point.target, .backgammon-tray.target { box-shadow: inset 0 0 0 3px #22c55e; background: #22c55e33; }
.backgammon-point.last-from, .backgammon-tray.last-from { outline: 2px dashed #60a5fa; outline-offset: -2px; }
.backgammon-marker { position: absolute !important; left: 50%; transform: translateX(-50%); bottom: 2px; z-index: 2 !important; min-width: 16px; padding: 0 3px; border-radius: 8px; background: #2563eb; color: white; font-size: .65rem; font-weight: bold; line-height: 16px; }
.backgammon-point.bottom .backgammon-marker, .backgammon-tray.bottom .backgammon-marker { top: 2px; bottom: auto; }
.backgammon-checker { width: 88%; max-width: 64px; aspect-ratio: 1; margin-top: -1px; border-radius: 50%; display: grid; place-items: center; box-sizing: border-box; box-shadow: 0 2px 3px #0008; border: 2px solid #0003; font-weight: bold; font-size: .7rem; }
.backgammon-checker.white { background: #fff4de; color: #38271d; }
.backgammon-checker.black { background: #232127; color: white; border-color: #fff3; }
.backgammon-off-count { margin: 4px 0; padding: 2px 6px; border-radius: 8px; font-weight: bold; font-size: .8rem; }
.backgammon-off-count.white { background: #fff4de; color: #38271d; }
.backgammon-off-count.black { background: #232127; color: white; }
.backgammon-chat { max-height: 180px; overflow-y: auto; }
.backgammon-chat-box summary { cursor: pointer; min-height: 32px; }
@media (max-width: 480px) {
  .backgammon-screen { padding: 8px 10px 16px; }
  .backgammon-board { padding: 4px; border-width: 4px; gap: 8px 1px; }
  .backgammon-die { width: 28px; height: 28px; padding: 3px; }
  .backgammon-header button { padding: 6px 10px; font-size: .85rem; }
}
/* Yatay/geniş ekran: tam ekran masa; tahta kalan yüksekliği doldurur, sağda sabit panel. */
@media (orientation: landscape) and (min-width: 640px), (min-width: 1100px) {
  .backgammon-screen:not(.hidden) { display: flex; flex-direction: column; overflow: hidden; padding: 6px 12px 10px; }
  .backgammon-header { flex: none; margin-bottom: 6px; }
  .backgammon-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 26vw, 340px); gap: 12px; }
  .backgammon-board-wrap { order: 0; min-height: 0; container-type: size; display: grid; place-items: center; }
  .backgammon-board { width: min(100cqw, 100cqh * 15 / 11); height: auto; margin: 0; }
  .backgammon-side { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
  .backgammon-side > * { order: 0 !important; }
  .backgammon-side .backgammon-player { margin: 0 0 8px; }
  .backgammon-side .backgammon-controls .btn-primary, .backgammon-side .backgammon-controls button { flex: 1 1 100px; }
  .backgammon-chat-box { margin-top: auto; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .backgammon-heading h2 { font-size: 1rem; }
  .backgammon-header button, .backgammon-controls button { min-height: 36px; padding: 4px 10px; }
  .backgammon-player { padding: 4px 8px; }
  .backgammon-status { padding: 4px 8px; font-size: .85rem; }
  #microphoneSelect { display: none; }
}

/* E-posta doğrulama adımı */
.verify-email-info { margin: 0 0 12px; color: var(--text-muted, #94a3b8); font-size: 0.9rem; line-height: 1.4; overflow-wrap: anywhere; }
.verify-code-input { font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.verify-email-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.verify-email-actions .btn { flex: 1 1 140px; }
.link-btn { display: block; margin: 10px auto 0; padding: 4px 8px; background: none; border: 0; color: var(--gold, #fbbf24); font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
.link-btn:hover, .link-btn:focus-visible { color: #fde68a; }

/* Temalı onay/seçim/giriş pencereleri (dialogs.js) */
.app-dialog { margin: auto; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow-y: auto; color: #f8fafc; background: #151a23; border: 1px solid var(--bg-card-border); border-radius: var(--radius-lg); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6); }
.app-dialog::backdrop { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); }
.app-dialog-form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.app-dialog-title { margin: 0; font-size: 1.15rem; color: var(--gold); }
.app-dialog-message { margin: 0; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.app-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.app-dialog-actions .btn { flex: 1 1 120px; min-height: 44px; }
.app-dialog-choices { display: flex; flex-direction: column; gap: 8px; }
.app-dialog-choices .btn { min-height: 44px; text-align: left; }
.app-dialog .form-group input { width: 100%; box-sizing: border-box; }
.btn-danger { background: #dc2626; color: #fff; border: 1px solid #f87171; }
.btn-danger:hover { background: #b91c1c; }
.app-dialog .btn:focus-visible, .modal-overlay .btn:focus-visible, .modal-close:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }

/* Form satırındaki seçim kutuları dar pencerede hücresinden taşmaz. */
.form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row .form-group { min-width: 0; }
.form-row .form-group select, .form-row .form-group input { width: 100%; min-width: 0; box-sizing: border-box; }

/* Masa üst barı: uzun masa adı satır kırmak yerine kısalır. */
.table-info-bar { gap: 8px; }
.table-title-pill { min-width: 0; flex: 1 1 auto; }
#currentTableTitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tablePointSummary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-badge { flex: none; white-space: nowrap; }

/* Dar ekran (telefon dikey): üst bar iki satıra, aksiyon düğmeleri alt alta sarar; hiçbir düğme ekran dışında kalmaz. */
@media (max-width: 760px) {
  .table-info-bar { flex-wrap: wrap; padding: 6px 8px; row-gap: 6px; }
  .table-info-bar > .btn { padding: 6px 8px; font-size: 12px; }
  .table-title-pill { order: -1; flex: 1 1 100%; gap: 6px; font-size: 13px; }
  .voice-controls { flex-wrap: nowrap; margin-left: auto; padding: 2px 6px; }
  #microphoneSelect, #micLevel { display: none; }
  .table-turn-indicator { padding: 2px 8px; gap: 6px; }
  .rack-action-bar { flex-direction: column; align-items: stretch; gap: 4px; }
  .rack-tips { text-align: center; }
  .rack-buttons { flex-wrap: wrap; justify-content: center; flex-shrink: 1; }
}
/* Çok dar pencerede seçenek metinleri kesilmesin: alanlar tek sütuna iner. */
@media (max-width: 420px) { .form-row { grid-template-columns: minmax(0, 1fr); } }

/* Erişilebilirlik ve dokunma düzeltmeleri (13 Kasım 2026 denetimi) */
/* Klavye odağı bütün düğme ve bağlantılarda görünür. */
.btn:focus-visible, .icon-btn:focus-visible, .filter-chip:focus-visible, .voice-icon-btn:focus-visible, .lobby-side-tab:focus-visible,
#refreshRoomsBtn:focus-visible, .user-badge:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.form-group input:focus-visible, .form-group select:focus-visible { outline: 2px solid #fbbf24; outline-offset: 1px; }

/* Küçük etiketler okunur boyuta çıkar; beyaz yazılı yeşil düğme AA kontrastına ulaşır. */
.discard-hint { font-size: 12px; color: rgba(255, 255, 255, 0.82); }
.seat-tiles-count, .deck-label, .table-badge { font-size: 12px; }
.box-label { font-size: 11px; }
.btn-success { background: #15803d; }

/* Masa ipucu kesilmek yerine iki satıra kadar sarar. */
.rack-tips { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.25; min-width: 0; padding-right: 8px; }

/* Yakınlaştırma serbest; oyun alanında çift dokunma yanlışlıkla büyütmesin. */
.game-table-container, .backgammon-screen { touch-action: manipulation; }

/* Dokunmatik ekran: hedefler en az 44 px; 16 px altı giriş alanı iOS'ta odaklanınca sayfayı büyütür. */
@media (pointer: coarse) {
  .btn, .filter-chip, .lobby-side-tab, .link-btn { min-height: 44px; }
  .filter-chip { display: inline-flex; align-items: center; }
  .icon-btn, .nav-actions .icon-btn, #refreshRoomsBtn { width: 44px; height: 44px; min-width: 44px; }
  .voice-icon-btn { min-width: 44px; min-height: 44px; }
  .modal-close { min-width: 44px; min-height: 44px; }
  .form-group input, .form-group select, #lobbyChatInput, #friendAddInput { font-size: 16px; min-height: 44px; }
}

/* Telefon: masalar sohbetten önce gelir; oyuncu masaya ulaşmak için sohbeti kaydırmak zorunda kalmaz. */
@media (max-width: 999px) {
  #lobbyScreen.active { display: flex; flex-direction: column; }
  .lobby-top { display: contents; }
  .lobby-top .lobby-hero { margin-bottom: 20px; }
  .rooms-container { order: 1; margin-bottom: 24px; }
  .lobby-side { order: 2; min-height: 360px; }
}
@media (max-width: 600px) {
  .rooms-header { flex-wrap: wrap; gap: 10px; }
  .rooms-filter { flex-wrap: wrap; }
}

/* Hareket azaltma tercihi: animasyon ve geçişler kapatılır. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
