* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 95vw;
  max-height: 95vh;
  overflow: auto;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
  font-size: 2.5em;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty {
  display: flex;
  gap: 5px;
}

.diff-btn {
  padding: 8px 10px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.7em;
  transition: all 0.3s ease;
  font-weight: 600;
  white-space: nowrap;
}

.diff-btn:hover {
  background: #f0f0f0;
}

.diff-btn.active {
  background: #667eea;
  color: white;
}

.game-buttons {
  display: flex;
  gap: 10px;
}

.new-game-btn, .daily-puzzle-btn {
  padding: 10px 20px;
  background: #764ba2;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.daily-puzzle-btn {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  z-index: 1;
}

.daily-puzzle-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: -1;
}

.daily-puzzle-btn:hover::before {
  width: 300px;
  height: 300px;
}

.new-game-btn:hover {
  background: #5f3a82;
  transform: scale(1.05);
}

.daily-puzzle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.game-info {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

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

.label {
  font-size: 0.9em;
  color: #666;
  font-weight: 500;
}

.value {
  font-size: 1.3em;
  font-weight: bold;
  color: #333;
}

#seedInfo {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  border-radius: 8px;
  padding: 10px;
  color: white;
}

#seedInfo .label {
  color: white;
  opacity: 0.95;
}

#seedInfo .value {
  color: white;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.status {
  font-size: 1.2em;
  font-weight: bold;
  padding: 5px 15px;
  border-radius: 20px;
  background: #4CAF50;
  color: white;
}

.status.lost {
  background: #f44336;
}

.status.won {
  background: #FFD700;
  color: #333;
}

.board {
  display: grid;
  gap: 2px;
  padding: 10px;
  background: #ddd;
  border-radius: 8px;
  margin: 0 auto;
  max-width: 100%;
  overflow: auto;
  contain: layout;
  /* Force GPU acceleration for the board */
  transform: translateZ(0);
  will-change: contents;
}

.cell {
  width: 30px;
  height: 30px;
  background: #bbb;
  border: 2px solid #999;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  transition: none; /* Remove transitions for instant response */
  user-select: none;
  -webkit-tap-highlight-color: transparent; /* Remove touch delay on mobile */
  touch-action: manipulation; /* Faster touch response */
  contain: layout style paint;
  /* Force GPU acceleration */
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

/* Dynamic cell sizing for larger boards */
.board[data-cell-size="25"] .cell {
  width: 25px;
  height: 25px;
  font-size: 0.8em;
  border-width: 1px;
}

.board[data-cell-size="20"] .cell {
  width: 20px;
  height: 20px;
  font-size: 0.7em;
  border-width: 1px;
}

.board[data-cell-size="18"] .cell {
  width: 18px;
  height: 18px;
  font-size: 0.65em;
  border-width: 1px;
}

.board[data-cell-size="15"] .cell {
  width: 15px;
  height: 15px;
  font-size: 0.6em;
  border-width: 1px;
}

.cell:hover:not(.revealed):not(.flagged) {
  background: #ccc;
  /* Remove scale transform for better performance */
}

.cell.revealed {
  background: #eee;
  border-color: #ccc;
  cursor: default;
}

.cell.flagged {
  background: #ff9800;
  border-color: #f57c00;
}

.cell.mine {
  background: #f44336;
  border-color: #d32f2f;
}

.cell.hit-mine {
  background: #ff1744 !important;
  border-color: #c51162 !important;
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.8);
  animation: explode 0.3s ease;
}

.cell.revealed.mine:not(.hit-mine) {
  background: #e57373;
  border-color: #ef5350;
}

@keyframes explode {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.cell-1 { color: #1976D2; }
.cell-2 { color: #388E3C; }
.cell-3 { color: #D32F2F; }
.cell-4 { color: #7B1FA2; }
.cell-5 { color: #F57C00; }
.cell-6 { color: #0097A7; }
.cell-7 { color: #455A64; }
.cell-8 { color: #212121; }

.instructions {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.instructions h3 {
  margin-bottom: 10px;
  color: #333;
}

.instructions ul {
  list-style: none;
}

.instructions li {
  margin: 5px 0;
  color: #666;
  padding-left: 20px;
  position: relative;
}

.instructions li:before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #667eea;
}

/* Daily Puzzle Badge */
.daily-badge {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 15px auto;
  padding: 16px 28px;
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  color: white;
  font-weight: bold;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
  max-width: fit-content;
  position: relative;
  overflow: hidden;
  animation: badgePulse 2s ease-in-out infinite;
}

.badge-icon {
  font-size: 1.8em;
  animation: iconFloat 3s ease-in-out infinite;
}

.badge-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.badge-title {
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-date {
  font-size: 0.85em;
  opacity: 0.95;
  font-weight: 500;
}

.badge-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  animation: pulseWave 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.7);
  }
}

@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes pulseWave {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.sync-status {
  width: 100%;
  padding: 10px 15px;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  margin: 15px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
  color: #856404;
}

.sync-icon {
  font-size: 1.2em;
}

.leaderboard-btn {
  width: 100%;
  padding: 12px 20px;
  background: #FFD700;
  color: #333;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 600;
  margin: 20px 0;
  transition: all 0.3s ease;
}

.leaderboard-btn:hover {
  background: #FFC700;
  transform: scale(1.02);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Daily Modal Styles */
.daily-modal {
  max-width: 700px;
}

.daily-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.daily-icon {
  font-size: 4em;
  margin-bottom: 10px;
  animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.daily-header h2 {
  margin: 10px 0;
  font-size: 2.2em;
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.daily-date {
  font-size: 1.2em;
  color: #666;
  font-weight: 600;
  margin: 5px 0 10px 0;
}

.daily-tagline {
  font-size: 0.9em;
  color: #999;
  font-style: italic;
  margin-top: 10px;
}

.daily-timezone {
  font-size: 0.8em;
  color: #666;
  margin-top: 5px;
  padding: 5px 15px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 15px;
  display: inline-block;
}

.daily-countdown {
  font-size: 0.85em;
  color: #FF6B6B;
  font-weight: 600;
  margin-top: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 142, 83, 0.1) 100%);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 20px;
  display: inline-block;
}

.daily-countdown.local-time {
  color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-color: rgba(102, 126, 234, 0.3);
}

.daily-difficulty {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.daily-diff-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.daily-diff-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #FF6B6B, #FF8E53);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.daily-diff-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #FF6B6B;
}

.daily-diff-card:hover::before {
  transform: scaleX(1);
}

.difficulty-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.diff-icon {
  font-size: 2em;
}

.diff-name {
  font-size: 1.3em;
  font-weight: 700;
  color: #333;
}

.diff-details {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
  padding-left: 10px;
}

.diff-play-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  color: white;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.daily-diff-card:hover .diff-play-btn {
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.daily-diff-card.completed {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-color: #4CAF50;
}

.daily-diff-card.completed::before {
  background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.daily-diff-card.completed::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5em;
  color: #4CAF50;
  font-weight: bold;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close, .close-daily {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover, .close-daily:hover {
  color: #333;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.leaderboard-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.tab-btn {
  padding: 8px 12px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.3s ease;
  font-weight: 600;
}

.tab-btn:hover {
  background: #f0f0f0;
}

.tab-btn.active {
  background: #667eea;
  color: white;
}

.leaderboard-content {
  min-height: 200px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  overflow: visible;
  white-space: nowrap;
}

.leaderboard-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

/* Only apply hover to body rows, not header */
.leaderboard-table tbody tr:hover {
  background: #f8f9fa;
}

/* Keep header background consistent on hover */
.leaderboard-table thead tr:hover th {
  background: #f8f9fa;
}

.leaderboard-table td:first-child {
  font-weight: bold;
  color: #667eea;
}

/* Highlight current user's scores */
.leaderboard-table tr.current-user {
  background: linear-gradient(90deg, #e8f5e9 0%, #f1f8e9 100%);
  border-left: 4px solid #4caf50;
  font-weight: 500;
}

.leaderboard-table tbody tr.current-user:hover {
  background: linear-gradient(90deg, #c8e6c9 0%, #dcedc8 100%);
}

.leaderboard-table tr.current-user td {
  border-bottom: 1px solid #a5d6a7;
  overflow: visible;
  white-space: nowrap;
}

/* Daily History UI */
.daily-history-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border: 1px solid #dee2e6;
}

.history-toggle-btn {
  padding: 10px 20px;
  background: white;
  border: 2px solid #007bff;
  border-radius: 8px;
  color: #007bff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-toggle-btn:hover {
  background: #007bff;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.history-toggle-btn.active {
  background: #007bff;
  color: white;
}

.historical-date-label {
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  padding: 8px 15px;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.history-date-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
}

.history-date-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.history-date-item:hover {
  border-color: #007bff;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.2);
}

.history-date-item .date-icon {
  font-size: 24px;
}

.history-date-item .date-display {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.history-date-item .date-arrow {
  font-size: 20px;
  color: #007bff;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.history-date-item:hover .date-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Calendar View for Historical Dates */
.calendar-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  margin: 0 auto;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e9ecef;
}

.calendar-month-year {
  font-size: 1.5em;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.calendar-nav-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #007bff;
  background: white;
  border-radius: 50%;
  color: #007bff;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav-btn:hover:not(.disabled) {
  background: #007bff;
  color: white;
  transform: scale(1.1);
}

.calendar-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: #ccc;
  color: #ccc;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 700;
  color: #666;
  padding: 10px 0;
  font-size: 0.9em;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  position: relative;
  transition: all 0.3s ease;
  cursor: default;
}

.calendar-day.empty {
  border: none;
  background: transparent;
}

.calendar-day.has-data {
  cursor: pointer;
  border-color: #4caf50;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.calendar-day.has-data:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  border-color: #2e7d32;
  z-index: 10;
}

.calendar-day.today {
  border-color: #ff6b6b;
  border-width: 3px;
  font-weight: bold;
}

.calendar-day.today.has-data {
  border-color: #ff6b6b;
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.calendar-day.no-data {
  opacity: 0.4;
  background: #f8f9fa;
}

.calendar-day.selected {
  border-color: #007bff !important;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
  transform: scale(1.05);
}

.calendar-day .day-number {
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
}

.calendar-day.no-data .day-number {
  color: #999;
}

.calendar-day .data-indicator {
  position: absolute;
  bottom: 4px;
  font-size: 0.6em;
  color: #4caf50;
  font-weight: bold;
}

.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #666;
}

.legend-dot {
  font-size: 1.5em;
  line-height: 1;
}

.legend-dot.has-data {
  color: #4caf50;
}

.legend-dot.today {
  color: #ff6b6b;
}

.legend-dot.no-data {
  color: #ccc;
}

/* User icon styling - ensure visibility on all devices */
.user-icon {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 1em;
  line-height: 1;
  margin-left: 4px;
  vertical-align: middle;
  color: #4caf50;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fallback: if emoji doesn't render, show text indicator */
@supports not (font-family: "Apple Color Emoji") {
  .user-icon::before {
    content: "[YOU]";
    font-family: inherit;
    font-size: 0.75em;
    color: #4caf50;
    font-weight: bold;
  }
  .user-icon {
    font-size: 0;
  }
}

.no-scores {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-style: italic;
}

/* Daily Leaderboard Difficulty Selector */
.daily-difficulty-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 25px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 12px;
}

.daily-diff-filter {
  padding: 10px 18px;
  border: 2px solid #e0e0e0;
  background: white;
  color: #333;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.daily-diff-filter:hover {
  border-color: #667eea;
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.daily-diff-filter.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.filter-count {
  font-size: 0.85em;
  opacity: 0.8;
}

.daily-diff-filter.active .filter-count {
  opacity: 0.95;
}

/* Daily Leaderboard Grouped Display */
.daily-leaderboard-grouped {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.difficulty-group {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 15px;
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
}

.difficulty-group:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.difficulty-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  font-weight: 600;
}

.difficulty-icon {
  font-size: 1.5em;
  line-height: 1;
}

.difficulty-name {
  font-size: 1.2em;
  flex: 1;
}

.difficulty-count {
  font-size: 0.9em;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
}

.leaderboard-table.grouped {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.leaderboard-table.grouped thead {
  background: #667eea;
  color: white;
}

.leaderboard-table.grouped th {
  background: transparent;
  color: white;
  border-bottom: none;
}

.leaderboard-table.grouped tr:first-child td {
  font-weight: 700;
  background: linear-gradient(135deg, #fff9e6 0%, #ffe9a3 100%);
}

.leaderboard-table.grouped tr:nth-child(2) td {
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  font-weight: 600;
}

.leaderboard-table.grouped tr:nth-child(3) td {
  background: linear-gradient(135deg, #fff4e6 0%, #ffd4a3 100%);
  font-weight: 600;
}

/* Current user highlighting in grouped tables */
.leaderboard-table.grouped tr.current-user td {
  background: linear-gradient(90deg, #e8f5e9 0%, #f1f8e9 100%) !important;
  border-left: 4px solid #4caf50;
  font-weight: 600 !important;
  overflow: visible;
  white-space: nowrap;
}

.leaderboard-table.grouped tbody tr.current-user:hover td {
  background: linear-gradient(90deg, #c8e6c9 0%, #dcedc8 100%) !important;
}


/* Daily Leaderboard Single Difficulty View */
.daily-leaderboard-single {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.single-difficulty-header {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.diff-icon-large {
  font-size: 3.5em;
  display: block;
  margin-bottom: 15px;
  animation: iconFloat 3s ease-in-out infinite;
}

.single-difficulty-header h3 {
  font-size: 2em;
  margin-bottom: 8px;
  color: white;
}

.single-difficulty-header .subtitle {
  font-size: 1em;
  opacity: 0.9;
  margin: 0;
}

.leaderboard-table.single {
  width: 100%;
}

.leaderboard-table.single thead {
  background: #f8f9fa;
}

.leaderboard-table.single th {
  padding: 15px 12px;
  font-weight: 700;
  color: #333;
}

.leaderboard-table.single td {
  padding: 15px 12px;
}

/* Top 3 highlighting for single view */
.leaderboard-table.single tr.rank-1 td {
  background: linear-gradient(135deg, #fff9e6 0%, #ffe9a3 100%);
  font-weight: 700;
  font-size: 1.05em;
}

.leaderboard-table.single tr.rank-1 td:first-child::before {
  content: '🥇 ';
}

.leaderboard-table.single tr.rank-2 td {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  font-weight: 700;
}

.leaderboard-table.single tr.rank-2 td:first-child::before {
  content: '🥈 ';
}

.leaderboard-table.single tr.rank-3 td {
  background: linear-gradient(135deg, #fff4e6 0%, #ffd4a3 100%);
  font-weight: 600;
}

.leaderboard-table.single tr.rank-3 td:first-child::before {
  content: '🥉 ';
}

.leaderboard-table.single tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

/* Current user highlighting in single view - override rank backgrounds */
.leaderboard-table.single tr.current-user td {
  background: linear-gradient(90deg, #e8f5e9 0%, #f1f8e9 100%) !important;
  border-left: 4px solid #4caf50;
  font-weight: 600 !important;
  overflow: visible;
  white-space: nowrap;
}

.leaderboard-table.single tbody tr.current-user:hover td {
  background: linear-gradient(90deg, #c8e6c9 0%, #dcedc8 100%) !important;
}


/* Developer Mode */
.dev-mine {
  position: relative;
  background: rgba(255, 193, 7, 0.2) !important;
  border-color: #ffc107 !important;
}

.dev-mine::before {
  content: attr(data-dev);
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.6em;
  opacity: 0.7;
}

.dev-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #4CAF50;
  color: white;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  font-size: 1.1em;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
}

.dev-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile/Tablet ARM Chip Optimizations */
@media (max-width: 1024px) {
  /* Reduce GPU layers on mobile - too many layers hurt weak ARM GPUs */
  .cell {
    transform: none; /* Remove translateZ that forces GPU layers */
    backface-visibility: visible;
    will-change: auto; /* Don't force GPU acceleration on every cell */
    border-radius: 2px; /* Simpler rounded corners (cheaper to render) */
    border-width: 1px; /* Thinner borders for faster rendering */
  }
  
  .board {
    transform: none; /* Remove GPU acceleration on weak devices */
    will-change: auto;
    gap: 1px; /* Smaller gaps reduce total render area */
  }
  
  /* Simplify hover effects on mobile (avoid repaints) */
  .cell:hover:not(.revealed):not(.flagged) {
    background: #bbb; /* No color change on mobile hover */
  }
  
  /* Remove expensive animations on mobile */
  .hit-mine {
    animation: none;
  }
  
  /* Optimize emoji rendering for ARM */
  .cell {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-rendering: optimizeSpeed; /* Faster text rendering */
  }
  
  /* Reduce memory usage on large boards for mobile */
  .board[data-cell-size="18"] .cell,
  .board[data-cell-size="15"] .cell {
    contain: strict; /* Aggressive containment for memory savings */
  }
  
  /* Reduce shadow complexity */
  .daily-puzzle-btn,
  .new-game-btn {
    box-shadow: none;
  }
  
  /* Simplify gradients (expensive on weak GPUs) */
  .daily-puzzle-btn {
    background: #FF6B6B; /* Solid color instead of gradient */
  }
  
  .daily-badge {
    background: #FF6B6B; /* Solid color instead of gradient */
    animation: none; /* Remove pulse animation */
  }
  
  /* Disable pulse animation on weak devices */
  .badge-pulse {
    display: none;
  }
  
  .badge-icon {
    animation: none;
  }
}

/* Responsive Design for Daily Puzzle UI */
@media (max-width: 768px) {
  .daily-modal {
    max-width: 95%;
    padding: 20px;
  }

  .daily-icon {
    font-size: 3em;
  }

  .daily-header h2 {
    font-size: 1.8em;
  }

  .daily-date {
    font-size: 1em;
  }

  .daily-tagline {
    font-size: 0.8em;
  }

  .daily-timezone {
    font-size: 0.75em;
    padding: 4px 12px;
  }

  .daily-countdown {
    font-size: 0.75em;
    padding: 6px 14px;
    white-space: normal;
    text-align: center;
    max-width: 90%;
  }

  .daily-difficulty {
    grid-template-columns: 1fr;
  }

  .daily-diff-card {
    padding: 15px;
  }

  .diff-icon {
    font-size: 1.5em;
  }

  .diff-name {
    font-size: 1.1em;
  }

  .badge-icon {
    font-size: 1.5em;
  }

  .badge-title {
    font-size: 1em;
  }

  .badge-date {
    font-size: 0.75em;
  }

  .daily-badge {
    padding: 12px 20px;
  }

  .difficulty-group-header {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .difficulty-icon {
    font-size: 1.2em;
  }

  .difficulty-name {
    font-size: 1em;
  }

  .difficulty-count {
    font-size: 0.8em;
    padding: 3px 10px;
  }

  .leaderboard-table.grouped th,
  .leaderboard-table.grouped td {
    padding: 8px 6px;
    font-size: 0.85em;
  }

  .daily-difficulty-selector {
    padding: 10px;
    gap: 8px;
  }

  .daily-diff-filter {
    padding: 8px 14px;
    font-size: 0.8em;
  }

  .filter-count {
    font-size: 0.75em;
  }

  .diff-icon-large {
    font-size: 2.5em;
  }

  .single-difficulty-header h3 {
    font-size: 1.5em;
  }

  .single-difficulty-header .subtitle {
    font-size: 0.9em;
  }

  .leaderboard-table.single th,
  .leaderboard-table.single td {
    padding: 10px 8px;
    font-size: 0.85em;
  }

  /* Ensure user icon is visible on mobile */
  .leaderboard-table tr.current-user td {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
  }
  
  .leaderboard-table.grouped tr.current-user td,
  .leaderboard-table.single tr.current-user td {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
  }
  
  /* Mobile adjustments for history UI */
  .daily-history-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  
  .history-date-list {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  
  .history-date-item {
    padding: 12px 15px;
  }
  
  .history-toggle-btn {
    width: 100%;
    justify-content: center;
  }
  
  .historical-date-label {
    font-size: 14px;
    text-align: center;
  }
  
  /* Mobile adjustments for calendar */
  .calendar-container {
    padding: 15px;
  }
  
  .calendar-header {
    margin-bottom: 15px;
  }
  
  .calendar-month-year {
    font-size: 1.2em;
  }
  
  .calendar-nav-btn {
    width: 35px;
    height: 35px;
    font-size: 1em;
  }
  
  .calendar-grid {
    gap: 4px;
  }
  
  .calendar-day-header {
    font-size: 0.75em;
    padding: 5px 0;
  }
  
  .calendar-day .day-number {
    font-size: 0.9em;
  }
  
  .calendar-day .data-indicator {
    font-size: 0.5em;
    bottom: 2px;
  }
  
  .calendar-legend {
    gap: 15px;
    margin-top: 15px;
    padding-top: 10px;
  }
  
  .legend-item {
    font-size: 0.8em;
    gap: 6px;
  }
}

/* Footer Styles */
.footer {
  margin-top: 40px;
  padding: 30px 20px 20px;
  border-top: 2px solid #e0e0e0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  text-align: center;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
}

.footer-author {
  font-size: 1.1em;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-icon {
  font-size: 1.3em;
  animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-10deg); }
  20% { transform: rotate(12deg); }
  40%, 100% { transform: rotate(0deg); }
}

.footer-author strong {
  font-weight: 600;
  color: #333;
}

.footer-author a {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.footer-author a:hover {
  color: #0056b3;
  text-decoration: underline;
}

.footer-copyright {
  font-size: 0.9em;
  color: #666;
  margin: 0;
}

.footer-copyright a {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.footer-copyright a:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Responsive footer styles */
@media (max-width: 768px) {
  .footer {
    margin-top: 30px;
    padding: 20px 15px 15px;
  }
  
  .footer-author {
    font-size: 1em;
  }
  
  .footer-copyright {
    font-size: 0.85em;
  }
}
