/* ==========================================================================
   KULAKTAN KULAĞA - PURE VANILLA CSS3 (DARK MODE & GLASSMORPHISM)
   Tema Renkleri: #E6E6E6 & #a78bfa
   ========================================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Tema Renk Paleti (#E6E6E6 & #a78bfa) */
  --bg-dark: #090814;
  --bg-surface: #121026;
  --bg-card: rgba(18, 16, 38, 0.85);
  --bg-card-hover: rgba(28, 25, 56, 0.9);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(167, 139, 250, 0.25);

  --primary: #a78bfa;
  --primary-hover: #8b5cf6;
  --primary-glow: rgba(167, 139, 250, 0.45);

  --secondary: #c4b5fd;
  --accent-pink: #f472b6;
  --accent-cyan: #38bdf8;
  --accent-light: #E6E6E6;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text-main: #E6E6E6;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --canvas-bg: #1e1b4b;
}

/* Sıfırlama ve Temel Yapı */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

input,
textarea {
  user-select: auto;
  -webkit-user-select: auto;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-y: none !important;
  overscroll-behavior-x: none !important;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  background-color: #ddd6fe;
  background-image: url('bg.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* SABİT TAM EKRAN KUSURSUZ ARKAPLAN KATMANI (DESKTOP & MOBİL) */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  background-color: #ddd6fe;
  background-image: url('bg.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

/* Kaydırma Çubuklarını Tamamen Görünmez Yap (İşleyiş ve Kaydırma Korunur) */
html,
body,
*,
*::before,
*::after {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  display: none !important;
  background: transparent !important;
}

::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  display: none !important;
  background: transparent !important;
}

::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
  display: none !important;
  background: transparent !important;
}

/* GLASSMORPHISM PANELS */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* UYGULAMA KONTEYNERİ */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1280px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* EKRAN GEÇİŞLERİ */
.view-screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.view-screen.hidden,
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #0f172a;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-card);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: rgba(167, 139, 250, 0.15);
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.15rem;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ÇİZBİL LOBİ KARTI (LOBİ YAPISININ KENDİSİ MOR #a78bfa, İÇ KUTULAR #E6E6E6) */
.lobby-card {
  width: 100%;
  max-width: 520px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #a78bfa;
  border: 3px solid #000000;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.lobby-players-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #E6E6E6;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px solid #000000;
}

.players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(0.85rem, 3.2vw, 0.95rem);
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-count-badge {
  background: #a78bfa;
  border: 2px solid #000000;
  color: #000000;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 114px;
  /* Tam 2 sıra = 4 oyuncu sığar; 5. oyuncu ve sonrası için kaydırılabilir olur */
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.players-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.player-card-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1 1 calc(50% - 4px);
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  box-sizing: border-box;
  padding: 10px 14px;
  background: #E6E6E6;
  border: 2px solid #000000;
  border-radius: var(--radius-sm);
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  transform: none !important;
}

.players-list .player-card-chip:last-child:nth-child(odd) {
  flex: 1 1 100%;
}

.player-card-chip.is-disconnected {
  opacity: 0.55;
  border-style: dashed;
  background: #d4d4d4;
}

.player-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
}

.player-dot {
  color: #000000;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transform: translateY(-1.5px);
}

.player-dot.offline {
  color: #94a3b8 !important;
}

.offline-tag {
  font-size: 0.72rem;
  color: #ef4444;
  font-weight: 700;
}

.player-card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
}

.host-crown-icon {
  color: #000000;
  font-size: 1.1rem;
}

/* LOBİ MOD / AYAR SEÇİCİLERİ (#E6E6E6 İÇ KUTU) */
.lobby-mode-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #E6E6E6;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 2px solid #000000;
}

.section-label {
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 3.2vw, 0.92rem);
  font-weight: 800;
  color: #000000;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-pills {
  display: flex;
  gap: 8px;
}

.mode-pill {
  flex: 1;
  background: #E6E6E6;
  border: 2px solid #000000;
  border-radius: var(--radius-sm);
  color: #000000;
  padding: 10px 6px;
  min-height: 42px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(0.78rem, 3vw, 0.95rem);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mode-pill:hover:not(.active) {
  background: #ffffff;
}

.mode-pill.active {
  background: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

.lobby-footer-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

#btn-start-game {
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  font-family: var(--font-heading);
  font-weight: 800;
  opacity: 1 !important;
  transition: all 0.2s ease;
}

#btn-start-game:hover:not(:disabled):not(.disabled):not(.btn-non-host) {
  background: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
}

#btn-start-game:disabled,
#btn-start-game.disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Lider olmayan oyuncular için tam opak (#E6E6E6) "Lider bekleniyor..." butonu */
#btn-start-game.btn-non-host {
  opacity: 1 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   GAME ARENA & RESULT SCREEN - LOBİ MOR & GRİ TEMASI (#a78bfa & #E6E6E6)
   ========================================================================== */

#game-screen {
  width: 100%;
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
}

/* GAME ARENA TOP BAR */
.game-top-bar {
  grid-area: topbar;
  width: 100%;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  background: #a78bfa !important;
  border: 3px solid #000000 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  position: relative;
  min-height: 60px;
  height: auto;
  box-sizing: border-box;
}

.top-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 2;
}

.phase-badge {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(0.85rem, 1.2vw, 1.05rem);
  color: #000000 !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: #000000 !important;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* SÜRENİN İÇİNDE BULUNDUĞU YAPININ TAM ORTASI - TÜM CÜMLE GÖRÜNÜR & ALT SATIRA İNEBİLİR */
.top-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  z-index: 5;
  pointer-events: auto;
  padding: 0 8px;
  box-sizing: border-box;
}

.top-prompt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  background: #E6E6E6;
  color: #000000;
  border: 2px solid #000000;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  box-shadow: 0 3px 0 #000000;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.top-prompt-label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(0.72rem, 1vw, 0.85rem);
  letter-spacing: 0.6px;
  color: #5b21b6;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

.top-prompt-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(0.78rem, 1.05vw, 0.95rem);
  color: #000000;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
  text-align: center;
  display: inline-block;
  max-width: 100%;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 6;
  margin-left: auto;
  flex-shrink: 0;
}

.timer-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #E6E6E6 !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  white-space: nowrap;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.timer-box.timer-critical {
  background: #ff4757 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(255, 71, 87, 0.7) !important;
  animation: timerPulse 0.8s ease-in-out infinite alternate;
}

@keyframes timerPulse {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.06);
  }
}

/* OYUN ÜST BARI VE SONUÇ EKRANI HUB KONTROLLERİ (Çizbil Birebir Tasarımı) */
.game-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.game-hub-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease, box-shadow 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.game-hub-btn:hover {
  transform: translateY(-2px) scale(1.08);
  filter: brightness(1.08);
}

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

/* 1) Nasıl Oynanır: Kulaktan Kulağa orijinal açık lavanta/mor (#c4b5fd), siyah çerçeve, orijinal Kanzi (i) SVG ikonu */
.game-hub-btn.hub-howto-btn {
  background: #c4b5fd !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.game-hub-btn.hub-howto-btn:hover {
  background: #ffffff !important;
  border-color: #000000 !important;
}

.game-hub-btn.hub-howto-btn .how-to-btn-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  color: #000000 !important;
}

.game-hub-btn.hub-howto-btn .how-to-icon {
  width: 18px !important;
  height: 18px !important;
  stroke: #000000 !important;
  stroke-width: 2.5 !important;
  fill: none !important;
  display: block !important;
  margin: auto !important;
}

/* 2) Lobi Butonu: GameHub orijinal mor degrade, sarı kontur (#ffde00) */
.game-hub-btn.hub-lobby-btn {
  background: linear-gradient(135deg, #d900ff 0%, #7209b7 100%) !important;
  color: #ffffff !important;
  border: 2px solid #ffde00 !important;
  box-shadow: 0 0 8px rgba(217, 0, 255, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35) !important;
  font-size: 0.9rem !important;
}

/* 3) Lobiye Dön Butonu: Kırmızı (#ff4757), siyah kontur (#2b1111) */
.game-hub-btn.hub-exit-btn {
  background: #ff4757 !important;
  color: #ffffff !important;
  border: 2px solid #2b1111 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  font-size: 0.9rem !important;
}

.game-hub-btn.hub-exit-btn.is-host {
  background: #ff758c !important;
}

/* Lobi ekranı dışındayken sol alttaki sabit Nasıl Oynanır kesinlikle gizlenir (başlığa taşındığı için) */
body.in-game #globalHowToBtn,
body.in-game .global-how-to-btn,
#lobby-screen.hidden #globalHowToBtn,
#lobby-screen.hidden .global-how-to-btn,
#globalHowToBtn.hidden-in-game,
.global-how-to-btn.hidden-in-game {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.game-stage {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  gap: 16px;
  overflow: hidden;
}

/* GAME STAGE SIDEBAR */
.stage-sidebar {
  grid-area: sidebar;
  width: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  background: #a78bfa !important;
  border: 3px solid #000000 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  max-height: 100%;
  overflow-y: auto;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  color: #000000 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* OYUN İÇİ OYUNCULAR LİSTESİ (TÜM KARTLAR BİREBİR AYNI BOYUTTA) */
.game-players-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  flex: 1;
}

.game-players-list .player-card-chip,
.game-players-list .player-card-chip:last-child:nth-child(odd),
.game-players-list .player-card-chip.submitted {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px !important;
  padding: 6px 12px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  transform: none !important;
  transition: all 0.2s ease !important;
}

.game-players-list .player-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1 1 auto;
}

.game-players-list .player-card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-players-list .player-card-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: 6px;
}

/* CÜMLE YAZIP VEYA RESİM ÇİZİP ONAYLAYAN OYUNCUNUN KARTI: YEŞİL ÇERÇEVE */
.player-card-chip.submitted,
.game-players-list .player-card-chip.submitted {
  border: 2px solid #22c55e !important;
  box-shadow: 0 0 0 1px #16a34a, 0 3px 8px rgba(34, 197, 94, 0.35) !important;
  background: #f0fdf4 !important;
  box-sizing: border-box !important;
}

.player-card-chip.submitted .player-card-name {
  color: #0f172a !important;
  font-weight: 800;
}

.player-card-chip.submitted .status-icon {
  color: #16a34a !important;
  font-weight: 900;
}

.game-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #E6E6E6 !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm);
  color: #000000 !important;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}

.game-player-row .status-icon {
  margin-left: auto;
  font-size: 0.95rem;
  color: #000000;
  font-weight: 900;
}

.game-player-row.submitted {
  background: #f0fdf4 !important;
  border: 2.5px solid #22c55e !important;
  box-shadow: 0 0 0 1px #16a34a, 0 3px 8px rgba(34, 197, 94, 0.35) !important;
}

.stage-main-area {
  grid-area: main;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.phase-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* GAME STAGE MAIN CARDS */
.phase-card,
.canvas-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: #a78bfa !important;
  border: 3px solid #000000 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  overflow: visible !important;
  position: relative;
}

/* ÇİZİM TUVALİ VE KONTEYNIRI (ÇİZBİL BİREBİR) */
.canvas-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141724;
  overflow: hidden;
  border-bottom: 4px solid #000000;
  padding: 8px;
  box-sizing: border-box;
  border-top-left-radius: calc(var(--radius-lg) - 3px);
  border-top-right-radius: calc(var(--radius-lg) - 3px);
}

/* Arka Plan Resmine Uyumlu Renk Geçişli & Boyut Hissiyatlı Çizim Çerçevesi (ÇizBil İmza Stili) */
.canvas-board-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: clamp(6px, 0.9vw, 11px);
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 15%, #6366f1 35%, #a855f7 50%, #ec4899 68%, #f43f5e 82%, #fbbf24 100%);
  border: 3.5px solid #000000;
  border-radius: clamp(12px, 1.4vw, 18px);
  box-shadow:
    0 6px 0 #000000,
    0 14px 28px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(56, 189, 248, 0.3),
    0 0 35px rgba(236, 72, 153, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 2px 0 0 rgba(255, 255, 255, 0.4),
    inset 0 -2.5px 0 rgba(0, 0, 0, 0.4),
    inset -2px 0 0 rgba(0, 0, 0, 0.3);
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.canvas-board-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.08) 28%, transparent 55%);
  pointer-events: none;
  z-index: 2;
}

#paint-canvas {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 800 / 500;
  background-color: #ffffff;
  cursor: crosshair;
  touch-action: none;
  display: block;
  border-radius: clamp(6px, 0.8vw, 10px);
  border: 2px solid #000000;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.14), inset 0 -1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

#paint-canvas.hidden {
  display: none !important;
}

/* Tahmin edilecek çizim görseli (Doğrudan kullanıcının çizim tahtasında büyük boyutta görüntülenir) */
.assigned-drawing-img {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 800 / 500;
  background-color: #ffffff;
  display: block;
  border-radius: clamp(6px, 0.8vw, 10px);
  border: 2px solid #000000;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.14), inset 0 -1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  object-fit: contain;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none !important;
  user-drag: none !important;
  pointer-events: none !important;
}

.assigned-drawing-img.hidden {
  display: none !important;
}

/* YARITRANSPARAN OVERLAY VE METİN GİRİŞİ */
.text-entry-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 38, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  z-index: 10;
  border-radius: inherit;
}

.text-entry-overlay.hidden {
  display: none !important;
}

.drawing-preview-box {
  width: 100%;
  max-width: 480px;
  max-height: 240px;
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.drawing-preview-box.hidden {
  display: none !important;
}

.drawing-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.text-entry-box {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-with-button {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.input-with-button .form-input {
  flex: 1;
  padding: 12px 16px;
  background: #E6E6E6 !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-md);
  color: #000000 !important;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  outline: none;
}

.btn-confirm {
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  font-family: var(--font-heading);
  font-weight: 800;
  padding: 12px 20px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-confirm:hover {
  background: #ffffff !important;
  transform: translateY(-2px);
}

.entry-sub-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 0 4px;
}

.entry-sub-bar .char-count {
  position: static;
  color: #E6E6E6 !important;
  font-size: 0.85rem;
  font-weight: 800;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* ÇİZER ARAÇ ÇUBUĞU (ÇİZBİL BİREBİR TASARIM, RENKLER VE ÖZELLİKLER) */
.drawer-toolbar {
  padding: 8px 16px;
  background: #E6E6E6;
  border-top: 2px solid #000000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  position: relative;
  overflow: visible !important;
  border-bottom-left-radius: calc(var(--radius-lg) - 3px);
  border-bottom-right-radius: calc(var(--radius-lg) - 3px);
  min-height: 52px;
  z-index: 20;
}

.drawer-toolbar.hidden {
  display: none !important;
}

/* TAHMİN GİRİŞ ÇUBUĞU (Çizim Tahtasının Altında Tahmin Girme Alanı) */
.guess-entry-bar {
  padding: 8px 16px;
  background: #E6E6E6;
  border-top: 2px solid #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom-left-radius: calc(var(--radius-lg) - 3px);
  border-bottom-right-radius: calc(var(--radius-lg) - 3px);
  min-height: 52px;
  box-sizing: border-box;
  z-index: 20;
  position: relative;
}

.guess-entry-bar.hidden {
  display: none !important;
}

.guess-entry-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.guess-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.guess-input {
  width: 100%;
  padding: 10px 72px 10px 14px !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  font-family: var(--font-body) !important;
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm) !important;
  color: #000000 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08) !important;
  box-sizing: border-box !important;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.guess-input:focus {
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.guess-char-counter {
  position: absolute;
  right: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  pointer-events: none;
  user-select: none;
}

.guess-confirm-btn {
  padding: 8px 20px !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  background: #22c55e !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 3px 0 #000000 !important;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.guess-confirm-btn:hover {
  background: #16a34a !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 0 #000000 !important;
}

.guess-confirm-btn:active {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #000000 !important;
}

.tools-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tool-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: 2px solid #8b5cf6;
  border-radius: var(--radius-sm);
  color: #6d28d9;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.16);
}

.tool-btn:hover {
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #5b21b6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.28);
}

.tool-btn.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-color: #5b21b6;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45);
  transform: translateY(-1px) scale(1.05);
}

.tool-btn.active:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #ffffff;
}

/* Araçlar + Butonu */
.tool-btn-plus .plus-icon {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.tool-btn-plus.active-open {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
  border-color: #5b21b6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45) !important;
}

.tool-btn-plus.active-open .plus-icon {
  transform: rotate(45deg);
}

.tool-btn-plus.has-active-tool {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
  border-color: #5b21b6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45) !important;
}

/* Ekstra Araçlar Açılır Paneli (Tray) */
.extra-tools-tray {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 27, 75, 0.98);
  border: 2px solid #000000;
  border-radius: var(--radius-md);
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(109, 40, 217, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.2s ease;
}

.extra-tools-tray::after {
  content: '';
  position: absolute;
  left: 92px;
  bottom: -6px;
  transform: rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(30, 27, 75, 0.98);
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
}

.extra-tools-tray.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.tool-group .tool-btn.btn-danger-soft {
  background: #ffffff;
  border: 2px solid #ef4444;
  color: #ef4444;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.16);
}

.tool-group .tool-btn.btn-danger-soft:hover {
  background: #fef2f2;
  border-color: #dc2626;
  color: #b91c1c;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28);
}

.tool-divider {
  width: 1px;
  height: 24px;
  background: rgba(0, 0, 0, 0.2);
}

/* Kalınlık Seçimi */
.brush-size-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #ffffff;
  border: 2px solid #8b5cf6;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.16);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.size-btn:hover {
  background: #f5f3ff;
  border-color: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.28);
}

.size-btn.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-color: #5b21b6;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45);
  transform: translateY(-1px) scale(1.05);
}

.size-btn-plus {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #6d28d9;
  background: #ffffff;
  border: 2px solid #8b5cf6;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.size-btn-plus:hover {
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #5b21b6;
  transform: translateY(-2px);
}

.size-btn-plus .plus-icon {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.size-btn-plus.active-open {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
  border-color: #5b21b6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45) !important;
}

.size-btn-plus.active-open .plus-icon {
  transform: rotate(45deg);
}

.size-btn-plus.has-active-size {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
  border-color: #5b21b6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45) !important;
}

.extra-sizes-tray {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 27, 75, 0.98);
  border: 2px solid #000000;
  border-radius: var(--radius-md);
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(109, 40, 217, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.2s ease;
}

.extra-sizes-tray::after {
  content: '';
  position: absolute;
  left: 48px;
  bottom: -6px;
  transform: rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(30, 27, 75, 0.98);
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
}

.extra-sizes-tray.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.size-dot {
  background: #6d28d9;
  border-radius: 50%;
  transition: background 0.18s ease;
}

.size-btn.active .size-dot {
  background: #ffffff !important;
}

.dot-sm {
  width: 4px;
  height: 4px;
}

.dot-md {
  width: 8px;
  height: 8px;
}

.dot-lg {
  width: 14px;
  height: 14px;
}

.dot-xl {
  width: 20px;
  height: 20px;
}

/* Renk Paleti ve Hamle Geçmişi Grubu */
.color-palette-group {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.history-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.undo-redo-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 2px solid #8b5cf6;
  color: #6d28d9;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.16);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.undo-redo-btn:not(:disabled):hover {
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #5b21b6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.28);
}

.undo-redo-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #94a3b8;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  position: relative;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--c);
  border: 2px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.color-swatch:hover {
  transform: scale(1.2);
  border-color: #000000;
}

.color-swatch.active {
  transform: scale(1.25);
  border-color: #000000;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.color-swatch-plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #8b5cf6;
  color: #6d28d9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  user-select: none;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.color-swatch-plus .plus-icon {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.color-swatch-plus:hover {
  transform: scale(1.2);
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #5b21b6;
}

.color-swatch-plus.active-open {
  transform: scale(1.18);
  border-color: #5b21b6;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(109, 40, 217, 0.5);
}

.color-swatch-plus.active-open .plus-icon {
  transform: rotate(45deg);
}

.color-swatch-plus.has-active-color {
  border-color: var(--active-extra-color, #ffffff);
  box-shadow: 0 0 10px var(--active-extra-color, rgba(0, 0, 0, 0.4));
}

.color-swatch-plus.has-active-color::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--active-extra-color);
  opacity: 0.9;
  z-index: 1;
}

.color-swatch-plus.has-active-color .plus-icon {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  color: #ffffff;
}

/* Diğer Renkler Açılır Paneli (Yukarı Doğru Açılan Panel) */
.extra-colors-tray {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 27, 75, 0.98);
  border: 2px solid #000000;
  border-radius: var(--radius-md);
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(109, 40, 217, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.2s ease;
}

.extra-colors-tray::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: -6px;
  transform: rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(30, 27, 75, 0.98);
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
}

.extra-colors-tray.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Toolbar Onay Butonu */
.toolbar-confirm-group {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.toolbar-btn-confirm {
  padding: 8px 18px !important;
  font-size: 0.92rem !important;
  background: #22c55e !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 3px 0 #000000 !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn-confirm:hover {
  background: #16a34a !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 0 #000000 !important;
}

/* DESKTOP / TABLET ADJUSTMENTS */
@media (min-width: 901px) and (max-width: 1200px) {
  .game-stage {
    grid-template-columns: 200px 1fr !important;
    gap: 12px !important;
  }

  .game-top-bar {
    padding: 6px 14px;
    gap: 8px;
  }

  .stage-sidebar {
    width: 100% !important;
    padding: 10px;
  }

  .game-players-list .player-card-chip,
  .game-players-list .player-card-chip:last-child:nth-child(odd),
  .game-players-list .player-card-chip.submitted {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    flex: 0 0 40px !important;
  }

  .phase-badge {
    font-size: 0.92rem;
  }

  .top-prompt-badge {
    padding: 5px 10px;
  }
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.size-btn {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  font-weight: 800;
}

.size-btn.active {
  background: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

.tool-action-btn {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  font-weight: 800;
}

.tool-action-btn.danger {
  color: #ef4444 !important;
}

/* BUTTONS IN GAME (Mor-Gri Teması ile Birebir Uyumlu) */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-outline {
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  font-family: var(--font-heading);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
  background: #ffffff !important;
  color: #000000 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* DRAWING PREVIEW */
.drawing-preview-wrapper {
  width: 100%;
  max-width: 600px;
  max-height: 350px;
  background: #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 3px solid #000000 !important;
}

.drawing-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* WAITING OVERLAY (GÖNDERİLDİ EKRANI - ULTRA PREMIUM KANZI RETRO-POP DÜZENİ) */
.waiting-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
  background: rgba(14, 12, 28, 0.82) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: inherit;
  animation: waitingFadeIn 0.25s ease-out;
}

.waiting-overlay.hidden {
  display: none !important;
}

@keyframes waitingFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.waiting-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff !important;
  border: 3.5px solid #000000 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 0 #000000, 0 20px 40px rgba(0, 0, 0, 0.45);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  position: relative;
  animation: waitingPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes waitingPopIn {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.waiting-icon-badge {
  position: relative;
  width: 76px;
  height: 76px;
  margin-bottom: 2px;
}

.waiting-icon-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #22c55e 50%, #4ade80 100%);
  border: 3.5px solid #000000;
  box-shadow: 0 5px 0 #000000, 0 0 24px rgba(34, 197, 94, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 2.2rem;
  animation: checkPulse 2s infinite ease-in-out;
}

@keyframes checkPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

.waiting-sparkle {
  position: absolute;
  font-size: 1.5rem;
  line-height: 1;
  pointer-events: none;
  animation: floatSparkle 2.2s infinite ease-in-out;
}

.waiting-sparkle.sparkle-1 {
  top: -8px;
  right: -8px;
  animation-delay: 0s;
}

.waiting-sparkle.sparkle-2 {
  bottom: -4px;
  left: -8px;
  animation-delay: 1.1s;
}

@keyframes floatSparkle {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-6px) rotate(12deg);
  }
}

.waiting-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.waiting-badge-pill {
  display: inline-block;
  padding: 4px 14px;
  background: #fef08a;
  color: #854d0e;
  border: 2px solid #000000;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 0 #000000;
}

.waiting-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.85rem;
  color: #000000 !important;
  margin: 0;
  line-height: 1.2;
}

.waiting-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  background: #f1f5f9;
  border: 2px solid #000000;
  border-radius: var(--radius-full);
  box-shadow: 0 3px 0 #000000;
  width: 100%;
  box-sizing: border-box;
}

.waiting-pulse-indicator {
  position: relative;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.6);
  animation: pulseAnim 1.6s infinite ease-out;
}

@keyframes pulseAnim {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }

  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.waiting-desc {
  font-family: var(--font-heading);
  font-weight: 800;
  color: #0f172a !important;
  font-size: 0.92rem;
  margin: 0;
}

/* KANZI TURUNCU DÜZENLE BUTONU */
.btn-edit-submission {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 30px;
  background: #f97316;
  background: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
  color: #ffffff;
  border: 2px solid #000000;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 0 #000000;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, filter 0.15s ease;
  user-select: none;
  margin-top: 4px;
}

.btn-edit-submission:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #000000;
  filter: brightness(1.08);
}

.btn-edit-submission:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000000;
}

.btn-edit-submission i {
  font-size: 0.95rem;
}

/* RESULT SCREEN - SABİT PENCERE DÜZENİ VE İÇTEN KAYDIRMA */
#result-screen {
  width: 100%;
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

.result-card {
  width: 100%;
  max-width: 840px;
  height: 100%;
  max-height: 100%;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  background: #a78bfa !important;
  border: 3px solid #000000 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #000000 !important;
  padding-bottom: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.result-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-header-action {
  padding: 8px 16px !important;
  font-size: 0.88rem !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 3px 0 #000000 !important;
}

.chain-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: #000000 !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: #E6E6E6 !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 2px 0 #000000;
}

/* Sabit Yapı İçinde Bağımsız Kaydırılabilir Çizim ve Cümleler Alanı */
#chain-steps-container,
.chain-steps-container {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 8px;
  box-sizing: border-box;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

#chain-steps-container::-webkit-scrollbar,
.chain-steps-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.step-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  background: #E6E6E6 !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-md);
  color: #000000 !important;
  flex-shrink: 0;
  box-shadow: 0 4px 0 #000000;
  animation: fadeInStep 0.25s ease-out;
}

@keyframes fadeInStep {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-author {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: #000000 !important;
}

.step-content-box {
  padding: 14px 18px;
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 700;
  color: #000000 !important;
  word-break: break-word;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.step-drawing-box {
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff !important;
  position: relative;
  border: 2px solid #000000 !important;
  display: flex;
  justify-content: center;
  align-items: center;
}

.step-drawing-box img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
  background: #ffffff;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none !important;
  user-drag: none !important;
  pointer-events: none !important;
}

.btn-download-png {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 2px 0 #000000;
  transition: all 0.15s ease;
  z-index: 2;
}

.btn-download-png:hover {
  background: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #000000;
}

.result-footer-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 2px solid #000000 !important;
  flex-shrink: 0;
  background: inherit;
  width: 100%;
  box-sizing: border-box;
}

.final-actions-group {
  display: flex;
  gap: 10px;
}

.final-actions-group.hidden {
  display: none !important;
}

.chain-nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chain-player-nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  max-width: 320px;
}

.chain-nav-left {
  justify-content: flex-end;
}

.chain-nav-right {
  justify-content: flex-start;
}

.chain-player-nav-group.hidden {
  display: none !important;
}

.chain-player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: 0 3px 0 #000000;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  user-select: none;
  min-width: 58px;
  text-align: center;
}

.chain-player-btn:hover {
  background: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #000000;
}

.chain-player-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000000;
}

.chain-player-btn.active {
  background: #fbbf24 !important;
  border-color: #000000 !important;
  box-shadow: 0 3px 0 #000000, 0 0 10px rgba(251, 191, 36, 0.6) !important;
  transform: translateY(-1px);
}

.chain-player-avatar {
  font-size: 0.95rem;
  line-height: 1;
}

.chain-player-name {
  font-size: 0.8rem;
  font-weight: 800;
}

.result-footer-actions .btn {
  background: #E6E6E6 !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius-md) !important;
  font-family: var(--font-heading) !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  padding: 12px 24px !important;
  box-shadow: 0 4px 0 #000000 !important;
  transition: all 0.15s ease !important;
}

.result-footer-actions .btn:hover:not(:disabled) {
  background: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 0 #000000 !important;
}

.result-footer-actions .btn:active:not(:disabled) {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #000000 !important;
}

.result-footer-actions .btn:disabled,
.result-footer-actions .btn.disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: 0 2px 0 #000000 !important;
}

.result-footer-actions .btn.btn-restart-game {
  background: #22c55e !important;
  color: #ffffff !important;
  border-color: #000000 !important;
  box-shadow: 0 4px 0 #000000 !important;
}

.result-footer-actions .btn.btn-restart-game:hover:not(:disabled) {
  background: #16a34a !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 0 #000000 !important;
}

.result-footer-actions .btn.btn-waiting-host {
  background: #cbd5e1 !important;
  color: #334155 !important;
  border-color: #000000 !important;
  box-shadow: 0 3px 0 #000000 !important;
  opacity: 0.85 !important;
}

/* TOAST NOTIFICATIONS (Kullanıcı isteğiyle oyun içi tüm bildirimler kaldırıldı) */
.toast-container,
.toast {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* ==========================================================================
   KULAKTAN KULAĞA - MOBİL TELEFON DİKEY EKRAN (PORTRAIT: ÇİZBİL BİREBİR MİMARİSİ)
   ========================================================================== */
@media (max-width: 900px) and (orientation: portrait) {

  .hidden,
  [hidden],
  .view-screen.hidden,
  #game-screen.hidden,
  #lobby-screen.hidden,
  #result-screen.hidden {
    display: none !important;
  }

  html,
  body {
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    background-image: url('bg_mobile.png') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
  }

  .bg-layer {
    background-image: url('bg_mobile.png') !important;
    background-position: center center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
  }

  #app-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* 1. LOBİ EKRANI MOBİL DİKEY (Sadece lobi aktifken/gizli değilken) */
  #lobby-screen:not(.hidden) {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    padding: 12px 10px !important;
  }

  .lobby-card {
    width: 100% !important;
    max-width: 440px !important;
    padding: 18px 14px !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }

  .players-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    max-height: 120px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .players-list .player-card-chip {
    flex: 1 1 calc(50% - 3px) !important;
    max-width: calc(50% - 3px) !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 4px 8px !important;
    box-sizing: border-box !important;
  }

  .players-list .player-card-chip:last-child:nth-child(odd) {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }

  .lobby-mode-box {
    padding: 10px 12px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .section-label {
    font-size: 0.82rem !important;
  }

  .mode-pills {
    display: flex !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mode-pill {
    flex: 1 !important;
    min-height: 36px !important;
    padding: 6px 4px !important;
    font-size: clamp(0.74rem, 2.8vw, 0.86rem) !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    text-align: center !important;
    border-radius: 7px !important;
  }

  .lobby-footer-btns {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 4px !important;
  }

  #btn-start-game {
    min-height: 44px !important;
    padding: 10px 16px !important;
    font-size: 0.98rem !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    text-align: center !important;
    border-radius: 9px !important;
  }

  /* 2. OYUN ARENASI MOBİL DİKEY (Sadece oyun başladığında/gizli değilken) */
  #game-screen:not(.hidden) {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  /* OYUN SAHNESİ: Dikey Esnek Konteyner (1. Çizim Alanı, 2. Butonlar & Süre Barı, 3. Oyuncular) */
  .game-stage {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* 1. EN ÜST KATMAN: ÇİZİM ALANI & TUVAL (Kullanıcı İsteği: En Üstte) */
  .stage-main-area {
    grid-area: unset !important;
    order: 1 !important;
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 20 !important;
    overflow: visible !important;
  }

  .canvas-card {
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 2.5px solid #000000 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    background: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
  }

  /* Tuval Konteynırı (Üstte maksimum ergonomik çizim alanı) */
  .canvas-container {
    height: clamp(170px, 29vh, 245px) !important;
    min-height: clamp(170px, 29vh, 245px) !important;
    max-height: clamp(170px, 29vh, 245px) !important;
    padding: 4px !important;
    border-bottom: 2px solid #000000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    background: #141724 !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  .canvas-board-frame {
    padding: 3px !important;
    border-radius: 8px !important;
    border-width: 2px !important;
    box-shadow: 0 3px 0 #000000, 0 6px 14px rgba(0, 0, 0, 0.4) !important;
    box-sizing: border-box !important;
  }

  #paint-canvas,
  .assigned-drawing-img {
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 800 / 500 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  /* Metin Giriş Katmanı (1. Tur - Cümle Yazma) */
  .text-entry-overlay {
    padding: 10px 12px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .text-entry-box {
    width: 100% !important;
    max-width: 100% !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .input-with-button {
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .input-with-button .form-input {
    padding: 6px 10px !important;
    font-size: 0.84rem !important;
    border-radius: 8px !important;
    height: 34px !important;
    box-sizing: border-box !important;
  }

  .input-with-button .btn-confirm {
    padding: 6px 12px !important;
    font-size: 0.80rem !important;
    border-radius: 8px !important;
    height: 34px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .entry-sub-bar .char-count {
    font-size: 0.74rem !important;
  }

  /* Çizer Araç Çubuğu ve Butonlar (Tuvalin Hemen Altında - Asla Taşmaz) */
  .drawer-toolbar {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 2px 6px !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 2px solid #000000 !important;
    box-shadow: none !important;
    background: #E6E6E6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 3px !important;
    overflow: visible !important;
    overflow-x: visible !important;
    position: relative !important;
    z-index: 100 !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .tools-left {
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
    flex-shrink: 0 !important;
  }

  .tool-group,
  .brush-size-group {
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .tool-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    font-size: 0.70rem !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .tool-btn svg {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
    margin: auto !important;
  }

  .drawer-toolbar .size-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .size-btn-plus .plus-icon,
  .drawer-toolbar .tool-btn-plus .plus-icon {
    font-size: 15px !important;
    line-height: 1 !important;
    pointer-events: none !important;
  }

  .tool-divider {
    width: 1px !important;
    height: 18px !important;
    margin: 0 1px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    flex-shrink: 0 !important;
  }

  .color-palette-group {
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .history-actions-group {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .undo-redo-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .undo-redo-btn svg {
    width: 13px !important;
    height: 13px !important;
    display: block !important;
    margin: auto !important;
  }

  .color-palette {
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .color-swatch,
  .drawer-toolbar .color-swatch-plus {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .toolbar-confirm-group {
    display: flex !important;
    align-items: center !important;
    margin-left: 2px !important;
    flex-shrink: 0 !important;
  }

  .toolbar-btn-confirm {
    padding: 3px 10px !important;
    font-size: 0.74rem !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    border-radius: var(--radius-md) !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Popuplar: Yukarı Açılır (Ok taşması engellendi) */
  .extra-tools-tray,
  .extra-sizes-tray {
    position: absolute !important;
    bottom: calc(100% + 6px) !important;
    top: auto !important;
    left: 0 !important;
    z-index: 99999 !important;
    background: rgba(15, 23, 42, 0.98) !important;
    border: 2px solid #000000 !important;
    border-radius: 10px !important;
    padding: 5px 6px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 2px 0 #000 !important;
    gap: 3px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .extra-tools-tray::after,
  .extra-sizes-tray::after,
  .extra-colors-tray::after {
    display: none !important;
  }

  .extra-tools-tray .tool-btn {
    width: 26px !important;
    height: 26px !important;
  }

  .extra-sizes-tray .size-btn {
    width: 24px !important;
    height: 24px !important;
  }

  .extra-colors-tray {
    position: absolute !important;
    bottom: calc(100% + 6px) !important;
    top: auto !important;
    right: 0 !important;
    left: auto !important;
    z-index: 99999 !important;
    background: rgba(15, 23, 42, 0.98) !important;
    border: 2px solid #000000 !important;
    border-radius: 10px !important;
    padding: 5px 6px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 2px 0 #000 !important;
    grid-template-columns: repeat(4, 18px) !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .extra-tools-tray.open,
  .extra-sizes-tray.open {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .extra-colors-tray.open {
    display: grid !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  /* Tahmin Giriş Çubuğu (Tahmin Aşaması) */
  .guess-entry-bar {
    min-height: 40px !important;
    max-height: 40px !important;
    height: 40px !important;
    padding: 3px 8px !important;
    background: #E6E6E6 !important;
    border-top: 2px solid #000000 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
  }

  .guess-entry-inner {
    gap: 6px !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  .guess-input {
    padding: 4px 50px 4px 8px !important;
    font-size: 0.82rem !important;
    height: 32px !important;
    box-sizing: border-box !important;
  }

  .guess-char-counter {
    right: 8px !important;
    font-size: 0.70rem !important;
  }

  .guess-confirm-btn {
    padding: 4px 12px !important;
    font-size: 0.78rem !important;
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* 2. ORTA KATMAN: BUTONLAR, SÜRE VE ÇİZİLECEK CÜMLE BARI (Kullanıcı İsteği: Çizim Alanının Hemen Altında) */
  .game-top-bar {
    grid-area: unset !important;
    order: 2 !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 42px !important;
    padding: 5px 8px !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 2.5px solid #000000 !important;
    border-bottom: 2.5px solid #000000 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 3px 6px !important;
    background: #a78bfa !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .top-left {
    order: 1 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
  }

  .phase-badge {
    padding: 2px 8px !important;
    font-size: clamp(0.70rem, 2.4vw, 0.78rem) !important;
    border-radius: var(--radius-full) !important;
    border: 1.5px solid #000000 !important;
    background: #ffffff !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
  }

  .top-right {
    order: 2 !important;
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
  }

  .timer-box {
    padding: 2px 8px !important;
    font-size: 0.84rem !important;
    min-width: 32px !important;
    height: 26px !important;
    border-radius: var(--radius-full) !important;
    border-width: 1.5px !important;
    box-sizing: border-box !important;
  }

  .game-header-controls {
    gap: 3px !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .game-hub-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    border-radius: 50% !important;
    font-size: 0.74rem !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }

  .game-hub-btn:hover {
    transform: none !important;
  }

  .game-hub-btn:active {
    transform: scale(0.92) !important;
  }

  .game-hub-btn.hub-howto-btn .how-to-icon {
    width: 14px !important;
    height: 14px !important;
  }

  /* Çizilecek Cümle / Bilgi Rozeti (Orta Katmanın İçinde Genişler, Asla Taşmaz) */
  .top-center {
    order: 3 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-top: 1px !important;
    display: flex !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .top-prompt-badge {
    width: 100% !important;
    max-width: 100% !important;
    padding: 3px 8px !important;
    gap: 2px 6px !important;
    border-radius: 7px !important;
    border: 1.5px solid #000000 !important;
    box-shadow: 0 1.5px 0 #000000 !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }

  .top-prompt-label {
    font-size: clamp(0.66rem, 2vw, 0.72rem) !important;
    line-height: 1.2 !important;
  }

  .top-prompt-text {
    font-size: clamp(0.72rem, 2.5vw, 0.84rem) !important;
    line-height: 1.25 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    max-width: 100% !important;
  }

  /* 3. EN ALT KATMAN: OYUNCULAR KISMI (Kullanıcı İsteği: Yapının En Altında) */
  .stage-sidebar {
    grid-area: unset !important;
    order: 3 !important;
    flex: 1 1 0 !important;
    min-height: 85px !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #a78bfa !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)) 8px !important;
    box-sizing: border-box !important;
  }

  .sidebar-header {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 2px 2px 2px !important;
    border-bottom: 1.5px solid #000000 !important;
    margin-bottom: 3px !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  .sidebar-title {
    font-size: 0.76rem !important;
  }

  .game-players-list {
    width: 100% !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-content: flex-start !important;
    gap: 4px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  /* OYUN İÇİ OYUNCU KARTLARI: HER ZAMAN BİREBİR AYNI BOYUTTA */
  .game-players-list .player-card-chip,
  .game-players-list .player-card-chip:last-child:nth-child(odd),
  .game-players-list .player-card-chip.submitted {
    flex: 0 0 calc(50% - 2px) !important;
    width: calc(50% - 2px) !important;
    max-width: calc(50% - 2px) !important;
    min-width: calc(50% - 2px) !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 2px 6px !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
    transform: none !important;
  }

  .game-players-list .player-card-name {
    font-size: 0.74rem !important;
  }

  /* Bekleme Katmanı & Kartı (Gönderildiğinde - Mobil Dikey Tam Ekran Modal) */
  .waiting-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(14, 12, 28, 0.88) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
  }

  .waiting-card {
    width: 90% !important;
    max-width: 330px !important;
    max-height: calc(100dvh - 32px) !important;
    overflow-y: auto !important;
    padding: 20px 16px !important;
    gap: 12px !important;
    border: 3px solid #000000 !important;
    border-radius: 20px !important;
    box-shadow: 0 8px 0 #000000, 0 18px 36px rgba(0, 0, 0, 0.45) !important;
    box-sizing: border-box !important;
  }

  .waiting-icon-badge {
    width: 56px !important;
    height: 56px !important;
    margin-bottom: 2px !important;
  }

  .waiting-icon-circle {
    font-size: 1.7rem !important;
    border-width: 3px !important;
    box-shadow: 0 4px 0 #000000, 0 0 18px rgba(34, 197, 94, 0.45) !important;
  }

  .waiting-card-content {
    gap: 5px !important;
  }

  .waiting-badge-pill {
    padding: 3px 12px !important;
    font-size: 0.72rem !important;
    border-width: 2px !important;
  }

  .waiting-title {
    font-size: 1.25rem !important;
    line-height: 1.2 !important;
  }

  .waiting-status-box {
    padding: 8px 14px !important;
    gap: 8px !important;
    border-radius: 12px !important;
    border-width: 2px !important;
    box-shadow: 0 3px 0 #000000 !important;
    box-sizing: border-box !important;
  }

  .waiting-desc {
    font-size: 0.78rem !important;
    line-height: 1.25 !important;
    text-align: center !important;
  }

  .btn-edit-submission {
    padding: 8px 26px !important;
    font-size: 0.90rem !important;
    min-height: 38px !important;
    border-width: 2px !important;
    box-shadow: 0 4px 0 #000000 !important;
    margin-top: 2px !important;
    box-sizing: border-box !important;
  }

  /* 3. SONUÇ EKRANI MOBİL DİKEY */
  #result-screen {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 6px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .result-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 8px !important;
    gap: 8px !important;
    height: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .result-header {
    padding-bottom: 6px !important;
    margin-bottom: 6px !important;
  }

  .chain-title {
    font-size: 1.02rem !important;
  }

  .chain-steps-container {
    flex: 1 !important;
    gap: 8px !important;
  }

  .step-card {
    padding: 10px 12px !important;
    gap: 6px !important;
  }

  .step-content-box {
    padding: 8px 12px !important;
    font-size: 0.90rem !important;
  }

  .step-drawing-box img {
    max-height: 180px !important;
  }

  .btn-download-png {
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
    border-radius: 5px !important;
    box-sizing: border-box !important;
  }

  .result-footer-actions {
    flex-direction: column !important;
    gap: 4px !important;
    padding-top: 4px !important;
    margin-top: 4px !important;
  }

  .chain-nav-center {
    width: 100% !important;
  }

  .chain-nav-center .btn {
    width: 100% !important;
    padding: 6px 12px !important;
    font-size: 0.86rem !important;
    min-height: 36px !important;
    box-sizing: border-box !important;
  }

  .chain-player-nav-group {
    max-width: 100% !important;
    justify-content: center !important;
    gap: 3px !important;
  }

  .chain-player-btn {
    padding: 3px 5px !important;
    font-size: 0.70rem !important;
    min-width: 38px !important;
    box-sizing: border-box !important;
  }
}

/* ==========================================================================
   KULAKTAN KULAĞA - MOBİL TELEFON YATAY EKRAN (LANDSCAPE: ÇİZBİL BİREBİR MİMARİSİ)
   ========================================================================== */
@media (max-width: 960px) and (max-height: 560px) and (orientation: landscape) {

  html,
  body {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    background-image: url('desktop_bg.png') !important;
    background-size: cover !important;
    box-sizing: border-box !important;
  }

  #app-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* 1. LOBİ EKRANI MOBİL YATAY (Sadece lobi aktifken/gizli değilken) */
  #lobby-screen:not(.hidden) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 6px 12px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .lobby-card {
    max-width: 480px !important;
    width: 100% !important;
    padding: 10px 16px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .players-list {
    max-height: 60px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .players-list .player-card-chip {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 2px 6px !important;
    font-size: 0.76rem !important;
    box-sizing: border-box !important;
  }

  .lobby-mode-box {
    padding: 6px 10px !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .section-label {
    font-size: 0.74rem !important;
  }

  .mode-pills {
    display: flex !important;
    gap: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mode-pill {
    flex: 1 !important;
    min-height: 28px !important;
    padding: 3px 6px !important;
    font-size: 0.78rem !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    text-align: center !important;
    border-radius: 6px !important;
  }

  .lobby-footer-btns {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 2px !important;
  }

  #btn-start-game {
    min-height: 34px !important;
    padding: 6px 14px !important;
    font-size: 0.88rem !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    text-align: center !important;
    border-radius: 7px !important;
  }

  /* 2. OYUN ARENASI MOBİL YATAY (Sadece oyun başladığında/gizli değilken - KESİNTİSİZ TAM SIĞMA) */
  #game-screen:not(.hidden) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  /* Kompakt Yatay Üst Bar (34px) */
  .game-top-bar {
    grid-area: topbar !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 2px 8px !important;
    gap: 6px !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 2px solid #000000 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
    background: #a78bfa !important;
    box-sizing: border-box !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  .top-left {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .phase-badge {
    padding: 2px 8px !important;
    font-size: 0.70rem !important;
    border-radius: var(--radius-full) !important;
    border: 1.5px solid #000000 !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }

  .top-center {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    box-sizing: border-box !important;
  }

  .top-prompt-badge {
    padding: 2px 6px !important;
    gap: 3px !important;
    border-radius: 6px !important;
    border: 1.5px solid #000000 !important;
    box-shadow: 0 1.5px 0 #000000 !important;
    background: #ffffff !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .top-prompt-label {
    font-size: 0.66rem !important;
    white-space: nowrap !important;
  }

  .top-prompt-text {
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: clamp(120px, 38vw, 340px) !important;
  }

  .top-right {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .timer-box {
    min-width: 28px !important;
    height: 24px !important;
    padding: 1px 8px !important;
    font-size: 0.80rem !important;
    border-radius: var(--radius-full) !important;
    border-width: 1.5px !important;
    box-sizing: border-box !important;
  }

  .game-header-controls {
    gap: 3px !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .game-hub-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    font-size: 0.70rem !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .game-hub-btn:hover {
    transform: none !important;
  }

  .game-hub-btn:active {
    transform: scale(0.92) !important;
  }

  .game-hub-btn.hub-howto-btn .how-to-icon {
    width: 13px !important;
    height: 13px !important;
  }

  /* Çizbil Yatay Sahne Düzeni (Grid: Üstte Top Bar, Altta Sol Oyuncular + Sağ Çizim Alanı) */
  .game-stage {
    display: grid !important;
    grid-template-columns: 24% 76% !important;
    grid-template-rows: 34px 1fr !important;
    grid-template-areas:
      "topbar topbar"
      "sidebar main" !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Sağ / Ana Alan: Tuval & Araçlar */
  .stage-main-area {
    grid-area: main !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    border-right: none !important;
    border-left: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .canvas-card {
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
    background: #0f172a !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .canvas-container {
    flex: 1 1 auto !important;
    height: calc(100% - 36px) !important;
    min-height: 0 !important;
    padding: 2px !important;
    background: #141724 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-bottom: 2px solid #000000 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .canvas-board-frame {
    padding: 2px !important;
    border-width: 1.5px !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 0 #000000, 0 4px 10px rgba(0, 0, 0, 0.4) !important;
    box-sizing: border-box !important;
  }

  #paint-canvas,
  .assigned-drawing-img {
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 800 / 500 !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
  }

  /* Metin Girişi Yatay */
  .text-entry-overlay {
    padding: 6px 10px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .text-entry-box {
    max-width: 440px !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .input-with-button .form-input {
    padding: 4px 8px !important;
    font-size: 0.80rem !important;
    height: 30px !important;
    box-sizing: border-box !important;
  }

  .input-with-button .btn-confirm {
    padding: 4px 10px !important;
    font-size: 0.76rem !important;
    height: 30px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  /* Çizer Araç Çubuğu Yatay (Kompakt 36px) */
  .drawer-toolbar {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 2px 5px !important;
    background: #E6E6E6 !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 2px solid #000000 !important;
    gap: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    z-index: 100 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    width: 100% !important;
  }

  .tools-left {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .tool-btn {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    min-height: 25px !important;
    max-width: 25px !important;
    max-height: 25px !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .tool-btn svg {
    width: 13px !important;
    height: 13px !important;
    display: block !important;
    margin: auto !important;
  }

  .drawer-toolbar .size-btn {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    min-height: 23px !important;
    max-width: 23px !important;
    max-height: 23px !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .size-btn-plus .plus-icon,
  .drawer-toolbar .tool-btn-plus .plus-icon {
    font-size: 14px !important;
    line-height: 1 !important;
  }

  .tool-divider {
    width: 1px !important;
    height: 16px !important;
    margin: 0 1px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    flex-shrink: 0 !important;
  }

  .color-palette-group {
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
    flex-shrink: 0 !important;
  }

  .history-actions-group {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .undo-redo-btn {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    min-height: 23px !important;
    max-width: 23px !important;
    max-height: 23px !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .drawer-toolbar .undo-redo-btn svg {
    width: 12px !important;
    height: 12px !important;
    display: block !important;
    margin: auto !important;
  }

  .color-palette {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .drawer-toolbar .color-swatch,
  .drawer-toolbar .color-swatch-plus {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    min-height: 17px !important;
    max-width: 17px !important;
    max-height: 17px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .extra-tools-tray,
  .extra-sizes-tray {
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 0 !important;
    z-index: 99999 !important;
    padding: 3px 5px !important;
    gap: 2px !important;
    box-sizing: border-box !important;
  }

  .extra-tools-tray::after,
  .extra-sizes-tray::after,
  .extra-colors-tray::after {
    display: none !important;
  }

  .extra-colors-tray {
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    right: 0 !important;
    left: auto !important;
    z-index: 99999 !important;
    padding: 3px 5px !important;
    grid-template-columns: repeat(4, 16px) !important;
    gap: 3px !important;
    box-sizing: border-box !important;
  }

  .toolbar-confirm-group {
    display: flex !important;
    align-items: center !important;
    margin-left: 2px !important;
    flex-shrink: 0 !important;
  }

  .toolbar-btn-confirm {
    padding: 3px 10px !important;
    font-size: 0.72rem !important;
    height: 25px !important;
    min-height: 25px !important;
    max-height: 25px !important;
    border-radius: var(--radius-md) !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Tahmin Giriş Çubuğu Yatay */
  .guess-entry-bar {
    min-height: 36px !important;
    max-height: 36px !important;
    height: 36px !important;
    padding: 2px 6px !important;
    background: #E6E6E6 !important;
    border-top: 2px solid #000000 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  .guess-input {
    padding: 2px 48px 2px 8px !important;
    font-size: 0.78rem !important;
    height: 28px !important;
    box-sizing: border-box !important;
  }

  .guess-char-counter {
    right: 6px !important;
    font-size: 0.66rem !important;
  }

  .guess-confirm-btn {
    padding: 2px 10px !important;
    font-size: 0.74rem !important;
    height: 28px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  /* Sol Alan: Oyuncular Sütunu (Yatayda Sol Taraf) */
  .stage-sidebar {
    grid-area: sidebar !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    border-right: 2px solid #000000 !important;
    box-shadow: none !important;
    background: #a78bfa !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 3px 5px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .sidebar-header {
    height: 24px !important;
    min-height: 24px !important;
    padding: 0 2px 1px 2px !important;
    border-bottom: 2px solid #000000 !important;
    margin-bottom: 3px !important;
    box-sizing: border-box !important;
  }

  .sidebar-title {
    font-size: 0.72rem !important;
  }

  .game-players-list {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    overflow-y: auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  /* OYUN İÇİ OYUNCU KARTLARI: HER ZAMAN BİREBİR AYNI BOYUTTA */
  .game-players-list .player-card-chip,
  .game-players-list .player-card-chip:last-child:nth-child(odd),
  .game-players-list .player-card-chip.submitted {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    flex: 0 0 28px !important;
    padding: 2px 5px !important;
    font-size: 0.72rem !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  .game-players-list .player-card-name {
    font-size: 0.70rem !important;
  }

  /* Bekleme Kartı Yatay */
  .waiting-overlay {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    z-index: 50 !important;
    background: rgba(14, 12, 28, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-sizing: border-box !important;
  }

  .waiting-card {
    width: 92% !important;
    max-width: 360px !important;
    max-height: calc(100% - 10px) !important;
    overflow-y: auto !important;
    padding: 8px 14px !important;
    gap: 6px !important;
    border: 2.5px solid #000000 !important;
    border-radius: 14px !important;
    box-shadow: 0 5px 0 #000000, 0 12px 28px rgba(0, 0, 0, 0.45) !important;
    box-sizing: border-box !important;
  }

  .waiting-icon-badge {
    width: 36px !important;
    height: 36px !important;
    margin-bottom: 0 !important;
  }

  .waiting-icon-circle {
    font-size: 1.15rem !important;
    border-width: 2.5px !important;
    box-shadow: 0 3px 0 #000000, 0 0 14px rgba(34, 197, 94, 0.4) !important;
  }

  .waiting-card-content {
    gap: 2px !important;
  }

  .waiting-badge-pill {
    padding: 2px 8px !important;
    font-size: 0.65rem !important;
    border-width: 1.5px !important;
  }

  .waiting-title {
    font-size: 1.02rem !important;
    line-height: 1.15 !important;
  }

  .waiting-status-box {
    padding: 4px 10px !important;
    gap: 6px !important;
    border-radius: 10px !important;
    border-width: 1.5px !important;
    box-shadow: 0 2px 0 #000000 !important;
    box-sizing: border-box !important;
  }

  .waiting-desc {
    font-size: 0.72rem !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }

  .btn-edit-submission {
    padding: 4px 18px !important;
    font-size: 0.80rem !important;
    min-height: 28px !important;
    border-width: 2px !important;
    box-shadow: 0 3px 0 #000000 !important;
    margin-top: 2px !important;
    box-sizing: border-box !important;
  }

  /* 3. SONUÇ EKRANI MOBİL YATAY */
  #result-screen {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 4px 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .result-card {
    padding: 6px 10px !important;
    gap: 6px !important;
    height: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .result-header {
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
  }

  .chain-title {
    font-size: 0.95rem !important;
  }

  .step-drawing-box img {
    max-height: 130px !important;
  }

  .result-footer-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 4px !important;
    margin-top: 4px !important;
    box-sizing: border-box !important;
  }

  .chain-player-btn {
    min-width: 34px !important;
    padding: 2px 4px !important;
    font-size: 0.68rem !important;
    box-sizing: border-box !important;
  }

  .chain-nav-center .btn {
    padding: 5px 12px !important;
    font-size: 0.80rem !important;
    height: 30px !important;
    box-sizing: border-box !important;
  }

  .btn-download-png {
    padding: 3px 6px !important;
    font-size: 0.70rem !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
  }
}

/* ==========================================================================
   KANZI STANDARDI FLOATING (i) BUTTON & NASIL OYNANIR MODALI (KULAKTAN KULAĞA TEMASI)
   ========================================================================== */
.global-how-to-btn {
  position: fixed;
  bottom: calc(clamp(12px, 3vw, 20px) + env(safe-area-inset-bottom, 0px));
  left: calc(clamp(12px, 3vw, 20px) + env(safe-area-inset-left, 0px));
  width: clamp(42px, 9vw, 50px);
  height: clamp(42px, 9vw, 50px);
  border-radius: 50%;
  background: #c4b5fd;
  /* Kulaktan Kulağa lavanta / açık mor teması */
  border: 2px solid #000000;
  /* Siyah retro-pop çerçeve */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, background-color 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  user-select: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.how-to-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000000;
  transition: transform 0.25s ease;
}

.how-to-icon {
  width: clamp(20px, 4.5vw, 24px);
  height: clamp(20px, 4.5vw, 24px);
  stroke: #000000;
  transition: stroke 0.25s ease, transform 0.25s ease;
}

.global-how-to-btn:hover {
  transform: translateY(-3px) scale(1.1);
  background: #ffffff;
  border-color: #000000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.global-how-to-btn:hover .how-to-icon {
  stroke: #000000;
  transform: scale(1.1);
}

.global-how-to-btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.global-how-to-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: clamp(8px, 2.5vw, 18px);
  box-sizing: border-box;
  animation: fadeInHowToModal 0.25s ease-out forwards;
}

.global-how-to-modal.hidden {
  display: none !important;
}

/* Sabit Oyun Devam Ediyor / Katılma Uyarısı Penceresi */
.join-in-progress-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(10, 8, 20, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: clamp(12px, 3vw, 24px);
  box-sizing: border-box;
  animation: fadeInHowToModal 0.25s ease-out forwards;
}

.join-in-progress-modal.hidden {
  display: none !important;
}

.join-in-progress-card {
  background: #1e1a30;
  border: 2px solid #8b5cf6;
  border-radius: clamp(14px, 3vw, 20px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(139, 92, 246, 0.2);
  width: min(92vw, 420px);
  max-width: 420px;
  box-sizing: border-box;
  padding: clamp(24px, 5vw, 36px) clamp(18px, 4vw, 28px);
  text-align: center;
  color: #f8fafc;
  user-select: none;
}

.join-in-progress-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  border: 2px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 18px auto;
}

.join-in-progress-title {
  font-size: clamp(19px, 3.8vw, 22px);
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 12px 0;
  font-family: var(--font-heading, sans-serif);
  letter-spacing: -0.3px;
}

.join-in-progress-message {
  font-size: clamp(14px, 3vw, 15px);
  color: #cbd5e1;
  line-height: 1.55;
  margin: 0;
  font-family: var(--font-body, sans-serif);
}

@keyframes fadeInHowToModal {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.global-how-to-box {
  background: #c4b5fd;
  /* Kulaktan Kulağa açık mor modal kartı */
  border: 2px solid #000000;
  /* Siyah kalın çerçeve */
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: #000000;
  padding: clamp(16px, 3.8vw, 26px) clamp(12px, 3.2vw, 24px);
  border-radius: clamp(14px, 3vw, 20px);
  width: min(94vw, 530px);
  max-width: 530px;
  position: relative;
  max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(88dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  font-family: var(--font-body);
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-sizing: border-box;
}

.global-how-to-box::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.global-how-to-close {
  position: absolute;
  top: clamp(8px, 2vw, 14px);
  right: clamp(10px, 2.2vw, 16px);
  z-index: 10;
  width: clamp(32px, 7vw, 36px) !important;
  height: clamp(32px, 7vw, 36px) !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #000000;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s ease, transform 0.2s ease;
}

.global-how-to-close:hover {
  color: #ef4444;
  transform: scale(1.15);
}

.global-how-to-title {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  font-weight: 900;
  color: #000000;
  text-align: center;
  margin-bottom: 4px;
  padding: 0 clamp(28px, 7vw, 42px);
  line-height: 1.25;
  letter-spacing: 0.5px;
  word-break: break-word;
}

.global-how-to-subtitle {
  text-align: center;
  color: #000000;
  font-weight: 700;
  font-size: clamp(0.76rem, 2.5vw, 0.9rem);
  margin-bottom: clamp(12px, 2.8vw, 18px);
  line-height: 1.35;
}

.global-how-to-content {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.2vw, 14px);
}

.global-how-to-content .rules-section {
  background: #ffffff;
  /* Beyaz iç kural kutuları */
  border: 2px solid #000000;
  /* Siyah çerçeve */
  border-radius: clamp(10px, 2.2vw, 14px);
  padding: clamp(12px, 2.6vw, 16px) clamp(12px, 2.8vw, 18px);
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.global-how-to-content h4 {
  font-family: var(--font-heading);
  font-size: clamp(0.88rem, 3vw, 1.02rem);
  font-weight: 800;
  color: #000000;
  margin-bottom: clamp(6px, 1.5vw, 8px);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.global-how-to-content p,
.global-how-to-content li {
  font-size: clamp(0.78rem, 2.5vw, 0.9rem);
  line-height: 1.55;
  color: #000000;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: break-word;
}

.global-how-to-content ul {
  padding-left: clamp(14px, 3.5vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1.2vw, 6px);
  margin: 0;
}

/* =============================================================
   ÖZEL RENK SEÇİCİ BUTONU VE MODALI
   ============================================================= */
.color-swatch-custom {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red) !important;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch-custom.active::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--custom-color-indicator, #ffffff);
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.color-swatch-custom.active-open {
  outline: 2px solid #8b5cf6 !important;
  outline-offset: 2px !important;
  transform: scale(1.08) !important;
}

/* Özel Renk Açılır Paneli (Gelişmiş Konumlandırma & Responsive Clamp) */
.custom-color-tray {
  position: fixed;
  z-index: 100000;
  top: -9999px;
  left: -9999px;
  margin: 0;
  width: min(320px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: visible;
  background: linear-gradient(150deg, rgba(30, 27, 75, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 2px solid #000000;
  border-radius: var(--radius-md, 12px);
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8), 0 0 16px rgba(109, 40, 217, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.94);
  transform-origin: var(--arrow-left, 50%) 100%;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.18s;
  user-select: none;
  touch-action: pan-y;
  box-sizing: border-box;
}

.custom-color-tray[data-placement="bottom"] {
  transform-origin: var(--arrow-left, 50%) 0%;
}

.custom-color-tray.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

.custom-color-tray::after {
  content: '';
  position: absolute;
  left: var(--arrow-left, 50%);
  bottom: -6px;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(30, 27, 75, 0.98);
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
  pointer-events: none;
  transition: left 0.1s ease;
}

.custom-color-tray[data-placement="bottom"]::after {
  bottom: auto;
  top: -6px;
  border-bottom: none;
  border-right: none;
  border-top: 2px solid #000000;
  border-left: 2px solid #000000;
}

.custom-color-tray::-webkit-scrollbar {
  width: 4px;
}

.custom-color-tray::-webkit-scrollbar-track {
  background: transparent;
}

.custom-color-tray::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.4);
  border-radius: 4px;
}

@media (max-height: 520px) {
  .custom-color-tray .color-sv-area {
    height: 75px !important;
  }
}

@media (max-width: 480px) {
  .custom-color-tray .color-sv-area {
    height: 95px;
  }
}

.custom-color-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.custom-color-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-color-title-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 6px #8b5cf6;
}

.custom-color-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #f1f5f9;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.3px;
  margin: 0;
}

.custom-color-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 4px;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.custom-color-close:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.25);
}

/* 2D Saturation / Value Alanı */
.color-sv-area {
  position: relative;
  width: 100%;
  height: 105px;
  border-radius: 8px;
  border: 1.5px solid #000000;
  cursor: crosshair;
  overflow: hidden;
  touch-action: none;
  background-color: #8b5cf6;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.4);
}

.color-sv-gradient-white {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0));
  pointer-events: none;
}

.color-sv-gradient-black {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #000000, rgba(0, 0, 0, 0));
  pointer-events: none;
}

.color-sv-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9), inset 0 0 2px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  top: 0%;
  left: 100%;
}

/* 1D Hue Bar */
.color-hue-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  border: 1.5px solid #000000;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.3);
}

.color-hue-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 8px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: #ffffff;
}

/* Canlı Önizleme ve HEX */
.color-preview-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-preview-swatch {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  border: 1.5px solid #000000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  background-color: #8b5cf6;
  transition: background-color 0.05s ease;
}

.color-hex-input-group {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #475569;
  border-radius: 6px;
  padding: 0 8px;
  height: 28px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-hex-input-group:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.color-hex-input-group.invalid {
  border-color: #ef4444 !important;
}

.hex-hash {
  color: #a855f7;
  font-weight: 700;
  margin-right: 4px;
  font-family: monospace;
  font-size: 13px;
}

.custom-color-hex-input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  width: 100%;
}

.custom-color-hex-error {
  font-size: 11px;
  color: #ef4444;
  margin-top: -4px;
  margin-bottom: 2px;
}

.custom-color-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.btn-custom-cancel {
  flex: 1;
  background: #334155;
  color: #cbd5e1;
  border: 1.5px solid #000000;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11.5px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: 'Outfit', sans-serif;
}

.btn-custom-cancel:hover {
  background: #475569;
  color: #ffffff;
}

.btn-custom-confirm {
  flex: 1.2;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  border: 1.5px solid #000000;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
  padding: 5px 10px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.45);
  transition: transform 0.1s ease, filter 0.15s ease;
  font-family: 'Outfit', sans-serif;
}

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

.btn-custom-confirm:active {
  transform: scale(0.97);
}

@media (max-width: 900px) {
  .color-swatch-custom.active::after {
    width: 6px;
    height: 6px;
    border-width: 1px;
  }
}

@media (max-width: 600px) {
  .color-swatch-custom.active::after {
    width: 5px;
    height: 5px;
    border-width: 1px;
  }
}