/**
 * SimpleGallery WebOS - 8 Queens Modern Chess Puzzle
 * Stylesheet with Glassmorphic Chessboard, Animated Queens, Conflict Rays & Victory Effects.
 */

.eight-queens-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--window-bg, var(--bg-main, radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 60%, #020617 100%)));
  color: var(--text-main, #f8fafc);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  overflow: hidden;
  position: relative;
}

/* Header & Status Bar */
.eight-queens-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--header-bg, var(--bg-card, rgba(15, 23, 42, 0.75)));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  gap: 12px;
  z-index: 10;
  flex-wrap: wrap;
}

.eight-queens-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eight-queens-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #e2e8f0);
}

.eight-queens-stat-pill.success {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.eight-queens-stat-pill.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
  animation: pulse-danger 1.5s infinite;
}

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

.eight-queens-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eight-queens-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-card, rgba(255, 255, 255, 0.1));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  color: var(--text-main, #fff);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eight-queens-btn:hover {
  background: var(--border-color-hover, rgba(255, 255, 255, 0.2));
  transform: translateY(-1px);
}

.eight-queens-btn:active {
  transform: translateY(0);
}

.eight-queens-btn.primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: #818cf8;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  color: #fff;
}

.eight-queens-btn.primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.eight-queens-btn.accent {
  background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
  border-color: #f472b6;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
  color: #fff;
}

/* Main Playing Arena */
.eight-queens-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  position: relative;
}

.chessboard-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
  border-radius: 16px;
  background: var(--bg-card, rgba(30, 41, 59, 0.5));
  backdrop-filter: blur(20px);
  border: 2px solid var(--border-color, rgba(255, 255, 255, 0.15));
  padding: 12px;
}

/* Chessboard Container */
.chessboard-grid {
  display: grid;
  border: 3px solid var(--border-color, rgba(255, 255, 255, 0.2));
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
}

/* Board Coordinates Labels */
.board-coords-col {
  display: flex;
  justify-content: space-around;
  width: 100%;
  padding-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
  letter-spacing: 1px;
}

.board-coords-row {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding-right: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
}

.chessboard-inner-row {
  display: flex;
  align-items: center;
}

/* Chessboard Cell */
.chess-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  user-select: none;
}

.chess-cell:hover {
  filter: brightness(1.15);
}

.chess-cell.cell-light {
  background-color: #e2e8f0;
  color: #1e293b;
}

.chess-cell.cell-dark {
  background-color: #64748b;
  color: #f8fafc;
}

/* Cell Themes */
.theme-cyber .chess-cell.cell-light {
  background-color: #1e293b;
}
.theme-cyber .chess-cell.cell-dark {
  background-color: #0f172a;
}
.theme-cyber .chessboard-grid {
  border-color: #6366f1;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
}

.theme-wood .chess-cell.cell-light {
  background-color: #f4d092;
}
.theme-wood .chess-cell.cell-dark {
  background-color: #b27a48;
}

.theme-emerald .chess-cell.cell-light {
  background-color: #d1fae5;
}
.theme-emerald .chess-cell.cell-dark {
  background-color: #059669;
}

/* Cell States */
.chess-cell.threatened {
  background-color: rgba(239, 68, 68, 0.35) !important;
}

.chess-cell.safe-hint {
  background-color: rgba(34, 197, 94, 0.35) !important;
}

.chess-cell.safe-hint::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 10px #22c55e;
  opacity: 0.8;
  pointer-events: none;
}

.chess-cell.hover-threatened {
  background-color: rgba(239, 68, 68, 0.2) !important;
}

/* Queen Piece Element */
.queen-piece {
  width: 78%;
  height: 78%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  line-height: 1;
  pointer-events: none;
  animation: pop-in 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  z-index: 5;
  transition: transform 0.15s ease;
}

@keyframes pop-in {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  80% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.queen-piece.conflict {
  filter: drop-shadow(0 0 10px #ef4444) drop-shadow(0 4px 8px rgba(0,0,0,0.6));
  animation: shake 0.4s ease infinite alternate;
}

@keyframes shake {
  0% { transform: scale(1.02) rotate(-2deg); }
  100% { transform: scale(1.02) rotate(2deg); }
}

/* Threat Canvas Overlay */
.threat-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* Victory Banner Overlay */
.eight-queens-victory-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fade-in 0.3s ease;
  text-align: center;
  padding: 2rem;
}

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

.victory-card {
  background: rgba(30, 41, 59, 0.9);
  border: 2px solid #fbbf24;
  border-radius: 20px;
  padding: 2.5rem 3rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.8), 0 0 50px rgba(251, 191, 36, 0.3);
  max-width: 440px;
}

.victory-crown {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.victory-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 0.5rem;
}

.victory-subtitle {
  font-size: 0.95rem;
  color: #e2e8f0;
  margin-bottom: 1.5rem;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 1.5rem;
}

.victory-stat-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 16px;
  text-align: center;
}

.victory-stat-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: #60a5fa;
}

.victory-stat-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
}

/* Solution Browser Panel */
.solution-browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--header-bg, var(--bg-card, rgba(15, 23, 42, 0.85)));
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  font-size: 0.82rem;
  z-index: 10;
}
