/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent any element from exceeding viewport width */
* {
  max-width: 100%;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.5;
  margin: 0;
  background-color: #f3f4f6;
  color: #1f2937;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 0.75rem;
}

/* Desktop adjustments */
@media (min-width: 768px) {
  body {
    padding: 1rem;
    padding-top: 4rem;
  }
}

/* Dark mode styles */
body.dark {
  background-color: #1f2937;
  color: #e5e7eb;
}

/* Container */
.container {
  width: 100%;
  max-width: 450px;
  background-color: #ffffff;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  position: relative;
  margin: 0 auto;
}

/* Desktop container adjustments */
@media (min-width: 768px) {
  .container {
    max-width: 768px;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
      0 4px 6px -4px rgba(0, 0, 0, 0.1);
  }
}

body.dark .container {
  background-color: #1f2937;
  border-color: #374151;
}

/* Display utilities */
.hidden {
  display: none !important;
}

.show-block {
  display: block;
}

.show-inline-block {
  display: inline-block;
}

.show-dropdown {
  display: block;
}

/* Icon utilities */
.icon-sm {
  height: 1rem;
  width: 1rem;
}

/* Buy Me a Coffee Button */
.coffee-button-container {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
}

.coffee-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: #a4eedf;
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 2px solid #e5e7eb;
}

.coffee-button:hover {
  background-color: #8ee5d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.coffee-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.coffee-logo {
  height: 1.2rem;
  width: auto;
}

.coffee-text {
  white-space: nowrap;
  font-family: 'Cookie', cursive;
}

/* Font color classes for coffee button */
.coffee-text-white {
  color: #ffffff;
}

.coffee-text-black {
  color: #000000;
}

.coffee-text-dark {
  color: #1f2937;
}

/* Desktop coffee button adjustments */
@media (min-width: 768px) {
  .coffee-button-container {
    top: 1rem;
    left: 1rem;
  }
  
  .coffee-button {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }
}

/* Mobile - hide text, show only icon */
@media (max-width: 480px) {
  .coffee-text {
    display: none;
  }
  
  .coffee-button {
    padding: 0.5rem;
    gap: 0;
  }
}

/* Dark mode support */
body.dark .coffee-button {
  background-color: #065f46;
  border-color: #10b981;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark .coffee-button:hover {
  background-color: #047857;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark .coffee-text-white {
  color: #f3f4f6;
}

body.dark .coffee-text-black {
  color: #e5e7eb;
}

body.dark .coffee-text-dark {
  color: #f9fafb;
}

/* Header elements */
.header-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2.5rem; /* Reserve space to prevent layout shift */
}

/* Desktop header adjustments */
@media (min-width: 768px) {
  .header-controls {
    top: 1rem;
    right: 1rem;
    gap: 0.5rem;
    min-height: 3rem;
  }
}

/* Theme toggle button */
#theme-toggle {
  padding: 0.5rem;
  border-radius: 9999px;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#theme-toggle:hover {
  background-color: #f3f4f6;
}

body.dark #theme-toggle:hover {
  background-color: #374151;
}

/* SVG icons */
.icon {
  height: 1.5rem;
  width: 1.5rem;
}

.icon-sm {
  height: 1rem;
  width: 1rem;
  margin-left: 0.25rem;
}

/* Alias menu button */
#alias-menu-button {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  background-color: #ffffff;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

#alias-menu-button:hover {
  background-color: #f3f4f6;
}

body.dark #alias-menu-button {
  background-color: #374151;
  color: #93c5fd;
}

body.dark #alias-menu-button:hover {
  background-color: #4b5563;
}

/* Dropdown menu */
.dropdown-menu {
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  width: 10rem;
  max-width: calc(100vw - 2rem); /* Prevent overflow on very narrow screens */
  background-color: #ffffff;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  padding: 0.25rem 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 1000; /* Ensure dropdown appears above other elements */
}

/* Mobile-specific dropdown adjustments */
@media (max-width: 480px) {
  .dropdown-menu {
    width: 8rem; /* Slightly narrower on mobile */
    right: -0.5rem; /* Adjust positioning to ensure it fits on screen */
  }
}

body.dark .dropdown-menu {
  background-color: #374151;
}

.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
  touch-action: manipulation; /* Improve touch responsiveness */
  min-height: 2.75rem; /* Ensure adequate touch target size on mobile */
}

.dropdown-item:hover {
  background-color: #f3f4f6;
}

body.dark .dropdown-item {
  color: #e5e7eb;
}

body.dark .dropdown-item:hover {
  background-color: #4b5563;
}

/* Main heading */
.main-title {
  font-size: 1.875rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
  margin-top: 3rem; /* Increased top margin to give header buttons space on mobile */
  color: #111827;
  line-height: 1.2;
}

/* Desktop title adjustments */
@media (min-width: 768px) {
  .main-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    margin-top: 0;
  }
}

body.dark .main-title {
  color: #ffffff;
}

/* Subtitle */
.subtitle {
  text-align: center;
  color: #4b5563;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .subtitle {
    margin-bottom: 1.5rem;
    font-size: 1rem;
  }
}

body.dark .subtitle {
  color: #e5e7eb;
}

/* Navigation container */
.nav-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Desktop nav spacing */
@media (min-width: 768px) {
  .nav-container {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .main-nav {
    gap: 1rem;
  }
}

/* Navigation buttons */
.nav-button {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  border: 2px solid #e5e7eb;
  background-color: #f9fafb;
  color: #374151;
  cursor: pointer;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Desktop nav button adjustments */
@media (min-width: 768px) {
  .nav-button {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    min-height: auto;
  }
}

.nav-button:hover:not(.active) {
  background-color: #059669;
  border-color: #059669;
  color: white;
  transform: translateY(-1px);
}

.nav-button.active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Dark mode nav button styles */
body.dark .nav-button {
  background-color: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

body.dark .nav-button:hover:not(.active) {
  background-color: #059669;
  border-color: #059669;
  color: white;
  transform: translateY(-1px);
}

body.dark .nav-button.active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Action buttons (reset, share, new round) have consistent styling */

/* Grid layout */
.view-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.view-container {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  transition: visibility 0s, opacity 0.3s linear;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.view-hidden {
  visibility: hidden;
  opacity: 0;
}

/* Letters display */
.letters-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
}

.plate-letter {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.1em;
}

/* Desktop letter size */
@media (min-width: 768px) {
  .letters-display {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .plate-letter {
    font-size: 2.25rem;
  }
}

body.dark .plate-letter {
  color: #f3f4f6;
}

/* Score display */
.score-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 1rem;
  gap: 0.5rem;
  width: 100%;
}

/* Desktop score container adjustments */
@media (min-width: 768px) {
  .score-container {
    font-size: 1.25rem;
    gap: 1rem;
    flex-direction: row;
  }

  .score-container.has-spacing {
    gap: 2rem;
  }
}

body.dark .score-container {
  color: #d1d5db;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
}

@media (min-width: 768px) {
  .score-item {
    gap: 1rem;
    width: auto;
  }
}

.score-display {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.75rem;
  text-align: center;
  flex: 1;
  min-width: 0;
  min-height: 2rem; /* Prevent height changes from content */
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .score-display {
    padding: 0.75rem 1.5rem;
    font-size: inherit;
    flex: none;
    min-height: auto;
  }
}

.leaderboard-score {
  background-color: #fef3c7;
  color: #92400e;
}

body.dark .leaderboard-score {
  background-color: #713f12;
  color: #fcd34d;
}

.your-score {
  background-color: #dbeafe;
  color: #1e40af;
}

body.dark .your-score {
  background-color: #1e3a8a;
  color: #bfdbfe;
}

/* Action buttons */
.action-button {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background-color: #dc2626;
  color: white;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Desktop action button adjustments */
@media (min-width: 768px) {
  .action-button {
    padding: 0.75rem;
    min-height: auto;
    min-width: auto;
    font-size: 1rem;
  }
}

.action-button:hover {
  background-color: #b91c1c;
}

.share-button {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background-color: #10b981;
  color: white;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  min-height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .share-button {
    padding: 0.75rem;
    min-height: auto;
    min-width: auto;
  }
}

.share-button:hover {
  background-color: #059669;
}

.share-button.highlighted {
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
  transform: scale(1.05);
}

/* Animations */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* How to play section */
.how-to-play {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
}

@media (min-width: 768px) {
  .how-to-play {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    padding: 0;
  }
}

.how-to-play-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .how-to-play-title {
    font-size: 1.5rem;
    text-align: left;
  }
}

body.dark .how-to-play-title {
  color: #e5e7eb;
}

.how-to-play-list {
  color: #374151;
  font-size: 0.875rem;
  list-style: none;
  padding: 0;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .how-to-play-list {
    font-size: 1rem;
  }
}

body.dark .how-to-play-list {
  color: #e5e7eb;
}

.how-to-play-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (min-width: 768px) {
  .how-to-play-list li {
    padding-left: 1.5rem;
  }
}

.how-to-play-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #2563eb;
}

@media (min-width: 768px) {
  .how-to-play-list li::before {
    font-size: 1.5rem;
  }
}

/* Input section */
.input-container {
  position: relative;
  margin-bottom: 1rem;
  width: 100%;
}

.word-input {
  width: 100%;
  padding: 0.75rem;
  padding-left: 1rem;
  padding-right: 3.5rem;
  color: #374151;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.15s ease;
  -webkit-appearance: none; /* Remove iOS styling */
  appearance: none;
  box-sizing: border-box;
}

/* Desktop input adjustments */
@media (min-width: 768px) {
  .word-input {
    padding: 0.75rem;
    padding-left: 1rem;
    padding-right: 4rem;
    font-size: 1.125rem;
  }
}

.word-input:focus {
  outline: none;
  box-shadow: 0 0 0 1px #3b82f6;
  border-color: #3b82f6;
}

body.dark .word-input {
  background-color: #374151;
  border-color: #4b5563;
  color: #ffffff;
}

body.dark .word-input::placeholder {
  color: #9ca3af;
}

.submit-button {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  border-radius: 0.375rem;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop submit button adjustments */
@media (min-width: 768px) {
  .submit-button {
    right: 0.5rem;
    padding: 0.5rem;
    min-width: auto;
    min-height: auto;
  }
}

.submit-button:hover {
  background-color: #1d4ed8;
}

/* Status messages */
.status-text {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  height: 1rem;
  color: #6b7280;
}

body.dark .status-text {
  color: #9ca3af;
}

.message-text {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
}

body.dark .message-text {
  color: #9ca3af;
}

/* Words containers */
.words-section {
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 768px) {
  .words-section {
    margin-top: 1.5rem;
  }
}

.words-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.words-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

@media (min-width: 768px) {
  .words-title {
    font-size: 1.5rem;
  }
}

body.dark .words-title {
  color: #e5e7eb;
}

.words-list {
  list-style: none;
  padding: 0;
  gap: 0.5rem;
  max-height: 10rem;
  overflow-y: auto;
  width: 100%;
}

@media (min-width: 768px) {
  .words-list {
    max-height: 12rem;
  }
}

.words-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  margin-bottom: 0.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.word-item {
  background-color: #f3f4f6;
}

body.dark .word-item {
  background-color: #374151;
}

.word-item.highlight {
  background-color: #bfdbfe;
  border: 2px solid #3b82f6;
}

body.dark .word-item.highlight {
  background-color: #1e40af;
}

.word-text {
  font-size: 1.125rem;
  font-weight: 500;
}

.word-score {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2563eb;
}

.empty-state {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 0.75rem;
}

body.dark .empty-state {
  color: #9ca3af;
}

/* Leaderboard */
.leaderboard-letters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
}

@media (min-width: 768px) {
  .leaderboard-letters {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
}

.leaderboard-info {
  text-align: center;
  color: #4b5563;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .leaderboard-info {
    font-size: 1rem;
  }
}

body.dark .leaderboard-info {
  color: #9ca3af;
}

/* Leaderboard controls */
.leaderboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  min-height: 2rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .leaderboard-controls {
    gap: 1rem;
    flex-wrap: nowrap;
  }
}

.leaderboard-navigation {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .leaderboard-navigation {
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
}

.table-nav-button {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  color: #374151;
  cursor: pointer;
  font-size: 0.625rem;
  padding: 0.5rem 0.25rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Desktop table nav adjustments */
@media (min-width: 768px) {
  .table-nav-button {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    min-height: auto;
    min-width: auto;
  }
}

.table-nav-button:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.table-nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-nav-button:disabled:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

body.dark .table-nav-button {
  background: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

body.dark .table-nav-button:hover {
  background: #4b5563;
  border-color: #6b7280;
}

body.dark .table-nav-button:disabled:hover {
  background: #374151;
  border-color: #4b5563;
}

.reveal-all-button {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 0.75rem;
  text-decoration: underline;
  padding: 0.25rem 0.5rem;
  transition: all 0.15s ease;
  opacity: 1;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .reveal-all-button {
    font-size: 0.875rem;
  }
}

.reveal-all-button:hover {
  color: #1d4ed8;
}

.reveal-all-button.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.dark .reveal-all-button {
  color: #60a5fa;
}

body.dark .reveal-all-button:hover {
  color: #93c5fd;
}

/* Censored word styles */
.censored-word {
  background: linear-gradient(90deg, #6b7280 0%, #9ca3af 50%, #6b7280 100%);
  color: transparent;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  border-radius: 0.25rem;
  padding: 0.125rem 0.25rem;
  margin: 0 -0.25rem;
}

.censored-word:hover {
  background: linear-gradient(90deg, #4b5563 0%, #6b7280 50%, #4b5563 100%);
}

.censored-word.revealed {
  background: none;
  color: inherit;
  cursor: default;
}

body.dark .censored-word {
  background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%);
}

body.dark .censored-word:hover {
  background: linear-gradient(90deg, #1f2937 0%, #374151 50%, #1f2937 100%);
}

body.dark .censored-word.revealed {
  background: none;
  color: inherit;
}

.leaderboard-table-container {
  position: relative;
  overflow-x: auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  width: 100%;
  max-width: 100%;
}

body.dark .leaderboard-table-container {
  border-color: #374151;
}

.leaderboard-table {
  width: 100%;
  font-size: 0.75rem;
  text-align: left;
  color: #6b7280;
  table-layout: fixed;
  border-collapse: collapse;
}

/* Desktop table font size */
@media (min-width: 768px) {
  .leaderboard-table {
    font-size: 0.875rem;
    table-layout: auto;
  }
}

body.dark .leaderboard-table {
  color: #9ca3af;
}

.leaderboard-header {
  font-size: 0.625rem;
  color: #374151;
  text-transform: uppercase;
  background-color: #f9fafb;
  font-weight: 600;
}

@media (min-width: 768px) {
  .leaderboard-header {
    font-size: 0.75rem;
  }
}

body.dark .leaderboard-header {
  background-color: #374151;
  color: #9ca3af;
}

.leaderboard-header th {
  padding: 0.5rem 0.25rem;
  text-align: left;
  vertical-align: middle;
}

.leaderboard-header th:nth-child(1) { width: 15%; } /* Rank */
.leaderboard-header th:nth-child(2) { width: 35%; } /* Player */
.leaderboard-header th:nth-child(3) { width: 15%; } /* Score */
.leaderboard-header th:nth-child(4) { width: 35%; } /* Word */

@media (min-width: 768px) {
  .leaderboard-header th {
    padding: 0.75rem 1.5rem;
  }
  
  .leaderboard-header th:nth-child(1) { width: auto; }
  .leaderboard-header th:nth-child(2) { width: auto; }
  .leaderboard-header th:nth-child(3) { width: auto; }
  .leaderboard-header th:nth-child(4) { width: auto; }
}

.leaderboard-row {
  border-bottom: 1px solid #e5e7eb;
  background-color: #ffffff;
  transition: background-color 0.15s ease;
}

.leaderboard-row:hover {
  background-color: #f9fafb;
}

.leaderboard-row.current-user {
  background-color: #eff6ff;
  font-weight: 700;
}

body.dark .leaderboard-row {
  background-color: #111827;
  border-color: #374151;
}

body.dark .leaderboard-row:hover {
  background-color: #1f2937;
}

body.dark .leaderboard-row.current-user {
  background-color: #1e40af;
}

.leaderboard-row td,
.leaderboard-cell {
  padding: 0.5rem 0.25rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .leaderboard-row td,
  .leaderboard-cell {
    padding: 1rem 1.5rem;
    max-width: none;
    white-space: normal;
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(75, 85, 99, 0.5);
  overflow-y: auto;
  height: 100%;
  width: 100%;
  z-index: 20;
}

.modal-content {
  position: relative;
  top: 5rem;
  margin: 0 auto;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  width: calc(100% - 2rem);
  max-width: 24rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  border-radius: 0.375rem;
  background-color: #ffffff;
}

body.dark .modal-content {
  background-color: #1f2937;
  border-color: #374151;
}

.modal-header {
  margin-top: 0.75rem;
  text-align: center;
}

.modal-title {
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: #111827;
}

body.dark .modal-title {
  color: #ffffff;
}

.modal-body {
  margin-top: 0.5rem;
  padding: 0 1.75rem 0.75rem;
}

.modal-text {
  font-size: 0.875rem;
  color: #6b7280;
}

body.dark .modal-text {
  color: #9ca3af;
}

.modal-input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
}

body.dark .modal-input {
  background-color: #374151;
  border-color: #4b5563;
  color: #ffffff;
}

body.dark .modal-input::placeholder {
  color: #9ca3af;
}

.modal-footer {
  align-items: center;
  padding: 1rem 0.75rem;
}

.modal-button {
  padding: 0.5rem 1rem;
  background-color: #2563eb;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 0.375rem;
  width: 100%;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.modal-button:hover {
  background-color: #1d4ed8;
}

.modal-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* Share feedback */
.share-feedback {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  transform: none;
  background-color: #16a34a;
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  z-index: 50;
  transition: all 0.3s ease;
  text-align: center;
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .share-feedback {
    position: fixed;
    top: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: none;
    width: auto;
    margin: 0;
  }
}

/* Message boxes */
.message-box {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.message-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

body.dark .message-error {
  background-color: #7f1d1d;
  color: #fecaca;
  border-color: #991b1b;
}

body.dark .message-success {
  background-color: #064e3b;
  color: #a7f3d0;
  border-color: #065f46;
}

body.dark input::placeholder {
  color: #9ca3af;
}

body.dark table tbody tr:hover {
  background-color: #374151;
}

body.dark table tbody tr:nth-child(odd) {
  background-color: #1f2937;
}

body.dark table tbody tr:nth-child(even) {
  background-color: #111827;
}

/* Utility Classes for Dynamic Content */
.empty-state {
  text-align: center;
  font-style: italic;
  color: #6b7280;
  padding: 1rem;
}

.error-state {
  text-align: center;
  font-style: italic;
  color: #ef4444;
  padding: 1rem;
}

.word-item {
  padding: 1rem 0.75rem;
}

.word-name {
  font-size: 1rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.word-score {
  font-size: 1.125rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Desktop word item adjustments */
@media (min-width: 768px) {
  .word-item {
    padding: 0.75rem;
  }
  
  .word-name {
    font-size: 1.125rem;
    max-width: none;
    white-space: normal;
  }
  
  .word-score {
    font-size: 1.25rem;
  }
}

.empty-state {
  color: #2563eb;
}

body.dark .empty-state {
  color: #9ca3af;
}

body.dark .error-state {
  color: #f87171;
}

body.dark .word-score {
  color: #60a5fa;
}
