@import url("https://fonts.cdnfonts.com/css/aller");
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #f5f5f5 url("assets/background.svg") no-repeat center center fixed;
  background-size: cover;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: 0;
}

.hidden {
  display: none !important;
}

/* ===== LANDING PAGE ===== */
#mode-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  width: 36rem;
  height: auto;
  margin-bottom: 3rem;
}

.mode-btn {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mode-btn:hover {
  transform: scale(1.02);
}

.mode-btn img {
  display: block;
  width: 20rem;
  height: auto;
}

/* ===== GAME CONTAINER ===== */
#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

/* ===== GAME PANEL & GRID ===== */
#game-panel {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  height: 70vh;
  margin-top: 3rem;
  position: relative;
  background-color: #8874dc;
  border-radius: 4rem;
  box-shadow: 2px 5px 3px #534198, 1px 9px 4px rgba(0, 0, 0, 0.3);
}

.panel-curve {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 5rem;
  object-fit: contain;
}

#bonus-words-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
}

#bonus-words-panel h2 {
  margin: 0;
  padding: 0;
  font-family: "Aller", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 2px 2px 5px #534198;
  -webkit-text-stroke: 2px #534198;
  text-stroke: 2px #534198;
}

.bonus-word-list {
  margin: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  background-color: #323063;
  border-radius: 2rem;
  padding: 3rem 4rem;
  box-shadow: inset 2px 6px 3px #534198, 2px 2px 3px #27254b;
}

.bonus-word-item {
  background: none;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px #534198;
}

.bonus-word-item.found {
  color: #ffc913;
  text-shadow: 2px 2px 4px #ffc914;
}

/* ===== SCOREBOARD ===== */
#scoreboard {
  padding-left: 1rem;
  padding-right: 1rem;
  display: flex;
}

.level-bar-container {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #8874dc;
  border-radius: 0.8rem;
  padding: 0.5rem 1rem;
  gap: 1.5rem;
  width: 42vw;
  box-sizing: border-box;
  box-shadow: 2px 3px 2px #534198, 1px 9px 4px rgba(0, 0, 0, 0.2);
}

.level-text {
  font-family: "Aller", sans-serif;
  font-size: 1.5rem;
  color: #ffffff;
  font-weight: bold;
}

.level-number {
  position: absolute;
  top: 50%;
  left: 4.5rem;
  transform: translate(50%, -50%);
  background-color: #ffffff;
  color: black;
  font-family: "Aller", sans-serif;
  font-weight: bold;
  font-size: 1.35rem;
  padding: 2px 0.5rem;
  border-radius: 0.5rem;
  z-index: 10;
}

.bar-track {
  position: relative;
  flex: 1;
  height: 1.5rem;
  background-color: #282547;
  border-radius: 0.4rem;
  overflow: visible;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(to bottom, #5affff 0%, #2dd0ff 100%);
  border-radius: 0.4rem;
  transition: width 0.4s ease-in-out;
}

.score-text-inside {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translate(-50%, -50%);
  font-family: "Aller", sans-serif;
  font-size: 1rem;
  color: white;
}

#timer {
  font-family: "Aller", sans-serif;
  font-size: 1.2rem;
  color: #524198;
  font-weight: bold;
}

#grid-background {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
}

.grid-background-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #242245;
  border-radius: 3rem;
  height: 100%;
  width: 100%;
  box-shadow: inset 2px 6px 3px #534198, 2px 2px 3px #27254b;
  box-sizing: border-box;
}

#grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
  margin-top: 0.23rem;
  margin-left: 0.13rem;
  border-radius: 2.5rem;
  background-color: #323063;
  width: 97%;
  height: 97%;
  box-sizing: border-box;
}

/* Start of Selection */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  color: #c07500;
  background: linear-gradient(145deg, #ffc914 0%, #ffb800 50%, #e6a800 100%);
  border-radius: 25%;
  box-shadow: inset 0px -1px 0px #ffd845, inset 1px 2px 0px #ffd845,
    2px 2px 2px #f4b50d, 1px 4px 1px #d07e00, 1px 5px 1px #985d00;
  padding: 0rem 1.5rem;
  max-height: 5rem;
  user-select: none;
  transition: transform 0.1s ease;
  font-family: "Aller", sans-serif;
  position: relative;
  transition: transform 0.2s ease, opacity 0.3s ease;
}

.cell::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 20%;
  pointer-events: none;
}
/* End of Selection */

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

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

.cell.empty {
  min-width: 1.2rem;
  background: #25234c;
  box-shadow: inset 2px 2px 3px #2b2857, 2px 2px 3px #2b2857;
}

.cell.empty::before {
  background: none;
}

/* ===== TOP NAVIGATION BAR ===== */
#top-nav {
  position: fixed;
  top: 1rem;
  left: 0;
  right: 0;
  padding-left: 1rem;
  padding-right: 1rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2000;
  box-sizing: border-box;
}

/* ===== UI BUTTONS ===== */
.back-button {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.back-button:hover {
  transform: scale(1.05);
}

.back-button img {
  margin-left: 1rem;
}

.sound-button {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-right: 1rem;
  position: relative;
}

.sound-button.muted::after {
  content: "";
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: rgba(255, 255, 255, 0.8);
  transform: rotate(-45deg);
  transform-origin: center;
}

.sound-button:hover {
  transform: scale(1.1);
}

.back-button img,
.sound-button img {
  display: block;
  width: 4rem;
  height: 4rem;
}

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

#how-to-play-modal {
  background-color: rgba(0, 0, 0, 0.2);
}

.modal img {
  max-width: 85vw;
  max-height: 85vh;
  width: auto;
  height: auto;
}

/* ===== GAME WIN/LOSE MODAL ===== */
.game-win-lose-modal .modal-content {
  background-color: #8874dc;
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  max-width: 650px;
  width: 100%;
  text-align: center;
  box-shadow: 3px 4px 3px #534198;
}

.game-win-lose-modal h2 {
  font-family: "Aller", sans-serif;
  font-size: 2.5rem;
  color: #fff;
  margin: 0 0 1rem;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 2px 2px 5px #534198;
  -webkit-text-stroke: 2px #534198;
  text-stroke: 2px #534198;
}

.game-win-lose-modal .modal-content p {
  font-family: "Aller", sans-serif;
  text-transform: uppercase;
  font-size: 1.5rem;
  color: #fff;
  margin: 0;
  letter-spacing: 0.1rem;
}

.game-win-lose-modal .score-box {
  background-color: #5d44a8;
  border-radius: 0.5rem;
  padding: 1rem 4rem;
  display: inline-block;
}

.game-win-lose-modal .score-box span {
  font-family: "Aller", sans-serif;
  font-size: 2.5rem;
  color: #fff;
  font-weight: bold;
}

.game-win-lose-modal .modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.game-win-lose-modal .modal-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex: 1;
  transition: transform 0.2s ease;
}

.game-win-lose-modal .modal-btn img {
  width: 15rem;
  height: auto;
}

.game-win-lose-modal .modal-btn:hover {
  transform: scale(1.05);
}

/* === TIMED‐MODE SCOREBAR === */
/* Start of Selection */
#timed-scoreboard {
  background-color: #8874dc;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  box-shadow: 2px 5px 3px #534198, 1px 9px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: visible;
  margin-top: 1rem;
}
/* End of Selection */

.timer-wrapper {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4.5rem;
  height: 4.5rem;
}

.timer-text {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 68%;
  transform: translate(-50%, -50%);
  font-family: "Aller", sans-serif;
  font-size: 1rem;
  color: #ffffff;
  font-weight: bold;
}

.score-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding-left: 0; /* take up the full bar width */
  justify-content: flex-start;
  gap: 1.5rem;
}

.score-label {
  font-family: "Aller", sans-serif;
  font-size: 1.25rem;
  color: #ffffff;
  font-weight: bold;
  margin-left: 2.5rem;
}

.score-value {
  background-color: #27213f;
  color: #ffffff;
  padding: 0.3rem 2rem;
  border-radius: 0.8rem;
  font-family: "Aller", sans-serif;
  font-size: 1.15rem;
  font-weight: bold;
}

.timer-icon {
  position: absolute;
  top: -11%;
  left: 13%;
  width: 110%;
  height: 110%;
  z-index: 1;
}

.timer-fill {
  position: absolute;
  top: 18%;
  left: 35%;
  width: 65%;
  height: 65%;
  border-radius: 50%;
  background: conic-gradient(
    from 90deg,
    transparent 0deg,
    transparent var(--angle, 0deg),
    #8874dc var(--angle, 0deg) 360deg
  );
  transition: background 1s linear;
  z-index: 2;
}

button.mode-btn:disabled {
  filter: blur(2px);
  cursor: not-allowed;
}
.cell-highlight::before {
  background: none !important;
}
.cell-highlight::before {
  background: none !important;
  content: none    !important;  
}

.cell-highlight {
  color: #c07500 !important;    
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
  /* ===== GAME PANEL & GRID ===== */
  #bonus-words-panel h2 {
    font-size: 1.75rem;
  }

  .bonus-word-list {
    padding: 2.5rem 3rem;
  }

  .bonus-word-item {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .back-button img,
  .sound-button img {
    width: 3rem;
    height: 3rem;
  }

  .level-bar-container {
    width: 62vw;
  }

  .level-text {
    font-size: 1.25rem;
  }

  .level-number {
    font-size: 1.15rem;
  }

  .bar-track {
    height: 1.25rem;
  }

  .score-text-inside {
    font-size: 0.8rem;
  }

  .logo {
    width: 28rem;
  }

  .mode-btn img {
    width: 16rem;
  }

  .modal img {
    max-width: 100%;
    max-height: 100%;
    width: 95vw;
    height: 100vh;
  }

  /* ===== Win/Lose Modal ===== */
  .game-win-lose-modal .modal-content {
    padding: 2rem 1.5rem;
    max-width: 420px;
    width: 85%;
  }

  .game-win-lose-modal h2 {
    font-size: 2.15rem;
  }

  .game-win-lose-modal .modal-content p {
    font-size: 1.25rem;
  }

  .game-win-lose-modal .score-box {
    padding: 0.8rem 3rem;
  }

  .game-win-lose-modal .score-box span {
    font-size: 2.15rem;
  }

  .game-win-lose-modal .modal-btn img {
    width: 13rem;
  }

  /* ===== GAME PANEL & GRID ===== */
  #game-panel {
    flex-direction: column;
    gap: 1rem;
    height: 85vh;
  }

  #bonus-words-panel {
    padding: 0;
  }

  #bonus-words-panel h2 {
    font-size: 1.75rem;
    margin-top: 1.5rem;
  }

  .bonus-word-list {
    margin: 0.5rem;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    border-radius: 1rem;
    padding: 0.8rem 2rem 0.6rem;
    box-shadow: inset 1px 3px 2px #534198, 2px 2px 3px #27254b;
  }

  .bonus-word-item {
    font-size: 1.35rem;
  }

  #grid {
    gap: 0.8rem;
    padding: 1rem;
    margin-top: 0.4rem;
    margin-left: 0.2rem;
    border-radius: 2.75rem;
  }

  /* Start of Selection */
  .cell {
    font-size: 2.5rem;
    padding: 0.5rem 1.25rem;
  }
}

@media (max-width: 480px) {
  #top-nav {
    top: 1.5rem;
    padding-left: 0;
    padding-right: 0;
  }

  .back-button img {
    margin-left: 0.5rem;
  }

  .sound-button {
    margin-right: 0.5rem;
  }

  .back-button img,
  .sound-button img {
    width: 2.75rem;
    height: 2.75rem;
  }

  #scoreboard {
    margin-top: -6px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .level-bar-container {
    width: 65vw;
  }

  .logo {
    width: 24rem;
  }

  .mode-btn img {
    width: 14rem;
  }

  /* ===== GAME PANEL & GRID ===== */
  #game-panel {
    height: 100%;
  }

  #bonus-words-panel h2 {
    font-size: 1.5rem;
    margin-top: 4rem;
    text-shadow: 1px 1px 2px #534198;
    -webkit-text-stroke: 0.5px #534198;
    text-stroke: 0.5px #534198;
  }

  .bonus-word-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .bonus-word-item {
    font-size: 1.15rem;
  }

  #grid {
    gap: 0.8rem;
    padding: 1rem;
    margin-top: 0.4rem;
    margin-left: 0.2rem;
    border-radius: 2.75rem;
  }

  /* Start of Selection */
  .cell {
    font-size: 2.5rem;
    padding: 0.5rem 1.25rem;
  }
}
.last-word {
  display: block;
  font-size: 1.1rem;
  font-style: italic;
  margin: 0.5em 0;
  color: white;
}

.cell-highlight {
  background: linear-gradient(135deg, #90ee90, #98fb98) !important;
  box-shadow: inset 0px -1px 0px #7cb342, inset 1px 1px 0px #7cb342,
    2px 2px 2px #558b2f, 1px 4px 1px #33691e, 1px 5px 1px #1b5e20 !important;
  transition: background-color 0.3s ease;
}
