/* ==========================================================================
   ADAM ASMACA - MODERN ARCADE THEME
   Türkiye Kelime Oyunları Merkezi
   ========================================================================== */

:root {
  --ha-bg: #0f1423;
  --ha-card-bg: rgba(22, 30, 49, 0.85);
  --ha-card-border: rgba(255, 255, 255, 0.08);
  --ha-primary: #38bdf8;
  --ha-primary-glow: rgba(56, 189, 248, 0.35);
  --ha-success: #10b981;
  --ha-success-glow: rgba(16, 185, 129, 0.4);
  --ha-danger: #ef4444;
  --ha-danger-glow: rgba(239, 68, 68, 0.4);
  --ha-warning: #f59e0b;
  --ha-warning-glow: rgba(245, 158, 11, 0.35);
  --ha-text: #f8fafc;
  --ha-text-muted: #94a3b8;
  --ha-key-bg: #1e293b;
  --ha-key-hover: #334155;
  --ha-key-shadow: 0 4px 0 #0f172a;
  --ha-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.hangman-game-container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px;
  font-family: var(--ha-font);
  color: var(--ha-text);
  box-sizing: border-box;
  user-select: none;
}

/* Header & Stats Bar */
.ha-header-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ha-card-bg);
  border: 1px solid var(--ha-card-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ha-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.ha-category-select-wrapper {
  position: relative;
  display: inline-block;
}

.ha-category-select {
  appearance: none;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 6px 28px 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.ha-category-select:hover {
  border-color: var(--ha-primary);
  box-shadow: 0 0 10px var(--ha-primary-glow);
}

.ha-stats-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ha-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ha-text-muted);
}

.ha-stat-value {
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
}

.ha-streak-badge {
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.ha-hearts-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ha-heart {
  font-size: 1.25rem;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
}

.ha-heart.alive {
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
  animation: ha-pulse 1.8s infinite ease-in-out;
}

.ha-heart.dead {
  color: #475569;
  filter: grayscale(1);
  transform: scale(0.85);
  opacity: 0.4;
}

.ha-heart.critical {
  animation: ha-heart-danger 0.5s infinite alternate ease-in-out;
}

@keyframes ha-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes ha-heart-danger {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #ef4444); }
  100% { transform: scale(1.25); filter: drop-shadow(0 0 12px #ef4444); }
}

/* Main Playing Area: 2 Columns on desktop */
.ha-play-area {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .ha-play-area {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* SVG Hangman Stage */
.ha-canvas-card {
  background: var(--ha-card-bg);
  border: 1px solid var(--ha-card-border);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-height: 280px;
}

.ha-canvas-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(56, 189, 248, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.ha-svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* SVG Elements Styling */
.ha-svg-gallows {
  stroke: #475569;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: stroke 0.4s;
}

.ha-svg-rope {
  stroke: #d97706;
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 4, 3;
}

.ha-svg-part {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform-origin: center;
}

.ha-svg-part.visible {
  opacity: 1;
  animation: ha-part-draw 0.4s ease forwards;
}

@keyframes ha-part-draw {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.ha-body-line {
  stroke: #38bdf8;
  stroke-width: 6;
  stroke-linecap: round;
  fill: none;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.ha-head-circle {
  fill: #0ea5e9;
  stroke: #bae6fd;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.8));
}

.ha-face-feature {
  stroke: #082f49;
  stroke-width: 2.8;
  stroke-linecap: round;
  fill: none;
}

/* Hangman Sway & Win Animations */
.ha-svg-character {
  transform-origin: 175px 85px; /* İpin ucu */
}

.ha-sway {
  animation: ha-hanging 2.6s infinite ease-in-out;
}

@keyframes ha-hanging {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(3.5deg); }
  75% { transform: rotate(-3.5deg); }
}

.ha-win-jump {
  animation: ha-jumping 0.6s infinite alternate ease-in-out;
}

@keyframes ha-jumping {
  0% { transform: translateY(0); }
  100% { transform: translateY(-16px); }
}

/* Right Panel: Word Slots, Hint, Action */
.ha-board-card {
  background: var(--ha-card-bg);
  border: 1px solid var(--ha-card-border);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ha-category-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ha-category-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ha-text-muted);
  font-weight: 700;
}

.ha-hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ha-hint-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
}

.ha-hint-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.6);
  transform: none;
}

/* Hint Box Display */
.ha-hint-box {
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: #fde68a;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: ha-fade-in 0.3s ease;
}

@keyframes ha-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Word Slots Area */
.ha-word-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: center;
  align-items: center;
  padding: 20px 10px;
  min-height: 100px;
}

.ha-word-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  gap: 8px;
}

.ha-letter-slot {
  width: 44px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-bottom: 4px solid var(--ha-primary);
  border-radius: 8px;
  font-size: 1.6rem;
  font-weight: 800;
  color: transparent;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.ha-letter-slot.revealed {
  color: #fff;
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--ha-primary);
  box-shadow: 0 0 16px var(--ha-primary-glow);
  animation: ha-letter-flip 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ha-letter-slot.hint-revealed {
  border-bottom-color: var(--ha-warning);
  background: rgba(245, 158, 11, 0.18);
  box-shadow: 0 0 16px var(--ha-warning-glow);
}

.ha-letter-slot.missed {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  animation: ha-shake 0.4s ease;
}

@keyframes ha-letter-flip {
  0% { transform: rotateY(90deg) scale(0.6); opacity: 0; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

@keyframes ha-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@media (max-width: 600px) {
  .ha-word-group {
    gap: 5px;
  }
  .ha-letter-slot {
    width: clamp(24px, 7.2vw, 33px);
    height: clamp(32px, 9.2vw, 42px);
    font-size: clamp(0.95rem, 3.8vw, 1.2rem);
  }
  .ha-word-wrapper {
    gap: 8px 12px;
    padding: 8px 2px;
  }
}

/* Keyboard Panel */
.ha-keyboard-card {
  background: var(--ha-card-bg);
  border: 1px solid var(--ha-card-border);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 16px 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ha-keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ha-keyboard-row:last-child {
  margin-bottom: 0;
}

.ha-key-btn {
  flex: 1;
  max-width: 48px;
  height: 48px;
  background: var(--ha-key-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--ha-key-shadow);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.ha-key-btn:hover:not(:disabled) {
  background: var(--ha-key-hover);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.ha-key-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0f172a;
}

/* Key States */
.ha-key-btn.correct {
  background: var(--ha-success) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #065f46, 0 0 16px var(--ha-success-glow) !important;
  cursor: default;
  transform: none !important;
  animation: ha-correct-pulse 0.3s ease;
}

.ha-key-btn.wrong {
  background: #334155 !important;
  color: #64748b !important;
  box-shadow: 0 2px 0 #1e293b !important;
  cursor: not-allowed;
  opacity: 0.45;
  transform: none !important;
}

.ha-key-btn:disabled {
  pointer-events: none;
}

@keyframes ha-correct-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@media (max-width: 600px) {
  .ha-keyboard-card {
    padding: 10px 6px;
  }
  .ha-key-btn {
    min-width: 0;
    padding: 0 2px;
    height: 40px;
    font-size: clamp(0.82rem, 3.4vw, 1rem);
  }
  .ha-keyboard-row {
    gap: 3px;
    margin-bottom: 5px;
  }
}

/* Game Over / Win Overlay Modal */
.ha-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 22, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  animation: ha-backdrop-in 0.3s ease;
}

@keyframes ha-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ha-modal-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
  animation: ha-modal-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ha-modal-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.ha-modal-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: ha-bounce 0.6s ease infinite alternate;
}

@keyframes ha-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.ha-modal-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ha-modal-title.win {
  color: #34d399;
  text-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
}

.ha-modal-title.lose {
  color: #f87171;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.4);
}

.ha-modal-word-reveal {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
}

.ha-reveal-label {
  font-size: 0.8rem;
  color: var(--ha-text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.ha-reveal-word {
  font-size: 1.4rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.ha-reveal-hint {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-top: 6px;
  line-height: 1.4;
  font-style: italic;
}

.ha-score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 12px;
}

.ha-score-cell {
  display: flex;
  flex-direction: column;
}

.ha-score-lbl {
  font-size: 0.75rem;
  color: var(--ha-text-muted);
  font-weight: 600;
}

.ha-score-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
}

.ha-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.ha-btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.ha-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.ha-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.ha-btn-secondary {
  background: #334155;
  color: #e2e8f0;
}

.ha-btn-secondary:hover {
  background: #475569;
}
