@import url('https://fonts.googleapis.com/css2?family=Lalezar&display=swap');

:root {
  --primary-color: #5372F0;
  --primary-hover-color: #2c52ed;
  --white: #fff;
  --light-grey: #e0e0e0;
  --text-color: #5372F0;
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  --background-hover: #f5f5f5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Lalezar', sans-serif;
}

body {
  background: var(--primary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

/* Shared positioning for main game sections */
.select-box,
.play-board,
.result-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  width: clamp(280px, 90%, 450px);
  box-shadow: var(--box-shadow);
}

/* Select Box Styles */
.select-box {
  background: var(--white);
  padding: 25px 30px;
  border-radius: 10px;
}

.select-box.hide {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}

.select-box header {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 600;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-grey);
  color: var(--primary-color);
}

.select-box .title {
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 500;
  margin: 25px 0 20px;
}

.select-box .options {
  display: flex;
  gap: 15px;
}

.options button {
  flex-grow: 1;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 500;
  padding: 12px 0;
  border: none;
  background: var(--primary-color);
  border-radius: 8px;
  color: var(--white);
  outline: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.options button:hover {
  background: var(--primary-hover-color);
  transform: translateY(-2px);
}

.options button:active {
  transform: translateY(0);
}

/* Play Board Styles */
.play-board {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}

.play-board.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.play-board .details {
  padding: 10px;
  border-radius: 10px;
  background: var(--white);
}

.play-board .players {
  display: flex;
  position: relative;
  width: 100%;
  justify-content: space-between;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
}

/* Player Turn States */
.players span {
  position: relative;
  z-index: 2;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 500;
  padding: 12px 0;
  width: 50%;
  text-align: center;
  cursor: default;
  user-select: none;
  transition: color 0.3s ease;
}

.players .Xturn {
  color: var(--white);
}

.players .Oturn {
  color: var(--text-color);
}

.players .slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--primary-color);
  border-radius: 8px;
  transition: left 0.3s ease;
}

.players.active .slider {
  left: 50%;
}

.players.active .Xturn {
  color: var(--text-color);
}

.players.active .Oturn {
  color: var(--white);
}


/* Play Area Styles */
.play-area {
  margin-top: 25px;
}

.play-area section {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.play-area section:last-child {
  margin-bottom: 0;
}

.play-area section span {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1 / 1;
  color: var(--text-color);
  font-size: clamp(30px, 10vw, 50px);
  background: var(--white);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Result Box Styles */
.result-box {
  padding: 30px 25px;
  border-radius: 10px;
  background: var(--white);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}

.result-box.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.result-box .won-text {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.result-box .won-text p {
  font-weight: 600;
  margin: 0 5px;
  color: var(--primary-color);
}

.result-box .btn {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.btn button {
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 500;
  padding: 10px 25px;
  border: none;
  background: var(--primary-color);
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn button:hover {
  background: var(--primary-hover-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

#errorMessage {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  z-index: 1000;
  max-width: 80%;
  text-align: center;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
  .play-area section span {
    height: auto;
  }
  
  .select-box, .play-board, .result-box {
    width: 90%;
  }
}

a.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #4CAF50;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  font-size: 16px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

a.btn:hover {
  background-color: #45a049;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

a.btn:active {
  background-color: #3e8e41;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
