:root {
  --bg-color: #121213;
  --tile-border: #3a3a3c;
  --tile-active: #565758;
  --vowel-hint: #263849;
  --vowel-border: #3d5a73;
  --key-bg: #818384;
  --correct: #538d4e;       /* Green: Exact spot */
  --present: #b59f3b;       /* Yellow: Wrong spot, SAME word */
  --present-other: #d97706; /* Orange: Wrong spot, DIFFERENT word */
  --absent: #3a3a3c;        /* Gray: Not in phrase */
  --text-color: #ffffff;
}
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  }
  
  body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    padding: 8px 10px;
    overflow: hidden; /* Prevents accidental rubber-band scrolling */
    user-select: none;
  }
  
  header {
    width: 100%;
    max-width: 90vw;
    text-align: center;
    border-bottom: 1px solid var(--tile-border);
    padding-bottom: 10px;
    font-size: clamp(0.95rem, 4.2vw, 2rem);
    font-weight: 700;
    letter-spacing: clamp(0.03rem, 0.3vw, 0.1rem);
    white-space: nowrap;
  }
  
  /* Toast Notification */
  #toast-container {
    position: fixed;
    top: 70px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
  }
  
  .toast {
    background-color: #ffffff;
    color: #121213;
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    animation: fadeOut 2s forwards;
  }
  
  /* Dynamic Grid */
  #board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    width: 100%;
    padding: 0 8px;
  }

  #board {
      display: flex;
      flex-direction: column;
      gap: 5px;
      justify-content: center;
      align-items: center;
      width: 100%;
  }

  .row {
      display: grid;
      grid-template-columns: repeat(var(--cols, 5), 1fr);
      gap: 4px;
      justify-content: center;
  }

  .tile {
      /* Dynamically fits up to 15 columns inside 94vw without overflow */
      width: min(62px, calc((94vw - (var(--cols, 5) - 1) * 4px) / var(--cols, 5)));
      aspect-ratio: 1 / 1;
      border: 2px solid var(--tile-border);
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: clamp(0.8rem, calc(50vw / var(--cols, 5)), 2rem);
      font-weight: bold;
      text-transform: uppercase;
      transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  }

  .tile.space {
      border-color: transparent;
      background-color: transparent;
      pointer-events: none;
  }

  .tile.vowel-hint {
      background-color: var(--vowel-hint);
      border-color: var(--vowel-border);
  }
  
  .tile.filled {
    border-color: var(--tile-active);
    animation: pop 0.1s ease-in-out;
  }
  
  /* Tile & Key Status Colors */
  .tile.correct, .key.correct {
    background-color: var(--correct);
    border-color: var(--correct);
  }
  
  .tile.present, .key.present {
    background-color: var(--present);
    border-color: var(--present);
  }

  .tile.present-other, .key.present-other {
    background-color: var(--present-other);
    border-color: var(--present-other);
  }
  
  .tile.absent, .key.absent {
    background-color: var(--absent);
    border-color: var(--absent);
  }
  
  /* On-Screen Keyboard */
  #keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
  }
  
  .keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }
  
  .key {
    background-color: var(--key-bg);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    height: 58px;
    flex: 1;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: background-color 0.2s ease;
  }
  
  .key:active {
    opacity: 0.8;
  }
  
  .key.wide {
    flex: 1.5;
    font-size: 0.8rem;
  }
  
  /* Animations */
  @keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
  }
  
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
  }
  
  .shake {
    animation: shake 0.4s ease-in-out;
  }
  
  .flip {
    transform: rotateX(90deg);
  }
  
  @keyframes fadeOut {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
  }

  /* PLAY BUTTON */

  .play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--correct);
    color: var(--text-color);
    text-decoration: none; /* Removes default anchor underline */
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(83, 141, 78, 0.35);
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  }
  
  .play-btn:hover {
    background-color: #61a35b;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(83, 141, 78, 0.5);
  }
  
  .play-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(83, 141, 78, 0.3);
  }
  
  .play-icon {
    font-size: 0.85rem;
  }

/* SPARKLING SUCCESS MESSAGE */
/* Sparkling Disappearing Success Message */
.sparkle-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: linear-gradient(135deg, #255733, #538d4e, #b59f3b);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 16px 28px;
  border-radius: 999px;
  font-size: clamp(0.95rem, 3.8vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.04rem;
  display: none;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  z-index: 300;
  overflow: hidden;
  box-shadow: 0 0 32px rgba(83, 141, 78, 0.85), 0 8px 24px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.sparkle-banner.show {
  display: inline-flex;
  animation: sparklePopFade 3.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Shimmering light sweep across the pill */
.sparkle-banner::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.45),
    transparent
  );
  animation: shimmerSweep 1.4s ease-in-out infinite;
}

.sparkle {
  display: inline-block;
  font-size: 1.2rem;
  animation: twinkle 0.65s infinite alternate;
}

@keyframes sparklePopFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.92);
  }
}

@keyframes twinkle {
  from {
    transform: scale(0.8) rotate(-12deg);
    opacity: 0.65;
  }
  to {
    transform: scale(1.3) rotate(12deg);
    opacity: 1;
  }
}

@keyframes shimmerSweep {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Free-Falling Sparkle Particles */
.falling-sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 299;
  font-size: 1rem;
  user-select: none;
  animation: sparkleFreeFall var(--fall-duration, 2.2s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes sparkleFreeFall {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5) rotate(0deg);
  }
  15% {
    opacity: 1;
    transform: translate(calc(var(--drift-x, 0px) * 0.2), 15px) scale(1.1) rotate(45deg);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift-x, 0px), var(--fall-distance, 260px)) scale(0.4) rotate(240deg);
  }
}

/* =========================================
   MONETISATION / AD LAYOUT OVERRIDES
   (Only active when body has class "has-ads")
   ========================================= */

   .ad-banner-top {
    width: 100%;
    max-width: 728px;
    min-height: 50px; /* Mobile banner height */
    margin: 0 auto 6px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    /* Optional: remove background/border once live AdSense code is pasted */
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--tile-active);
  }
  
  @media (min-width: 768px) {
    .ad-banner-top {
      min-height: 90px; /* Desktop leaderboard height */
    }
  }
  
  /* Shift toast down only when top ad is active */
  body.has-ads #toast-container {
    top: 125px;
  }
  
  /* Cap tile vertical height only when top ad is active */
  body.has-ads .tile {
    width: min(56px, calc((94vw - (var(--cols, 5) - 1) * 4px) / var(--cols, 5)), 6.8vh);
    font-size: clamp(0.8rem, calc(45vw / var(--cols, 5)), 1.8rem);
  }

  /* =========================================
   SINGLE-LINE COMPACT FOOTER
   ========================================= */

#keyboard {
  padding-bottom: 4px; /* Slightly tighter gap above footer */
}

.site-footer {
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  color: #818384;
  letter-spacing: 0.03rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  padding-top: 2px;
}

.site-footer a {
  color: #818384;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--text-color);
}

/* =========================================
   PRIVACY POLICY MODAL POP-UP
   ========================================= */

   .modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.78);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 400;
    user-select: text; /* Allows users to read/copy policy text */
  }
  
  .modal-overlay.open {
    display: flex;
  }
  
  .modal-box {
    background-color: #1a1a1b;
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    animation: modalPop 0.2s ease-out;
  }
  
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--tile-border);
  }
  
  .modal-header h2 {
    font-size: 1rem;
    letter-spacing: 0.04rem;
    color: var(--text-color);
  }
  
  .modal-close {
    background: none;
    border: none;
    color: #818384;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
  }
  
  .modal-close:hover {
    color: var(--text-color);
  }
  
  .modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #d7dadc;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .modal-body a {
    color: #86efac;
    text-decoration: underline;
  }
  
  @keyframes modalPop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }

  /* =========================================
   THIN TOP NAVIGATION BAR
   ========================================= */

   .top-nav {
    width: 100%;
    max-width: 90vw;
    height: 36px; /* Increased slightly from 30px for easier mobile tapping */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 4px 4px;
    border-bottom: 1px solid rgba(58, 58, 60, 0.55);
    flex-shrink: 0;
  }


  .nav-left {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  @media (max-width: 400px) {
    .nav-group {
      gap: 4px;
    }
    .nav-divider {
      display: none; /* Hides vertical dividers on very small phones to save space */
    }
    .nav-btn {
      padding: 4px;
    }
    .nav-btn svg {
      width: 16px;
      height: 16px;
    }
    .nav-create-btn {
      font-size: 0.65rem;
      padding: 3px 7px;
    }
  }

.nav-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-btn {
  background: none;
  border: none;
  color: #818384;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-btn:hover {
  color: var(--text-color);
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-btn svg {
  width: 17px;
  height: 17px;
}

/* Adjust toast and tile height slightly to account for the 30px nav bar */
#toast-container {
  top: 100px;
}

body.has-ads #toast-container {
  top: 155px;
}

body.has-ads .tile {
  width: min(54px, calc((94vw - (var(--cols, 5) - 1) * 4px) / var(--cols, 5)), 6.4vh);
}

/* =========================================
   CREATE YOUR OWN MESSAGE PILL BUTTON
   ========================================= */

   .nav-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(83, 141, 78, 0.22); /* Subtle green tint matching --correct */
    border: 1px solid rgba(83, 141, 78, 0.65);
    color: #a7f3d0;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03rem;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  }
  
  .nav-create-btn:hover {
    background-color: var(--correct);
    border-color: var(--correct);
    color: #ffffff;
    transform: translateY(-1px);
  }
  
  .nav-create-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }
  
  /* Keep icons compact on narrow mobile screens (< 380px) so nothing wraps */
  @media (max-width: 380px) {
    .nav-group {
      gap: 8px;
    }
    .nav-create-btn {
      font-size: 0.65rem;
      padding: 3px 8px;
    }
  }


/* =========================================
   NAV SEPARATOR & COMPACT RIGHT GROUPING
   ========================================= */

.nav-group {
  gap: 10px;
}

.nav-divider {
  width: 1px;
  height: 15px;
  background-color: var(--tile-border);
  margin: 0 2px;
  flex-shrink: 0;
}

@media (max-width: 390px) {
  .nav-group {
    gap: 6px;
  }
  .nav-divider {
    margin: 0 1px;
  }
  .nav-create-btn {
    font-size: 0.66rem;
    padding: 3px 8px;
  }
}

/* =========================================
   NAV USER NAME & AUTH ICONS
   ========================================= */
   .nav-user-name {
    font-size: 0.74rem;
    font-weight: 600;
    color: #d7dadc;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(58, 58, 60, 0.8);
    padding: 2px 8px;
    border-radius: 999px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .nav-logout-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
  }
  
  .nav-logout-btn:hover {
    color: #f87171;
    background-color: rgba(248, 113, 113, 0.12);
  }
  
  @media (max-width: 390px) {
    .nav-user-name {
      max-width: 72px;
      font-size: 0.68rem;
      padding: 2px 6px;
    }
  }

  /* =========================================
   SUPERUSER DATE INPUT & DISABLED NAV BUTTON
========================================= */
#su-date-input {
  width: 100%;
  background-color: #121213;
  border: 1px solid var(--tile-border);
  border-radius: 6px;
  color: var(--text-color);
  padding: 10px 12px;
  font-size: 0.9rem;
  color-scheme: dark; /* Makes the browser calendar icon white on dark mode */
}

#su-date-input:focus {
  outline: none;
  border-color: var(--correct);
}

.nav-create-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  user-select: none;
}

.nav-create-btn.is-disabled:hover {
  background-color: rgba(83, 141, 78, 0.22);
  border-color: rgba(83, 141, 78, 0.65);
  color: #a7f3d0;
  transform: none;
}

#su-message-input,
#su-date-input {
  width: 100%;
  background-color: #121213;
  border: 1.5px solid var(--tile-border);
  border-radius: 6px;
  color: var(--text-color);
  padding: 10px 58px 10px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
  transition: border-color 0.15s ease;
}

#su-date-input {
  padding-right: 12px;
  text-transform: none;
  color-scheme: dark;
}

#su-message-input:focus,
#su-date-input:focus {
  outline: none;
  border-color: var(--correct);
}

  /* =========================================
   USER GREETING & HEADER WRAPPER
   ========================================= */
.title-block {
  width: 100%;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.user-greeting {
  font-size: clamp(0.75rem, 2.4vw, 0.85rem);
  font-weight: 600;
  color: #a0a0a5;
  letter-spacing: 0.04rem;
}

.user-greeting span {
  color: #86efac; /* Subtle Zest green accent matching your theme */
  font-weight: 700;
}

.nav-logout-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.nav-logout-btn:hover {
  color: #f87171;
  background-color: rgba(248, 113, 113, 0.12);
}

/* =========================================
   CREATE PUZZLE POPUP FORM
   ========================================= */
   .create-modal-box {
    max-width: 400px;
  }
  
  .create-hint {
    font-size: 0.84rem;
    color: #a0a0a5;
    line-height: 1.45;
  }
  
  #create-puzzle-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
  }
  
  .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
  }
  
  #custom-message-input {
    width: 100%;
    padding: 13px 58px 13px 14px;
    background-color: #121213;
    border: 1.5px solid #3a3a3c;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }
  
  #custom-message-input::placeholder {
    color: #565758;
    font-weight: 500;
    letter-spacing: 0.03rem;
    text-transform: none;
  }
  
  #custom-message-input:focus {
    outline: none;
    border-color: var(--correct);
    box-shadow: 0 0 0 3px rgba(83, 141, 78, 0.25);
  }
  
  .char-counter {
    position: absolute;
    right: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #818384;
    pointer-events: none;
  }
  
  .char-counter.limit {
    color: var(--present-other);
  }
  
  .create-error {
    display: none;
    font-size: 0.82rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 8px 12px;
    border-radius: 8px;
  }
  
  .btn-create-submit {
    width: 100%;
    padding: 12px 20px;
    border-radius: 999px;
    background-color: var(--correct);
    color: #ffffff;
    border: 1.5px solid var(--correct);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(83, 141, 78, 0.35);
    transition: transform 0.15s ease, background-color 0.2s ease;
  }
  
  .btn-create-submit:hover {
    background-color: #61a35b;
    transform: translateY(-1px);
  }

  /* =========================================
   GUEST POINTS PROMPT MODAL
   ========================================= */
.points-modal-box {
  max-width: 390px;
  text-align: center;
}

.points-modal-body {
  align-items: center;
  gap: 14px;
}

.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background-color: rgba(83, 141, 78, 0.22);
  border: 1px solid rgba(83, 141, 78, 0.65);
  color: #86efac;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.05rem;
}

.points-desc {
  font-size: 0.86rem;
  color: #c8c8ce;
  line-height: 1.5;
}

.btn-claim-points {
  width: 100%;
  padding: 12px 20px;
  border-radius: 999px;
  background-color: var(--correct);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03rem;
  box-shadow: 0 4px 14px rgba(83, 141, 78, 0.35);
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.btn-claim-points:hover {
  background-color: #61a35b;
  transform: translateY(-1px);
}

.btn-skip-points {
  background: none;
  border: none;
  color: #818384;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s ease;
}

.btn-skip-points:hover {
  color: #ffffff;
}

  /* =========================================
   DISABLED CREATE YOUR OWN BUTTON
   ========================================= */

.nav-create-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  user-select: none;
  /* Keep pointer-events active on a <span> so the native title tooltip shows on hover */
}

/* =========================================
   MOBILE RESPONSIVE & 2-ROW NAVBAR OVERRIDES
   ========================================= */

/* 1. Fix keyboard cutoff behind mobile browser toolbar */
body {
  height: 100vh; /* Fallback */
  height: 100dvh; /* Fits exact visible mobile viewport */
  overflow: hidden;
}

#board-container {
  flex-grow: 0;
  margin: auto 0;
  padding: 6px 8px;
}

/* 2. Mobile 2-Row Navbar & Compact Keyboard (Screens <= 600px) */
@media (max-width: 768px) {
  .top-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    height: auto;
    gap: 8px;
    padding: 4px 2px 8px 2px;
    border-bottom: none;
  }

  .nav-group {
    order: 1;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  .nav-group .nav-divider {
    display: none;
  }

  #btn-share {
    margin-left: auto;
  }

  .nav-left {
    order: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(58, 58, 60, 0.35);
  }

  #keyboard {
    gap: 5px;
    padding-bottom: 2px;
  }

  .keyboard-row {
    gap: 4px;
  }

  .key {
    height: 44px;
    font-size: 0.85rem;
  }

  .key.wide {
    font-size: 0.72rem;
  }
}

/* 4. Prevent iOS Safari Auto-Zoom on Modal Inputs */
#custom-message-input,
#su-message-input,
#su-date-input {
  font-size: 16px;
}

/* 5. Keep Sparkle Banner Inside Narrow Mobile Screens */
.sparkle-banner {
  max-width: 92vw;
  padding: 12px 18px;
  white-space: normal;
  text-align: center;
}

/* =========================================
   HOW TO PLAY MODAL STYLES
   ========================================= */
   .help-rules-list {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .vowel-badge {
    display: inline-block;
    background-color: var(--vowel-hint);
    border: 1px solid var(--vowel-border);
    color: #ffffff;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
  }
  
  .help-examples {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--tile-border);
    border-bottom: 1px solid var(--tile-border);
  }
  
  .help-example-row {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .help-example-row p {
    font-size: 0.82rem;
    line-height: 1.35;
  }
  
  .help-mini-tiles {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
  }
  
  .mini-tile {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--tile-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
    border-radius: 3px;
  }
  
  .mini-tile.correct {
    background-color: var(--correct);
    border-color: var(--correct);
  }
  
  .mini-tile.present {
    background-color: var(--present);
    border-color: var(--present);
  }
  
  .mini-tile.present-other {
    background-color: var(--present-other);
    border-color: var(--present-other);
  }
  
  .mini-tile.absent {
    background-color: var(--absent);
    border-color: var(--absent);
  }
  
  .help-footer-note {
    font-size: 0.8rem;
    color: #a0a0a5;
  }

  /* =========================================
   STATISTICS MODAL STYLES
   ========================================= */
.stats-modal-box {
  max-width: 400px;
}

.stats-points-pill {
  align-self: center;
  background-color: rgba(253, 224, 71, 0.12);
  border: 1px solid rgba(253, 224, 71, 0.4);
  color: #fde047;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
  padding: 6px 0 12px 0;
  border-bottom: 1px solid var(--tile-border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #a0a0a5;
  text-transform: uppercase;
  letter-spacing: 0.03rem;
}

.stats-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: #d7dadc;
  margin-bottom: 8px;
}

.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.dist-try {
  width: 12px;
  text-align: center;
  color: #a0a0a5;
}

.dist-bar-track {
  flex: 1;
}

.dist-bar-fill {
  min-width: 24px;
  background-color: var(--absent);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: right;
  transition: width 0.3s ease;
}

.dist-bar-fill.highlight {
  background-color: var(--correct);
}

.stats-guest-cta {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--tile-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.stats-guest-cta p {
  font-size: 0.78rem;
  color: #a0a0a5;
}

/* =========================================
   PUZZLE DATE & NUMBER SUBTITLE
   ========================================= */
   .puzzle-meta {
    font-size: clamp(0.68rem, 2.2vw, 0.78rem);
    font-weight: 500;
    color: rgba(160, 160, 165, 0.72);
    letter-spacing: 0.05rem;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
  }