/* General styles */
header {
  background-color: black;
  padding: 20px 20px;
  margin-bottom: 5px;
}

header h1 {
  color: orange;
  font-family: 'Palatino Linotype', serif;
  font-size: 48px;
  text-align: center;
  margin: 0;
}

body {
  background-color: black;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

#overlay {
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(189, 102, 8, 0.8);
  z-index: 1;
}

footer {
  color: white;
  font-family: 'Palatino Linotype', serif;
}

/* Welcome and contest screen styles */
#welcome-screen, #contest-screen {
  max-width: 850px; /* Set a maximum width to prevent the box from becoming too large on wide screens */
  width: 70%; /* Set the desired width here (e.g., 70% of the parent container) */
  background-color: #2c2c2c; /* Set the background color to dark grey */
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  text-align: center;
  color: #ffffff; /* Set the text color to white */
  font-family: 'Palatino Linotype', serif;
}

#welcome-screen h2, #contest-screen h2 {
  margin-top: 0;
  font-size: 30px;
  font-weight: bold;
}

#welcome-screen p, #contest-screen p {
  margin: 10px 0;
  text-align: left; /* Add this line to make the body text left justified */
  font-size: 18px;
}

#welcome-screen ul, #welcome-screen ol, #contest-screen ul, #contest-screen ol {
  text-align: left;
  font-size: 18px;
}

#contest-screen form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#contest-screen form input[type="email"] {
  background-color: white;
  color: rgb(5, 5, 5);
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Palatino Linotype', serif;
  font-size: 20px;
  margin-bottom: 10px;
}

#contest-screen p:last-child {
  text-align: center;
}

#contest-screen {
  display: none; /* Hides the contest screen initially */
}

/* Button styles with gradients */
#welcome-screen button,
#contest-screen button,
#submit-email-button {
  background: linear-gradient(to bottom, #FF6D00, #B54B00);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Palatino Linotype', serif;
  font-size: 20px;
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
}

/* Hover styles for buttons with gradients */
#welcome-screen button:hover,
#contest-screen button:hover,
#submit-email-button:hover{
  background: linear-gradient(to bottom, #B54B00, #FF6D00);
}

#welcome-screen button:hover, #contest-screen button:hover, #submit-email-button:hover {
  background-color: rgb(150, 80, 0);
}

/* Card styles */
.card {
  background-image: none;
  background: rgb(189, 102, 2);
  background-size: cover;
  border-radius: 10px;
  border: 3px solid rgb(189, 102, 2);
  box-shadow: 2px 2px 5px rgba(189, 111, 10, 0.3);
  height: 90px;
  width: 60px;
  margin: 10px;
  text-align: center;
  font-size: 2rem;
  line-height: 90px;
  cursor: pointer;
  text-shadow: -1px -1px 0 #FFF, 1px -1px 0 #FFF, -1px 1px 0 #FFF, 1px 1px 0 #FFF;
  user-select: none;
}

.card-invalid {
  background-image: url('./card-back.png');
  background-size: cover;
  background-position: center;
  }

.card-valid {
  background-image: url('./card-back-key.png');
  background-size: cover;
  background-position: center;
  user-select: none;
  }
  
.card-flipped {
    background-color: white;
  }

.card-locked {
    background-image: url('./card-back.png');
    background-size: cover;
    background-position: center;
    }

.card-selected {
  border: 3px solid rgba(255, 215, 0);
  }

.heart {
  color: red;
}

.diamond {
  color: blue;
}

.spade {
  color: rgb(73, 73, 73);
}

.club {
  color: green;
}

/* Container styles */
.content-container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto minmax(0, 1fr) 50px;
  background-color: black;
  padding: 20px;
  width: 1150px;
  height: 820px;
  margin: auto;
  position: relative;
  background-image: url('./background.jpg');
  border: 3px solid rgb(189, 102, 2);
}

.scoreboard-container {
  margin-left: 20px;
  margin-right: 20px;
}

/* Game board styles */
.game-board {
  display: grid;
  grid-template-rows: repeat(1, 1fr);
  grid-template-columns: repeat(8, 1fr);
  gap: 30px;
}

.game-board .row:first-child {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  align-items: center;
}

.game-board .row:first-child .card:first-child,
.game-board .row:first-child .card:last-child {
  margin: 20px 0;
}

/* Scoreboard and score tracker styles */
.scoreboard, .scoretracker, .suittracker {
  font-size: 22px;
  font-weight: bold;
  padding: 5px;
  background-color: rgba(255, 255, 255, 0.8);
  border: 3px solid rgb(189, 102, 2);
  border-radius: 5px;
  text-align: center;
  width: 175px;
  margin: 20px auto;
}

.suittracker {
  font-size: 18px;
}

.total-score, .average-score {
  font-weight: bold;
  text-shadow: 1px 1px 1px black;
}

.scoreboard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scoretracker {
  text-align: left;
}

/* Sound container styles */
.sound-toggle-container {
  display: flex;
  justify-content: center;
}

.sound-toggle {
  font-size: 18px;
  font-weight: bold;
  font-family: 'Palatino Linotype', serif;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.8); /* Set the background color to dark grey */
  color:green;
  border: 3px solid rgb(189, 102, 2);
  border-radius: 5px;
  width: 60%;
  height: 50px;
  grid-row: 2;
  grid-column: 2;
  justify-self: center; /* horizontally center the box within the grid cell */
  display: flex;
  align-items: center;
  justify-content: center; /* horizontally center the content */
  text-align: center;
}

.sound-toggle.off {
  color: red;
}

.sound-toggle.on {
  color: green;
}

.sound-toggle:hover {
  background: linear-gradient(to bottom, #B54B00, #FF6D00);
  background-color: rgba(150, 80, 0, 0.205);
}

/* Rule box styles */
.rule-container {
  font-size: 18px;
  font-weight: bold;
  font-family: 'Palatino Linotype', serif;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.8); /* Set the background color to dark grey */
  color: white;
  border: 3px solid rgb(189, 102, 2);
  border-radius: 5px;
  width: 60%;
  height: 50px;
  grid-row: 2;
  grid-column: 2;
  justify-self: center; /* horizontally center the box within the grid cell */
  display: flex;
  align-items: center;
  justify-content: center; /* horizontally center the content */
  text-align: center;
}

.rule-container .purple-text {
  color: rgb(156, 102, 241);
}

.rule-container .green-text {
  color: rgb(66, 190, 41);
}

.rule-container .red-text {
  color: rgb(228, 51, 51);
}

/* Message box styles */
.message-box {
  font-size: 24px;
  font-weight: bold;
  position: fixed;
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(44,44,44,0.95); 
  padding: 20px;
  border-radius: 10px;
  border: 3px solid rgb(189, 102, 2);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-family: 'Palatino Linotype', serif;
}

.message-box .button-container button {
  background-color: rgb(189, 102, 2);
  color: white;
  font-size: 1.2rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease-out;
}

.message-box .button-container button:hover {
  background: linear-gradient(to bottom, #B54B00, #FF6D00);
  background-color: rgb(150, 80, 0);
}

/* Error message box styles */
.error-box {
  position: absolute;
  z-index: 999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: transparent;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: center;
  font-size: 3rem;
  font-weight: bold;
  color: rgb(189, 102, 2);  
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  display: none; /* Set display to none by default */
}

.error-box.fade-in {
  animation: fade-in .2s ease-in-out forwards;
  display: block; /* Set display to block when fading in */
}

.error-box.fade-out {
  animation: fade-out 1s ease-in-out forwards;
  display: none; /* Set display to none when fading out */
}


@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}


/* Mobile styles */
@media only screen and (max-width: 768px) {
  /* Adjust font sizes and spacing */
  html,
  body {
    background-color: black;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 100vh;
  }

  header {
    background-color: black;
    padding: 5px 5px;
    margin-bottom: 5px;
    order: 0;
  }

  header h1 {
    background-color: rgba(0, 0, 0, 0.164);
    font-size: 36px;
    padding: 10px;
  }

  .card {
    font-size: 1.5rem;
    height: 60px;
    width: 40px;
    margin: 5px;
    line-height: 60px;
  }

  /* Welcome and contest screen styles for mobile */
  #welcome-screen, #contest-screen {
    max-width: 850px;
    width: 90%;
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    text-align: flex-start;
    color: #ffffff;
    font-family: 'Palatino Linotype', serif;
    margin: 0 auto;
    margin-top: 20px;
  }

  #welcome-screen h2, #contest-screen h2 {
    margin-top: 0;
    font-size: 30px;
    font-weight: bold;
  }

  #welcome-screen p, #contest-screen p {
    margin: 10px 0;
    text-align: left;
    font-size: 18px;
  }

  #welcome-screen ul, #welcome-screen ol, #contest-screen ul, #contest-screen ol {
    text-align: left;
    font-size: 18px;
  }

  #contest-screen form {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #contest-screen form input[type="email"] {
    background-color: white;
    color: rgb(5, 5, 5);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Palatino Linotype', serif;
    font-size: 20px;
    margin-bottom: 10px;
  }

  #contest-screen p:last-child {
    text-align: center;
  }

  #contest-screen {
    display: none;
  }

  /* Adjust content container */
  .content-container {
    width: 90%;
    height: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Adjust message box */
  .message-box {
    font-size: 20px;
    padding: 10px;
  }

  /* Adjust gameboard */
  .game-board {
    order: 2;
    gap: 10px;
  }

  /* Adjust scoreboard and score tracker */
  .scoreboard-container {
    order: 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }

  .scoreboard, .suittracker  {
    font-size: 18px;
    align-self: flex-start;
  }
  .total-score, .average-score {
    font-size: 20px;
  }

  .suittracker {
    font-size: 18px;
    text-align: center;
    align-self: flex-start;
    margin-top: auto;
    margin-bottom: 0;
  }
  .suittracker-container {
    align-items: flex-start;
  }

    /* Adjust rule container and score tracker */
  .rule-container {
    font-size: 14px;
    height: 25px;
    order: 3;
    justify-self: center; /* horizontally center the box within the grid cell */
    display: flex;
    align-items: center;
    justify-content: center; /* horizontally center the content */
    text-align: center;
  }

  /* Adjust error message box */
  .error-box {
    font-size: 2rem;
  }

  /* Hide contest screen */
  #contest-screen {
    display: none;
  }

  /* Adjust button styles */
  #welcome-screen button,
  #contest-screen button,
  #submit-email-button {
    padding: 5px 10px;
    font-size: 18px;
  }

  /* Adjust footer */
  footer {
    font-size: 18px;
  }
}

