/* 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: #f6f4ef;
  margin: 0;
  color: #000;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles for about page */
body.dark-mode {
  background: #13141c;
  color: #e0e0e0;
}

.about-wrapper {
  max-width: 800px;
  margin: 80px auto;
  padding: 0 20px;
}

.about-wrapper h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode .about-wrapper h1 {
  color: #e0e0e0;
}

.about-wrapper h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2.2rem;
  margin-bottom: 0.75rem;
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode .about-wrapper h2 {
  color: #e0e0e0;
}

.about-wrapper p,
.about-wrapper ul {
  font-size: 1rem;
  line-height: 1.65;
  color: #403f3f;
  margin: 0.5rem 0 1rem;
  transition: color 0.3s ease;
}

body.dark-mode .about-wrapper p,
body.dark-mode .about-wrapper ul {
  color: #d0d0d0;
}

.about-wrapper ul {
  list-style: disc;
  padding-left: 1.5rem;
}

.about-wrapper ul li {
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

body.dark-mode .about-wrapper ul li {
  color: #d0d0d0;
}

.intro {
  font-size: 1.05rem;
  text-align: center;
  margin-bottom: 2rem;
  color: #3a3a3a;
  transition: color 0.3s ease;
}

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

/* Footer */
footer {
    text-align: center;
    background-color: #facb1c;
    padding: 1rem;
    font-size: 0.85rem;
    color: #000;
}

footer p{
  margin: 0.3rem;
}

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

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

.footer-links a {
    color: #000;
    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: #000;
    font-size: 0.85rem;
}

.social-links a {
    color: #000;
    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 span {
    color: #94a3b8;
}

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

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

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

/* Responsive */
@media (max-width: 600px) {
  .about-wrapper {
    margin: 60px 15px;
  }

  .about-wrapper h1 {
    font-size: 1.7rem;
  }

  .about-wrapper h2 {
    font-size: 1.2rem;
  }
}

/* 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;
  font-weight: 700;
  color: #000;
  font-size: 1.3rem;
  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; }

/* Points System Styling in How to Play */
.points-system {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(100, 182, 171, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(100, 182, 171, 0.3);
}

body.dark-mode .points-system {
  background: rgba(100, 182, 171, 0.15);
  border-color: rgba(100, 182, 171, 0.4);
}

.points-section {
  margin-bottom: 1.2rem;
}

.points-section:last-child {
  margin-bottom: 0;
}

.points-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: #000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.dark-mode .points-section h3 {
  color: #e0e0e0;
}

.points-section ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.points-section li {
  margin-bottom: 0.3rem;
  line-height: 1.4;
  color: #000;
}

body.dark-mode .points-section li {
  color: #e0e0e0;
}

.points-section strong {
  color: #1c9c8b;
  font-weight: 700;
}

body.dark-mode .points-section strong {
  color: #4ecdc4;
}

.points-note {
  margin-top: 1rem;
  padding: 0.8rem;
  background: rgba(233, 194, 87, 0.1);
  border-radius: 6px;
  border-left: 3px solid #e9c257;
  font-size: 0.85rem;
  line-height: 1.4;
}

body.dark-mode .points-note {
  background: rgba(233, 194, 87, 0.15);
  border-left-color: #e9c257;
}

.points-note p {
  margin: 0;
  color: #000;
}

body.dark-mode .points-note p {
  color: #e0e0e0;
}

.points-note strong {
  color: #e9c257;
}

body.dark-mode .points-note strong {
  color: #ffd700;
}

/* Bonus description styling */
.bonus-description {
  font-size: 0.85rem;
  margin: 0.5rem;
  color: #000;
  line-height: 1.3;
}

body.dark-mode .bonus-description {
  color: #e0e0e0;
}

/* Responsive design */
@media (max-width: 600px) {
  .points-section h3 {
    font-size: 0.9rem;
  }
  
  .points-section ul {
    font-size: 0.8rem;
  }
  
  .points-note {
    font-size: 0.8rem;
    padding: 0.6rem;
  }
}

/* hidden class */
.hidden { display: none !important; }

/* 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; 
}

/* prevents body to scroll when modal is open */
body:has(.modal:not(.hidden)) {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

.modal-content {
  background: #f6f4ef;
  color: #000;
  padding: 1.5rem;
  border-radius: 15px;
  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: #3a3d52;
  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.25rem;
  right: 1rem;
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}

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

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

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

/* 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: #e9c257;
  color: #000;
  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: #b69949;
}

body.dark-mode .stats-signin-btn:hover {
  background: #a19e9e;
}

.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: #a19e9e;
}

/* 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;
  }

  .modal {
    padding: 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: #facb1c;
  border-bottom: 2px solid #e2e8f0;
}

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

.leaderboard-table th {
  padding: 1rem 0.75rem;
  text-align: center;
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  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.85rem;
  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: #2f3247;
}

.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;
    font-size: 0.75rem;
  }
}

/* profile modal logout button */
.logout-btn {
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  background: #e9c257;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #000;
  transition: background 0.2s ease;
}

.logout-btn:hover {
  background: #b98d25;
}

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

body.dark-mode .logout-btn:hover {
  background: #a19e9e;
}

/* 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;
}