@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Roboto:wght@800&display=swap");

:root {
  --tile-height: 70px;
  --tile-width: 60px;
  --tile-font-size: 48px;
  --board-width: calc(var(--tile-width) * 17.25); /* 14 tiles max + buffer */
}

.puzzle-row:not(:first-child) {
  margin-top: 2px;
}

.puzzle-board-border {
  position: relative;
  padding: 40px;
  background-color: #dbdbdb; /* Border color */
  clip-path: polygon(
    11.5% 6%,
    88.5% 6%,
    88.5% 24%,
    94.5% 24%,
    94.5% 76%,
    88.5% 76%,
    88.5% 94%,
    11.5% 94%,
    11.5% 76%,
    5.5% 76%,
    5.5% 24%,
    11.5% 24%
  );
}

.puzzle-board-border.buzzed {
  background: #0097ff;
  background-size: 400% 400%;
  animation: buzz-flash 1s cubic-bezier(0, 0.95, 0.05, 1) infinite;
}

.puzzle-board-border.solving {
  background: linear-gradient(90deg, #dbdbdb, #1eff00, #0099ff, #dbdbdb);
  background-size: 400% 400%;
  animation: solve-gradient 5s infinite;
}

.puzzle-board.solved {
  background: linear-gradient(270deg, #ffd700, #ffa600, #2f8033, #00b6b6);
  background-size: 400% 400%;
  animation: solve-gradient 2.5s ease-in;
}

.puzzle-board-border.solved-bonus {
  background: linear-gradient(45deg, #8ce2e2, #75c579, #2bb632, #2bd1d1);
  background-size: 400% 400%;
  animation: solve-gradient-backwards 2s infinite ease-in-out;
  background-position: 100% 50%;
}

.puzzle-board-border.solved {
  background: linear-gradient(90deg, #2bb632, #2bd1d1, #dbdbdb, #dbdbdb);
  background-size: 400% 400%;
  animation: solve-gradient-backwards 2.5s ease-out;
  background-position: 100% 50%;
}

html,
body {
  font-family: "IBM Plex Sans", sans-serif;
  overflow: hidden;
  color: white;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  box-sizing: border-box;
}

.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  transition: filter 0.5s ease;
  padding-top: 120px; /* Increased for more space */
}

@keyframes buzz-flash {
  0% {
    background-color: #dbdbdb;
  }
  50% {
    background-color: #0097ff;
  }
  100% {
    background-color: #dbdbdb;
  }
}

@keyframes pulsing-glow {
  0% {
    filter: drop-shadow(0 0 8px #2f7780);
  }
  50% {
    filter: drop-shadow(0 0 20px #2f7780);
  }
  100% {
    filter: drop-shadow(0 0 8px #2f7780);
  }
}

@keyframes solve-gradient-backwards {
  0% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes solve-gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.category-label {
  text-align: center;
  font-weight: 600;
  font-family: "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  border: 4px solid rgba(167, 167, 167, 0.5);
  background-color: #00404093;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  font-size: 2.4rem;
  padding: 12px 24px;
  letter-spacing: 0.05em;
}

.game-info-and-controls {
  display: flex;
  border: 4px solid rgba(167, 167, 167, 0.5);
  height: 100px;
  justify-content: space-between;
  align-items: center;
  width: clamp(45rem, 90vw, 80rem); /* Increased max-width */
  background: #1c1c1ccc;
  border-radius: 10px;
  padding: 10px 20px;
  box-sizing: border-box;
}

.info-display {
  font-size: 1.6rem;
  font-weight: 500;
  text-align: center;
}

#player-score {
  flex: 1;
  text-align: left;
  font-weight: bold;
  font-size: clamp(1.1rem, 1.8vw, 1.6rem);
}
#message-label {
  flex: 2;
  color: #ffc107;
  font-weight: bold;

  /* These rules create the alignment */
  display: flex;
  flex-direction: row; /* This puts the items on the same line */
  align-items: center; /* This keeps them vertically centered next to each other */
  justify-content: center;
  gap: 15px; /* This adds a nice space between the two text elements */
}

#solve-btn-container {
  flex: 1;
  text-align: right;
}
#solve-btn {
  padding: 10px 15px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: white;
  background-color: #007bff;
  transition: filter 0.2s, opacity 0.2s;
}
#solve-btn:hover:not(:disabled) {
  filter: brightness(1.2);
}
#solve-btn:disabled {
  background-color: #555;
  opacity: 0.6;
  cursor: not-allowed;
}
.puzzle-board {
  position: relative;
  background-color: #2f7780;
  padding: 24px;
  box-sizing: border-box;
  clip-path: polygon(
    10% 0%,
    90% 0%,
    90% 22.5%,
    96.5% 22.5%,
    96.5% 77.5%,
    90% 77.5%,
    90% 100%,
    10% 100%,
    10% 77.5%,
    3.5% 77.5%,
    3.5% 22.5%,
    10% 22.5%
  );
  transition: background-color 0.5s;
}

.puzzle-row {
  display: flex;
  justify-content: center;
  margin: 0;
  line-height: 0;
  height: var(--tile-height);
}

.tile-container {
  position: relative;
  width: var(--tile-width);
  height: 100%;
  user-select: none;
  background-image: url("assets/images/WoF Puzzle Board SVG.svg");
  background-size: 100% 100%;
}

#wallpaper {
  filter: brightness(0.3);
  width: 100%;
  height: 100%;
  top: 0;
  background-size: cover;
  left: 0;
  z-index: -1;
  position: fixed;
}

.tile-letter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 85%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--tile-font-size);
  color: black;
  background-color: white;
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* --- FIX: Corrected styles for punctuation tiles --- */
.tile-letter.symbol {
  background-color: white; /* Restores the white tile background */
  color: black; /* Makes the punctuation mark black */
}

.puzzle-board-glow-container {
  width: var(--board-width);
  margin: 0 auto;
  animation: pulsing-glow 4s infinite ease-in-out;
}
.tile-container.revealed > .tile-letter {
  opacity: 1;
}
.tile-container.unrevealed > .tile-letter {
  background-color: #002fff;
  opacity: 1;
  color: transparent;
}

#wheel {
  position: fixed;
  left: 50%;
  --rotation-angle: 0deg;
  transform: translateX(-50%) rotate(var(--rotation-angle));
  transform-origin: center;
  z-index: -1;
  height: clamp(35rem, 40vw, 45rem);
  width: clamp(35rem, 40vw, 45rem);
  bottom: calc(clamp(35rem, 40vw, 45rem) / -2);
  animation: pulsing-glow 4s infinite ease-in-out;
}

#wheel.is-spinning {
  transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
}

#ptr {
  position: fixed;
  left: 50%;
  --rotation-angle: 0deg;
  transform: translateX(-50%) rotate(var(--rotation-angle));
  bottom: clamp(250px, 16vw, 320px);
  width: 4vw;
  z-index: 10;
}

@media (min-width: 2000px) {
  #wheel {
    height: clamp(35rem, 40vw, 50rem);
    width: clamp(35rem, 40vw, 50rem);
    bottom: calc(clamp(35rem, 40vw, 50rem) / -2);
  }
}

button {
  font-family: "IBM Plex Sans", sans-serif;
}

#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: none; /* Hidden by default */
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 30px 40px;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  width: 600px; /* Fixed width for consistency */
  max-width: 90vw;
  border: 2px solid #3498db;
  text-align: center;
}

#intro-modal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: all 0.5s ease;
}

#intro-modal h1,
#about-modal h1 {
  margin-top: 0;
  font-size: 2em;
  color: #ffffff;
  font-family: "IBM Plex Sans", sans-serif;
}

#intro-modal p,
#about-modal p {
  font-size: 1.1em;
  line-height: 1.6;
}

.rules-container {
  min-height: 150px; /* Keeps modal from resizing */
}

.rules-container ul {
  text-align: left;
  font-size: 1.1em;
  list-style-position: inside;
  padding-left: 0;
}

.rules-container li {
  margin-bottom: 10px;
}

.modal-footer-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#start-game-btn,
.close-modal-btn,
#intro-about-btn {
  padding: 12px 25px;
  font-size: 1.6em;
  font-weight: bold;
  flex-grow: 1;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: white;
  transition: background-color 0.2s;
}

#start-game-btn {
  background-color: #27ae60;
}
#start-game-btn:hover {
  background-color: #2ecc71;
}

#intro-about-btn {
  background-color: #3498db;
}
#intro-about-btn:hover {
  background-color: #5dade2;
}

.close-modal-btn {
  background-color: #c0392b;
  font-size: 1.8em;
  width: 100%;
}
.close-modal-btn:hover {
  background-color: #e74c3c;
}

/* --- NEW STYLES --- */
.hidden {
  display: none !important;
}

#game-mode-selection {
  display: flex;
  justify-content: center;
  margin: 25px 0;
  gap: 20px;
}

.mode-label {
  padding: 10px 20px;
  border: 2px solid #555;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}

.mode-label input[type="radio"] {
  display: none;
}

.mode-label span {
  font-size: 1.4em;
  font-weight: bold;
  transition: color 0.3s;
}

.mode-label:has(input:checked) {
  background-color: #3498db;
  border-color: #3498db;
}

#tossup-points-display,
#avg-points-display {
  flex: 1;
  text-align: center;
  font-weight: bold;
  font-size: clamp(1.1rem, 1.8vw, 1.6rem);
  color: #28a745;
}

#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  pointer-events: none;
  display: none;
}

#game-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 3px solid white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 100;
  box-sizing: border-box;
}

#header-title {
  font-size: 1.8em;
  font-weight: bold;
  color: #ffc107;
  text-align: center;
}

#back-btn {
  justify-self: start;
}

#about-btn {
  justify-self: end;
}

#back-btn,
#about-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2em;
  font-weight: bold;
  transition: background-color 0.2s;
}
#back-btn:hover,
#about-btn:hover {
  background: #2980b9;
}

#solve-input-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1500;
}

#solve-input-box {
  background: #2c3e50;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  border: 2px solid #3498db;
  position: relative;
}

#solve-input-box h2 {
  font-size: 2em;
  margin: 0;
}

#solve-input-box p {
  font-size: 1.6em;
  margin: 0.2em;
  color: #28a745;
  font-weight: bold;
}

#solve-input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 1.6em;
  color: white;
  margin: 20px 0;
  border-radius: 5px;
  border: none;
  box-sizing: border-box;
  font-family: "IBM Plex Sans", sans-serif;
  outline: none;
}

#submit-solve-btn {
  width: 100%;
  padding: 12px;
  font-size: 1.6em;
  font-weight: 700;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#submit-solve-btn:hover {
  background: #2ecc71;
}

.close-solve-box {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 3.4em;
  color: #ecf0f1;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

#bonus-round-info {
  width: clamp(45rem, 90vw, 80rem);
  background: #1c1c1ccc;
  border-radius: 10px;
  padding: 10px 20px;
  box-sizing: border-box;
  flex-direction: column;
  gap: 10px;
}
#bonus-round-message {
  font-size: 1.4em;
  color: #ffc107;
  font-weight: bold;
}
#bonus-letters-picked {
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 0.2em;
  font-size: 1.5em;
  background-color: #0000005e;
  padding: 5px 15px;
  border-radius: 5px;
}

#timeLeft {
  color: white;
  padding: 0px 8px;
  position: relative;
}

#player-picks-display {
  color: white;
  padding: 0; /* Reset previous padding */
  font-size: 2.5rem; /* Make the picked letters much larger */
  line-height: 1.1; /* Adjust line height for the larger font */
}

/* --- Bottom Solve Bar Styles --- */
#bottom-solve-bar {
  position: fixed;
  bottom: 40px; /* Moves the bar up from the edge */
  left: 50%; /* Helps with centering */
  width: 90vw; /* Responsive width */
  max-width: 900px; /* Maximum width on large screens */
  background: rgba(28, 28, 28, 0.95);
  border: 2px solid rgb(170, 170, 170);
  border-radius: 12px; /* Added for a softer look */
  padding: 15px;
  box-sizing: border-box;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Start off-screen and horizontally centered */
  transform: translate(-50%, 150%);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#bottom-solve-bar.visible {
  /* Slide into its final, centered position */
  transform: translate(-50%, 0);
}

#solve-bar-content {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 800px;
  padding-right: 40px; /* ADD THIS LINE */
}

#solve-bar-title,
#solve-bar-points {
  margin: 0;
  color: #ffc107;
  font-size: 1.5em;
  font-weight: bold;
  white-space: nowrap;
}

#solve-bar-points {
  color: #28a745;
}

#solve-bar-input {
  flex-grow: 1;
  padding: 10px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 1.4em;
  color: white;
  border-radius: 5px;
  border: 1px solid #555;
  box-sizing: border-box;
  font-family: "IBM Plex Sans", sans-serif;
  outline: none;
  text-align: center;
}

#solve-bar-submit-btn {
  padding: 10px 20px;
  font-size: 1.2em;
  font-weight: 700;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#solve-bar-submit-btn:hover {
  background: #2ecc71;
}

#solve-bar-close-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  font-size: 4em;
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0 10px;
}

#solve-bar-close-btn:hover {
  color: white;
}
