/* Box sizing + font smoothing */
* { box-sizing: border-box;}
html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* General layout */
body {
  font-family: 'Kanit', sans-serif;
  background: #e0e3e5;
  margin: 0;
  color: #000;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles - BLACK THEME */
body.dark-mode {
  background: #1a1a2e;
  color: #e0e0e0;
}

/* Three column layout */
.three-columns {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  justify-self: center;
  gap: 1rem;
  margin: 1rem auto;
  padding: 0 1rem;
  align-items: start;
}

/* Container */
.left-container {
  grid-column: 1;
  justify-self: center;
  padding: 2rem;
  background-color: transparent;
  color: inherit;
}

.container {
  grid-column: 2;
  width: 500px;
  padding: 1rem 2rem;
  background-color: transparent;
  justify-self: center;
  color: inherit;
}

.right-container {
  grid-column: 3;
  padding: 2rem;
  background-color: transparent;
  color: inherit;
}

/* ===== Header ===== */
.header-with-menu {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.header-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  color: inherit;
}

.header-controls {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 100%;
  width: 2.5rem;
  transition: background 0.2s ease;
  color: inherit;
}

.dark-mode-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.subtitle {
  font-size: 1rem;
  margin: 1.5rem 0 2rem 0;
  color: inherit;
  text-align: center;
}

/* Dropdown */
.dropdown {
  position: relative;
}
.menu-button {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 100%;
  width: 2.5rem;
  transition: background 0.2s ease;
  color: inherit;
}
.menu-button:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .menu-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Dropdown content */
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  background: #ffffff;
  border: 1px solid #000;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  min-width: 180px;
  z-index: 999;
}

body.dark-mode .dropdown-content {
  background: #2d2d44;
  border-color: #333;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.dropdown-content a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: #000;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
}

body.dark-mode .dropdown-content a {
  color: #e0e0e0;
}

.dropdown-content a:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .dropdown-content a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown.open .dropdown-content {
  display: block;
}

/* Disabled elements */
.disabled {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Input Section */
#input-section {
  margin: 1.5rem 0 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#input-section .game-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
  margin: 0;
}
#input-section input {
  /* width: 100%; */
  padding: 0.45rem 1rem;
  font-size: 1rem;
  border: 1.5px solid #000;
  border-radius: 8px;
  outline: none;
  transition: all 0.16s ease;
  background: #ffffff;
  color: #333;
}

#guessInput{
  font-weight: 500;
  font-family: 'Kanit', sans-serif;
}

#guessInput::placeholder {
  font-family: 'Kanit', sans-serif;
  color: #999;
}

body.dark-mode #input-section input {
  background: #2d2d44;
  color: #e0e0e0;
  border: 3px solid #e0e0e0;
}

input[disabled] {
  cursor: not-allowed;
  background-color: #f5f5f5;
  color: #999;               
}

body.dark-mode input[disabled] {
  background-color: #3a3a52;
  color: #666;               
}

.inline-warning {
  color: #b91c1c;
  font-size: 1rem;
  margin: 0.3rem;
  font-weight: 600;
}

body.dark-mode .inline-warning {
  color: #f87171;
}

/* Section Titles */
.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1.2rem 0 0.8rem 0;
  color: inherit;
  text-align: left;
}

/* Card (used for result rows) */
.card {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 7px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  overflow: hidden;
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border 0.18s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .card {
  background: #2d2d44;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.07);
}

body.dark-mode .card:hover {
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}

/* Info card */
.info-card {
  font-weight: 500;
  display: block;
  background: #ffffff;
  border: 1.5px solid #000;
  color: #000;
  font-size: 0.96rem;
  line-height: 1.5rem;
  padding: 1.2rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

body.dark-mode .info-card {
  background: #2d2d44;
  border-color: #e0e0e0;
  color: #e0e0e0;
}

/* Header with icon */
.how-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.how-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: inherit;
}

/* Question mark icon */
.help-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #000;
  font-weight: 700;
  color: #000;
  font-size: 0.95rem;
  flex-shrink: 0;
}

body.dark-mode .help-icon {
  border-color: #e0e0e0;
  color: #e0e0e0;
}

/* List styling */
.how-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.5rem;
}
.how-list li { margin-bottom: 0.5rem; }

/* Modal Styles */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.5);
  font-size: 0.96rem;
  line-height: 1.5rem;
  padding: 1.2rem 1.15rem;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.modal.hidden { display: none; }

.modal-content {
  background: #ffffff;
  border: 3px solid #000;
  color: #000;
  padding: 1.5rem;
  border-radius: 10px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  position: relative;
}

body.dark-mode .modal-content {
  background: #2d2d44;
  border-color: #e0e0e0;
  color: #e0e0e0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

.close-btn, .close-hint-btn {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}

body.dark-mode .close-btn,
body.dark-mode .close-hint-btn {
  color: #e0e0e0;
}

.close-btn:hover { color: #000; }

body.dark-mode .close-btn:hover,
body.dark-mode .close-hint-btn:hover {
  color: #ffffff;
}

/* Action buttons */
.action-buttons{
  align-self: center;
  gap: 0.1rem;
}
.action-btn {
  margin-top: 0.5rem;
  padding: 0.3rem 0.3rem;
  width: 5rem;
  font-family: 'Kanit', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  background: #ffffff;
  border: 1.5px solid #000;
  border-radius: 6px;
  cursor: pointer;
  color: #000;
}
.action-btn:hover {
  background: #000;
  color: #ffffff;
  border: 1px solid #000;
}

body.dark-mode .action-btn {
  background: #2d2d44;
  border: 1.2px solid #e0e0e0;
  color: #e0e0e0;
}

body.dark-mode .action-btn:hover {
  background: #e0e0e0;
  color: #2d2d44;
  border: 1px solid #e0e0e0;
}

/* Hint Modal */
.hint-btn {
  margin-top: 1rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: #facc15;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #000;
  transition: background 0.2s ease;
}
.hint-btn:hover {
  background: #fbbf24;
}
.hint-result {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
}

/* profile modal logout button */
.logout-btn {
  margin-top: 1rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: #000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #ffffff;
  transition: background 0.2s ease;
}

body.dark-mode .logout-btn {
  background: #e0e0e0;
  color: #2d2d44;
}

/* Giveup Modal */
.giveup-btn {
  margin-top: 1rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: #000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #ffffff;
  transition: background 0.2s ease;
}

#giveup-yes-btn {
    margin-right: 1.5rem;
  }

body.dark-mode .giveup-btn {
  background: #e0e0e0;
  color: #2d2d44;
}

/* Messages */
.message {
  padding: 0.8rem 1rem;
  font-size: 1rem;
  text-align: center;
  font-weight: 600;
}
.message.success {
  border: 2px solid #16a34a;
  color: #166534;
  background: #ffffff;
}

body.dark-mode .message.success {
  border-color: #4ade80;
  color: #bbf7d0;
  background: #2d2d44;
}

.message.error {
  border: 2px solid #dc2626;
  color: #991b1b;
  background: #ffffff;
}

body.dark-mode .message.error {
  border-color: #f87171;
  color: #fecaca;
  background: #2d2d44;
}

/* Highlight */
.highlight {
  border: 2px solid #000;
}

body.dark-mode .highlight {
  border-color: #e0e0e0;
}

/* Fill effect */
.result-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  z-index: 0;
  transition: width 0.36s ease;
}

/* Card content */
.result-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.word {
  font-weight: 500;
  font-size: 1rem;
  color: inherit;
}
.rank {
  color: inherit;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    font-size: 0.85rem;
    color: #64748b;
}

footer p{
  margin: 0.3rem;
}

body.dark-mode footer {
    color: #94a3b8;
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #000;
    text-decoration: underline;
}

body.dark-mode .footer-links a {
    color: #94a3b8;
}

body.dark-mode .footer-links a:hover {
    color: #e0e0e0;
}

.footer-links span {
    margin: 0 0.2rem;
    color: #94a3b8;
}

/* Social Links Styles */
.social-links {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.social-links .fab {
    font-size: 1.1rem;
}

.social-links span {
    color: #64748b;
    font-size: 0.85rem;
}

.social-links a {
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.2s, transform 0.2s;
    padding: 0.2rem;
}

.social-links a:hover {
    transform: scale(1.1);
    text-decoration: none;
}

/* Instagram hover effect */
.social-links a:nth-child(2):hover {
    color: #E4405F; /* Instagram color */
}

/* Facebook hover effect */
.social-links a:nth-child(4):hover {
    color: #1877F2; /* Facebook color */
}

/* Twitter hover effect */
.social-links a:nth-child(6):hover {
    color: #1DA1F2; /* Twitter color */
}

body.dark-mode .social-links a {
    color: #94a3b8;
}

body.dark-mode .social-links a:hover {
    color: #e0e0e0;
}

/* Keep brand colors in dark mode too */
body.dark-mode .social-links a:nth-child(2):hover {
    color: #E4405F;
}

body.dark-mode .social-links a:nth-child(4):hover {
    color: #1877F2;
}

body.dark-mode .social-links a:nth-child(6):hover {
    color: #1DA1F2;
}

.social-links .separator {
    margin: 0 0.2rem;
    color: #94a3b8;
}

/* Responsive Design */
@media (max-width: 480px) {
    .social-links {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    .social-links span:first-child {
        flex-basis: 100%;
        margin-bottom: 0.5rem;
    }
}

.hidden { display: none !important; }

/* For mobile devices */
@media (max-width: 600px) {
  .three-columns {
    display: inline;
    gap: 0.5rem;
    padding: 0 0.5rem;
    align-items: center;
    margin: 0;
  }
  
  .left-container {
    min-height: auto;
  }
  
  .container {
    grid-row: 2; /* Middle row */
    width: auto;
    padding: 0.5rem 2rem;
    justify-self: stretch; /* Take full width on mobile */
  }
  
  .right-container {
    display: none;
  }

  header h1 { 
    font-size: 1.6rem; 
  }

  .how-title { 
    font-size: 1rem; 
  }

  #input-section .game-info { 
    font-size: 0.8rem; 
    flex-direction: row; 
    gap: 0.35rem; 
    align-items: flex-start; 
  }

  .modal-content {
    max-height: 70vh;
  }
}

.loader-text {
  font-weight: 500;
  font-size: 1rem;
  color: inherit;
}

.wave-loader span {
  display: inline-block;
  animation: waviy 1.5s infinite;
  animation-delay: calc(0.05s * var(--i));
  position: relative;
  margin-right: -0.15rem;
}

#game-loader{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

@keyframes waviy {
  0%, 40%, 100% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-10px);
  }
}

.hidden {
  display: none;
}

/* 🎉 WIN SCREEN STYLE */
#win-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  background: #e0e3e5;
  z-index: 1000;
}

body.dark-mode #win-screen {
  background: #1a1a2e;
}

.win-card {
  background: #ffffff;
  border-radius: 0.5rem;
  padding: 2.5rem 2rem;
  max-width: 450px;
  width: 100%;
  text-align: center;
  animation: fadeInScale 0.4s ease forwards;
  border: 2px solid #000;
}

body.dark-mode .win-card {
  background: #2d2d44;
  border-color: #e0e0e0;
}

.win-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: inherit;
}

.win-card p {
  font-size: 1rem;
  margin: 0.6rem 0;
  color: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.win-card strong {
  font-weight: 700;
  color: inherit;
}

.play-again-text {
  margin-top: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: inherit;
}

.wins-previous-games {
  font-family: 'Kanit', sans-serif;
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.45rem 1rem;
  background: #fff;
  border: 1.5px solid #000;
  border-radius: 6px;
  color: #000;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  /* box-shadow: 0 3px 10px rgba(0,0,0,0.1); */
}

body.dark-mode .wins-previous-games {
  background: #e0e0e0;
  color: #2d2d44;
}

.wins-previous-games:hover {
  background: #000;
  color: #fff;
}

body.dark-mode .wins-previous-games:hover {
  background: #c0c0c0;
}

/* Secret Word Bold Styling */
.secret-word-bold {
    font-weight: 700 !important;
    font-size: 1em !important;
    text-transform: uppercase;
}

/* Share Results Section */
.share-results {
    padding: 1rem;
    background: rgba(100, 116, 139, 0.05);
    border-radius: 8px;
    border: 1px solid #000;
}

.share-text {
    margin: 0 0 0.8rem 0;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.share-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.share-btn .fab {
    font-size: 1rem;
    width: 16px;
    text-align: center;
}

.share-insta:hover {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white;
    border-color: transparent;
}

.share-fb:hover {
    background: #1877f2;
    color: white;
    border-color: transparent;
}

.share-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: transparent;
}

/* Dark Mode Styles */
body.dark-mode .share-results {
    background: rgba(148, 163, 184, 0.08);
    border-color: #fff;
}

body.dark-mode .share-text {
    color: #94a3b8;
}

body.dark-mode .share-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .share-insta:hover {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white;
    border-color: transparent;
}

body.dark-mode .share-fb:hover {
    background: #1877f2;
    color: white;
    border-color: transparent;
}

body.dark-mode .share-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: transparent;
}

/* Responsive Design */
@media (max-width: 480px) {
    .share-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .share-btn {
        justify-content: center;
        padding: 0.7rem 1rem;
    }
}

/* Guess distribution */
.guess-distribution {
    margin: 0.5rem 30%;
    padding: 1rem;
}

.distribution-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 200px;
    margin: 0 auto;
}

.distribution-row {
    display: flex;
    width: 100%;
}

.distribution-boxes {
    display: flex;
    gap: 0.5rem;
}

.distribution-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.green-box {
    background-color: #64b6ab;
}

.yellow-box {
    background-color: #e9c257;
}

.orange-box {
    background-color: #F59069;
}

.dark-mode .green-box {
    background-color: #64b6ab;
    border-color: #64b6ab;
}

.dark-mode .yellow-box {
    background-color: #e9c257;
    border-color: #e9c257;
}

.dark-mode .orange-box {
    background-color: #F59069;
    border-color: #F59069;
}

.distribution-count {
    font-size: 0.9rem;
    font-weight: 600;
    align-self: center;
    min-width: 30px;
    color: #374151;
}

.dark-mode .distribution-count {
    color: #d1d5db;
}

@media (max-width: 768px) {
  .guess-distribution {
    margin: 0.5rem 25%;
  }
}

/* Next game timer */
.next-game-timer {
  text-align: center;
  margin: 0.5rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 1px solid #000;
}

body.dark-mode .next-game-timer {
  background: rgba(45, 45, 68, 0.3);
  border-color: #fff;
}

.timer-title {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #666;
  font-weight: 600;
}

.timer-display {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  color: #64b6ab;
  letter-spacing: 2px;
}

.dark-mode .timer-display {
  color: #4ecdc4;
}

.dark-mode .timer-title {
  color: #ccc;
}

.next-game-timer.hidden {
  display: none;
}

/* 🎬 animation */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* Closest Words Modal Text Styling */
.closest-word-text {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.closest-word-text p {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: #000;
  line-height: 1.4;
}

body.dark-mode .closest-word-text p {
  color: #e0e0e0;
}

.closest-game-number {
  color: #000;
  font-weight: 800;
}

body.dark-mode .closest-game-number {
  color: #e0e0e0;
}

.closest-secret-word {
  color: #64b6ab;
  font-weight: 800;
  margin-left: 0.3rem;
}

body.dark-mode .closest-secret-word {
  color: #4a9c91;
}

.closest-word-text div {
  font-size: 0.95rem;
  color: #6b7280;
  font-weight: 600;
  margin-top: 0.5rem;
}

body.dark-mode .closest-word-text div {
  color: #94a3b8;
}

.closest-word-item {
  margin-bottom: 0.5rem;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

/* Closest Words Button Styling */
#closest-words-section {
  text-align: center;
  margin: 1.5rem 0;
  padding: 0 1rem;
}

.closest-words-btn {
  font-family: 'Kanit', sans-serif;
  padding: 0.45rem 1rem;
  background: #fff;
  color: #000;
  border: 1.5px solid #000;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.closest-words-btn:hover {
  background: #000;
  color: #fff;
}

.closest-words-btn:active {
  transform: translateY(0);
}

.closest-words-btn i {
  margin-right: 0.5rem;
}

/* Dark mode support */
body.dark-mode .closest-words-btn {
  background: #e0e0e0;
  color: #2d2d44;
}

body.dark-mode .closest-words-btn:hover {
  background: #c0c0c0;
}

/* Responsive design */
@media (max-width: 768px) {
  .closest-words-btn {
    padding: 0.65rem 1.2rem;
    font-size: 0.95rem;
  }
  
  .closest-word-text p {
    font-size: 1rem;
  }
  
  .closest-word-text div {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .closest-word-text {
    padding: 0 0.5rem;
  }
  
  .closest-word-text p {
    font-size: 0.95rem;
  }
  
  .closest-word-text div {
    font-size: 0.85rem;
  }
}

/* Previous game modal */
.previous-modal-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.3rem;
  color: inherit;
}

.previous-game-item {
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-weight: 600;
  transition: background 0.25s ease, transform 0.15s ease;
  border: 2px solid #000;
}

.previous-game-item:hover {
  background: #e0e3e5;
}

body.dark-mode .previous-game-item {
  background: #3a3a52;
  border-color: #e0e0e0;
}

body.dark-mode .previous-game-item:hover {
  background: #6a6a82;
}

.previous-game-date {
  flex: 1;
  font-size: 0.85rem;
  color: #000;
  font-weight: 600;
  text-align: left;
}

body.dark-mode .previous-game-date {
  color: #e0e0e0;
}

.previous-game-word {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: #000;
  text-align: center;
}

body.dark-mode .previous-game-word {
  color: #e0e0e0;
}

.previous-game-status {
  flex: 1;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
}

.previous-game-status span {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #000;
}

body.dark-mode .previous-game-status span {
  color: #e0e0e0;
}

/* Responsive previous games modal */
@media (max-width: 600px) {
  .previous-game-date {
  font-size: 0.7rem;
}
  
.previous-game-word {
  font-size: 0.8rem;
}

.previous-game-status span{
  font-size: 0.7rem;
}
}

/* STATS modal - Clean Design */
.stats-modal-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: inherit;
}

.stats-grid-modal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 0 auto;
}

.stat-box {
  border-radius: 8px;
  /* padding: 0.8rem 0.3rem; */
  border: 2px solid #000;
  text-align: center;
  color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 70px;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .stat-box {
  background: #2d2d44;
  color: #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid #fff;
}

body.dark-mode .stat-box:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-box h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.stat-box p {
  margin: 0;
  font-size: 0.7rem;
  color: #000;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

body.dark-mode .stat-box p {
  color: #a0a0a0;
}

/* Stats summary section */
.stats-summary {
  margin-top: 1rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: 8px;
  text-align: center;
  border: 2px solid #000;
}

body.dark-mode .stats-summary {
  background: #2d2d44;
  border: 1px solid #fff;
}

.stats-summary h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 900;
  color: #000;
}

body.dark-mode .stats-summary h4 {
  color: #e0e0e0;
}

.stats-summary p {
  margin: 0.3rem 0;
  font-size: 0.75rem;
  color: #000;
  font-weight: 500;
}

body.dark-mode .stats-summary p {
  color: #a0a0a0;
}

.win-rate {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: #64b6ab !important;
}

.giveup-rate {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: #b67764 !important;
}

body.dark-mode .win-rate {
  color: #4ade80 !important;
}

/* Stats Sign-in Prompt Styles */
.stats-signin-prompt {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.signin-icon {
  font-size: 3rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

body.dark-mode .signin-icon {
  color: #9ca3af;
}

.stats-signin-prompt h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 1rem;
}

body.dark-mode .stats-signin-prompt h3 {
  color: #e0e0e0;
}

.stats-signin-prompt p {
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

body.dark-mode .stats-signin-prompt p {
  color: #9ca3af;
}

.stats-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #000;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  margin-bottom: 1.5rem;
}

body.dark-mode .stats-signin-btn {
  background: #e0e0e0;
  color: #1a1a2e;
}

.stats-signin-btn:hover {
  background: #333;
  transform: translateY(-1px);
}

body.dark-mode .stats-signin-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.signin-note {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0;
}

body.dark-mode .signin-note {
  color: #9ca3af;
}

.signup-link {
  color: #000;
  text-decoration: underline;
  font-weight: 600;
}

body.dark-mode .signup-link {
  color: #e0e0e0;
}

.signup-link:hover {
  color: #333;
}

body.dark-mode .signup-link:hover {
  color: #ffffff;
}

/* Stats Error Styles */
.stats-error {
  text-align: center;
  padding: 2rem;
  color: #b91c1c;
}

body.dark-mode .stats-error {
  color: #fca5a5;
}

.stats-error i {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.stats-error h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.stats-error p {
  color: #6b7280;
}

body.dark-mode .stats-error p {
  color: #9ca3af;
}

@media (max-width: 600px) {
  .stats-grid-modal { 
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 0.5rem;
  }
  
  .stat-box {
    padding: 0.6rem 0.2rem;
    min-height: 60px;
  }
  
  .stat-box h3 {
    font-size: 1rem;
  }
  
  .stats-modal-title {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }
  
  .stats-summary {
    padding: 0.8rem;
    margin-top: 0.8rem;
  }
  
  .stats-summary h4 {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
  }
  
  .stats-summary p {
    font-size: 0.7rem;
    margin: 0.2rem 0;
  }
}

/* leaderboard modal */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.65rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

body.dark-mode .leaderboard-table {
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.1);
}

.leaderboard-table thead {
  background-color: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

body.dark-mode .leaderboard-table thead {
  background-color: #2d2d44;
  border-bottom-color: #333;
}

.leaderboard-table th {
  padding: 1rem 0.75rem;
  text-align: center;
  font-weight: 600;
  color: #374151;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.dark-mode .leaderboard-table th {
  color: #e0e0e0;
}

.leaderboard-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s ease;
  font-size: 0.7rem;
  text-align: center;
}

body.dark-mode .leaderboard-table td {
  border-bottom-color: #333;
}

.leaderboard-table tbody tr:hover {
  background-color: #f8fafc;
}

body.dark-mode .leaderboard-table tbody tr:hover {
  background-color: #3a3a52;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

/* Loading and error states */
.leaderboard-loading {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  font-style: italic;
}

body.dark-mode .leaderboard-loading {
  color: #888;
}

.leaderboard-error {
  text-align: center;
  padding: 3rem;
  color: #dc2626;
  background-color: #fef2f2;
  border-radius: 8px;
  margin: 1rem 0;
}

body.dark-mode .leaderboard-error {
  color: #f87171;
  background-color: #3a3a52;
}

.leaderboard-empty {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  background-color: #f9fafb;
  border-radius: 8px;
  margin: 1rem 0;
}

body.dark-mode .leaderboard-empty {
  color: #888;
  background-color: #2d2d44;
}

/* Responsive design */
@media (max-width: 600px) {
  .leaderboard-table {
    font-size: 0.8rem;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.75rem 0.5rem;
  }
}

/* FAQ Section */
.faq-section {
  margin-top: 2rem;
}
.faq-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: inherit;
}
.faq-item {
  margin-bottom: 0.5rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #000;
}

body.dark-mode .faq-item {
  border-color: #d1d5db;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 0.8rem 1rem;
  background: #fff;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  color: inherit;
}

body.dark-mode .faq-question {
  background: #2d2d44;
}

.faq-question.active { background: rgba(0, 0, 0, 0.05); }

body.dark-mode .faq-question.active { 
  background: rgba(255, 255, 255, 0.1); 
}

.faq-question:hover { background: rgba(0, 0, 0, 0.05); }

body.dark-mode .faq-question:hover { 
  background: rgba(255, 255, 255, 0.1); 
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 1rem;
  background: #ffffff;
  font-size: 0.9rem;
  line-height: 1.4rem;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: inherit;
}

body.dark-mode .faq-answer {
  background: #2d2d44;
}

.faq-answer.open {
  padding: 0.5rem 1rem 0.8rem 1rem;
  max-height: 500px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(224, 224, 224, 0.3);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(224, 224, 224, 0.5);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

body.dark-mode * {
  scrollbar-color: rgba(224, 224, 224, 0.3) transparent;
}

/* ===== CHRISTMAS THEME (TEMPORARY) ===== */
/* Remove this entire block after Christmas */

/* Christmas header with Santa hat */
body.christmas-theme .header-title {
  position: relative;
  display: inline-block;
}

body.christmas-theme .header-title::before {
  content: "🎅";
  position: absolute;
  left: -35px;
  top: -5px;
  font-size: 1.5rem;
  transform: rotate(-15deg);
}

body.christmas-theme .header-title::after {
  content: "🎄";
  position: absolute;
  right: -35px;
  top: -5px;
  font-size: 1.5rem;
  transform: rotate(15deg);
}

/* Christmas win screen */
body.christmas-theme .win-card::before,
body.christmas-theme .win-card::after {
  content: "🎁";
  position: absolute;
  font-size: 1.2rem;
  top: 10px;
}

body.christmas-theme .win-card::before {
  left: 10px;
}

body.christmas-theme .win-card::after {
  right: 10px;
}

/* Floating Christmas decorations */
body.christmas-theme::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.03;
}

/* Animated snowflakes */
@keyframes snowfall {
  0% { transform: translateY(-100px) rotate(0deg); }
  100% { transform: translateY(100vh) rotate(360deg); }
}

body.christmas-theme .snowflake {
  position: fixed;
  top: -50px;
  color: #c41e3a;
  font-size: 1rem;
  animation: snowfall linear infinite;
  pointer-events: none;
  z-index: 9999;
}

body.christmas-theme.dark-mode .snowflake {
  color: #ff6b6b;
}

/* Add some Christmas icons to section titles */
body.christmas-theme .section-title::before {
  content: "🎄 ";
}

body.christmas-theme .how-title::before {
  content: "🎁 ";
}

/* END CHRISTMAS THEME */