html, body {
  background: #ffe5d9;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: 'Roboto Slab', Arial Black, sans-serif;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: calc(100vh - 50px);
  height: calc(100dvh - 50px);
  margin-top: 50px;
  background: transparent;
  box-sizing: border-box;
  gap: 0;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 8px;
  z-index: 102;
  position: relative;
}

.mode-btn {
  background: #fff9ef;
  border: 2px solid #e5c9a8;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.mode-btn:hover {
  background: #f3e8d7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mode-btn.active {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Header Section */
.game-header {
  text-align: center;
  margin-top: 2px;
  margin-bottom: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  position: relative;
  z-index: 100;
}

.game-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 60px !important;
  font-weight: 900;
  color: #7c3aed;
  margin: 2px 0 2px 0;
  letter-spacing: 12px;
  text-shadow: none;
  border: none;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  position: relative;
  z-index: 101;
}

.game-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-size: 22.5px !important;
  font-weight: 700;
  color: #000;
}

.stat-value {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-size: 25px !important;
  font-weight: 700;
  color: #000;
}

.chain-svg {
  width: 16px !important;
  height: 16px !important;
}

/* Taptile Stats */
.taptile-stats {
  display: flex;
  gap: 20px;
}

/* Remove Taptile-specific font size overrides - use unified sizes */
/* .taptile-stats .stat-label {
  font-size: 16px !important;
}

.taptile-stats .stat-value {
  font-size: 18px !important;
}

.taptile-mode .game-stats .stat-label {
  font-size: 16px !important;
}

.taptile-mode .game-stats .stat-value {
  font-size: 18px !important;
}

.taptile-mode .chain-svg {
  width: 27.5px !important;
  height: 27.5px !important;
} */

.clock-icon {
  color: #000;
}

/* Playfield Container */
#playfield-container {
  width: 100%;
  height: 100%;
  max-width: 800px; /* Increased to fit larger playfield and tiles */
  max-height: calc(100vh - 250px);
  max-height: calc(100dvh - 250px);
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  margin: 0 auto;
}

/* Flash Message */
.flash-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  font-family: 'Roboto Slab', sans-serif;
  font-size: 18px;
  font-weight: 700;
  display: none;
  z-index: 1000;
  text-align: center;
  min-width: 200px;
}

/* Leaderboard Styles */
#leaderboard-content {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin: 8px 0;
  background: #fff9ef;
  border: 1px solid #e5c9a8;
  border-radius: 8px;
  font-family: 'Inter', Arial, sans-serif;
}

.leaderboard-rank {
  font-weight: 700;
  color: #7c3aed;
  min-width: 40px;
}

.leaderboard-name {
  flex: 1;
  margin: 0 16px;
  font-weight: 500;
}

.leaderboard-score {
  font-weight: 700;
  color: #222;
}

.leaderboard-time {
  font-size: 14px;
  color: #666;
  margin-left: 8px;
}

.loading {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

/* Responsive Design */
@media (max-width: 600px), (max-height: 900px) {
  html, body {
    overflow-y: hidden;
    height: 100%;
  }
  #main-content {
    margin-top: 50px !important;
    height: calc(100vh - 50px) !important;
    height: calc(100dvh - 50px) !important;
    overflow: visible !important;
  }
  .game-header {
    margin-top: 5px !important;
  }

  #playfield-container {
    min-height: 350px;
    height: auto;
    max-height: calc(100vh - 170px);
    max-height: calc(100dvh - 170px);
  }
  .game-title {
    font-size: 8vw !important;
    width: 100%;
    letter-spacing: 1vw;
    margin: 0 0 2px 0;
  }
  .game-stats {
    gap: 20px;
    margin-top: 2px;
  }
  .taptile-stats {
    gap: 15px;
  }
  /* Remove Taptile-specific responsive font size overrides - use unified sizes */
  /* .taptile-stats .stat-label {
    font-size: 14px !important;
  }
  .taptile-stats .stat-value {
    font-size: 16px !important;
  } */
}

@media (min-height: 800px) and (max-width: 430px) {
  #main-content {
    margin-top: 50px !important;
    height: calc(100vh - 50px) !important;
    height: calc(100dvh - 50px) !important;
  }
  .game-header {
    margin-top: 5px !important;
  }

  #playfield-container {
    min-height: 350px;
    height: auto;
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
  }
  .game-title {
    font-size: 7vw !important;
    letter-spacing: 0.8vw;
    margin: 0 0 3px 0;
  }
}

/* Force playfield visibility on all devices */
@media (max-height: 700px) {
  #main-content {
    margin-top: 50px !important;
    height: calc(100vh - 50px) !important;
    height: calc(100dvh - 50px) !important;
  }
  #playfield-container {
    height: calc(100vh - 150px);
    height: calc(100dvh - 150px);
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    min-height: 300px;
  }
  .game-title {
    font-size: 6vw !important;
    letter-spacing: 0.7vw;
    margin: 0 0 3px 0;
  }
  .game-stats {
    margin-top: 3px;
    gap: 15px;
  }
}

/* Mobile Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  #main-content {
    height: calc(100vh - 50px);
    height: calc(-webkit-fill-available - 50px);
    margin-top: 50px;
  }
  #playfield-container {
    max-height: calc(100vh - 250px);
    max-height: calc(-webkit-fill-available - 250px);
  }
}

/* iPhone 14 Pro Max and similar large mobile devices */
@media (max-width: 600px) and (min-height: 800px) {
  .game-header {
    margin-top: 5px !important;
  }
  
  .game-title {
    margin: -2px 0 3px 0;
  }
  
  .game-stats {
    margin-top: 2px;
  }
}

/* iPhone 14 Pro Max specific fixes */
@media screen and (max-width: 430px) and (min-height: 932px) {
  #main-content {
    margin-top: 50px !important;
    height: calc(100vh - 50px) !important;
    height: calc(100dvh - 50px) !important;
    padding-top: 0;
  }
  .game-header {
    margin-top: 5px !important;
    padding-top: 0 !important;
  }
  .game-title {
    font-size: 7.5vw !important;
    letter-spacing: 0.8vw;
    margin: 0 0 3px 0;
    line-height: 1.1;
  }
  .game-stats {
    margin-top: 2px;
    gap: 18px;
  }
  #playfield-container {
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px);
  }
}

/* Safe area support for all iOS devices */
@supports (padding: max(0px)) {
  #main-content {
    padding-top: max(50px, env(safe-area-inset-top));
    margin-top: 0 !important;
  }
  
  .game-header {
    padding-top: max(5px, env(safe-area-inset-top) - 45px);
  }
}

/* Additional fix for devices with dynamic island */
@media screen and (max-width: 430px) and (min-height: 932px) and (-webkit-device-pixel-ratio: 3) {
  #main-content {
    margin-top: 70px !important;
    height: calc(100vh - 70px) !important;
    height: calc(100dvh - 70px) !important;
  }
  
  .game-header {
    margin-top: 5px !important;
  }
  
  .game-title {
    margin: 0 0 5px 0;
  }
}


/* Unified Responsive Modal System */
.responsive-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 3000;
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.responsive-modal.show {
  display: flex;
}

/* Mobile: Slide-up modal */
@media (max-width: 600px) {
  .responsive-modal {
    align-items: flex-end;
    justify-content: center;
  }
  
  .responsive-modal-content {
    background: #fff5e1;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100vw;
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 18px 24px 18px;
    min-height: 220px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUpIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .responsive-modal-content.compact {
    padding: 24px 16px 20px 16px;
    min-height: 180px;
  }
  
  .responsive-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #7c3aed;
    cursor: pointer;
    z-index: 10;
    padding: 8px;
    line-height: 1;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
  
  .responsive-close-btn svg {
    width: 20px;
    height: 20px;
  }
  
  .responsive-close-btn:hover,
  .responsive-close-btn:focus {
    color: #b8860b;
    outline: none;
  }
}

/* Desktop: Centered modal */
@media (min-width: 601px) {
  .responsive-modal {
    align-items: center;
    justify-content: center;
  }
  
  .responsive-modal-content {
    background: #fff5e1;
    border: 3px solid #7c3aed;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUpIn 0.4s ease-out;
  }
  
  .responsive-modal-content.compact {
    max-width: 500px;
    padding: 30px;
  }
  
  .responsive-modal-content.standard {
    padding: 40px;
  }
  
  .responsive-modal-content.large {
    max-width: 700px;
    padding: 40px;
  }
  
  .responsive-close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #7c3aed;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
  }
  
  .responsive-close-btn:hover {
    background: rgba(124, 58, 237, 0.1);
  }
}

/* Modal Content Styles */
.modal-title {
  color: #7c3aed;
  font-size: 2.1rem;
  font-weight: bold;
  margin-bottom: 18px;
  letter-spacing: 0.08em;
  text-align: center;
}

.modal-stats {
  font-size: 1.2rem;
  color: #222;
  margin-bottom: 22px;
  text-align: center;
}

.modal-stats strong {
  color: #b8860b;
  font-weight: bold;
}

.modal-actions {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
  margin-top: 18px;
  width: 100%;
  flex-wrap: wrap;
}

.modal-btn {
  background: #ffe5d9;
  color: #7c3aed;
  border: 2px solid #7c3aed;
  border-radius: 8px;
  font-size: 1.1rem;
  font-family: 'Montserrat', 'Roboto Slab', sans-serif;
  font-weight: bold;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 120px;
}

.modal-btn:hover,
.modal-btn:focus {
  background: #7c3aed;
  color: #fff5e1;
  outline: none;
}

.modal-btn.primary {
  background: #7c3aed;
  color: #fff5e1;
}

.modal-btn.primary:hover,
.modal-btn.primary:focus {
  background: #6d28d9;
}

/* Mobile-specific adjustments */
@media (max-width: 600px) {
  .responsive-modal-content {
    padding: 24px 16px 20px 16px;
  }
  
  .modal-title {
    font-size: 1.8rem;
    margin-bottom: 16px;
  }
  
  .modal-stats {
    font-size: 1.1rem;
    margin-bottom: 18px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 12px;
  }
  
  .modal-btn {
    width: 100%;
    max-width: 200px;
    padding: 12px 24px;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Legacy modal classes - keep for backward compatibility but update to use responsive system */
.slideup-modal {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;
  background: rgba(0,0,0,0.18);
  z-index: 3000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  transition: background 0.2s;
}
.slideup-modal.show {
  display: flex;
}
.slideup-modal-content {
  background: #fff5e1;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100vw;
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 18px 24px 18px;
  min-height: 220px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideUpIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.slideup-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #7c3aed;
  cursor: pointer;
  z-index: 10;
  padding: 8px;
  line-height: 1;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.slideup-close-btn svg {
  width: 20px;
  height: 20px;
}
.slideup-close-btn:hover, .slideup-close-btn:focus {
  color: #b8860b;
  outline: none;
}



/* Help Button */
.help-btn {
  background: #7c3aed;
  color: #fff5e1;
  border: 2px solid #7c3aed;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  font-weight: bold;
  font-family: 'Arial', 'Helvetica', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 15px;
  transition: background 0.15s, color 0.15s;
}
.help-btn:hover, .help-btn:focus {
  background: #fff5e1;
  color: #7c3aed;
  outline: none;
}

/* Instructions Modal */
.instructions-content {
  max-width: 500px;
  text-align: left;
}
.instructions-text {
  font-size: 1rem;
  color: #222;
  margin-bottom: 22px;
  line-height: 1.5;
}
.instructions-text h3 {
  color: #7c3aed;
  font-size: 1.1rem;
  font-weight: bold;
  margin: 16px 0 8px 0;
  font-family: 'Montserrat', sans-serif;
}
.instructions-text h3:first-child {
  margin-top: 0;
}
.instructions-text p {
  margin: 6px 0;
  font-family: 'Arial', 'Helvetica', sans-serif;
}





/* Top Menu Bar */
.top-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 50px !important;
  min-height: 50px !important;
  background: #ffe5d9; /* Changed to match the pale peach background */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  box-shadow: none !important;
  padding: 0 12px !important;
  gap: 20px;
}

.menu-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}
.top-menu-btn {
  background: none;
  border: none;
  color: #7c3aed;
  font-size: 1.7rem;
  font-weight: bold;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.top-menu-btn:hover, .top-menu-btn:focus {
  background: #f3e3ff;
  outline: none;
}

.top-menu .menu-section {
  height: 40px !important;
  display: flex;
  align-items: center;
}

.top-menu .menu-button, .top-menu .menu-link {
  height: 40px !important;
  line-height: 40px !important;
  font-size: 18px !important;
  padding: 0 10px !important;
}

/* Daily Challenge Already Attempted Modal */
.daily-attempted-modal {
  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: 1000;
  animation: fadeIn 0.3s ease-out;
}

.daily-attempted-content {
  background: #fff9ef;
  border: 3px solid #e5c9a8;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUpIn 0.3s ease-out;
}

.daily-attempted-content h3 {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #7c3aed;
  margin: 0 0 15px 0;
}

.daily-attempted-content p {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  margin: 0 0 15px 0;
}

.todays-score {
  background: #f3e8d7;
  border: 2px solid #e5c9a8;
  border-radius: 12px;
  padding: 15px;
  margin: 15px 0;
}

.todays-score p {
  margin: 5px 0;
  font-weight: 500;
}

.todays-score strong {
  color: #7c3aed;
}

.daily-attempted-content .modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.daily-attempted-content .modal-btn {
  background: #fff;
  border: 2px solid #e5c9a8;
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.daily-attempted-content .modal-btn:hover {
  background: #f3e8d7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.daily-attempted-content .modal-btn.primary {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
}

.daily-attempted-content .modal-btn.primary:hover {
  background: #6d28d9;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Daily Leaderboard Modal */
.daily-leaderboard-modal {
  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: 1000;
  animation: fadeIn 0.3s ease-out;
}

.daily-leaderboard-content {
  background: #fff9ef;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUpIn 0.3s ease-out;
}

.daily-leaderboard-header {
  background: #7c3aed;
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 20px 20px 0 0;
}

.daily-leaderboard-header h3 {
  margin: 0;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 24px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.daily-leaderboard-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-height: 400px;
}

.daily-leaderboard-footer {
  padding: 20px;
  border-top: 1px solid #e5c9a8;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.daily-leaderboard-footer .modal-btn {
  padding: 12px 24px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid #e5c9a8;
  border-radius: 12px;
  background: #fff9ef;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.2s ease;
}

.daily-leaderboard-footer .modal-btn:hover {
  background: #f3e8d7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.daily-leaderboard-footer .modal-btn.primary {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
}

.daily-leaderboard-footer .modal-btn.primary:hover {
  background: #6d28d9;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.daily-leaderboard-footer .modal-btn + .modal-btn {
  margin-left: 12px;
}

/* Daily Leaderboard List Styles */
.daily-leaderboard-body .leaderboard-list {
  margin: 0;
}

.daily-leaderboard-body .leaderboard-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-leaderboard-body .leaderboard-entry {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5c9a8;
  transition: all 0.2s ease;
}

.daily-leaderboard-body .leaderboard-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.daily-leaderboard-body .rank {
  font-size: 18px;
  font-weight: 700;
  color: #7c3aed;
  text-align: center;
}

.daily-leaderboard-body .player-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.daily-leaderboard-body .details {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #666;
}

.daily-leaderboard-body .score {
  font-size: 18px;
  font-weight: 700;
  color: #7c3aed;
  text-align: right;
}

/* High Score Modal */
.high-score-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.high-score-content {
  background: linear-gradient(135deg, #fff9ef 0%, #f3e8d7 100%);
  border: 3px solid #7c3aed;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideUpIn 0.4s ease-out;
}

.high-score-header {
  margin-bottom: 25px;
}

.high-score-header h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #7c3aed;
  margin: 0 0 15px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-display {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-size: 48px;
  font-weight: 900;
  color: #7c3aed;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
  margin: 10px 0;
}

.high-score-stats {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #e5c9a8;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  padding: 5px 0;
}

.stat-label {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-align: left;
}

.stat-value {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #7c3aed;
  text-align: right;
}

.high-score-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
  flex-wrap: wrap;
}

.high-score-actions .modal-btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 25px;
  border: 2px solid;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', Arial, sans-serif;
  min-width: 140px;
}

.high-score-actions .modal-btn.primary {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.high-score-actions .modal-btn.primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.high-score-actions .modal-btn:not(.primary) {
  background: transparent;
  color: #7c3aed;
  border-color: #7c3aed;
}

.high-score-actions .modal-btn:not(.primary):hover {
  background: #7c3aed;
  color: white;
  transform: translateY(-2px);
}

/* Leaderboard Content */
.leaderboard-header {
  margin-bottom: 20px;
  text-align: center;
}

.leaderboard-header h3 {
  margin: 0;
  color: #7c3aed;
  font-size: 1.2em;
}

.leaderboard-list {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #e9ecef;
}

.leaderboard-entry.top-three {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border-left-color: #fdcb6e;
}

.leaderboard-entry:nth-child(1) {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border-left-color: #ffc107;
}

.leaderboard-entry:nth-child(2) {
  background: linear-gradient(135deg, #c0c0c0, #e9ecef);
  border-left-color: #6c757d;
}

.leaderboard-entry:nth-child(3) {
  background: linear-gradient(135deg, #cd7f32, #d4a574);
  border-left-color: #8b4513;
}

.rank {
  font-weight: bold;
  font-size: 1.1em;
  color: #495057;
  min-width: 40px;
}

.player-info {
  flex: 1;
  margin: 0 12px;
}

.player-name {
  font-weight: 600;
  color: #212529;
  margin-bottom: 2px;
}

.player-stats {
  font-size: 0.85em;
  color: #6c757d;
}

.score {
  font-weight: bold;
  font-size: 1.2em;
  color: #7c3aed;
  min-width: 60px;
  text-align: right;
}

.loading, .error, .no-scores {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.error {
  color: #dc3545;
}

/* Name Input Modal */
.name-input-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.name-input-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.name-input-content h3 {
  margin: 0 0 15px 0;
  color: #7c3aed;
  font-size: 1.4em;
}

.name-input-content p {
  margin: 0 0 20px 0;
  color: #495057;
  font-size: 1.1em;
}

.input-group {
  margin-bottom: 25px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #495057;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: #7c3aed;
}

/* Mobile responsive adjustments for existing modals */
@media (max-width: 600px) {
  .daily-attempted-content {
    padding: 20px;
    margin: 20px;
  }
  
  .daily-attempted-content h3 {
    font-size: 20px;
  }
  
  .daily-attempted-content p {
    font-size: 14px;
  }
  
  .daily-attempted-content .modal-actions {
    flex-direction: column;
  }
  
  .daily-leaderboard-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .daily-leaderboard-header {
    padding: 16px;
  }
  
  .daily-leaderboard-header h3 {
    font-size: 20px;
  }
  
  .daily-leaderboard-body {
    padding: 16px;
    max-height: 300px;
  }
  
  .daily-leaderboard-footer {
    padding: 16px;
    flex-direction: column;
  }
  
  .daily-leaderboard-body .leaderboard-entry {
    grid-template-columns: 50px 1fr 70px;
    gap: 8px;
    padding: 10px 12px;
  }
  
  .daily-leaderboard-body .rank {
    font-size: 16px;
  }
  
  .daily-leaderboard-body .player-name {
    font-size: 14px;
  }
  
  .daily-leaderboard-body .score {
    font-size: 16px;
  }
  
  .daily-leaderboard-body .details {
    font-size: 11px;
    gap: 12px;
  }
  
  .high-score-content {
    padding: 20px;
    margin: 20px;
  }
  
  .high-score-header h2 {
    font-size: 24px;
  }
  
  .score-display {
    font-size: 36px;
  }
  
  .high-score-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .high-score-actions .modal-btn {
    width: 100%;
    max-width: 200px;
  }
  
  .top-menu {
    height: 50px;
    padding: 0 8px;
    justify-content: center;
    gap: 15px;
  }
  
  .mode-selector {
    gap: 6px;
  }
  
  .mode-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .menu-buttons {
    gap: 8px;
  }
}

/* Confetti Animation */
@keyframes confetti-fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

#leaderboard-btn svg {
  vertical-align: middle;
  display: inline-block;
  margin-top: -1px; /* Move up slightly for perfect alignment */
}

