* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
}

body {
  background: linear-gradient(180deg, #d9d9d9 0%, #bfbfbf 100%);
  color: #222;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

.game-wrapper {
  width: 100%;
  max-width: 700px;
}

.screen {
  width: 100%;
}
#game-screen,
#recap-screen,
#end-screen {
  max-width: 560px;
  margin: 0 auto;
}
.home-container {
  width: 100%;
}

.home-image-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 18px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.home-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.hotspot {
  position: absolute;
  display: block;
  z-index: 20;
  background: transparent;
}

.home-link { top: 0.5%; left: 0.5%; width: 11%; height: 7%; }
.leaderboard-link { top: 0.5%; left: 12%; width: 16%; height: 7%; }
.privacy-link { top: 0.5%; left: 28.5%; width: 21%; height: 7%; }
.terms-link { top: 0.5%; left: 49.5%; width: 19%; height: 7%; }
.about-link { top: 0.5%; left: 69%; width: 11%; height: 7%; }
.settings-link { top: 0.5%; left: 80%; width: 11%; height: 7%; }
.profile-link { top: 0.5%; left: 91%; width: 9%; height: 7%; }

.play-button {
  position: absolute;
  left: 50%;
  top: 80%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 11%;
  cursor: pointer;
  z-index: 30;
  border: none;
  background: transparent;
  padding: 0;
}

.contact-link {
  position: absolute;
  bottom: 2.5%;
  right: 1.5%;
  width: 26%;
  height: 6%;
  z-index: 20;
}

.card {
  background: linear-gradient(180deg, #f2f2f2 0%, #d8d8d8 100%);
  border-radius: 18px;
  padding: 24px;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  text-align: center;
}

.intro-card {
  margin-bottom: 20px;
}

h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 2.2rem;
}

h2 {
  margin-top: 0;
  margin-bottom: 14px;
}

.subtitle {
  margin-top: 0;
  margin-bottom: 22px;
  font-size: 1.05rem;
  color: #444;
}

.rules-box {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.rules-box p {
  margin: 10px 0;
  line-height: 1.45;
}

.top-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.hud-box {
  background: linear-gradient(180deg, #efefef 0%, #cfcfcf 100%);
  border-radius: 12px;
  padding: 12px 10px;
  font-weight: bold;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08),
    0 3px 8px rgba(0, 0, 0, 0.1);
}

.scramble-display {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 92px;
  margin-bottom: 24px;
}

.letter-tile {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f4f4 0%, #bdbdbd 100%);
  color: #222;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.7rem;
  font-weight: bold;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  user-select: none;
}

.input-area {
  margin-bottom: 16px;
}

#answer-input {
  width: 100%;
  max-width: 360px;
  padding: 14px 16px;
  font-size: 1.15rem;
  text-align: center;
  border: 2px solid #b5b5b5;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: #222;
}

#answer-input:focus {
  border-color: #888;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease;
}

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

.main-btn {
  background: linear-gradient(180deg, #3f3f3f 0%, #1f1f1f 100%);
  color: white;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.change-btn {
  color: white;
}

.change-btn.available {
  background: linear-gradient(180deg, #29b84a 0%, #168732 100%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.change-btn.used {
  background: linear-gradient(180deg, #d94747 0%, #a71f1f 100%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: not-allowed;
  opacity: 1;
}

button:disabled {
  cursor: not-allowed;
}


.recap-text {
  font-size: 1.08rem;
  line-height: 1.6;
  margin-bottom: 18px;
}

.countdown-text {
  font-size: 3rem;
  font-weight: bold;
  color: #222;
  min-height: 56px;
}

.final-score-line {
  font-size: 1.35rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.final-summary {
  margin-bottom: 22px;
  font-size: 1.05rem;
  color: #444;
}

@media (max-width: 640px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  .home-image-wrap,
  .home-image,
  .card {
    border-radius: 16px;
  }

  .home-image-wrap {
    margin-bottom: 14px;
  }

  .card {
    padding: 18px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .top-bar {
    grid-template-columns: 1fr;
  }

  .letter-tile {
    width: 52px;
    height: 52px;
    font-size: 1.45rem;
    border-radius: 10px;
  }

  #answer-input {
    font-size: 16px;
  }

  .countdown-text {
    font-size: 2.5rem;
  }

  .button-row {
    flex-direction: column;
    align-items: center;
  }

  .button-row button,
  .main-btn {
    width: 100%;
    max-width: 360px;
  }
}
/* REPLACE all existing .message styles with this */
.message {
  margin-top: 12px;
  min-height: 40px;
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
  opacity: 1;
}

.message.normal {
  color: #333;
}

.message.success {
  color: #00c853;
  text-shadow: 0 0 10px rgba(0, 200, 83, 0.75);
  animation: popFlash 0.55s ease;
}

.message.error {
  color: #ff1744;
  text-shadow: 0 0 10px rgba(255, 23, 68, 0.75);
  animation: shakeFlash 0.55s ease;
}

.warning {
  color: #c62828;
}

@keyframes popFlash {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }
  50% {
    transform: scale(1.22);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shakeFlash {
  0% { transform: translateX(0); opacity: 0; }
  20% { transform: translateX(-8px); opacity: 1; }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
  100% { transform: translateX(0); opacity: 1; }
}

/* POP EFFECT (CORRECT) */
@keyframes popFlash {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

/* SHAKE EFFECT (WRONG) */
@keyframes shakeFlash {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.brain-tagline {
  margin-top: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  color: #555;
  letter-spacing: 0.5px;
}
.brain-quote {
  margin-top: 25px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(0,195,255,0.08), rgba(255,255,255,0.05));
  border-left: 4px solid #00c3ff;
  border-radius: 8px;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #333;
}
body.contact-page {
  margin: 0;
  font-family: Arial, sans-serif;
  background: url("background.jpg") center center / cover no-repeat fixed;
  color: white;
  text-align: center;
}

body.contact-page .page-container {
  box-sizing: border-box;
  width: calc(100% - 30px);
  max-width: 600px;
  margin: 40px auto;
  padding: 30px 18px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 12px;
  overflow: hidden;
}

body.contact-page .page-container p {
  max-width: 100%;
  overflow-wrap: break-word;
  line-height: 1.4;
}

body.contact-page .page-container h1 {
  font-size: 38px;
}

body.contact-page .page-container a {
  color: #00ffcc;
  font-weight: bold;
}

body.contact-page .home-button {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 20px;
  background: #00ffcc;
  color: black !important;
  border-radius: 6px;
  text-decoration: none;
}

body.contact-page .ad-box iframe {
  max-width: 100%;
}

body.contact-page .bottom-ad iframe {
  max-width: 100%;
}

@media (max-width: 500px) {
  body.contact-page .page-container {
    width: calc(100% - 24px);
    padding: 24px 14px;
    margin: 30px auto;
  }

  body.contact-page .page-container p {
    font-size: 18px;
  }

  body.contact-page .page-container h1 {
    font-size: 34px;
  }
}