/* ==========================================================================
   ÇENGEL VE KARE BULMACA - ÖZEL CYBER NEON STİLLERİ
   Türkiye Kelime Oyunları Merkezi - Gazete Eki Tarzı Çengel Bulmaca Motoru
   ========================================================================== */

.cengel-game-wrapper {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
  position: relative;
  user-select: none;
}

/* ---------------- ÜST KONTROL HUD / SEVİYE BAR ---------------- */
.cw-hud-panel {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card, rgba(18, 24, 46, 0.85));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 14px);
  padding: 10px 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.cw-hud-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cw-size-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cw-size-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #8b9bb4);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--font-display, inherit);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cw-size-btn:hover {
  color: #fff;
}

.cw-size-btn.active {
  background: linear-gradient(135deg, var(--neon-cyan, #00f0ff), #0099ff);
  color: #070913;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.cw-puzzle-select {
  background: rgba(14, 20, 42, 0.9);
  color: #fff;
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.cw-hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 65px;
}

.cw-hud-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted, #8b9bb4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cw-hud-stat-val {
  font-family: var(--font-mono, monospace);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.cw-hud-stat-val.cyan { color: var(--neon-cyan, #00f0ff); }
.cw-hud-stat-val.gold { color: var(--neon-yellow, #ffe600); }
.cw-hud-stat-val.green { color: var(--neon-green, #00ff88); }

/* ---------------- AKTİF TANIM VE SORU BANNERI ---------------- */
.cw-active-clue-banner {
  width: 100%;
  background: linear-gradient(135deg, rgba(20, 28, 58, 0.95) 0%, rgba(12, 16, 36, 0.95) 100%);
  border: 2px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 240, 255, 0.05);
  border-radius: var(--radius-lg, 18px);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color 0.25s ease;
}

.cw-clue-info-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cw-clue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cw-direction-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-cyan, #00f0ff);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.cw-direction-badge.down {
  background: rgba(255, 230, 0, 0.15);
  color: var(--neon-yellow, #ffe600);
  border-color: rgba(255, 230, 0, 0.4);
}

.cw-length-badge {
  font-size: 0.75rem;
  color: var(--text-muted, #8b9bb4);
  font-weight: 600;
}

.cw-clue-full-text {
  font-family: var(--font-display, inherit);
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.cw-clue-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cw-clue-toggle-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--neon-cyan, #00f0ff);
  color: var(--neon-cyan, #00f0ff);
  transform: translateY(-1px);
}

/* ---------------- BULMACA TAHTASI & IZGARA ---------------- */
.cw-board-container {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 8px 4px;
  scrollbar-width: thin;
}

.cw-board-grid {
  display: grid;
  gap: 2px;
  background: #080b18;
  border: 3px solid rgba(0, 240, 255, 0.35);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 240, 255, 0.12);
}

/* 8x8, 10x10, 12x12 Boyutları */
.cw-board-grid.size-8 {
  grid-template-columns: repeat(8, 48px);
}
.cw-board-grid.size-8 .cw-grid-cell {
  width: 48px;
  height: 48px;
}

.cw-board-grid.size-10 {
  grid-template-columns: repeat(10, 42px);
}
.cw-board-grid.size-10 .cw-grid-cell {
  width: 42px;
  height: 42px;
}

.cw-board-grid.size-12 {
  grid-template-columns: repeat(12, 36px);
}
.cw-board-grid.size-12 .cw-grid-cell {
  width: 36px;
  height: 36px;
}

/* Hücre Temel Tasarımı */
.cw-grid-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

/* 1. TANIM HÜCRESİ (CLUE CELL) */
.cw-grid-cell.cw-clue {
  background: #171f3d;
  border: 1px solid rgba(255, 230, 0, 0.25);
  cursor: pointer;
  padding: 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.cw-grid-cell.cw-clue:hover {
  background: #1f2a52;
  border-color: var(--neon-yellow, #ffe600);
}

.cw-grid-cell.cw-clue.clue-active {
  border-color: var(--neon-cyan, #00f0ff);
  background: #1d2b58;
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.3);
}

.cw-clue-subitem {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.05;
  padding: 1px;
}

.cw-clue-subitem.has-divider {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  margin-bottom: 1px;
  padding-bottom: 2px;
}

.cw-clue-snippet {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.50rem;
  font-weight: 700;
  color: #ffd000;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  word-break: break-word;
}

.size-12 .cw-clue-snippet {
  font-size: 0.44rem;
  -webkit-line-clamp: 2;
}

.cw-clue-arrow-icon {
  font-size: 0.65rem;
  line-height: 1;
  color: var(--neon-cyan, #00f0ff);
  margin-top: 1px;
}

.cw-clue-arrow-icon.down {
  color: var(--neon-yellow, #ffe600);
}

/* 2. HARF HÜCRESİ (LETTER CELL) */
.cw-grid-cell.cw-letter {
  background: #161e38;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-weight: 800;
  font-size: 1.25rem;
  cursor: pointer;
}

.size-10 .cw-grid-cell.cw-letter {
  font-size: 1.15rem;
}

.size-12 .cw-grid-cell.cw-letter {
  font-size: 1.0rem;
}

.cw-grid-cell.cw-letter:hover {
  background: #1f2b52;
  border-color: rgba(0, 240, 255, 0.4);
}

/* Seçili kelime hattı */
.cw-grid-cell.cw-letter.highlighted {
  background: rgba(0, 240, 255, 0.22);
  border-color: rgba(0, 240, 255, 0.45);
}

/* İmleç / Aktif Hücre */
.cw-grid-cell.cw-letter.active {
  background: #00f0ff !important;
  color: #060a16 !important;
  border-color: #fff !important;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.8), inset 0 0 6px #fff;
  transform: scale(1.05);
  z-index: 5;
  animation: cursorPulse 1.4s ease-in-out infinite alternate;
}

@keyframes cursorPulse {
  0% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.6); }
  100% { box-shadow: 0 0 20px rgba(0, 240, 255, 1), 0 0 8px #fff; }
}

/* Kontrol Sonucu: Doğru / Yanlış / İpucu */
.cw-grid-cell.cw-letter.correct {
  background: rgba(0, 255, 136, 0.25) !important;
  border-color: var(--neon-green, #00ff88) !important;
  color: #00ff88 !important;
}

.cw-grid-cell.cw-letter.wrong {
  background: rgba(255, 0, 127, 0.3) !important;
  border-color: var(--neon-pink, #ff007f) !important;
  color: #ff007f !important;
  animation: cellShake 0.4s ease;
}

@keyframes cellShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.cw-grid-cell.cw-letter.revealed {
  border-color: var(--neon-yellow, #ffe600);
  color: var(--neon-yellow, #ffe600);
}

.cw-grid-cell.cw-letter.revealed::after {
  content: '★';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.50rem;
  color: var(--neon-yellow, #ffe600);
}

/* 3. KARA HÜCRE (BLACK CELL) */
.cw-grid-cell.cw-black {
  background: #0a0d1a;
  border: 1px solid rgba(255, 255, 255, 0.03);
  cursor: default;
}

.cw-grid-cell.cw-black::before {
  content: '';
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

/* ---------------- YARDIMCI ARAÇLAR / AKSİYON BAR ---------------- */
.cw-actions-toolbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.cw-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm, 10px);
  font-family: var(--font-display, inherit);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: var(--bg-card, rgba(18, 24, 46, 0.85));
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cw-tool-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.cw-tool-btn.primary {
  background: linear-gradient(135deg, var(--neon-cyan, #00f0ff), #0088ff);
  color: #070913;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.35);
}
.cw-tool-btn.primary:hover {
  box-shadow: 0 6px 22px rgba(0, 240, 255, 0.55);
}

.cw-tool-btn.hint-btn {
  background: rgba(255, 230, 0, 0.12);
  border-color: rgba(255, 230, 0, 0.35);
  color: var(--neon-yellow, #ffe600);
}
.cw-tool-btn.hint-btn:hover {
  background: rgba(255, 230, 0, 0.22);
  border-color: var(--neon-yellow, #ffe600);
}

.cw-tool-btn.check-btn {
  background: rgba(0, 255, 136, 0.12);
  border-color: rgba(0, 255, 136, 0.35);
  color: var(--neon-green, #00ff88);
}
.cw-tool-btn.check-btn:hover {
  background: rgba(0, 255, 136, 0.22);
  border-color: var(--neon-green, #00ff88);
}

.cw-tool-btn.danger-btn {
  background: rgba(255, 0, 127, 0.12);
  border-color: rgba(255, 0, 127, 0.3);
  color: var(--neon-pink, #ff007f);
}
.cw-tool-btn.danger-btn:hover {
  background: rgba(255, 0, 127, 0.22);
  border-color: var(--neon-pink, #ff007f);
}

/* ---------------- SANAL KLAVYE (VIRTUAL KEYBOARD) ---------------- */
.cw-virtual-keyboard {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(12, 16, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 14px);
  margin-top: 4px;
}

.cw-kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.cw-key {
  min-width: 34px;
  height: 42px;
  padding: 0 8px;
  background: rgba(25, 34, 65, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-display, inherit);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.cw-key:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--neon-cyan, #00f0ff);
  color: var(--neon-cyan, #00f0ff);
  transform: translateY(-1px);
}

.cw-key:active {
  transform: translateY(1px);
  background: var(--neon-cyan, #00f0ff);
  color: #070913;
}

.cw-key.action-key {
  background: rgba(38, 48, 88, 0.95);
  font-size: 0.85rem;
  padding: 0 12px;
  color: var(--neon-yellow, #ffe600);
}

/* ---------------- ZAFER MODALI & KUTLAMA ---------------- */
.cw-victory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 9, 19, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.cw-victory-card {
  width: 90%;
  max-width: 480px;
  background: linear-gradient(135deg, rgba(22, 30, 62, 0.98) 0%, rgba(14, 18, 40, 0.98) 100%);
  border: 2px solid var(--neon-yellow, #ffe600);
  box-shadow: 0 0 35px rgba(255, 230, 0, 0.3), 0 20px 50px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-lg, 20px);
  padding: 32px 24px;
  text-align: center;
  position: relative;
  animation: cardPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardPop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.cw-victory-icon {
  font-size: 64px;
  margin-bottom: 12px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.cw-victory-title {
  font-family: var(--font-display, inherit);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.cw-victory-subtitle {
  color: var(--neon-cyan, #00f0ff);
  font-weight: 600;
  margin-bottom: 20px;
}

.cw-victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.cw-vstat-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 8px;
}

.cw-vstat-val {
  font-family: var(--font-mono, monospace);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.cw-vstat-val.gold { color: var(--neon-yellow, #ffe600); }
.cw-vstat-val.cyan { color: var(--neon-cyan, #00f0ff); }
.cw-vstat-val.green { color: var(--neon-green, #00ff88); }

.cw-vstat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted, #8b9bb4);
  text-transform: uppercase;
  margin-top: 2px;
}

.cw-victory-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ---------------- RESPONSIVE AYARLAR ---------------- */
@media (max-width: 768px) {
  .cw-board-wrapper {
    padding: 8px 4px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .cw-board-grid {
    gap: 2px;
    padding: 4px;
    width: min(100%, calc(100vw - 24px));
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
  }

  .cw-board-grid.size-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    max-width: 340px;
  }
  .cw-board-grid.size-8 .cw-grid-cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
  }
  .size-8 .cw-grid-cell.cw-letter {
    font-size: clamp(0.85rem, 3.8vw, 1.05rem);
  }

  .cw-board-grid.size-10 {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    max-width: 360px;
  }
  .cw-board-grid.size-10 .cw-grid-cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
  }
  .size-10 .cw-grid-cell.cw-letter {
    font-size: clamp(0.75rem, 3.2vw, 0.95rem);
  }

  .cw-board-grid.size-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    max-width: 380px;
  }
  .cw-board-grid.size-12 .cw-grid-cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
  }
  .size-12 .cw-grid-cell.cw-letter {
    font-size: clamp(0.65rem, 2.8vw, 0.82rem);
  }

  .cw-active-clue-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }

  .cw-clue-toggle-btn {
    align-self: flex-end;
  }

  .cw-keyboard {
    padding: 8px 4px;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
  }

  .cw-kb-row {
    gap: 3px;
    width: 100%;
  }

  .cw-key {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 2px;
    height: 38px;
    font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  }
}
