@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root, body.theme-default {
  --color-light-square: #ffffff;
  --color-dark-square: rgba(128, 128, 128, 0.8);
  --color-border: #000;
  --color-highlight-move: rgba(65, 161, 73, 0.8);
  --color-last-move: rgba(204, 219, 83, 0.7);
  --color-check: rgba(255, 0, 0, 0.5);
}

body.theme-classic {
  --color-light-square: #f0d9b5;
  --color-dark-square: #b58863;
  --color-border: #333;
}

body.theme-ocean {
  --color-light-square: #cce5ff;
  --color-dark-square: #66a3ff;
}

body.theme-forest {
  --color-light-square: #dcedc8;
  --color-dark-square: #7cb342;
}

html, body {
  width: 100%;
  min-height: 100%;
  padding: 0;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #2b2b2b, #1a1a1a);
  color: #f0f0f0;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  color: white;
}
.nav-brand a {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
}
.nav-links a {
  color: #ccc;
  text-decoration: none;
  margin-left: 1rem;
  transition: color 0.3s ease;
  position: relative;
  padding: 5px 0;
}
.nav-links a:hover {
  text-decoration: underline;
}
.nav-links a.active {
  color: #4a90e2;
  font-weight: bold;
  text-decoration: none;
}
.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #4a90e2;
  transition: width 0.3s ease;
}

div * {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

#turn {
  width: 498px;
  margin: 10px auto 0;
  height: 30px;
  border-radius: 5px;
  border: 1px solid rgb(0, 0, 0);
  border-style: inset;
  text-align: center;
  padding: 5px 0 0 0;
  background: #252525;
  color: #f0f0f0;
  transition: .85s linear;
}

.controls {
  text-align: center;
  margin: 10px auto;
}

.theme-selector {
  display: inline-block;
  margin-left: 15px;
}

#new-game-btn, #theme-select {
  display: inline-block;
  vertical-align: middle;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid #4a90e2;
  background: transparent;
  color: #f0f0f0;
  transition: background-color 0.3s, color 0.3s;
}

#new-game-btn:hover, #theme-select:hover {
  background-color: #4a90e2;
  color: #fff;
}

.turnhighlight {
  background: #5cb85c !important;
  color: #fff;
}

#game {
  display: grid;
  grid-template-columns: 50px repeat(8, 56px);
  grid-template-rows: repeat(8, 56px) 50px;
  width: 498px; /* (8 * 56px) + 50px */
  position: relative;
  margin: 20px auto 0;
}

.cellprefix {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.gamecell {
  background-color: var(--color-light-square);
  width: 100%;
  height: 100%;
  transition: all 0.5s ease-in-out;
  border-radius: 5px;
  font-size: 30pt;
  padding: 0 0 0 6px;
  cursor: pointer;
  z-index: 1;
}

.gamecell:hover {
  z-index: 2;
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(74, 144, 226, 0.5);
}

.grey {
  background-color: var(--color-dark-square);
}

.green {
  background: radial-gradient(circle, rgba(74, 144, 226, 0.7) 20%, transparent 70%) !important;
}

.last-move-from {
  background-color: var(--color-last-move) !important; /* A yellowish color */
}

.last-move-to {
  background-color: var(--color-last-move) !important; /* A slightly darker yellowish-green */
}

.in-check {
  background-color: var(--color-check) !important; /* A light red color */
}

.neonblue_txt {
  animation: neonBlueText 1.5s ease-in-out infinite alternate;
}

.neonorange_txt {
  animation: neonOrangeText 1.5s ease-in-out infinite alternate;
}

.neongreen_txt {
  animation: neonGreenText 1.5s ease-in-out infinite alternate;
}

/* --- N E O N    T E X T --- */
@keyframes neonBlueText {
  from {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #228dff,
      0 0 70px #228dff, 0 0 80px #228dff, 0 0 100px #228dff, 0 0 150px #228dff;
  }
  to {
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #228dff,
      0 0 35px #228dff, 0 0 40px #228dff, 0 0 50px #228dff, 0 0 75px #228dff;
  }
}

@keyframes neonOrangeText {
  from {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #ff9900,
      0 0 70px #ff9900, 0 0 80px #ff9900, 0 0 100px #ff9900, 0 0 150px #ff9900;
  }
  to {
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff9900,
      0 0 35px #ff9900, 0 0 40px #ff9900, 0 0 50px #ff9900, 0 0 75px #ff9900;
  }
}

@keyframes neonGreenText {
  from {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #b6ff00,
      0 0 70px #b6ff00, 0 0 80px #b6ff00, 0 0 100px #b6ff00, 0 0 150px #b6ff00;
  }
  to {
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #b6ff00,
      0 0 35px #b6ff00, 0 0 40px #b6ff00, 0 0 50px #b6ff00, 0 0 75px #b6ff00;
  }
}
/* --- N E O N --- */

/* animation: neon 1.5s ease-in-out infinite alternate; */

@keyframes neonBlue {
  from {
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #228dff,
      0 0 70px #228dff, 0 0 80px #228dff, 0 0 100px #228dff, 0 0 150px #228dff;
  }
  to {
    box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #228dff,
      0 0 35px #228dff, 0 0 40px #228dff, 0 0 50px #228dff, 0 0 75px #228dff;
  }
}

/*! * * * * * * * * * * * * * * * * * * * *\  
  CSShake :: shake-little
  v1.5.0
  CSS classes to move your DOM
  (c) 2015 @elrumordelaluz
  http://elrumordelaluz.github.io/csshake/
  Licensed under MIT
\* * * * * * * * * * * * * * * * * * * * */
.shake-little {
  display: inline-block;
  transform-origin: center center; }

.shake-freeze,
.shake-constant.shake-constant--hover:hover,
.shake-trigger:hover .shake-constant.shake-constant--hover {
  animation-play-state: paused; }

.shake-freeze:hover,
.shake-trigger:hover .shake-freeze, .shake-little:hover,
.shake-trigger:hover .shake-little {
  animation-play-state: running; }

@keyframes shake-little {
  2% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  4% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  6% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  8% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  10% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  12% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  14% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  16% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  18% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  20% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  22% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  24% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  26% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  28% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  30% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  32% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  34% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  36% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  38% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  40% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  42% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  44% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  46% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  48% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  50% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  52% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  54% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  56% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  58% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  60% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  62% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  64% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  66% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  68% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  70% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  72% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  74% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  76% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  78% {
    transform: translate(0px, 0px) rotate(0.5deg); }
  80% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  82% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  84% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  86% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  88% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  90% {
    transform: translate(0px, 1px) rotate(0.5deg); }
  92% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  94% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  96% {
    transform: translate(1px, 0px) rotate(0.5deg); }
  98% {
    transform: translate(1px, 1px) rotate(0.5deg); }
  0%, 100% {
    transform: translate(0, 0) rotate(0); } }

.shake-little:hover,
.shake-trigger:hover .shake-little, .shake-little.shake-freeze, .shake-little.shake-constant {
  animation-name: shake-little;
  animation-duration: 100ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; }

/* --- Auth & Dashboard Form/Card Styles --- */
.auth-container, .dashboard-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px 20px;
}
.auth-form, .dashboard-content {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background-color: #2a2a2e;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.auth-form h2, .dashboard-content h2 {
  margin-bottom: 25px;
  color: #fff;
  font-weight: 600;
}
.auth-form input {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 1px solid #444;
  background-color: #333;
  color: #f0f0f0;
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.auth-form input:focus {
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
  outline: none;
}
.auth-form button {
  width: 100%;
  padding: 12px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.3s;
}
.auth-form button:hover { background-color: #357abd; }
.form-footer { margin-top: 20px; font-size: 14px; color: #aaa; }
.form-footer a { color: #4a90e2; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* --- Tutorial Page Styles --- */
.tutorial-container { max-width: 800px; margin: 40px auto; padding: 20px; }
.tutorial-container h1 { text-align: center; margin-bottom: 40px; font-size: 2.5rem; font-weight: 700; }
.piece-tutorial { background-color: #2a2a2e; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 4px 15px rgba(0,0,0,0.2); border-radius: 8px; padding: 25px; margin-bottom: 25px; transition: transform 0.2s, box-shadow 0.2s; }
.piece-tutorial:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.piece-header { display: flex; align-items: center; gap: 20px; margin-bottom: 15px; }
.piece-char { font-size: 50px; line-height: 1; color: #4a90e2; }
.piece-header h3 { margin: 0; font-size: 1.8rem; color: #fff; }
.piece-tutorial p { line-height: 1.7; color: #ccc; }