body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #121212;
  color: #ffffff;
}

header {
  background-color: #1f1e1e;
  padding: 1rem;
  text-align: center;
  color: #cccccc;
}

.puzzle-page main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
}

body:not(.puzzle-page) main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 0.75rem;
}

h2 { margin-bottom: 0.5rem; }


.daily-puzzle-stat {
  position: relative;
  cursor: pointer;
}

.daily-puzzle-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.daily-rating-small {
  font-size: 1rem;
  color: #9900ff;
  font-weight: bold;
}

.daily-puzzle-mini {
  position: absolute;
  top: 100%;
  right: 0;
  background: linear-gradient(135deg, #1a1a1a 0%, #121212 100%);
  border: 2px solid #3a4a5c;
  border-radius: 8px;
  padding: 0.75rem;
  min-width: 200px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.daily-puzzle-stat:hover .daily-puzzle-mini {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mini-rating {
  text-align: center;
  margin-bottom: 0.5rem;
}

.mini-rating span {
  font-size: 1.2rem;
  font-weight: bold;
  color: #9900ff;
}

.mini-themes {
  text-align: center;
  margin-bottom: 0.75rem;
}

.mini-themes span {
  font-size: 0.8rem;
  color: #cccccc;
  font-style: italic;
}

.mini-daily-btn {
  width: 100%;
  background: linear-gradient(135deg, #4a9eff, #6bb6ff);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mini-daily-btn:hover {
  background: linear-gradient(135deg, #3a8eef, #5ba6ff);
  transform: translateY(-1px);
}

.daily-puzzle-btn {
  width: 100%;
  background: linear-gradient(135deg, #4a9eff, #6bb6ff);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.3);
}

.daily-puzzle-btn:hover {
  background: linear-gradient(135deg, #3a8eef, #5ba6ff);
  box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
  transform: translateY(-1px);
}

.daily-puzzle-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 1.2rem;
}

.btn-text {
  font-size: 1rem;
}


.daily-indicator {
  background: linear-gradient(135deg, #4a9eff, #6bb6ff);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-right: 0.5rem;
}


.game-modes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 1200px;
  margin-top: 1rem;
}

.or-divider {
  color: #cccccc;
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  margin: 2rem 0 1.5rem 0;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: #3a4a5c;
}

.or-divider::before {
  left: -70px;
}

.or-divider::after {
  right: -70px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: rgba(26, 26, 26, 0.8);
  border: 2px solid rgba(153, 0, 255, 0.3);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  width: 100%;
  min-height: 110px;
}

.mode-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 255, 195, 0.3);
}

.mode-card:active {
  transform: translateY(-2px);
}

.mode-icon {
  font-size: 3rem;
  flex-shrink: 0;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.199));
}

.mode-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.mode-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: #9900ff;
  line-height: 1.2;
}

.mode-desc {
  font-size: 0.95rem;
  color: #cccccc;
  line-height: 1.3;
}

.daily-mode {
  background: linear-gradient(135deg, rgba(153, 0, 255, 0.507), rgba(26, 26, 26, 0.8));
  border-color: rgba(153, 0, 255, 0.4);
}

.daily-mode:hover {
  background: linear-gradient(135deg, rgba(153, 0, 255, 0.4), rgba(26, 26, 26, 0.95));
  border-color: #9900ff;
  box-shadow: 0 12px 32px #9900ff;
}

.survival-mode {
  background: linear-gradient(135deg, rgba(255, 60, 0, 0.15), rgba(26, 26, 26, 0.8));
  border-color: rgba(255, 60, 0, 0.4);
}

.survival-mode:hover {
  background: linear-gradient(135deg, rgba(255, 60, 0, 0.25), rgba(26, 26, 26, 0.95));
  border-color: #FF3C00;
  box-shadow: 0 12px 32px rgba(255, 60, 0, 0.3);
}

.survival-mode .mode-title {
  color: #FF3C00;
}

.pvp-mode {
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.15), rgba(26, 26, 26, 0.8));
  border-color: rgba(255, 51, 102, 0.4);
}

.pvp-mode:hover {
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.25), rgba(26, 26, 26, 0.95));
  border-color: #FF3366;
  box-shadow: 0 12px 32px rgba(255, 51, 102, 0.3);
}

.pvp-mode .mode-title {
  color: #FF3366;
}

.review-mode {
  background: linear-gradient(135deg, rgba(0, 255, 195, 0.1), rgba(26, 26, 26, 0.8));
  border-color: rgba(156, 203, 189, 0.4);
}

.review-mode:hover {
  background: linear-gradient(135deg, rgba(0, 255, 195, 0.2), rgba(26, 26, 26, 0.95));
  border-color: #00FFC3;
  box-shadow: 0 12px 32px rgba(0, 255, 195, 0.3);
}

.review-mode .mode-title {
  color: #00FFC3;
}

@media (max-width: 1024px) {
  .game-modes-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
  }
}

@media (max-width: 768px) {
  .mode-card {
    min-height: 100px;
  }
  
  .mode-icon {
    font-size: 2.5rem;
  }
  
  .mode-title {
    font-size: 1.1rem;
  }
  
  .mode-desc {
    font-size: 0.85rem;
  }
}

#board-container {
  position: relative;
}


#board,
.chessboard-63f37,
.board-b72b1,
div[id*="chessboard"],
table,
td,
tr,
th {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}


div[id*="board"],
div[class*="board"],
div[class*="chessboard"],
table[class*="board"] {
  border: none !important;
  outline: none !important;
}


@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .right-section {
    flex: none;
    order: -1;
  }
  
  #daily-puzzle-section {
    max-width: 100%;
  }
  
  .daily-puzzle-card {
    max-width: 400px;
    margin: 0 auto;
  }
  
}

#board {
  touch-action: none;
}

.button-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

button {
  padding: 1rem 1.5rem;
  background-color: #1a1a1a;
  color: #cccccc;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

button:hover {
  background-color: #9900ff;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(153, 0, 255, 0.4);
}

#diff-beginner:hover, #diff-intermediate:hover, #diff-advanced:hover, #diff-grandmaster:hover,
#pos-opening:hover, #pos-middlegame:hover, #pos-endgame:hover, #pos-checkmate:hover {
  background-color: #9900ff !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(153, 0, 255, 0.4) !important;
}

img {
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

#startSolvingBtn {
  padding: 1rem 3rem;
  margin-top: 1rem;
}

.selected {
  background-color: #00FFC3;
  color: #121212;
}

.puzzle-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start; 
  justify-content: center;
  width: 100%;
  max-width: 1200px;
}

#board-container {
  order: 1;
  display: flex;
  justify-content: center;
  margin: 0;
}

#board {
  width: 80vw;
  max-width: 600px;
  aspect-ratio: 1/1;
  background-color: #2B2B2B;
  border-radius: 12px;
  border: 2px solid #FF3C00;
}

.chess-board .square.white-1e1e1e {
  background-color: #F0EBD8;
}

.chess-board .square.black-3c3c3c {
  background-color: #2B2B2B;
}

.highlight-move {
  background-color: rgba(0, 255, 195, 0.3) !important;
}

.chess-board .grey {
  background-color: transparent !important;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.9), 0 0 40px rgba(255, 255, 0, 0.5), inset 0 0 20px rgba(255, 255, 0, 0.3) !important;
  border: 3px solid rgba(255, 255, 0, 0.8) !important;
  position: relative !important;
  z-index: 10 !important;
}

.highlight-wrong {
  background-color: rgba(255, 60, 0, 0.3) !important;
}

.highlight-check {
  background-color: rgba(255, 60, 0, 0.5) !important;
}

#puzzle-theme {
  text-align: center;
  font-size: 1.3rem;
  color: #9900ff;
  margin-bottom: 1.5rem;
  font-weight: 600;
  padding: 0.5rem;
  background: rgba(100, 181, 246, 0.1);
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
}

#puzzle-info-sidebar {
  width: 280px;
  background: rgba(26, 26, 26, 0.9);
  border: 2px solid rgba(153, 0, 255, 0.2);
  border-radius: 15px;
  padding: 1.5rem;
  color: #ffffff;
  order: 2;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.info-section {
  margin-bottom: 2rem;
}

.info-section h3 {
  color: #9900ff;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

#puzzle-rating, #turn-indicator {
  background: rgba(100,181,246,0.1);
  padding: 0.5rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.white-turn {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}
.black-turn {
  background: rgba(0,0,0,0.3) !important;
  color: #ddd !important;
}

#move-history {
  min-height: 100px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: monospace;
}

.move-item {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.move-item.correct { color: #00FFC3; }
.move-item.incorrect { color: #FF3C00; }

#nextPuzzleBtn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

#nextPuzzleBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

#coachBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
}

#chatPopup {
  position: fixed;
  bottom: 70px;
  right: 20px;
  background-color: #1a1a1a;
  color: #cccccc;
  border: 1px solid #9900ff;
  border-radius: 12px;
  padding: 1rem;
  width: 200px;
}

.hidden { display: none; }

#hintBtn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #9900ff, #7c00cc);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  margin-bottom: 0.5rem;
}

#hintBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(153, 0, 255, 0.3);
}

#chatMessages div {
  max-width: 80%;
  margin: 4px 0;
  padding: 6px 10px;
  border-radius: 6px;
  word-wrap: break-word;
  font-size: 14px;
}

#chatMessages div.user {
  text-align: right;
  background: #3a4a5c;
  color: white;
  margin-left: auto;
}

#chatMessages div.ai {
  text-align: left;
  background: #2a2a2a;
  color: white;
  margin-right: auto;
}

#chatInput {
  padding: 5px;
  border: none;
  border-radius: 4px;
  outline: none;
  width: calc(100% - 60px);
  background: #333;
  color: white;
}

#chatSend {
  padding: 5px 8px;
  margin-left: 5px;
  border: none;
  border-radius: 4px;
  background: #3a4a5c;
  color: white;
  cursor: pointer;
}

#chatMessages div.user {
  text-align: right;
  background: #3a4a5c;
  color: white;
  margin: 4px 0;
  padding: 5px 8px;
  border-radius: 6px;
}

#chatMessages div.ai {
  text-align: left;
  background: #2a2a2a;
  color: white;
  margin: 4px 0;
  padding: 5px 8px;
  border-radius: 6px;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show { transform: translateX(0); }
.toast.success { background: linear-gradient(135deg, #00d4ff, #0099cc); }
.toast.error { background: linear-gradient(135deg, #ff1744, #d50000); }
.toast.info { background: linear-gradient(135deg, #9900ff, #7c00cc); }
#chatMessages div.user strong { color: #FFD700; }   
#chatMessages div.ai strong { color: #00FFC3; }


header{background:linear-gradient(135deg,#121212,#1a1a1a);padding:2rem 1rem;box-shadow:0 4px 15px rgba(0,0,0,0.2)}

h1{font-size:2.5rem;font-weight:bold;margin-bottom:0.5rem;color:#00FFC3}

.tagline{font-size:1rem;color:#cccccc;margin:0 0 2rem 0}

.stats-bar{display:flex;justify-content:center;gap:3rem;margin-top:1.5rem}

.stat-item{text-align:center}

.stat-number{display:block;font-size:2rem;font-weight:bold;color:#9900ff;line-height:1}

.stat-label{font-size:0.9rem;color:#cccccc;text-transform:uppercase;letter-spacing:1px}


section {
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid rgba(153, 0, 255, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

section:hover {
  border-color: #9900ff;
  transform: translateY(-2px);
  transition: all 0.2s ease;
  box-shadow: 0 8px 25px rgba(153, 0, 255, 0.3);
}

h2 {
  color: #9900ff;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}


.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

button {
  min-height: 44px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


#diff-beginner.selected { 
  background-color: #00d4ff; 
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
#diff-intermediate.selected { 
  background-color: #0066ff; 
  box-shadow: 0 0 10px rgba(0, 102, 255, 0.5);
}
#diff-advanced.selected { 
  background-color: #ffeb3b; 
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}
#diff-grandmaster.selected { 
  background-color: #ff1744; 
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
}


#pos-opening.selected { 
  background-color: #00d4ff; 
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
#pos-middlegame.selected { 
  background-color: #0066ff; 
  box-shadow: 0 0 10px rgba(0, 102, 255, 0.5);
}
#pos-endgame.selected { 
  background-color: #ffeb3b; 
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}
#pos-checkmate.selected { 
  background-color: #ff1744; 
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
}


#startSolvingBtn {
  background: linear-gradient(135deg, #9900ff, #e03500, #00FFC3);
  color: white;
  font-size: 1.1rem;
  padding: 1.2rem 3rem;
  border-radius: 25px;
  box-shadow: 0 6px 20px rgba(255, 60, 0, 0.3);
  min-height: 44px; 
}

#startSolvingBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 60, 0, 0.4);
}


.puzzle-page header {
  background: linear-gradient(135deg, #121212, #1a1a1a);
  padding: 1rem 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.puzzle-navigation {
  position: absolute;
  left: 0;
}

.puzzle-page h1 {
  font-size: 2.5rem;
  margin: 0;
  color: #9900ff;
  font-weight: bold;
}

.back-btn {
  color: #cccccc;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(162, 197, 191, 0.3);
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.back-btn:hover {
  background: rgba(162, 197, 191, 0.1);
  border-color: rgba(162, 197, 191, 0.6);
  color: #ffffff;
}

.puzzle-theme-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(100, 181, 246, 0.1), rgba(100, 181, 246, 0.05));
  border: 1px solid rgba(100, 181, 246, 0.2);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  margin: 0 auto 2rem auto;
  max-width: 600px;
  width: fit-content;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-icon {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.theme-text {
  font-size: 2rem;
  color: #9900ff;
  font-weight: 700;
  line-height: 1.2;
}

.board-section {
  display: flex;
  justify-content: center;
  order: 1;
}

.board-wrapper {
  background: rgba(30, 36, 45, 0.8);
  border: 2px solid rgba(100, 181, 246, 0.2);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#board {
  width: 80vw;
  max-width: 600px;
  aspect-ratio: 1/1;
  border-radius: 12px;
  overflow: hidden;
}

.info-sidebar {
  width: 320px;
  background: linear-gradient(145deg, rgba(30, 36, 45, 0.95), rgba(26, 32, 41, 0.95));
  border: 2px solid rgba(100, 181, 246, 0.2);
  border-radius: 20px;
  padding: 1.5rem;
  color: #ffffff;
  order: 2;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.section-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #9900ff, #7c00cc);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.section-header h3 {
  color: #9900ff;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.info-cards {
  display: grid;
  gap: 0.8rem;
}

.info-card {
  background: rgba(100, 181, 246, 0.08);
  border: 1px solid rgba(100, 181, 246, 0.15);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.info-card:hover {
  background: rgba(100, 181, 246, 0.12);
  border-color: rgba(100, 181, 246, 0.25);
}

.info-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1rem;
  color: #ffffff;
  font-weight: 600;
}

.turn-card.white-turn {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.turn-card.black-turn {
  background: rgba(0, 0, 0, 0.3) !important;
  border-color: rgba(0, 0, 0, 0.4) !important;
}

.move-history-container {
  min-height: 120px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  max-height: 200px;
  overflow-y: auto;
}

.no-moves {
  color: #94a3b8;
  font-style: italic;
  display: block;
  text-align: center;
  margin-top: 2rem;
}

.move-item {
  padding: 0.4rem 0.6rem;
  margin: 0.2rem 0;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.move-item.correct {
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
  border-left-color: #4CAF50;
}

.move-item.incorrect {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
  border-left-color: #f44336;
}

.action-buttons {
  display: grid;
  gap: 0.8rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.action-btn:hover::before {
  left: 100%;
}

.hint-btn {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.hint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.next-btn {
  background: linear-gradient(135deg, #9900ff, #7c00cc);
  color: white;
  box-shadow: 0 4px 15px rgba(100, 181, 246, 0.3);
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(100, 181, 246, 0.4);
}

.btn-icon {
  font-size: 1.1rem;
}

.btn-text {
  font-size: 0.95rem;
}

.coach-floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #304aa0, #1e3a8a);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(48, 74, 160, 0.4);
  transition: all 0.3s ease;
}

.coach-floating-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(48, 74, 160, 0.6);
}

.coach-icon {
  font-size: 1.2rem;
}

.coach-text {
  font-size: 0.9rem;
}

.chat-popup{
  position:fixed;
  bottom:90px;
  right:20px;
  width:420px;
  height:500px; 
  background:linear-gradient(145deg,#1e1e1e,#2a2a2a);
  border:5px solid rgba(100,181,246,0.3);
  border-radius:20px;
  display:flex;
  flex-direction:column;
  color:white;
  font-family:Arial,sans-serif;
  box-shadow:0 12px 40px rgba(0,0,0,0.6);
  z-index:1000;
  backdrop-filter:blur(10px);
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
}

.chat-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-header{display:flex;justify-content:center;align-items:center;padding:1rem 1.2rem;background:linear-gradient(135deg,#304aa0,#1e3a8a);border-radius:14px 14px 0 0;border-bottom:1px solid rgba(255,255,255,0.1)}

.chat-title{display:flex;align-items:center;gap:0.5rem;font-weight:600}

.chat-icon{font-size:1.1rem}

.chat-messages{flex:1;overflow-y:auto;padding:1rem;scrollbar-width:thin;scrollbar-color:rgba(100,181,246,0.5) transparent}

.chat-messages::-webkit-scrollbar{width:4px}
.chat-messages::-webkit-scrollbar-track{background:transparent}
.chat-messages::-webkit-scrollbar-thumb{background:rgba(100,181,246,0.5);border-radius:2px}

.chat-input-area{display:flex;gap:0.5rem;padding:1rem;border-top:1px solid rgba(255,255,255,0.1)}

.chat-input{flex:1;padding:0.8rem;border:1px solid rgba(255,255,255,0.2);border-radius:25px;background:rgba(255,255,255,0.05);color:white;outline:none;font-size:0.9rem}

.chat-input::placeholder{color:rgba(255,255,255,0.5)}
.chat-input:focus{border-color:rgba(100,181,246,0.5);box-shadow:0 0 10px rgba(100,181,246,0.2)}

.chat-send-btn{width:40px;height:40px;border:none;border-radius:50%;background:linear-gradient(135deg,#304aa0,#1e3a8a);color:white;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:1.2rem;transition:all 0.2s ease}

.chat-send-btn:hover{transform:scale(1.1);box-shadow:0 4px 15px rgba(48,74,160,0.4)}

@media (max-width: 1024px) {
  .puzzle-container {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .info-sidebar {
    order: 1;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }
  
  .board-section {
    order: 2;
  }
  
  .board-wrapper {
    padding: 0.8rem;
  }
}

@media (max-width: 768px) {
  .puzzle-page main {
    padding: 0.5rem;
    gap: 1rem;
  }
  
  .header-content {
    padding: 0 1rem;
  }
  
  .puzzle-page h1 {
    font-size: 1.8rem;
  }
  
  .puzzle-theme-card {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    gap: 1.25rem;
  }
  
  .theme-icon {
    font-size: 2.5rem;
  }
  
  .theme-text {
    font-size: 1.5rem;
  }
  
  .info-sidebar {
    padding: 1rem;
    width: 100%;
  }
  
  .section-header {
    gap: 0.5rem;
  }
  
  .section-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .action-buttons {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  
  .action-btn {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
  }
  
  .chat-popup {
    width: 95vw;
    right: 2.5vw;
    height: 400px;
  }
  
  .coach-floating-btn {
    bottom: 15px;
    right: 15px;
    padding: 0.8rem 1.2rem;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .puzzle-page h1 {
    font-size: 1.6rem;
  }
  
  .back-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .puzzle-theme-card {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .theme-icon {
    font-size: 2rem;
  }
  
  .theme-text {
    font-size: 1.25rem;
    text-align: center;
  }
  
  .board-wrapper {
    padding: 0.5rem;
  }
  
  #board {
    width: 90vw;
    max-width: 400px;
  }
  
  .info-sidebar {
    padding: 0.8rem;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .coach-floating-btn {
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem;
    border-radius: 16px;
  }
  
  .coach-text {
    font-size: 0.75rem;
  }
  
  .chat-popup {
    width: 95vw;
    height: 350px;
    bottom: 80px;
  }
}


@media (max-width:768px){
body:not(.puzzle-page) main{padding:0.5rem}
header{padding:1.5rem 1rem}
h1{font-size:2rem}
.stats-bar{gap:2rem}
.stat-number{font-size:1.6rem}
section{padding:1.5rem 1rem;margin-bottom:1rem;min-height:160px}
.button-row{grid-template-columns:repeat(2,1fr);gap:0.6rem}
button{padding:1rem;font-size:0.85rem}
#startSolvingBtn{padding:1.2rem 2rem;font-size:1rem;width:90%;max-width:300px}
.chat-popup{width:95vw;right:2.5vw;height:500px}
}

@media (max-width:480px){
h1{font-size:1.8rem}
.tagline{font-size:0.9rem}
.stats-bar{flex-direction:column;gap:1rem;align-items:center}
.stat-item{display:flex;align-items:center;gap:1rem}
.stat-number{font-size:1.4rem}
.button-row{grid-template-columns:1fr;gap:0.5rem}
button{padding:1rem;width:100%}
section{margin-bottom:0.8rem;min-height:140px}
.chat-popup{height:450px}
}
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #121212;
  color: #ffffff;
}

header {
  background: linear-gradient(135deg, #121212, #1a1a1a);
  padding: 2rem 1rem;
  text-align: center;
  color: #cccccc;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

h1 {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #9900ff;
}

.tagline {
  font-size: 1rem;
  color: #cccccc;
  margin: 0 0 1rem 0;
}

.back-btn {
  color: #cccccc;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(162, 197, 191, 0.3);
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  display: inline-block;
  margin-top: 1rem;
}

.back-btn:hover {
  background: rgba(162, 197, 191, 0.1);
  border-color: rgba(162, 197, 191, 0.6);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 2rem;
}

.game-review-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1400px;
  flex-wrap: wrap;
}

.board-section {
  background: rgba(40, 50, 60, 0.5);
  border: 1px solid rgba(100, 181, 246, 0.3);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  width: fit-content;
  height: fit-content;
}

#board {
  width: 80vw;
  max-width: 600px;
  aspect-ratio: 1/1;
  border-radius: 12px;
  overflow: hidden;
}

.controls-panel {
  width: 350px;
  background: linear-gradient(145deg, rgba(30, 36, 45, 0.95), rgba(26, 32, 41, 0.95));
  border: 2px solid rgba(100, 181, 246, 0.2);
  border-radius: 20px;
  padding: 1.5rem;
  color: #ffffff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.section-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #9900ff, #7c00cc);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.section-header h3 {
  color: #9900ff;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

textarea, input {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid rgba(100, 181, 246, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: none;
  border-color: rgba(100, 181, 246, 0.5);
  box-shadow: 0 0 10px rgba(100, 181, 246, 0.2);
}

.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #9900ff, #7c00cc);
  color: white;
  box-shadow: 0 4px 15px rgba(100, 181, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(100, 181, 246, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.move-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.move-btn {
  padding: 0.6rem;
  background: rgba(100, 181, 246, 0.1);
  border: 1px solid rgba(100, 181, 246, 0.2);
  color: #9900ff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.move-btn:hover {
  background: rgba(100, 181, 246, 0.2);
  border-color: rgba(100, 181, 246, 0.4);
}

.analysis-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  min-height: 120px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.engine-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.8rem;
  background: rgba(100, 181, 246, 0.08);
  border: 1px solid rgba(100, 181, 246, 0.15);
  border-radius: 8px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f44336;
  animation: pulse 2s infinite;
}

.status-dot.ready {
  background: #4CAF50;
  animation: none;
}

.status-text {
  font-weight: 600;
  color: #ffffff;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.evaluation-bar {
  width: 100%;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.evaluation-fill {
  height: 100%;
  background: linear-gradient(90deg, #f44336, #4CAF50);
  transition: width 0.3s ease;
  width: 50%;
}

.eval-score {
  text-align: center;
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: #cccccc;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.move-list {
  max-height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 0.5rem;
}

.move-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem;
  margin: 0.3rem 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.move-item:hover {
  background: rgba(100, 181, 246, 0.1);
  border-left-color: #64b5f6;
  transform: translateX(2px);
}

.move-item.active {
  background: rgba(100, 181, 246, 0.2);
  border-left-color: #64b5f6;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(100, 181, 246, 0.3);
}

.move-notation {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 0.95rem;
}

.move-evaluation {
  font-weight: bold;
  font-size: 1.2rem;
  min-width: 25px;
  text-align: center;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.move-item:hover .move-evaluation {
  transform: scale(1.1);
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show { 
  transform: translateX(0); 
}

.toast.success { 
  background: linear-gradient(135deg, #4CAF50, #45a049); 
}

.toast.error { 
  background: linear-gradient(135deg, #f44336, #d32f2f); 
}

.toast.info { 
  background: linear-gradient(135deg, #2196F3, #1976D2); 
}

@media (max-width: 1024px) {
  .game-review-container {
    flex-direction: column;
    align-items: center;
  }
  
  .controls-panel {
    width: 100%;
    max-width: 600px;
    order: -1;
  }
}

@media (max-width: 768px) {
  main {
    padding: 1rem 0.5rem;
  }
  
  .board-section {
    padding: 0.8rem;
  }
  
  .controls-panel {
    padding: 1rem;
  }
  
  #board {
    width: 90vw;
    max-width: 450px;
  }}
  .review-page main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    gap: 2rem;
  }
  
  .review-page .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
  }
  
  .game-review-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 1600px;
    flex-wrap: wrap;
  }
  
  .controls-panel {
    width: 350px;
    background: linear-gradient(145deg, rgba(30, 36, 45, 0.95), rgba(26, 32, 41, 0.95));
    border: 2px solid rgba(100, 181, 246, 0.2);
    border-radius: 20px;
    padding: 1.5rem;
    color: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    order: 1; 
  }
  
  .board-section {
    background: rgba(30, 36, 45, 0.8);
    border: 2px solid rgba(100, 181, 246, 0.2);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    order: 2; 
    flex: 1;
    min-width: 500px;
  }
  
  .move-list-panel {
    width: 300px;
    background: linear-gradient(145deg, rgba(30, 36, 45, 0.95), rgba(26, 32, 41, 0.95));
    border: 2px solid rgba(100, 181, 246, 0.2);
    border-radius: 20px;
    padding: 1.5rem;
    color: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    order: 3; 
  }
  
  .board-wrapper {
    display: flex;
    justify-content: center;
  }
  
  #board {
    width: 80vw;
    max-width: 600px;
    aspect-ratio: 1/1;
    border-radius: 12px;
    overflow: hidden;
  }
  
  .input-group {
    margin-bottom: 1rem;
  }
  
  .input-group label {
    display: block;
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
  }
  
  textarea, input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid rgba(100, 181, 246, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
  }
  
  textarea:focus, input:focus {
    outline: none;
    border-color: rgba(100, 181, 246, 0.5);
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.2);
  }
  
  .button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
  }
  
  .btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .btn-primary {
    background: linear-gradient(135deg, #9900ff, #7c00cc);
    color: white;
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.3);
  }
  
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 181, 246, 0.4);
  }
  
  .btn-secondary {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
  }
  
  .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
  }
  
  .move-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .move-btn {
    padding: 0.6rem;
    background: rgba(100, 181, 246, 0.1);
    border: 1px solid rgba(100, 181, 246, 0.2);
    color: #9900ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
  }
  
  .move-btn:hover {
    background: rgba(100, 181, 246, 0.2);
    border-color: rgba(100, 181, 246, 0.4);
  }
  
  .analysis-display {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
  }
  
  .engine-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: rgba(100, 181, 246, 0.08);
    border: 1px solid rgba(100, 181, 246, 0.15);
    border-radius: 8px;
  }
  
  .status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f44336;
    animation: pulse 2s infinite;
  }
  
  .status-dot.ready {
    background: #4CAF50;
    animation: none;
  }
  
  .status-text {
    font-weight: 600;
    color: #ffffff;
  }
  
  @keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
  }
  
  .evaluation-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
  }
  
  .evaluation-fill {
    height: 100%;
    background: linear-gradient(90deg, #f44336, #4CAF50);
    transition: width 0.3s ease;
    width: 50%;
  }
  
  .move-list {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
  }
  
  .move-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    margin: 0.2rem 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .move-item:hover {
    background: rgba(100, 181, 246, 0.1);
  }
  
  .move-item.active {
    background: rgba(100, 181, 246, 0.2);
    border: 1px solid rgba(100, 181, 246, 0.4);
  }
  
  .move-notation {
    font-weight: 600;
  }
  
  .move-evaluation {
    font-size: 0.8rem;
    color: #94a3b8;
  }
  

  .square-highlight {
    background: rgba(255, 235, 59, 0.8) !important;
    box-shadow: inset 0 0 3px rgba(255, 235, 59, 1);
  }
  
  .square-highlight-to {
    background: rgba(76, 175, 80, 0.8) !important;
    box-shadow: inset 0 0 3px rgba(76, 175, 80, 1);
  }
  

  @media (max-width: 1024px) {
    .game-review-container {
      flex-direction: column;
      align-items: center;
    }
    
    .controls-panel {
      width: 100%;
      max-width: 600px;
      order: 1;
    }
    
    .board-section {
      order: 2;
    }
  }
  
  @media (max-width: 768px) {
    .review-page main {
      padding: 1rem 0.5rem;
    }
    
    .board-section {
      padding: 0.8rem;
    }
    
    .controls-panel {
      padding: 1rem;
    }
    
    #board {
      width: 90vw;
      max-width: 450px;
    }
    
    .review-page .header-content {
      flex-direction: column;
      gap: 1rem;
    }
  }

.leaderboard-floating-btn {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-floating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.leaderboard-icon {
  font-size: 18px;
}

.leaderboard-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.leaderboard-modal.hidden {
  display: none;
}

.leaderboard-content {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border: 2px solid #ffd700;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #ffd700;
}

.leaderboard-header h2 {
  color: #ffd700;
  margin: 0;
  font-size: 24px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.close-btn {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #c0392b;
  transform: scale(1.1);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading-spinner {
  text-align: center;
  color: #bdc3c7;
  padding: 40px 20px;
  font-style: italic;
}

.leaderboard-entry {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid #ffd700;
  transition: all 0.3s ease;
  position: relative;
}

.leaderboard-entry:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(5px);
}

.leaderboard-entry.top3 {
  border-left-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
}

.leaderboard-entry.rank-1 {
  border-left-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.15));
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.rank-2 {
  border-left-color: #c0c0c0;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
}

.leaderboard-entry.rank-3 {
  border-left-color: #cd7f32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
}

.entry-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-name {
  font-size: 16px;
  font-weight: 600;
  color: #ecf0f1;
}

.entry-date {
  font-size: 12px;
  color: #bdc3c7;
}

.entry-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.entry-elo {
  font-size: 18px;
  font-weight: 700;
  color: #e74c3c;
}

.entry-score {
  font-size: 14px;
  color: #27ae60;
}

.entry-streak {
  font-size: 12px;
  color: #f39c12;
}

.rank-badge {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  background: #ffd700;
  color: #333;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.empty-leaderboard {
  text-align: center;
  color: #bdc3c7;
  font-style: italic;
  padding: 40px 20px;
}

.empty-leaderboard .empty-icon {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
}

@media (max-width: 768px) {
  .leaderboard-floating-btn {
    bottom: 75px;
    right: 15px;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .leaderboard-content {
    padding: 20px;
    margin: 20px;
    max-height: 85vh;
  }
  
  .leaderboard-header h2 {
    font-size: 20px;
  }
  
  .leaderboard-entry {
    padding: 12px;
  }
  
  .entry-name {
    font-size: 14px;
  }
  
  .entry-elo {
    font-size: 16px;
  }
}

.room-setup-screen,
.waiting-room-screen,
.game-screen {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.room-setup-container {
  display: flex;
  gap: 30px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 30px;
}

.setup-card {
  flex: 1;
  min-width: 300px;
  max-width: 400px;
  background: rgba(26, 26, 26, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.setup-card:hover {
  border-color: rgba(255, 51, 102, 0.4);
  box-shadow: 0 8px 24px rgba(255, 51, 102, 0.2);
  transform: translateY(-5px);
}

.setup-card h2 {
  color: #FF3366;
  margin-bottom: 10px;
  font-size: 24px;
}

.setup-card p {
  color: #95a5a6;
  margin-bottom: 20px;
  font-size: 14px;
}

.setup-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #95a5a6;
  font-size: 18px;
  font-weight: bold;
  padding: 0 20px;
}

.room-input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ecf0f1;
  font-size: 16px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.room-input:focus {
  outline: none;
  border-color: #FF3366;
  background: rgba(255, 255, 255, 0.08);
}

.room-input::placeholder {
  color: #7f8c8d;
}

.action-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.primary-btn {
  background: linear-gradient(135deg, #FF3366, #e91e63);
}

.primary-btn:hover {
  box-shadow: 0 6px 20px rgba(255, 51, 102, 0.4);
}

.success-btn {
  background: linear-gradient(135deg, #27ae60, #229954);
}

.success-btn:hover {
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.waiting-room-container {
  max-width: 800px;
  margin: 30px auto;
  text-align: center;
}

.room-code-display {
  background: rgba(26, 26, 26, 0.8);
  border: 2px solid rgba(255, 51, 102, 0.3);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
}

.room-code-display h2 {
  color: #ecf0f1;
  margin-bottom: 15px;
  font-size: 22px;
}

.room-code {
  font-size: 48px;
  font-weight: bold;
  color: #FF3366;
  letter-spacing: 8px;
  margin: 20px 0;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 20px rgba(255, 51, 102, 0.5);
}

.copy-btn {
  padding: 10px 20px;
  background: rgba(52, 152, 219, 0.2);
  border: 2px solid #3498db;
  border-radius: 8px;
  color: #3498db;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: rgba(52, 152, 219, 0.3);
  transform: translateY(-2px);
}

.players-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.player-card {
  flex: 1;
  min-width: 200px;
  max-width: 250px;
  background: rgba(26, 26, 26, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 25px;
  transition: all 0.3s ease;
}

.host-card {
  border-color: rgba(52, 152, 219, 0.4);
}

.guest-card {
  border-color: rgba(231, 76, 60, 0.4);
}

.player-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.player-name {
  font-size: 20px;
  font-weight: bold;
  color: #ecf0f1;
  margin-bottom: 10px;
}

.player-status {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-block;
}

.player-status.ready {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.player-status.waiting {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
}

.vs-divider {
  font-size: 28px;
  font-weight: bold;
  color: #95a5a6;
}

.match-settings {
  background: rgba(26, 26, 26, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin: 30px 0;
}

.match-settings h3 {
  color: #ecf0f1;
  margin-bottom: 15px;
  font-size: 18px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #95a5a6;
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-value {
  color: #ecf0f1;
  font-weight: bold;
}

.timer-display {
  font-size: 48px;
  font-weight: bold;
  color: #FF3366;
  text-align: center;
  padding: 20px;
  background: rgba(255, 51, 102, 0.1);
  border-radius: 12px;
  margin: 10px 0;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 20px rgba(255, 51, 102, 0.5);
}

.score-comparison {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
}

.player-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.player-label {
  font-size: 14px;
  color: #95a5a6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-value {
  font-size: 36px;
  font-weight: bold;
}

.your-score {
  color: #3498db;
}

.opponent-score {
  color: #e74c3c;
}

.score-vs {
  font-size: 18px;
  color: #95a5a6;
  font-weight: bold;
}

@media (max-width: 768px) {
  .room-setup-container {
    flex-direction: column;
    align-items: center;
  }
  
  .setup-divider {
    transform: rotate(90deg);
    margin: 20px 0;
  }
  
  .room-code {
    font-size: 32px;
    letter-spacing: 4px;
  }
  
  .players-status {
    flex-direction: column;
    gap: 20px;
  }
  
  .vs-divider {
    transform: rotate(90deg);
  }
  
  .timer-display {
    font-size: 36px;
  }
  
  .score-comparison {
    flex-direction: column;
    gap: 20px;
  }
}

