/* GLOBAL */
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(#dff2ff, #fdfdfd);
  font-family: Arial, sans-serif;
  color: #1b1b1b;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* HOME SCREEN */
#home-screen {
  text-align: center;
  margin-top: 40px;
}

#main-title {
  margin: 0;
  font-size: 32px;
  letter-spacing: 1px;
  color: #22303c;
}

#main-subtitle {
  margin: 8px 0 24px;
  font-size: 14px;
  color: #66758a;
}

#home-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* BUTTONS */
.primary-btn {
  width: 100%;
  max-width: 320px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #4aa4ff, #276edb);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.secondary-btn {
  width: 100%;
  max-width: 320px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #4a90e2;
  font-size: 16px;
  color: #276edb;
  background: white;
}

/* Bigger home button */
.home-btn {
  background: white;
  border-radius: 10px;
  border: 1px solid #4a90e2;
  color: #276edb;
  font-size: 16px;
  padding: 6px 12px;
}

/* TOP BAR */
.top-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 4px;
}

/* GAME SCREEN */
#game-screen {
  margin-top: 8px;
  text-align: center;
}

#game-heading {
  margin: 4px 0 0;
  font-size: 22px;
  color: #22303c;
}

#puzzle-label {
  margin: 2px 0 12px;
  font-size: 13px;
  color: #6c7a8b;
}

/* TIMER ABOVE CLUE */
#timer {
  font-size: 14px;
  color: #2d3b47;
  text-align: center;
  margin-bottom: 4px;
}

/* CLUE BOX */
#clue-box {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

#clue {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
  color: #293441;
}

/* ANSWER ROW */
#answer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

#answer {
  flex: 1;
  padding: 12px;
  font-size: 18px;
  border-radius: 10px;
  border: 1px solid #b9c3d1;
}

#submit-answer {
  padding: 12px 15px;
  font-size: 16px;
  border-radius: 10px;
  border: none;
  background: #4a90e2;
  color: white;
}

#result {
  margin-top: 8px;
  min-height: 24px;
  font-size: 16px;
}

/* PLAY AREA: centered stack of rungs */
#play-area {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

#stack-area {
  width: 70%;
  max-width: 260px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;  /* center the group initially */
  align-items: center;
  gap: 8px;
}

/* Each answer = "rung" with a subtle line behind it */
.rung-word {
  position: relative;
  background: linear-gradient(#ffffff, #e6ebf3);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: bold;
  color: #2d3b47;
  box-shadow: 0 3px 6px rgba(0,0,0,0.14);
  animation: rungSlideUp 0.5s ease-out;  /* smooth climb */
}

/* Rung line behind word */
.rung-word::before {
  content: "";
  position: absolute;
  left: -24px;
  right: -24px;
  height: 2px;
  background: #c6d0e0;
  top: 50%;
  transform: translateY(-50%);
  z-index: -1;
}

/* Smooth upward slide on new answer */
@keyframes rungSlideUp {
  0% {
    transform: translateY(14px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* INPUT SHAKE ON WRONG */
.shake {
  animation: shakeAnim 0.2s ease-in-out 2;
}

@keyframes shakeAnim {
  0% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  100% { transform: translateX(0px); }
}

/* ARCHIVE SCREEN */
#archive-screen {
  margin-top: 8px;
}

#archive-subtitle {
  margin: 0 0 12px;
  font-size: 14px;
  color: #66758a;
}

#archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-item-btn {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid #b9c3d1;
  background: white;
  padding: 10px;
  font-size: 14px;
}

.archive-item-title {
  font-weight: bold;
  color: #22303c;
}

.archive-item-sub {
  font-size: 12px;
  color: #6c7a8b;
}

/* HOW TO PLAY MODAL */
#howto-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#howto-modal {
  max-width: 360px;
  width: 90%;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  text-align: left;
  animation: fadeInModal 0.2s ease-out;
}

#howto-modal h2 {
  margin-top: 0;
  margin-bottom: 8px;
  text-align: center;
}

#howto-modal p {
  font-size: 14px;
  color: #344454;
  margin-top: 4px;
}

#howto-modal ul {
  padding-left: 20px;
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

#howto-modal .primary-btn {
  width: 100%;
}

/* Modal animation */
@keyframes fadeInModal {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}