body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #121212;
    color: white;
    margin: 0;
}
button {
  touch-action: manipulation;
}
#board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    margin: 0 0 20px 0;
}

.row {
    display: grid;
    grid-template-columns: repeat(6, 52px);
    gap: 5px;
    justify-content: center;
    perspective: 300px;
}

.tile {
    width: 52px;
    height: 50px;
    border: 2px solid #444;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    background: #222;
    color: white;
}

.green {
    background: #538d4e;
}

.orange {
    background: #b59f3b;
}

.grey {
    background: #3a3a3c;
}
#shareImageBtn {
    margin-top: 20px;
    height: 40px;
    width: 200px;
    border-radius: 20px;
    outline: none;
    border: none;
    background: #ffffff;
}
#keyboard {
    display: flex;
    flex-wrap: wrap;
    max-width: 540px;
    justify-content: center;
    gap: 5px;
}
.keyboard-row {
    display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
}
.keyboard-row:last-of-type {
    width: 100%;
}
.key {
    padding: 14px 16px;
    border: none;
    background: #666;
    color: white;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
        width: 44px;
    height: 44px;
}

.key.used {
    background: #444;
}
.key.wide {
  flex: 1 1 100%;
  padding: 10px 0;
  font-size: 20px;
        background: green;
    height: 50px;
}
.key.wide:last-of-type {
   background: #9d1414;
}
#score {
    margin-top: 20px;
}

.key.green {
  background-color: #538d4e !important;
  color: white;
}

.key.orange {
  background-color: #b59f3b !important;
  color: white;
}

.key.grey {
  background-color: #3a3a3c !important;
  color: white;
}
#showHintBtn {
width: 140px;
    height: 30px;
    outline: none;
    border-radius: 0;
    border: none;
}
  #resultGrid .row {
      pointer-events: none;
    }

    #hintText {
      color: #ccc;
      font-style: italic;
    }

    button {
      cursor: pointer;
    }
  #stats {
      margin-top: 30px;
     
      background: #1e1e1e;
      
      border-radius: 8px;
      max-width: 300px;
      margin-left: auto;
      margin-right: auto;
    }
    #stats h3 {
      margin-bottom: 10px;
      color: #eee;
    }
    #stats div {
      margin: 4px 0;
      font-size: 16px;
    }
    #stats div:last-child {
      font-weight: bold;
      color: #ccc;
    }
div#stats > * {
    padding: 5px 30px;
}

#showHintBtnModal {
 padding: 6px;
    border-radius: 27px;
    outline: none;
    border: none;
    margin-bottom: 5px;
    background: green;
    color: #fff;
    width: 150px;
    height: 40px;
    box-shadow: 0 0 10px 10px #00000026;
}
@keyframes pop {
  0%   { transform: scale(0); opacity: 0; }
  80%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

#hintIconBtn.pop-animate {
  animation: pop 0.4s ease-out;
}

#leaderboardContent {
    margin-top: 10px;
    text-align: left;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
        margin: auto;
    padding: 15px 25px;
    background: #333;
    box-sizing: border-box;
    border-radius: 20px;
    box-shadow: 0 0 10px 10px #0000003d;
        min-height: 300px;
}
@media only screen and (max-width: 768px) {
    #keyboard {
    flex-wrap: wrap;
    max-width: 100%;
    justify-content: center;
    gap: 2px;
}
    .keyboard-row {
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    width: 100%;
}
.key:not(.key.wide) {
    padding: 0px 0px;
    border: none;
        border-radius: 2px;
    background: #666;
    color: white;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    width: 100%;
        max-width: 30px;
    height: 40px;
}
    .keyboard-row:last-of-type {
    width: 100%;
    flex-wrap: nowrap;
    padding: 0 2px;
}
}

/* Add these animations to your CSS */
/* Option 1: Fade-in with slight drop */
@keyframes typeLetter {
  0% { transform: translateY(-10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Option 2: Bounce effect */
@keyframes typeLetter {
  0% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
  75% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

/* Option 3: Flip reveal */
@keyframes typeLetter {
  0% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

/* Option 4: Pulse with color change */
@keyframes typeLetter {
  0% { background-color: #444; transform: scale(0.95); }
  50% { background-color: #666; transform: scale(1.05); }
  100% { background-color: #222; transform: scale(1); }
}

/* Option 5: Slide in from right */
@keyframes typeLetter {
  0% { transform: translateX(10px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* Choose one of the above animations and use it with this class */
.tile-animate {
  animation: typeLetter 0.2s ease-out;
}

@keyframes deleteLetter {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@keyframes success {
  0% { transform: scale(1); }
  50% { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.row-delete-animate {
  animation: deleteLetter 0.15s ease-in-out;
}

.success-animate {
  animation: success 0.5s ease-in-out;
}

/* Fireworks animation */
.firework {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.6) 100%);
}

.firework-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 6px 1px rgba(255,255,255,0.9);
  animation: firework-explode 1s ease-out forwards;
}

@keyframes firework-explode {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty));
    opacity: 0;
  }
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Shake animation for invalid input */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.shake {
  animation: shake 0.4s ease-in-out;
}

/* Profile modal */
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  margin: 0 auto 10px;
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.profile-stat-item {
  background: #333;
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
}
.profile-stat-value {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}
.profile-stat-label {
  font-size: 10px;
  color: #888;
  margin-top: 3px;
}

/* Loading screen */
#loadingScreen {
  position: fixed;
  inset: 0;
  background: #121212;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#loadingScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}

@keyframes loadingTileIn {
  0%   { transform: scale(0) rotateX(90deg); opacity: 0; }
  65%  { transform: scale(1.18) rotateX(0deg); opacity: 1; }
  100% { transform: scale(1) rotateX(0deg); opacity: 1; }
}

.loading-tile {
  width: 50px;
  height: 50px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  opacity: 0;
  animation: loadingTileIn 0.5s ease forwards;
}

@keyframes loadingDotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.75); }
  40%           { opacity: 1;    transform: scale(1); }
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #538d4e;
  animation: loadingDotPulse 1.2s ease-in-out infinite;
}

/* Tile flip animation */
@keyframes tileFlip {
  0%   { transform: rotateX(0deg) scale(1);     animation-timing-function: ease-in; }
  50%  { transform: rotateX(-90deg) scale(0.96); animation-timing-function: ease-out; }
  100% { transform: rotateX(0deg) scale(1); }
}

.tile.flipping {
  animation: tileFlip 0.42s linear forwards;
  border-color: #666;
}

.tile.green  { border-color: #538d4e; }
.tile.orange { border-color: #b59f3b; }
.tile.grey   { border-color: #3a3a3c; }

/* ── Day Hero ────────────────────────────────────────── */
#dayHeroSection { padding: 4px 12px 8px; width: 100%; box-sizing: border-box; max-width: 360px; margin: 0 auto; }

.day-hero-card {
  background: linear-gradient(135deg, #1f1800 0%, #2a2000 100%);
  border: 1px solid #ffd70033;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 0 12px rgba(255,215,0,0.08);
}
.day-hero-label {
  font-size: 11px;
  font-weight: bold;
  color: #ffd700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.day-hero-body {
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-hero-info { flex: 1; min-width: 0; }
.day-hero-name { font-size: 15px; font-weight: bold; color: #fff; }
.day-hero-sub { font-size: 12px; color: #aaa; margin-top: 2px; }
.day-hero-streak { font-size: 11px; color: #ff9500; margin-top: 4px; font-weight: bold; }

/* ── Leaderboard ──────────────────────────────────────── */
.lb-tab { padding:6px 14px;border:none;border-radius:20px;cursor:pointer;font-size:13px;background:#333;color:#aaa;transition:background 0.15s,color 0.15s; }
.lb-tab.active { background:#538d4e;color:#fff;font-weight:bold; }
.lb-tab.hof-tab { background:#4a3200;color:#ffd700; }
.lb-tab.hof-tab.active { background:#7a5200;outline:1px solid #ffd70055; }

.lb-row { display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;margin-bottom:4px;transition:background 0.1s; }
.lb-row:hover { background:#2a2a2a; }
.lb-you { background:#1a2e1a !important;outline:1px solid #538d4e44; }
.lb-top1 { background:#1f1a00; }
.lb-top2 { background:#181818; }
.lb-top3 { background:#141210; }
.lb-rank-num { width:30px;text-align:center;font-size:13px;color:#555;flex-shrink:0; }
.lb-avatar { width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:bold;color:#fff;flex-shrink:0; }
.lb-name { flex:1;font-size:14px;font-weight:bold;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.lb-name-you { color:#6abf69; }
.lb-score { font-size:12px;color:#888;text-align:right;flex-shrink:0;line-height:1.4; }
.lb-score strong { color:#fff;font-size:15px;display:block; }
.lb-score strong small { font-size:11px;color:#aaa;font-weight:normal; }
.lb-season-label { font-size:11px;color:#666;text-align:center;margin-bottom:12px;letter-spacing:0.5px;text-transform:uppercase; }
.lb-your-rank { margin-top:12px;padding:8px;background:#1a2e1a;border-radius:8px;font-size:13px;color:#6abf69;text-align:center; }
.lb-hof-season { font-size:11px;font-weight:bold;color:#ffd700;letter-spacing:0.5px;padding:12px 0 6px;border-bottom:1px solid #333;margin-bottom:4px; }
.lb-hof-season:first-child { padding-top:0; }

/* ── Keyboard action buttons ──────────────────────────── */
.key-enter { background:#538d4e !important;color:#fff !important; }
.key-enter:active { background:#3a6b3a !important; }
.key-delete { background:#3d1f1f !important;color:#ff7b7b !important; }
.key-delete:active { background:#2a1010 !important; }

/* ── Modal close button ───────────────────────────────── */
.modal-close { position:absolute;top:12px;right:12px;width:28px;height:28px;border-radius:50%;border:none;background:rgba(255,255,255,0.08);color:#bbb;font-size:13px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background 0.15s,color 0.15s; }
.modal-close:hover { background:rgba(255,255,255,0.2);color:#fff; }

/* ── Emoji avatar picker ──────────────────────────────── */
.emoji-picker-grid { display:flex;flex-wrap:wrap;gap:5px;justify-content:center;padding:8px 4px 4px; }
.emoji-opt { font-size:22px;padding:5px;border-radius:8px;cursor:pointer;border:2px solid transparent;transition:border-color 0.1s,background 0.1s;line-height:1; }
.emoji-opt:hover,.emoji-opt.selected { border-color:#538d4e;background:#1a2e1a; }
.profile-avatar { cursor:pointer; }
