/* Game Container Styling */
.form_container {
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  max-width: 500px;
  margin: 2rem auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.game-header h2 {
  color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
  display: inline-block;
  font-size: 1.4rem;
  margin-bottom: 0;
  padding-bottom: 0.2rem;
}

.game-instructions {
  text-align: center;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: #6c757d;
}
#game_intro {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Word Board (Wheel of Fortune Style) */
#current_word {
  display: flex;
  flex-direction: row !important;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 5px;
  list-style: none;
  padding: 1rem 0;
  width: 100%;
  font-weight: bold;
  letter-spacing: 5px;
  font-size: 1.5rem;
  list-style: none;
  padding: 10px 0;
}

#current_word li {
  background-color: var(--bg-body);
  border: 2px solid var(--accent-primary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  box-shadow: 2px 2px 0px rgba(44, 62, 80, 0.2);
  text-transform: uppercase;

  width: 32px;
  height: 42px;
  display: flex;
  border-bottom: 3px solid var(--border-medium);
  font-weight: bold;
  font-size: 1.4rem;
}
.word-display-field {
  display: block !important; /* Break out of the 2-column grid */
  text-align: center;
  padding: 2rem 0;
  border-bottom: 2px solid #f1f3f5;
}

/* Form Layout */
.formField {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f3f5;
}

.formField:last-of-type {
  border-bottom: none;
}

.formField label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
}

/* Inputs & Buttons */
#guess_letter {
  width: 50px;
  padding: 10px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  border: 2px solid #dee2e6;
  border-radius: 4px;
  transition: border-color 0.2s;
}

#guess_letter:focus {
  border-color: var(--accent-primary);
  outline: none;
}

#guess_count {
  width: 60px;
  background: #e9ecef;
  border: 1px solid #ced4da;
  padding: 5px;
  text-align: center;
  font-family: monospace;
  font-weight: bold;
  border-radius: 4px;
}

.submitField {
  padding: 1.5rem 0;
  text-align: center;
}

#guess_button {
  background-color: var(--bg-header);
  color: #ffffff;
  border: none;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#guess_button:hover {
  background-color: var(--bg-footer);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Guess History Pills */
#guesses {
  display: flex;
  flex-wrap: nowrap; /* Keep them on one line */
  overflow-x: auto; /* Scroll if there are too many */
  gap: 5px;
  padding: 5px 0;
  margin: 0;
  list-style: none;
  scrollbar-width: none; /* Hide scrollbar for clean UI */
}

#guesses::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

#guesses li {
}
#guesses li {
  background: var(--accent-secondary, #e9ecef);
  color: #1976d2;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: "Roboto Mono", monospace;
  /* font-family: "Courier New", Courier, monospace; */
  font-weight: bold;
  flex-shrink: 0;
  border: 1px solid #bbdefb;
  border-radius: 3px;
}

/* Notifications */
#notifications {
  text-align: center;
  font-weight: 600;
  margin-bottom: 1rem;
  min-height: 1.2em;
  color: #d9534f;
  font-style: italic;
  text-align: center;
}

.success-msg {
  color: #2e7d32;
}
.error-msg {
  color: #c62828;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
  .form_container {
    padding: 1rem;
    margin: 0.5rem;
  }
  #game_container {
    top: 0px;
    left: 0px;
    position: fixed;
    z-index: 1000;
  }
  #site-header,
  footer,
  #guesses,
  #guess_letter_container {
    display: none;
    position: absolute;
    z-index: -9999;
  }

  /* /1* Shrink the tiles so long words don't wrap awkwardly *1/ */
  /* #current_word { */
  /*   gap: 4px; */
  /*   padding: 0.5rem 0; */
  /* } */

  /* #current_word li { */
  /*   width: 30px; /1* Reduced from 45px *1/ */
  /*   height: 40px; /1* Reduced from 60px *1/ */
  /*   font-size: 1.2rem; /1* Reduced from 2rem *1/ */
  /*   border-width: 1px; */
  /* } */

  /* /1* Stack the form fields vertically instead of 2-columns *1/ */
  /* .formField { */
  /*   grid-template-columns: 1fr; */
  /*   gap: 5px; */
  /*   text-align: center; */
  /* } */

  /* /1* Make the Alphabet Grid look like a keypad *1/ */
  /* .alphabet-grid { */
  /*   display: grid; */
  /*   grid-template-columns: repeat(auto-fill, minmax(35px, 1fr)); */
  /*   gap: 5px; */
  /*   margin-top: 1.5rem; */
  /* } */

  /* .letter-btn { */
  /*   padding: 10px 0; */
  /*   font-family: "Roboto Mono", monospace; */
  /*   font-weight: bold; */
  /*   background: var(--bg-tag); */
  /*   border: 1px solid var(--border-medium); */
  /*   border-radius: 4px; */
  /*   cursor: pointer; */
  /* } */

  /* .letter-btn:disabled { */
  /*   opacity: 0.4; */
  /*   cursor: not-allowed; */
  /* } */
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  background: #ebf3f9;
  padding: 8px;
  border-radius: 8px;
}

.letter-btn {
  aspect-ratio: 1 / 1.2;
  padding: 0;
  font-size: 1.1rem;
  font-weight: bold;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
  transition:
    transform 0.1s,
    background 0.1s;
}

.letter-btn:active {
  transform: translateY(2px);
  box-shadow: none;
  background: #dee2e6;
}

.letter-btn:disabled {
  background: #e9ecef;
  color: #adb5bd;
  box-shadow: none;
  border-color: transparent;
}

.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
}

#notifications {
  min-height: 1.2em;
  color: #d9534f;
  font-style: italic;
  text-align: center;
}

#game_metrics {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  padding: 10px;
  background: var(
    --bg-secondary,
    #f8f9fa
  ); /* Light background to define the area */
  border-radius: 8px;
  margin: 10px 0;
}

/* Individual Metric Groups */
.formField.metric_group,
#game_metrics .formField {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* Critical for preventing flex items from overflowing */
}

/* Labels */
#game_metrics .label {
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-muted, #6c757d);
  letter-spacing: 0.05em;
}

/* Attempts Input Styling */
#guess_count {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-light, #dee2e6);
  border-radius: 4px;
  background: #fff;
  font-family: "Roboto Mono", monospace;
  font-size: 1.1rem;
  text-align: center;
  color: var(--text-primary, #212529);
}

#game_container {
  max-width: 500px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 20px;
  overflow: hidden;
}

/* Splash Screen (Login) specific styling */
#user_info_container {
  display: flex; /* Show by default */
}

#splash_screen {
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Hide the game form properly via CSS instead of inline styles */
#game_form {
  display: none; /* Changed from visibility:hidden to display:none */
}

/* Scoreboard Overlay */
#scoreboard_overlay {
  display: none; /* Toggle to 'flex' via JS */
  position: fixed;
  inset: 0; /* Shorthand for top/bottom/left/right: 0 */
  background: rgba(15, 23, 42, 0.9); /* Darker slate backdrop */
  backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  color: #f8fafc;
}

#scoreboard_overlay > div {
  /* The wrapper inside the overlay */
  background: #1e293b;
  border: 2px solid #38bdf8;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Individual Stat Rows */
#scoreboard_overlay > div > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #334155;
}

#scoreboard_overlay > div > div:last-child {
  border-bottom: none;
}

#scoreboard_overlay [id^="total_"],
#scoreboard_overlay [id^="average_"] {
  font-family: "Roboto Mono", monospace;
  font-weight: bold;
  color: #38bdf8;
  font-size: 1.2rem;
}
