/* guesser css */
@media (min-width: 768px) {
  /* Guesser home screen */
  #guesserMenu {
    transform: scale(1.2);
    transform-origin: top center;
  }

  #guesserMainMenuBtn {
    width: 288px;
    max-width: 100%;
    margin: 8px auto 0;
  }
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f4f4;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.game-container {
  margin-top: 40px;
  background: #ffffff;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-width: 520px;
  width: 100%;
}

h1 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.9rem;
}

.subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 16px;
}

/* Buttons */
button {
  cursor: pointer;
  border-radius: 6px;
  border: none;
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 500;
  background: #0077ff;
  color: white;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: #005fcb;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.secondary-btn {
  background: #ffffff;
  color: #0077ff;
  border: 1px solid #0077ff;
}

.secondary-btn:hover {
  background: #e9f1ff;
}

/* Main menu buttons */
.main-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 16px;
  align-items: center;
}

.main-menu-buttons button {
  width: 100%;
  height: 40px;
  max-width: 280px;
}

/* How to play */

.how-to-play {
  margin-top: 20px;
  margin-bottom: 12px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}

.how-to-play h2 {
  font-size: 1.1rem;
  margin: 0 0 6px;
  text-align: center;
}

.how-to-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 0.95rem;
}

.how-to-steps li {
  margin-bottom: 4px;
}

.how-to-example {
  list-style: none;
  background: #ffffff;
  border: 1px solid #ccc;
  padding: 10px 12px;
  border-radius: 8px;
  margin-left: 0;
  margin-top: 8px;
  margin-bottom: 12px;
  font-size: 0.75rem;
}

.how-to-example-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.how-to-example-list {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
  text-align: left;  
}

.how-to-example-list li {
  margin-bottom: 4px;
}

/* Status */
.status-text {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 10px;
  text-align: center;
}

/* Alphabet letter board */
.alphabet-label {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 6px;
  text-align: center;
}

.alphabet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
  user-select: none;
  touch-action: none;
}

.alphabet-grid button.dragging {
  opacity: 0.92;
  transform: scale(1.12);
  z-index: 20;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.alphabet-grid button {
  width: 44px;
  height: 48px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #777;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  background: #f5f5f5;
  color: #333;
  position: relative;
  overflow: hidden;
  transition:
    transform 180ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
  will-change: transform;
}

/* Letters you've marked as "not in the word" */
.alphabet-grid button.alpha-off {
  background: #ffe5e5;      /* light red background */
  border-color: #d32f2f;    /* red border */
  color: #d32f2f;           /* red text */
}

/* Diagonal strike-through for crossed-out letters */
.alphabet-grid button.alpha-off::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  border-top: 2px solid #d32f2f;
  transform: rotate(-25deg);
  transform-origin: center;
  pointer-events: none;     /* don't block clicks */
}

.alphabet-grid button.alpha-on {
  background: #2e8b57;
  color: #fff;
  border-color: #1f5a37;
}

/* Input row */
.visible-input-row {
  display: flex;
  margin-top: 8px;
  margin-bottom: 10px;
  gap: 8px;
}

.visible-input-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

/* Shake answer box when a guess is rejected */
#guesserGuessInput.guess-shake {
  animation: guessInputShake 0.35s ease;
}

@keyframes guessInputShake {
  0%, 100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-5px);
  }

  40% {
    transform: translateX(5px);
  }

  60% {
    transform: translateX(-3px);
  }

  80% {
    transform: translateX(3px);
  }
}

/* Message */
#guesserMessage {
  min-height: 20px;
  font-size: 0.95rem;
  margin-top: 4px;
  margin-bottom: 10px;
  color: #d12c2c;
}

#guesserMessage.ok {
  color: #1a7d26;
}

/* Guess list */
.guess-list {
  border-top: 1px solid #ddd;
  padding-top: 10px;
  margin-top: 10px;
  font-size: 0.95rem;
}

.guess-row {
  display: grid;
  justify-content: space-between;
  align-items: center;
  grid-template-columns: 90px 190px 1fr;  /* adjust width of column 1 and 2 */
  padding: 4px 0;
  column-gap: 8px;
  font-size: 0.95rem;
  margin-bottom: 4px;
  font-family: monospace;
  text-transform: uppercase;
}

.guess-word {
  font-weight: 600;
  text-align: left;
}

.guess-col {
  white-space: nowrap; /* keeps each label+value together */
}

.guess-col-left {
  text-align: left;
}

.guess-col-right {
  text-align: left;
}

.guess-letters {
  text-align: left;
}

.guess-length {
  text-align: left;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.6rem;
  text-align: center;
}

.modal-body {
  font-size: 1.05rem;
  color: #333;
  margin-bottom: 16px;
  line-height: 1.2;
  text-align: center;
}

.modal-buttons-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.modal-guess-list {
  counter-reset: guessnum;
  list-style: none;  
  padding: 0;
  margin: 0 auto;
  text-align: center;  
}

.modal-guess-list li {
  margin: 8px 0;
  display: block;
  line-height: 1.35;
}

/* This controls the size of the correct letters and length 2 lines in the completion modal */
.modal-guess-list li span {
  font-size: 0.85rem;
}

.modal-guess-list li::before {
  counter-increment: guessnum;
  content: counter(guessnum) ". ";
  font-weight: bold;
}

#guesserMainMenuBtn {
  display: block;
  margin: 0 auto;
}

.half-line-break {
  display: block;
  height: 8px;
}

.gate-buttons-row {
  margin-top: 16px;
}

.modal-overlay.gate-modal .modal-content {
  box-shadow: 0 14px 36px rgba(0,0,0,0.28);
}

.gate-top-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.gate-top-buttons button,
.modal-buttons-row button {
  width: 140px;
  flex: 0 0 140px;
}

.modal-footer-note {
  text-align: center;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #555;
}

@media (min-width: 0px) and (max-width: 1024px) {
  .modal-overlay.compact-win-modal .modal-content {
    padding: 10px 12px;
    width: 76%;
    max-width: 315px;
  }

  .modal-overlay.compact-win-modal .modal-content h2 {
    font-size: 1rem;
  }

  .modal-overlay.compact-win-modal .modal-body {
    font-size: 0.84rem;
  }

  .modal-overlay.compact-win-modal .modal-guess-list {
    font-size: 0.78rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .game-container {
    margin-top: 24px;
    padding: 20px 20px;
  }

  #guesserMenu {
    margin-top: 180px;
  }

  .alphabet-grid button {
    width: 36px;
    height: 50px;
    font-size: 0.9rem;
  }

  .modal-content {
    padding: 16px;
    width: 92%;
  }

  .modal-buttons-row {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
  }

  .modal-buttons-row button {
    width: 140px;
    flex: 0 0 140px;
  }

  .visible-input-row {
    flex-direction: column;
  }

    /* Make Main Menu button match share buttons on mobile */
  #guesserMainMenuBtn {
    width: 290px;
    max-width: 100%;
    margin: 10px auto 0;
  }

 .guess-row {
    display: grid;
    grid-template-columns: 70px 150px 1fr; /* control both columns */
    column-gap: 4px;
    padding: 2px 0;
  }

  .guess-col {
    white-space: nowrap; /* keep all on one line */
    overflow: hidden;    /* prevent overflow cutoff */
    text-overflow: ellipsis; /* if it MUST trim, use ellipsis */
    font-size: 0.75rem;  /* smaller text fits mobile */
  }

  .guess-word {
    font-weight: 700;
  }
}

.leaderboard-box {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-card {
  background: #ffffff;
  width: 90%;
  max-width: 420px;
  max-height: 82vh;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leaderboard-card h2 {
  margin-top: 0;
  margin-bottom: 6px;
}

.leaderboard-subtitle {
  margin-top: 0;
  color: #555;
  font-size: 0.95rem;
}

.leaderboard-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  margin: 10px 0;
}

.leaderboard-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.leaderboard-actions button {
  width: 100%;
}

.leaderboard-message {
  min-height: 20px;
  color: #d12c2c;
  font-size: 0.9rem;
}

.leaderboard-list {
  margin: 12px 0;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  max-height: 48vh;
  padding-right: 6px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  align-items: center;
  text-align: left;
}

.leaderboard-rank {
  font-weight: 700;
}

.leaderboard-name {
  font-weight: 600;
}

.leaderboard-score {
  color: #555;
  white-space: nowrap;
}

.leaderboard-empty,
.leaderboard-loading {
  color: #555;
  margin: 16px 0;
}

.leaderboard-win-loss-line {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.leaderboard-card > #leaderboardCloseBtn {
  margin-top: 18px;
}

.leaderboard-actions #leaderboardCloseBtn {
  margin-top: 8px;
}

.alphabet-grid button.win-letter {
  animation: guesserWinJump 520ms ease forwards;
}

.alphabet-grid button.win-extra {
  opacity: 0.35;
  transform: scale(0.92);
  transition: opacity 250ms ease, transform 250ms ease;
}

.alphabet-grid button.win-moving {
  pointer-events: none;
}

@keyframes guesserWinJump {
  0% {
    transform: translateY(0) scale(1);
    background: #2e8b57;
    border-color: #1f5a37;
    color: #ffffff;
  }

  35% {
    transform: translateY(-16px) scale(1.08);
    background: #3aaa70;
    border-color: #1f5a37;
    color: #ffffff;
  }

  65% {
    transform: translateY(4px) scale(0.98);
    background: #2e8b57;
    border-color: #1f5a37;
    color: #ffffff;
  }

  100% {
    transform: translateY(0) scale(1);
    background: #2e8b57;
    border-color: #1f5a37;
    color: #ffffff;
  }
}

.alphabet-grid button.lose-letter {
  animation: guesserLoseJump 520ms ease forwards;
}

@keyframes guesserLoseJump {
  0% {
    transform: translateY(0) scale(1);
    background: #f5f5f5;
    border-color: #777;
    color: #333;
  }

  35% {
    transform: translateY(-16px) scale(1.08);
    background: #ffe5e5;
    border-color: #d32f2f;
    color: #d32f2f;
  }

  65% {
    transform: translateY(4px) scale(0.98);
    background: #d32f2f;
    border-color: #9f1f1f;
    color: #ffffff;
  }

  100% {
    transform: translateY(0) scale(1);
    background: #d32f2f;
    border-color: #9f1f1f;
    color: #ffffff;
  }
}

.leaderboard-list::before {
  content: "Scroll for more ↓";
  display: block;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
  color: #555;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid #eee;
}

@media (min-width: 701px) {
  .leaderboard-card {
    max-height: 88vh;
  }

  .leaderboard-list {
    max-height: 60vh;
  }
}

@media (max-width: 700px) {
  .leaderboard-card {
    max-height: 88vh;
    transform: scale(0.94);
    transform-origin: center center;
  }

  .leaderboard-list {
    max-height: 58vh;
  }
}

.streak-celebration {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 220ms ease, transform 220ms ease;
}

.streak-celebration.show {
  opacity: 1;
  transform: scale(1);
}

.streak-emoji {
  font-size: 5rem;
  line-height: 1;
  animation: streakEmojiPop 900ms ease forwards;
}

.streak-title {
  margin-top: 12px;
  background: #ffffff;
  color: #333;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}

@keyframes streakEmojiPop {
  0% {
    transform: scale(0.4) rotate(-18deg);
  }

  40% {
    transform: scale(1.25) rotate(10deg);
  }

  70% {
    transform: scale(0.95) rotate(-4deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

.streak-five .streak-emoji {
  text-shadow: 0 0 24px rgba(255, 100, 0, 0.85);
}

.streak-ten .streak-title {
  box-shadow: 0 0 26px rgba(0, 119, 255, 0.45);
}

.streak-thirty .streak-title {
  border: 2px solid #f4c542;
}

.streak-sixty .streak-emoji {
  animation: streakEmojiPop 900ms ease forwards, streakWiggle 500ms ease 2;
}

.streak-ninety .streak-title {
  border: 2px solid #f4c542;
  box-shadow: 0 0 30px rgba(244, 197, 66, 0.55);
}

.streak-six-months .streak-title {
  border: 2px solid #7bdff2;
  box-shadow: 0 0 32px rgba(123, 223, 242, 0.65);
}

.streak-year .streak-emoji {
  font-size: 6rem;
}

.streak-year .streak-title {
  border: 2px solid #f4c542;
  box-shadow: 0 0 40px rgba(244, 197, 66, 0.75);
}

.modal-overlay.gate-modal .modal-footer-note {
  display: none;
}

.home-footer {
  margin-top: 20px;
  font-size: 0.7rem;
  color: #777;
  text-align: center;
}

@keyframes streakWiggle {
  0% {
    transform: rotate(0deg) scale(1);
  }

  25% {
    transform: rotate(-8deg) scale(1.05);
  }

  50% {
    transform: rotate(8deg) scale(1.05);
  }

  75% {
    transform: rotate(-5deg) scale(1.02);
  }

  100% {
    transform: rotate(0deg) scale(1);
  }
}

@media (max-width: 480px) {
  .streak-emoji {
    font-size: 4.2rem;
  }

  .streak-title {
    font-size: 1rem;
    padding: 9px 15px;
  }

  .streak-year .streak-emoji {
    font-size: 5rem;
  }
}