/* ==========================================================================
   KanziGames Satranç - Design System & Stylesheet
   Kullanıcının sağladığı orijinal temel renk ve tahta yapısına %100 sadık kalınmıştır.
   ========================================================================== */

:root {
  --bg: #1d1530;
  --fg: #f3e9d2;
  --panel: #2c2147;
  --lt: #e8c98f;
  --dk: #a0643f;
  --hl: #ffd23f;
  --muted: #a39fb5;
  --success: #2ecc71;
  --danger: #d9344f;
  --accent: #e67e22;
  --card-bg: rgba(44, 33, 71, 0.95);
  --glass-border: rgba(243, 233, 210, 0.15);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.2);
  --board-size: min(calc(100dvh - 180px), 540px, calc(100vw - 310px));
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  overflow: hidden; /* Scrollbar kesinlikle olmasın */
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background-color: #120b22;
  background-image:
    radial-gradient(ellipse at center, rgba(18, 11, 34, 0.25) 0%, rgba(18, 11, 34, 0.65) 75%, rgba(10, 6, 20, 0.9) 100%),
    url('assets/bg.jpg');
  background-position: center bottom;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  image-rendering: pixelated;
}

/* ==========================================================================
   ANA OYUN DÜZENİ (GAME CONTAINER & BOARD COLUMN)
   ========================================================================== */
.game-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: 100dvh;
  padding: 6px 14px;
  box-sizing: border-box;
}

.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ==========================================================================
   ÜST BAŞLIK VE BAR (HEADER BAR)
   ========================================================================== */
.header-bar {
  width: 100%;
  max-width: var(--board-size);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 4px;
  padding: 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hl);
  filter: drop-shadow(0 2px 6px rgba(255, 210, 63, 0.4));
}

h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
  color: var(--fg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: rgba(38, 28, 62, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--fg);
  color: var(--fg);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.icon-btn:hover {
  transform: translateY(-1px);
  background: var(--hl);
  color: #2a1b3d;
}

.icon-btn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   DURUM VE BİLGİ ŞERİDİ
   ========================================================================== */
#st {
  min-height: 27px;
  margin: 2px 0;
  text-align: center;
  width: 100%;
  max-width: var(--board-size);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(38, 28, 62, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 3px 12px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: background .2s;
  box-sizing: border-box;
}

#st.check-alert {
  background: rgba(217, 52, 79, 0.2);
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse-danger 1s infinite alternate;
}

@keyframes pulse-danger {
  from { box-shadow: 0 0 4px rgba(217, 52, 79, 0.4); }
  to { box-shadow: 0 0 14px rgba(217, 52, 79, 0.7); }
}

/* ==========================================================================
   SATRANÇ SAATİ (CHESS CLOCK BARS)
   ========================================================================== */
.clock-bar {
  width: 100%;
  max-width: var(--board-size);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(38, 28, 62, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--glass-border);
  border-radius: 9px;
  margin: 2px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all .2s ease;
  box-sizing: border-box;
}

.clock-bar.active {
  border-color: var(--hl);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.5);
  background: linear-gradient(90deg, var(--panel), rgba(255, 210, 63, 0.15));
}

.clock-bar.low-time {
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(217, 52, 79, 0.6);
  animation: pulse-low 0.8s infinite alternate;
}

@keyframes pulse-low {
  from { background-color: var(--panel); }
  to { background-color: rgba(217, 52, 79, 0.25); }
}

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid var(--fg);
}
.side-badge.w { background: #fff; }
.side-badge.b { background: #222; }

.player-name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.85;
}

.timer-box {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}

.timer-display {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .05em;
}

.inc-badge {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
}

/* ==========================================================================
   SATRANÇ TAHTASI (ORİJİNAL TEMELE SADIK)
   ========================================================================== */
#bd {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: var(--board-size);
  height: var(--board-size);
  max-width: var(--board-size);
  max-height: var(--board-size);
  aspect-ratio: 1;
  border: 3.5px solid var(--fg);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 40px rgba(120, 60, 200, 0.28);
  touch-action: none;
  position: relative;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
  -webkit-user-select: none;
}

.sq {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.sq.has-piece {
  cursor: grab;
}

.sq.dragging {
  cursor: grabbing;
}

.sq.dragging img {
  opacity: 0.22;
  transform: scale(0.9);
}

.sq.drag-hover {
  background: rgba(255, 210, 63, 0.45) !important;
  box-shadow: inset 0 0 0 3px var(--hl) !important;
}

/* Sürüklenen Taş (Floating Drag Ghost) */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%) scale(1.18);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55));
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  will-change: left, top, transform;
}

.l { background: var(--lt); }
.d { background: var(--dk); }

.sq img {
  position: absolute;
  inset: 1%;
  z-index: 1;
  width: 98%;
  height: 98%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .26));
  transition: transform .12s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
  -webkit-user-drag: none;
}

.sq:active img {
  transform: scale(0.94);
}

.last::before, .sel::before, .chk::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}

.last::before { background: rgba(255, 210, 63, .45); }
.sel::before { background: rgba(70, 200, 110, .6); }
.chk::before { background: rgba(217, 52, 79, .75); }

/* Hamle noktası */
.mv::after {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  background: rgba(42, 27, 61, .65);
  border-radius: 50%;
  z-index: 2;
  top: 36%;
  left: 36%;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Taş alma karesi */
.cp::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid rgba(217, 52, 79, .9);
  z-index: 2;
  pointer-events: none;
  box-sizing: border-box;
}

/* Tahta Koordinatları */
.co {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  z-index: 2;
  opacity: .85;
  pointer-events: none;
  font-family: inherit;
}

.rk { top: 2px; left: 3px; }
.fl { bottom: 2px; right: 3px; }

.l .co { color: var(--dk); }
.d .co { color: var(--lt); }

/* ==========================================================================
   KONTROL DÜĞMELERİ (CONTROLS BAR)
   ========================================================================== */
.bt {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 0;
  width: 100%;
  max-width: var(--board-size);
  box-sizing: border-box;
}

button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  background: rgba(38, 28, 62, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--fg);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

button:hover {
  background: var(--hl);
  color: #2a1b3d;
}

button:active {
  transform: translateY(1px);
}

/* ==========================================================================
   MODERN VEKTÖR İKONLAR (COOL VECTOR ICONS)
   ========================================================================== */
.ui-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
  flex-shrink: 0;
  transition: transform .15s ease;
}

button:hover .ui-icon {
  transform: scale(1.12);
}

.spinning {
  animation: ui-spin 2.2s infinite linear;
}

@keyframes ui-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.go-icon-svg {
  width: 54px;
  height: 54px;
  stroke: var(--hl);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.45));
}

.confirm-icon-svg {
  width: 44px;
  height: 44px;
  stroke: var(--hl);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(255, 210, 63, 0.4));
}

.confirm-icon-svg.danger {
  stroke: var(--danger);
  filter: drop-shadow(0 0 10px rgba(217, 52, 79, 0.5));
}

button.on {
  background: var(--hl);
  color: #2a1b3d;
  font-weight: 700;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   SOL PANEL - HAMLE GEÇMİŞİ (MOVES SIDEBAR)
   ========================================================================== */
.moves-sidebar {
  width: clamp(190px, 18vw, 240px);
  height: calc(var(--board-size) + 120px);
  max-height: calc(100dvh - 20px);
  background: rgba(38, 28, 62, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(243, 233, 210, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 20px rgba(120, 60, 200, 0.15);
  box-sizing: border-box;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--hl);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 6px;
}

#ml.moves-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 12.5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 210, 63, 0.4) transparent;
}

#ml::-webkit-scrollbar {
  width: 4px;
}

#ml::-webkit-scrollbar-thumb {
  background: rgba(255, 210, 63, 0.35);
  border-radius: 4px;
}

.move-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  align-items: center;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.4;
  transition: background 0.12s ease;
}

.move-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.move-num {
  color: var(--muted);
  font-weight: 600;
}

.move-item {
  color: var(--fg);
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 4px;
}

.move-item.latest {
  background: rgba(255, 210, 63, 0.25);
  color: var(--hl);
  font-weight: 700;
}

.empty-moves {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 30px 8px;
}

.sidebar-rule-note {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.35;
  padding-top: 6px;
  border-top: 1px solid var(--glass-border);
  margin-top: 6px;
  text-align: center;
}

/* ==========================================================================
   TERFİ MODALI (PAWN PROMOTION MODAL)
   ========================================================================== */
#pm {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  animation: fadeIn 0.15s ease;
  padding: 16px;
  box-sizing: border-box;
}

#pm .promotion-card {
  background: rgba(44, 33, 71, 0.96);
  border: 2px solid var(--hl);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 210, 63, 0.25);
  animation: pop-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.promotion-title {
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  color: var(--hl);
  display: flex;
  align-items: center;
  gap: 8px;
}

.promotion-subtitle {
  margin: -4px 0 2px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.promotion-pieces {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.promotion-btn {
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .18s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
  min-width: 0;
  box-sizing: border-box;
}

.promotion-btn:hover {
  background: rgba(255, 210, 63, 0.2);
  border-color: var(--hl);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 16px rgba(255, 210, 63, 0.35);
}

.promotion-btn img {
  width: clamp(36px, 11vw, 56px);
  height: clamp(36px, 11vw, 56px);
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.promotion-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
}

.promotion-cancel-btn {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 2px;
  box-sizing: border-box;
}

.promotion-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ff6b6b;
}

/* ==========================================================================
   OYUN İÇİ LOBİ MODALI / EKRANI (LOBBY VIEW)
   ========================================================================== */
#lobby-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 12px;
}

.lobby-card {
  background: var(--card-bg);
  border: 3px solid var(--fg);
  border-radius: 16px;
  width: min(94vw, 460px);
  max-height: 94vh;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox için scrollbar gizleme */
  -ms-overflow-style: none; /* IE/Edge için scrollbar gizleme */
  padding: 16px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop-in 0.25s ease;
}

.lobby-card::-webkit-scrollbar {
  display: none; /* Chrome, Safari ve yeni Edge için scrollbar gizleme */
  width: 0;
  height: 0;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px dashed var(--glass-border);
  padding-bottom: 10px;
}

.lobby-title {
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  color: var(--fg);
  cursor: pointer;
}

.close-btn:hover {
  background: transparent;
  color: var(--danger);
}

.section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .8;
  margin-bottom: 6px;
}

/* Mod Seçimi (Tab butonları) */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-tab {
  padding: 10px 4px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  border: 2px solid var(--fg);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mode-tab.selected {
  background: var(--hl);
  color: #2a1b3d;
  box-shadow: 0 0 8px rgba(255, 210, 63, 0.5);
}

/* Süre Kontrolleri (Sadeleştirilmiş Tasarım) */
.time-presets-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.16);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.time-presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time-presets-header .section-label {
  margin-bottom: 0;
}

.time-presets-hint {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hl);
  background: rgba(255, 210, 63, 0.12);
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: .02em;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--fg);
  transition: all .16s ease;
  user-select: none;
}

.preset-btn:hover {
  background: rgba(255, 210, 63, 0.15);
  border-color: rgba(255, 210, 63, 0.5);
  transform: translateY(-1px);
}

.preset-btn.selected {
  background: var(--hl);
  color: #2a1b3d;
  border-color: var(--hl);
  box-shadow: 0 4px 14px rgba(255, 210, 63, 0.35);
}

.preset-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}

.preset-sub {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.75;
  text-transform: uppercase;
}

.preset-btn.selected .preset-sub {
  opacity: 0.9;
  font-weight: 700;
}

.custom-time-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(18, 12, 32, 0.65);
  border-radius: 10px;
  border: 1.5px solid rgba(255, 210, 63, 0.25);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
  margin-top: 2px;
  animation: fadeIn .18s ease;
}

.custom-time-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-card-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.custom-stepper {
  display: flex;
  align-items: center;
  background: rgba(44, 33, 71, 0.95);
  border: 1.5px solid var(--fg);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.custom-stepper:focus-within {
  border-color: var(--hl);
  box-shadow: 0 0 8px rgba(255, 210, 63, 0.45);
}

.step-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 6px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  transition: all .12s ease;
}

.step-btn:hover {
  background: var(--hl);
  color: #2a1b3d;
  transform: scale(1.05);
}

.step-btn:active {
  transform: scale(0.92);
}

.step-value-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
}

.step-value-wrap input {
  width: 38px;
  padding: 2px 0;
  font: inherit;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  font-size: 15px;
  background: transparent;
  color: #ffffff;
  border: none;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.step-value-wrap input::-webkit-outer-spin-button,
.step-value-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.step-unit {
  font-size: 12px;
  font-weight: 800;
  color: var(--hl);
  letter-spacing: .02em;
}

/* Eski chip yapısı uyumluluğu */
.time-selector-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--fg);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip.selected {
  background: var(--hl);
  color: #2a1b3d;
}

/* Tahta Rengi Önizleme Rozetleri */
.board-color-preview {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.board-color-preview.classic {
  background: linear-gradient(135deg, #e8c98f 50%, #a0643f 50%);
}

.board-color-preview.green {
  background: linear-gradient(135deg, #eeeed2 50%, #769656 50%);
}

.board-color-preview.lila {
  background: linear-gradient(135deg, #ded6ee 50%, #7d639b 50%);
}

.board-color-preview.blue {
  background: linear-gradient(135deg, #dee3e6 50%, #5a8296 50%);
}

.board-color-preview.gray {
  background: linear-gradient(135deg, #dcdfe3 50%, #667484 50%);
}

.custom-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.custom-time-row input {
  width: 70px;
  padding: 6px 8px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--fg);
  border-radius: 6px;
  text-align: center;
}

/* Taraf / Renk Seçimi */
.color-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.color-option {
  padding: 8px 6px;
  border: 2px solid var(--fg);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.color-option.selected {
  background: var(--hl);
  color: #2a1b3d;
}

/* Çevrimiçi Oda Paneli */
.online-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.06);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.room-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--fg);
}

.room-code-val {
  font-family: monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .1em;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.player-slot span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.player-slot.empty {
  opacity: 0.6;
  border-style: dashed;
}

.lobby-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  flex: 1;
  background: var(--hl);
  color: #2a1b3d;
  font-size: 15px;
  font-weight: 800;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #2a1b3d;
  box-shadow: 0 4px 12px rgba(255, 210, 63, 0.4);
  justify-content: center;
}

.btn-primary:hover {
  background: #ffc400;
}

/* ==========================================================================
   ŞAH MAT / OYUN BİTTİ DİYALOĞU (GAME OVER MODAL)
   ========================================================================== */
#game-over-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 16px;
}

.game-over-card {
  position: relative;
  background: var(--panel);
  border: 4px solid var(--fg);
  border-radius: 18px;
  width: min(92vw, 420px);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-over-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}

.game-over-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--fg);
}

.game-over-sub {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.game-over-reason {
  font-size: 13.5px;
  line-height: 1.4;
  opacity: .9;
  background: rgba(0, 0, 0, 0.12);
  padding: 8px 12px;
  border-radius: 8px;
}

.game-over-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.game-over-actions button {
  flex: 1;
  padding: 11px;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
}

/* Misafir Bekleme & Lider Yetki Kısıtlamaları */
.disabled-for-guest {
  pointer-events: none !important;
  opacity: 0.65;
  filter: grayscale(0.2);
  cursor: not-allowed;
}

.guest-waiting-box {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 210, 63, 0.12);
  border: 1px dashed var(--hl);
  border-radius: 12px;
  color: var(--hl);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: pulse-notice 2s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@keyframes pulse-notice {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.01); }
}

.btn-inspect {
  background: transparent !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--fg) !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  transition: background .2s, border-color .2s;
}

.btn-inspect:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--hl) !important;
}

/* ==========================================================================
   BİLDİRİM / TOAST
   ========================================================================== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   ÖZEL ONAY / BİLDİRİM DİYALOĞU (CUSTOM CONFIRM MODAL)
   ========================================================================== */
#confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 22, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.confirm-card {
  background: var(--panel);
  border: 2px solid var(--glass-border);
  border-radius: 18px;
  width: min(92vw, 380px);
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-icon {
  font-size: 42px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.confirm-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: .01em;
}

.confirm-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  opacity: 0.88;
  padding: 0 4px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.confirm-actions button {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: transform .12s, filter .15s, background .15s;
}

.confirm-actions button:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  border: 1px solid var(--glass-border) !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
  background: var(--danger) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(217, 52, 79, 0.35);
}

.btn-danger:hover {
  filter: brightness(1.1);
}

/* ==========================================================================
   RESPONSIVE UYUM (MOBİL & MASAÜSTÜ)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --board-size: min(calc(100dvh - 170px), 92vw);
  }

  .game-container {
    flex-direction: column;
    padding: 4px;
    gap: 4px;
  }

  .moves-sidebar {
    display: none;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 18px; }
  .clock-bar { padding: 3px 6px; }
  .timer-display { font-size: 16px; }
  .bt { gap: 4px; }
  button { padding: 5px 8px; font-size: 11px; }
  .mode-tab { font-size: 11px; padding: 6px 2px; }

  #pm {
    padding: 10px;
  }
  #pm .promotion-card {
    padding: 14px 10px;
    gap: 10px;
    border-radius: 14px;
    max-width: 95vw;
  }
  .promotion-title {
    font-size: 15px;
  }
  .promotion-pieces {
    gap: 6px;
  }
  .promotion-btn {
    padding: 6px 2px;
    gap: 4px;
    border-radius: 10px;
  }
  .promotion-btn img {
    width: 38px;
    height: 38px;
  }
  .promotion-label {
    font-size: 10.5px;
  }
  .promotion-cancel-btn {
    padding: 7px 10px;
    font-size: 11.5px;
  }
}
