* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a0a2e;
  background: radial-gradient(ellipse at center, #2d1b69 0%, #1a0a2e 70%);
  color: #fff;
  font-family: 'Russo One', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

#game-container {
  max-width: 700px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex: 1;
}

/* Title */
header {
  text-align: center;
  position: relative;
  width: 100%;
}

.title {
  font-family: 'Bowlby One SC', cursive;
  font-size: 3rem;
  color: #ffd700;
  text-shadow:
    3px 3px 0 #b8860b,
    0 0 20px rgba(255, 215, 0, 0.5),
    0 0 40px rgba(255, 215, 0, 0.3);
  letter-spacing: 4px;
}

.pseud {
  color: #ff6b35;
  text-shadow:
    3px 3px 0 #c44d1a,
    0 0 20px rgba(255, 107, 53, 0.5);
}

.tm {
  font-size: 0.35em;
  vertical-align: super;
  opacity: 0.7;
}

.subtitle {
  font-size: 1rem;
  color: #aaa;
  margin-top: 4px;
  font-style: italic;
  font-family: sans-serif;
}

/* Question board */
#question-board {
  background: linear-gradient(180deg, #1e3a5f 0%, #0d1f33 100%);
  border: 4px solid #ffd700;
  border-radius: 12px;
  padding: 20px 30px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 0 15px rgba(255, 215, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.question-text {
  font-size: 1.3rem;
  line-height: 1.4;
  color: #fff;
  text-transform: uppercase;
}

/* Answer board */
#answer-board {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.answer-row {
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, #1e3a5f 0%, #142d4a 100%);
  border: 3px solid #ffd700;
  border-radius: 8px;
  height: 52px;
  overflow: hidden;
  cursor: default;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.answer-number {
  background: #ffd700;
  color: #1a0a2e;
  font-size: 1.2rem;
  font-weight: bold;
  width: 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.answer-text {
  flex: 1;
  padding: 0 16px;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.answer-count {
  background: #ffd700;
  color: #1a0a2e;
  font-size: 1.1rem;
  font-weight: bold;
  width: 50px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.answer-row.hidden-answer .answer-text,
.answer-row.hidden-answer .answer-count {
  visibility: hidden;
}

.answer-row.hidden-answer {
  background: linear-gradient(180deg, #2a1a4e 0%, #1a0a2e 100%);
}

.answer-row.revealed {
  animation: flipReveal 0.4s ease-out;
  background: linear-gradient(180deg, #2a5a2a 0%, #1a3a1a 100%);
  border-color: #5aff5a;
}

.answer-row.revealed-missed {
  animation: flipReveal 0.4s ease-out;
  background: linear-gradient(180deg, #5a2a2a 0%, #3a1a1a 100%);
  border-color: #ff6666;
}

.answer-row.revealed-missed .answer-text {
  color: #ff9999;
}

.answer-row.revealed-missed .answer-count {
  background: #ff6666;
}

@keyframes flipReveal {
  0% { transform: scaleY(0); }
  50% { transform: scaleY(1.1); }
  100% { transform: scaleY(1); }
}

/* Strikes */
#strikes-area {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.strike-x {
  width: 50px;
  height: 50px;
  border: 3px solid #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  color: transparent;
  transition: all 0.3s;
}

.strike-x.active {
  color: #ff3333;
  border-color: #ff3333;
  text-shadow: 0 0 10px rgba(255, 50, 50, 0.8);
  box-shadow: 0 0 12px rgba(255, 50, 50, 0.4);
}

/* Strike overlay */
#strike-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#strike-overlay .big-x {
  font-family: 'Bowlby One SC', cursive;
  font-size: 20rem;
  color: #ff3333;
  text-shadow:
    0 0 40px rgba(255, 50, 50, 0.8),
    0 0 80px rgba(255, 50, 50, 0.4);
  animation: strikeIn 0.3s ease-out;
}

@keyframes strikeIn {
  0% { transform: scale(3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#strike-overlay.hidden {
  display: none;
}

/* Input */
#input-area {
  display: flex;
  gap: 10px;
  width: 100%;
}

#guess-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 1.1rem;
  font-family: 'Russo One', sans-serif;
  border: 3px solid #ffd700;
  border-radius: 8px;
  background: #0d1f33;
  color: #fff;
  outline: none;
  text-transform: uppercase;
}

#guess-input:focus {
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

#guess-input:disabled {
  opacity: 0.5;
}

#guess-btn {
  padding: 12px 24px;
  font-size: 1.1rem;
  font-family: 'Russo One', sans-serif;
  background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
  color: #1a0a2e;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: transform 0.1s;
}

#guess-btn:hover {
  transform: scale(1.05);
}

#guess-btn:active {
  transform: scale(0.95);
}

#guess-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Score */
#score-area {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1.1rem;
  color: #ffd700;
}

/* Game over */
#game-over {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#game-over.hidden {
  display: none;
}

.game-over-content {
  background: linear-gradient(180deg, #1e3a5f 0%, #0d1f33 100%);
  border: 4px solid #ffd700;
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.game-over-content h2 {
  font-family: 'Bowlby One SC', cursive;
  font-size: 2rem;
  color: #ffd700;
  margin-bottom: 10px;
}

.game-over-content p {
  margin-bottom: 16px;
  color: #ccc;
  font-family: sans-serif;
}

#revealed-answers {
  text-align: left;
  margin: 16px 0;
}

#revealed-answers .reveal-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  font-size: 0.95rem;
}

#revealed-answers .reveal-row.was-found {
  color: #5aff5a;
}

#revealed-answers .reveal-row.was-missed {
  color: #ff6666;
}

/* Post-game area (below board) */
#post-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#post-game.hidden {
  display: none;
}

.next-puzzle-timer {
  font-size: 0.9rem;
  color: #aaa;
}

.next-puzzle-timer strong {
  color: #ffd700;
}

/* Stats button in header */
#stats-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#stats-btn:hover {
  opacity: 1;
}

/* Stats modal */
#stats-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

#stats-modal.hidden {
  display: none;
}

.stats-modal-content {
  background: linear-gradient(180deg, #1e3a5f 0%, #0d1f33 100%);
  border: 4px solid #ffd700;
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  position: relative;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.stats-modal-content h2 {
  font-family: 'Bowlby One SC', cursive;
  font-size: 1.5rem;
  color: #ffd700;
  margin-bottom: 16px;
}

.stats-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.stats-close:hover {
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.8rem;
  font-family: 'Bowlby One SC', cursive;
  color: #fff;
}

.stat-label {
  font-size: 0.7rem;
  color: #aaa;
  text-transform: uppercase;
  font-family: sans-serif;
}

.stats-extra {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #ccc;
  font-family: sans-serif;
}

.stats-extra strong {
  color: #ffd700;
}

#stats-history {
  max-height: 150px;
  overflow-y: auto;
  text-align: left;
  font-family: sans-serif;
  font-size: 0.8rem;
  color: #aaa;
}

#stats-history .history-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #1a0a2e;
}

#stats-history .history-row .history-score {
  color: #ffd700;
}

/* Share button */
.share-btn {
  padding: 10px 32px;
  font-size: 1rem;
  font-family: 'Russo One', sans-serif;
  background: linear-gradient(180deg, #5aff5a 0%, #2a8a2a 100%);
  color: #0d1f33;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  transition: transform 0.1s;
}

.share-btn:hover {
  transform: scale(1.05);
}

.share-btn:active {
  transform: scale(0.95);
}

/* Footer */
#site-footer {
  text-align: center;
  padding: 24px 16px 12px;
  font-family: sans-serif;
  font-size: 0.8rem;
  color: #555;
  width: 100%;
  max-width: 700px;
}

#site-footer a {
  color: #777;
  text-decoration: none;
  transition: color 0.2s;
}

#site-footer a:hover {
  color: #ffd700;
}

/* Mobile */
@media (max-width: 500px) {
  body {
    padding: 12px 8px;
  }

  .title {
    font-size: 2rem;
    letter-spacing: 2px;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  #question-board {
    padding: 14px 16px;
    border-width: 3px;
  }

  .question-text {
    font-size: 1rem;
  }

  .answer-row {
    height: 44px;
    border-width: 2px;
  }

  .answer-number {
    width: 32px;
    font-size: 1rem;
  }

  .answer-text {
    padding: 0 10px;
    font-size: 0.9rem;
  }

  .answer-count {
    width: 40px;
    font-size: 0.9rem;
  }

  .strike-x {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  #guess-input {
    padding: 10px 12px;
    font-size: 1rem;
    border-width: 2px;
  }

  #guess-btn {
    padding: 10px 16px;
    font-size: 1rem;
    letter-spacing: 1px;
  }

  #score-area {
    font-size: 0.95rem;
  }

  .game-over-content {
    padding: 20px 24px;
  }

  .game-over-content h2 {
    font-size: 1.5rem;
  }

  #strike-overlay .big-x {
    font-size: 12rem;
  }

  .stats-modal-content {
    padding: 20px 24px;
  }

  .stat-value {
    font-size: 1.4rem;
  }
}
