/* Enhanced Rock Paper Scissors Game Styles */

:root {
  --dark-bg: #1a1a2e;
  --card-bg: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  
  /* Player colors */
  --player1-primary: #fbbf24;
  --player1-secondary: #f59e0b;
  --player2-primary: #a78bfa;
  --player2-secondary: #8b5cf6;
  
  /* Piece glow effects */
  --rock-glow: rgba(139, 69, 19, 0.6);
  --paper-glow: rgba(255, 255, 255, 0.4);
  --scissors-glow: rgba(192, 192, 192, 0.6);
}

body {
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--card-bg) 100%);
  color: var(--text-primary);
  font-family: 'Open Sans', sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.game-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0px;
}

/* Screen Management */
.screen {
  display: none;
  text-align: center;
}

.screen.active {
  display: block;
}

/* Start Screen */
#start-screen h1 {
  color: var(--highlight);
  margin-bottom: 30px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-description {
  /* background: var(--medium-gray); */
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
  font-weight: bold;
  font-size: 1.5rem;
  /* border: 2px solid var(--light-gray); */
}

.game-description ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-description li {
  padding: 8px 0;
  font-size: 1.1em;
}

.game-description .highlight {
  color: var(--highlight);
  font-weight: bold;
}

/* Mode Selector */
.game-mode-selector {
  margin: 30px 0;
}



.mode-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.mode-btn {
  padding: 12px 24px;
  border: 2px solid var(--accent);
  background: var(--card-bg);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.3s ease;
}

.mode-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: var(--highlight);
  border-color: var(--highlight);
  color: white;
}

/* Buttons */
.btn {
  background: var(--highlight);
  color: var(--white);
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px;
}

.btn:hover {
  background: #d63d54;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.btn-secondary {
  background: var(--accent);
  color: var(--text-primary);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px;
}

.btn-secondary:hover {
  background: #1a4a7a;
}

.btn-small {
  background: var(--accent);
  color: var(--text-primary);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-small:hover {
  background: #1a4a7a;
}

/* Multiplayer Setup */
#multiplayer-setup h2 {
  color: var(--highlight);
  margin-bottom: 30px;
}

.connection-info {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 30px;
  margin: 20px 0;
  border: 2px solid var(--accent);
}

.connection-section {
  margin: 20px 0;
}

.connection-section h3 {
  color: var(--highlight);
  margin-bottom: 15px;
}

.connection-section p {
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.link-container {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

.link-container input {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--dark-bg);
  color: var(--text-primary);
  font-size: 0.9em;
}

#game-id-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--dark-bg);
  color: var(--text-primary);
  font-size: 1em;
  margin: 10px 0;
}

.connection-divider {
  text-align: center;
  margin: 30px 0;
  font-size: 1.2em;
  color: var(--text-secondary);
  position: relative;
}

.connection-divider::before,
.connection-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 2px;
  background: var(--accent);
}

.connection-divider::before {
  left: 0;
}

.connection-divider::after {
  right: 0;
}

/* Game Screen */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: top;
  /* margin-bottom: 10px; */
  padding: 5px;
  /* background: var(--medium-gray); */
  /* border-radius: 10px; */
  /* border: 2px solid var(--light-gray); */
}

.game-header h2 {
  /* color: var(--highlight-color); */
  margin: 0;
  font-size: 1rem;
  text-align: left;

  .eliminate {
    color: var(--error);
    
    font-weight: bold;
  }
}

.game-info {
  display: flex;
  gap: 20px;
  display: none;
}

.player-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9em;
}

.player-label {
  color: var(--text-secondary);
  font-size: 0.8em;
}

.connection-status {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.8em;
  font-weight: bold;
  width: 80%;
  margin: 0 auto;
}

.connection-status.connected {
  background: var(--success);
  color: var(--white);
}

.connection-status.disconnected {
  background: var(--error);
  color: var(--white);
}

.connection-status.connecting {
  background: var(--warning);
  color: var(--white);
}

/* Game Objective */
.game-objective {
  padding: 8px 12px;

  font-size: 0.85em;
  font-weight: 500;


  color: var(--text-secondary);
  text-align: center;
  margin-top: 0px;
}

/* Game Board - Enhanced */
.game-board {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  border: 4px solid #4a5568;
  border-radius: 12px;
  padding: 8px;
  width: 400px;
  height: 400px;
  box-shadow: 
    0 0 30px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.cell {
  background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
  border: 1px solid #4a5568;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  font-size: 2em;
  font-weight: bold;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.cell:hover {
  background: linear-gradient(145deg, #3d4758 0%, #2a303c 100%);
  transform: scale(1.02);
}

.cell.selected {
  background: linear-gradient(145deg, var(--highlight) 0%, #d63d54 100%);
  box-shadow: 0 0 15px var(--highlight);
  border-color: #ff6b6b;
}

/* Directional arrows for valid moves */
.cell.valid-move {
  position: relative;
}

.cell.valid-move::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  animation: arrow-pulse 1.5s infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Up arrow */
.cell.valid-move.move-up::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234ade80' stroke='%234ade80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E");
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

/* Down arrow */
.cell.valid-move.move-down::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234ade80' stroke='%234ade80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

/* Left arrow */
.cell.valid-move.move-left::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234ade80' stroke='%234ade80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* Right arrow */
.cell.valid-move.move-right::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234ade80' stroke='%234ade80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes arrow-pulse {
  0%, 100% { 
    opacity: 0.7;
    transform: scale(1);
  }
  50% { 
    opacity: 1;
    transform: scale(1.15);
  }
}

.cell.valid-move:hover {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.15) 0%, rgba(34, 197, 94, 0.15) 100%);
}

/* Enhanced Piece Styles */
.piece {
  width: 85%;
  height: 85%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  border: 4px solid;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 2;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Smooth transitions for general piece interactions */

/* Elimination animation */
@keyframes eliminate {
  0% { 
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  25% { 
    transform: scale(1.3) rotate(90deg);
    opacity: 0.8;
  }
  50% { 
    transform: scale(1.5) rotate(180deg);
    opacity: 0.6;
    box-shadow: 0 0 30px rgba(248, 113, 113, 0.9);
  }
  75% { 
    transform: scale(1.2) rotate(270deg);
    opacity: 0.3;
  }
  100% { 
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.piece.eliminating {
  animation: eliminate 0.6s ease-out forwards;
  z-index: 100;
}

/* Pulse animation for the winning piece */
@keyframes victory-pulse {
  0% { 
    transform: scale(1);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
  }
  50% { 
    transform: scale(1.15);
    box-shadow: 0 0 25px rgba(74, 222, 128, 1), 0 0 40px rgba(74, 222, 128, 0.5);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
  }
}

.piece.victory {
  animation: victory-pulse 0.3s ease-in-out;
}

/* Player 1 pieces (Yellow/Gold theme) */
.piece.player1 {
  background: linear-gradient(145deg, var(--player1-primary) 0%, var(--player1-secondary) 100%);
  color: #1a1a2e;
  border-color: var(--player1-primary);
  box-shadow: 
    0 0 15px rgba(251, 191, 36, 0.5),
    0 4px 6px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.piece.player1:hover {
  box-shadow: 
    0 0 25px rgba(251, 191, 36, 0.7),
    0 6px 8px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Player 2 pieces (Purple theme) */
.piece.player2 {
  background: linear-gradient(145deg, var(--player2-primary) 0%, var(--player2-secondary) 100%);
  color: #1a1a2e;
  border-color: var(--player2-primary);
  box-shadow: 
    0 0 15px rgba(167, 139, 250, 0.5),
    0 4px 6px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.piece.player2:hover {
  box-shadow: 
    0 0 25px rgba(167, 139, 250, 0.7),
    0 6px 8px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Piece Type Styling with enhanced icons */
.piece.rock::before {
  content: '';
  width: 60%;
  height: 60%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L4 8L12 22L20 8L12 2Z'/%3E%3Cline x1='4' y1='8' x2='20' y2='8'/%3E%3Cline x1='12' y1='2' x2='8' y2='8'/%3E%3Cline x1='12' y1='2' x2='16' y2='8'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}

.piece.paper::before {
  content: '';
  width: 60%;
  height: 60%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}

.piece.scissors::before {
  content: '';
  width: 60%;
  height: 60%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cline x1='20' y1='4' x2='8.12' y2='15.88'/%3E%3Cline x1='14.47' y1='14.48' x2='20' y2='20'/%3E%3Cline x1='8.12' y1='8.12' x2='12' y2='12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}



/* Move-limited pieces (oscillated 4 times) */
.piece.move-limited {
  border-width: 3px;
  border-style: dashed;
  opacity: 0.8;
  animation: limited-pulse 2s infinite;
}

@keyframes limited-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.5; }
}

/* Move count indicator */
.move-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--warning);
  color: #1a1a2e;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  font-weight: bold;
  border: 2px solid var(--dark-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Game Controls */
.game-controls {
  
  
  padding: 5px;
  margin: 0px 0px 10px 0px;
  
  text-align: center;
}

.turn-indicator {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 15px;
}

.turn-indicator.your-turn {
  color: var(--success);
}

.turn-indicator.opponent-turn {
  color: var(--warning);
}

.selected-piece-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* End Screen */
#end-screen h2 {
  color: var(--highlight);
  margin-bottom: 30px;
  font-size: 2em;
}

.game-summary {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 30px;
  margin: 20px 0;
  border: 2px solid var(--accent);
  display: none;
}

.final-scores {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.2em;
}

.score-item span:first-child {
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.score-item span:last-child {
  font-weight: bold;
  font-size: 1.5em;
  color: var(--highlight);
}

.end-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 10px;
  }
  
  .grid {
    width: 300px;
    height: 300px;
    gap: 3px;
    padding: 6px;
  }
  
  .cell {
    font-size: 1.5em;
    border-radius: 6px;
  }
  
  .piece {
    font-size: 1.2em;
    border-width: 3px;
  }
  
  .game-header {
    flex-direction: column;
    gap: 25px;
  }
  
  .game-info {
    gap: 15px;
  }
  
  .mode-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .end-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .final-scores {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .grid {
    width: 260px;
    height: 260px;
    gap: 2px;
    padding: 4px;
  }
  
  .cell {
    font-size: 1.2em;
    border-radius: 4px;
  }
  
  .piece {
    font-size: 1em;
    width: 80%;
    height: 80%;
  }
  
  #start-screen h1 {
    font-size: 2em;
  }
  
  .game-description {
    padding: 15px;
  }
  
  .connection-info {
    padding: 10px;
  }
}

/* Share Link Section */
.share-link-section {
  /* background: rgba(161, 141, 252, 0.1); */
  /* border-bottom: 2px solid var(--purple); */
  
  padding: 10px;
  margin: 0;
  text-align: center;
}



.share-info p {
  margin: 10px 0;
  color: var(--text-secondary);
}

.waiting-text {
  color: var(--warning);
  font-weight: bold;
  font-style: italic;
  margin-top: 15px !important;
}

.share-link-section .link-container {
  margin: 15px 0;
}

.share-link-section input {
  background: var(--dark-bg);
  border: 1px solid var(--player2-primary);
  color: var(--text-primary);
  padding: 12px;
  border-radius: 8px;
  width: 70%;
  margin-right: 10px;
  font-size: 0.9rem;
}

.share-link-section .btn-small {
  background: var(--player2-secondary);
  color: var(--white);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}



/* Responsive styles for share link */
@media (max-width: 600px) {
  .share-link-section input {
    width: 60%;
    margin-right: 5px;
    font-size: 0.8rem;
  }
  
  .share-link-section .btn-small {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

/* Piece selection glow effect */
.piece.selected-piece {
  animation: selected-glow 1s infinite alternate;
}

@keyframes selected-glow {
  from {
    box-shadow: 
      0 0 10px rgba(233, 69, 96, 0.5),
      0 0 20px rgba(233, 69, 96, 0.3);
  }
  to {
    box-shadow: 
      0 0 20px rgba(233, 69, 96, 0.8),
      0 0 40px rgba(233, 69, 96, 0.5);
  }
}

/* Hover effects for pieces */
.cell:hover .piece {
  transform: scale(1.05);
}

/* Smooth cell transitions */
.cell {
  transition: all 0.2s ease;
}

.cell:active {
  transform: scale(0.98);
}

/* Elimination Rules Icons in Header */
.elimination-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.piece-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a5568 0%, #2d3748 100%);
  border: 2px solid #718096;
}

.rock-icon::before {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L4 8L12 22L20 8L12 2Z'/%3E%3Cline x1='4' y1='8' x2='20' y2='8'/%3E%3Cline x1='12' y1='2' x2='8' y2='8'/%3E%3Cline x1='12' y1='2' x2='16' y2='8'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.paper-icon::before {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.scissors-icon::before {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cline x1='20' y1='4' x2='8.12' y2='15.88'/%3E%3Cline x1='14.47' y1='14.48' x2='20' y2='20'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
