:root {
  --primary-color: #3b82f6;
  --secondary-color: #f59e0b;
  --accent-color: #10b981;
  --background-color: #f0f4f8;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --grid-color: #cbd5e1;
  --shadow-light: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-medium: 0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-large: 0 10px 15px -3px rgb(0 0 0 / 0.15),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glow-primary: 0 0 20px rgba(59, 130, 246, 0.3);
  --glow-secondary: 0 0 20px rgba(245, 158, 11, 0.3);
  --glow-accent: 0 0 20px rgba(16, 185, 129, 0.3);
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin: 0;
  min-height: 100vh;
  box-sizing: border-box;
  position: relative;
  overflow-x: hidden;
}

/* Remove animated background particles */

/* Game Header */
.game-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  width: 100%;
}

.turn-indicator {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.status-message {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Remove shimmer effect */

.status-player {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.status-computer {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.status-win {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.player-icon {
  font-size: 1rem;
}

.computer-icon {
  font-size: 1rem;
}

.status-text {
  font-weight: 600;
}

.board-container {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.8);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  backdrop-filter: blur(10px);
  transition: all 0.4s ease;
}

.board-container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(59, 130, 246, 0.1),
    rgba(16, 185, 129, 0.05)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Remove board shimmer effect */

#game-board {
  width: 100%;
  height: 100%;
  min-height: 350px;
  max-width: 500px;
  max-height: 500px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.06));
  transition: filter 0.3s ease;
}

.node-group {
  cursor: pointer;
  transition: all 0.3s ease;
}

.node-base {
  fill: #ffffff;
  stroke: #cbd5e1;
  stroke-width: 2;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
}

.node-group:hover .node-base {
  fill: #f1f5f9;
  stroke: #94a3b8;
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.node-group.valid-move .node-base {
  fill: #e0f2fe;
  stroke: var(--primary-color);
  stroke-width: 2;
  filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.2));
  animation: pulse-node 2s ease-in-out infinite;
}

.node-group.valid-move-player2 .node-base {
  fill: #fffbeb;
  stroke: var(--secondary-color);
  stroke-width: 2;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.2));
  animation: pulse-node 2s ease-in-out infinite;
}

.node-group.selected-piece .node-base {
  fill: #dbeafe;
  stroke: var(--primary-color);
  stroke-width: 2;
  filter: drop-shadow(0 3px 8px rgba(59, 130, 246, 0.3));
}

.node-group.selected-piece-player2 .node-base {
  fill: #fef3c7;
  stroke: var(--secondary-color);
  stroke-width: 2;
  filter: drop-shadow(0 3px 8px rgba(245, 158, 11, 0.3));
}

.piece {
  transition: all 0.4s ease;
  animation: fadeIn 0.5s ease;
}

.player-piece {
  color: var(--primary-color);
}

.computer-piece {
  color: var(--secondary-color);
}

.winning-line {
  stroke: var(--accent-color);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-line 1s forwards;
}

.connection-line {
  stroke: #cbd5e1;
  stroke-width: 1.5;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

/* Control Buttons */
.control-buttons {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  z-index: 10;
}

.home-button-container {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 10;
}

.control-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

/* Remove button shimmer effect */

.restart-btn {
  background: linear-gradient(135deg, var(--primary-color), #2563eb);
  color: white;
  box-shadow: var(--shadow-medium), var(--glow-primary);
}

.restart-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-large), var(--glow-primary);
}

.home-btn {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  border: none;
}

.home-btn:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  transform: translateY(-2px) scale(1.08);
}

.home-btn:active {
  transform: translateY(0) scale(1);
}

.sound-btn {
  background: linear-gradient(135deg, var(--accent-color), #059669);
  color: white;
  box-shadow: var(--shadow-medium), var(--glow-accent);
}

.sound-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-large), var(--glow-accent);
}

.sound-btn.sound-off {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: var(--shadow-medium), 0 0 20px rgba(239, 68, 68, 0.4);
}

.sound-btn.sound-off:hover {
  box-shadow: var(--shadow-large), 0 0 20px rgba(239, 68, 68, 0.4);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

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

/* Pulse animation removed - using solid colors only */

@keyframes draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

/* Glow animation removed - using solid colors only */

.game-end-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.game-end-popup.show {
  opacity: 1;
}

.game-end-popup .popup-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-large);
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

/* Remove popup shimmer effect */
.game-end-popup .popup-content::before {
  display: none;
}

.game-end-popup .popup-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-end-popup .popup-message {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.game-end-popup .popup-button {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-medium);
  cursor: pointer;
}

.game-end-popup .popup-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-large);
}

.game-end-popup .popup-button:active {
  transform: translateY(0);
}

.game-end-popup .popup-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.game-end-popup .popup-button-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  color: white;
}

.game-end-popup .popup-button-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.game-end-popup .popup-button-secondary:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.game-end-win .popup-content {
  border: 2px solid var(--primary-color);
  box-shadow: var(--shadow-large), var(--glow-primary);
}

.game-end-defeat .popup-content {
  border: 2px solid var(--secondary-color);
  box-shadow: var(--shadow-large), var(--glow-secondary);
}

.difficulty-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.difficulty-popup .popup-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-large);
  text-align: center;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  position: relative;
  /* Hide scrollbar for Chrome, Safari and Opera */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.difficulty-popup .popup-content::-webkit-scrollbar {
  display: none;
}

/* Remove difficulty popup shimmer effect */
.difficulty-popup .popup-content::before {
  display: none;
}

.difficulty-popup .popup-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 1rem;
}

.popup-logo-icon {
  font-size: 3rem;
  animation: pulse 2s infinite;
}

.popup-logo-text {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.difficulty-popup .popup-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.difficulty-popup .popup-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.difficulty-popup .rules-section {
  text-align: left;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 16px;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.difficulty-popup .rules-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.difficulty-popup .rules-title i {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.difficulty-popup .rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.difficulty-popup .rule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.difficulty-popup .rule-item:hover {
  background: #f8fafc;
  transform: translateX(4px);
}

.difficulty-popup .rule-item i {
  color: var(--primary-color);
  font-size: 1rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.difficulty-popup .rule-item span {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
  flex: 1;
}

.difficulty-popup .difficulty-buttons {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.difficulty-popup .difficulty-btn {
  padding: 1rem 0.75rem;
  border-radius: 16px;
  border: 3px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-shadow: var(--shadow-medium);
}

/* Easy Button */
.difficulty-popup .difficulty-btn.easy:hover {
  background: #f0fdf4;
  transform: translateY(-2px);
}

.difficulty-popup .difficulty-btn.easy.selected {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Medium Button */
.difficulty-popup .difficulty-btn.medium:hover {
  background: #fffbeb;
  transform: translateY(-2px);
}

.difficulty-popup .difficulty-btn.medium.selected {
  border-color: #f59e0b;
  background: #fffbeb;
}

/* Hard Button */
.difficulty-popup .difficulty-btn.hard:hover {
  background: #fef2f2;
  transform: translateY(-2px);
}

.difficulty-popup .difficulty-btn.hard.selected {
  border-color: #ef4444;
  background: #fef2f2;
}

/* General hover state */
.difficulty-popup .difficulty-btn:hover {
  box-shadow: var(--shadow-large);
}

.difficulty-popup .difficulty-btn:active {
  transform: translateY(0);
}

.difficulty-popup .start-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  color: white;
  border: 2px solid var(--accent-color);
  border-radius: 12px;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-medium), var(--glow-primary);
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Remove start button shimmer effect */

.difficulty-popup .start-btn:hover {
  background: linear-gradient(135deg, #2563eb, #059669);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-large), var(--glow-primary);
}

.difficulty-popup .start-btn:active {
  transform: translateY(0) scale(1);
}

/* Large Desktop Screens (1200px and above) */
@media (min-width: 1200px) {
  body {
    padding: 2rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.75rem 0;
  }

  .board-container {
    padding: 1.75rem;
    min-height: 450px;
  }

  #game-board {
    max-width: 550px;
    max-height: 550px;
  }

  .status-message {
    font-size: 1.125rem;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Desktop Screens (1024px to 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  body {
    padding: 1.5rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.625rem 0;
  }

  .board-container {
    padding: 1.5rem;
    min-height: 400px;
  }

  #game-board {
    max-width: 500px;
    max-height: 500px;
  }
}

/* Tablet Landscape (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  body {
    padding: 1rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.5rem 0;
  }

  .board-container {
    padding: 1.25rem;
    min-height: 380px;
  }

  #game-board {
    max-width: 450px;
    max-height: 450px;
  }

  .status-message {
    font-size: 1rem;
  }
}

/* Tablet Portrait (481px to 767px) */
@media (min-width: 481px) and (max-width: 767px) {
  body {
    padding: 0.75rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.5rem 0;
  }

  .board-container {
    padding: 1rem;
    min-height: 350px;
  }

  #game-board {
    max-width: 400px;
    max-height: 400px;
  }

  .status-message {
    font-size: 0.95rem;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

/* Mobile Large (375px to 480px) */
@media (min-width: 375px) and (max-width: 480px) {
  body {
    padding: 0.5rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0;
  }

  .board-container {
    padding: 1rem;
    min-height: 320px;
    border-radius: 16px;
  }

  #game-board {
    max-width: 380px;
    max-height: 380px;
    min-height: 280px;
  }

  .status-message {
    font-size: 0.9rem;
    padding: 0.625rem 0.875rem;
  }

  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .game-end-popup .popup-content {
    padding: 1.5rem;
    max-width: 320px;
  }

  .game-end-popup .popup-title {
    font-size: 1.75rem;
  }

  .game-end-popup .popup-message {
    font-size: 1rem;
  }

  .difficulty-popup .popup-content {
    padding: 1.5rem;
    max-width: 400px;
  }

  .difficulty-popup .popup-title {
    font-size: 1.75rem;
  }

  .difficulty-popup .difficulty-buttons {
    flex-direction: row;
    gap: 0.5rem;
  }

  .difficulty-popup .difficulty-btn {
    padding: 0.875rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* Mobile Small (320px to 374px) */
@media (min-width: 320px) and (max-width: 374px) {
  body {
    padding: 0.25rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.5rem 0;
  }

  .board-container {
    padding: 0.75rem;
    min-height: 300px;
    border-radius: 12px;
  }

  #game-board {
    max-width: 320px;
    max-height: 320px;
    min-height: 260px;
  }

  .status-message {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }

  .control-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .game-end-popup .popup-content {
    padding: 1.25rem;
    max-width: 280px;
  }

  .game-end-popup .popup-title {
    font-size: 1.5rem;
  }

  .game-end-popup .popup-message {
    font-size: 0.95rem;
  }

  .difficulty-popup .popup-content {
    padding: 1.25rem;
    max-width: 320px;
  }

  .difficulty-popup .popup-title {
    font-size: 1.5rem;
  }

  .difficulty-popup .difficulty-buttons {
    flex-direction: row;
    gap: 0.5rem;
  }

  .difficulty-popup .difficulty-btn {
    padding: 0.75rem 0.625rem;
    font-size: 0.8rem;
  }
}

/* Extra Small Mobile (below 320px) */
@media (max-width: 319px) {
  body {
    padding: 0.125rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.375rem 0;
  }

  .board-container {
    padding: 0.625rem;
    min-height: 280px;
    border-radius: 10px;
  }

  #game-board {
    max-width: 280px;
    max-height: 280px;
    min-height: 240px;
  }

  .status-message {
    font-size: 0.8rem;
    padding: 0.5rem 0.625rem;
  }

  .control-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .game-end-popup .popup-content {
    padding: 1rem;
    max-width: 250px;
  }

  .game-end-popup .popup-title {
    font-size: 1.25rem;
  }

  .game-end-popup .popup-message {
    font-size: 0.9rem;
  }

  .difficulty-popup .popup-content {
    padding: 1rem;
    max-width: 280px;
  }

  .difficulty-popup .popup-title {
    font-size: 1.25rem;
  }

  .difficulty-popup .difficulty-buttons {
    flex-direction: row;
    gap: 0.375rem;
  }

  .difficulty-popup .difficulty-btn {
    padding: 0.625rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 0.25rem;
    min-height: 100vh;
  }

  .game-header {
    padding: 0;
    margin: 0 0 0.375rem 0;
  }

  .board-container {
    padding: 0.75rem;
    min-height: 250px;
  }

  #game-board {
    max-width: 350px;
    max-height: 350px;
    min-height: 220px;
  }

  .status-message {
    margin-bottom: 1rem;
    padding: 0.5rem;
  }

  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .node-base {
    stroke-width: 1.5;
  }

  .connection-line {
    stroke-width: 1;
  }

  .winning-line {
    stroke-width: 3;
  }
}
