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

body {
  font-family: 'Barlow Semi Condensed', sans-serif;
  background: radial-gradient(circle at top, hsl(214, 47%, 23%), hsl(237, 49%, 15%));
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 3px solid hsl(217, 16%, 45%);
  border-radius: 15px;
  padding: 1.5rem 2rem;
  margin-bottom: 4rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 0.8;
  color: white;
}

.score-board {
  background: white;
  padding: 1rem 2.5rem;
  border-radius: 8px;
  text-align: center;
  min-width: 80px;
}

.score-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(229, 64%, 46%);
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.score-value {
  font-size: 3rem;
  font-weight: 700;
  color: hsl(229, 25%, 31%);
  line-height: 1;
}

/* Game Area */
.game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Selection Phase */
.selection-phase {
  width: 100%;
  max-width: 400px;
}

.triangle-bg {
  background-image: url('bg-triangle.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
  padding: 4rem 2rem;
}

.choice-container {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2rem;
  max-width: 300px;
  margin: 0 auto;
}

.choice {
  width: 120px;
  height: 120px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}

.choice:hover {
  transform: scale(1.05);
}

.choice.paper {
  background: linear-gradient(135deg, hsl(230, 89%, 62%), hsl(230, 89%, 65%));
  box-shadow: 0 6px 0 hsl(230, 89%, 55%);
  justify-self: start;
}

.choice.scissors {
  background: linear-gradient(135deg, hsl(39, 89%, 49%), hsl(40, 84%, 53%));
  box-shadow: 0 6px 0 hsl(39, 89%, 42%);
  justify-self: end;
}

.choice.rock {
  background: linear-gradient(135deg, hsl(349, 71%, 52%), hsl(349, 70%, 56%));
  box-shadow: 0 6px 0 hsl(349, 71%, 45%);
  grid-column: 1 / -1;
  justify-self: center;
}

.choice-inner {
  width: 85px;
  height: 85px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 6px 0 rgba(0, 0, 0, 0.15);
  margin: 0 auto;
  margin-top: 18px;
}

.choice-inner img {
  width: 40px;
  height: auto;
}

/* Result Phase */
.result-phase {
  width: 100%;
  max-width: 600px;
}

.result-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: center;
  text-align: center;
}

.choice-label {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  color: white;
}

.choice-display {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}

.choice-display.paper {
  background: linear-gradient(135deg, hsl(230, 89%, 62%), hsl(230, 89%, 65%));
  box-shadow: 0 8px 0 hsl(230, 89%, 55%);
}

.choice-display.scissors {
  background: linear-gradient(135deg, hsl(39, 89%, 49%), hsl(40, 84%, 53%));
  box-shadow: 0 8px 0 hsl(39, 89%, 42%);
}

.choice-display.rock {
  background: linear-gradient(135deg, hsl(349, 71%, 52%), hsl(349, 70%, 56%));
  box-shadow: 0 8px 0 hsl(349, 71%, 45%);
}

.choice-display .choice-inner {
  width: 100px;
  height: 100px;
  margin-top: 20px;
  box-shadow: inset 0 8px 0 rgba(0, 0, 0, 0.15);
}

.choice-display .choice-inner img {
  width: 50px;
}

.result-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.result-text {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
}

.play-again-btn {
  background: white;
  color: hsl(229, 25%, 31%);
  border: none;
  padding: 1rem 3rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.play-again-btn:hover {
  color: hsl(349, 71%, 52%);
}

/* Rules Button */
.rules-btn {
  background: transparent;
  color: white;
  border: 2px solid hsl(217, 16%, 45%);
  padding: 0.8rem 2.5rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  align-self: flex-end;
  margin-top: auto;
  transition: background-color 0.2s ease;
}

.rules-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-header h2 {
  color: hsl(229, 25%, 31%);
  font-size: 2rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.close-btn img {
  width: 20px;
  height: 20px;
}

.rules-image {
  width: 100%;
  height: auto;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .container {
    padding: 2rem 1.5rem 4rem;
  }

  .header {
    padding: 1rem 1.5rem;
    margin-bottom: 6rem;
  }

  .logo h1 {
    font-size: 1.2rem;
  }

  .score-board {
    padding: 0.8rem 1.5rem;
  }

  .score-value {
    font-size: 2.5rem;
  }

  .choice {
    width: 100px;
    height: 100px;
  }

  .choice-inner {
    width: 70px;
    height: 70px;
    margin-top: 15px;
  }

  .choice-inner img {
    width: 30px;
  }

  .result-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 3rem;
  }

  .result-container .player-choice {
    order: 1;
  }

  .result-container .house-choice {
    order: 2;
  }

  .result-container .result-message {
    order: 3;
  }

  .choice-display {
    width: 120px;
    height: 120px;
  }

  .choice-display .choice-inner {
    width: 85px;
    height: 85px;
    margin-top: 18px;
  }

  .choice-display .choice-inner img {
    width: 40px;
  }

  .result-text {
    font-size: 2.5rem;
  }

  .rules-btn {
    align-self: center;
    padding: 1rem 4rem;
  }

  .modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    justify-content: center;
    position: relative;
  }

  .close-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }

  .modal-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 375px) {
  .triangle-bg {
    padding: 3rem 1rem;
  }

  .choice-container {
    max-width: 250px;
    gap: 1.5rem;
  }

  .choice {
    width: 90px;
    height: 90px;
  }

  .choice-inner {
    width: 60px;
    height: 60px;
    margin-top: 15px;
  }

  .choice-inner img {
    width: 25px;
  }
}

.attribution a {
  color: white;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  margin-top: 1rem;
  align-items: center;
}
