@tailwind base;
@tailwind components;
@tailwind utilities;

/* Chat functionality styles */
.typing-dots span {
  animation: typing 1.5s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.5s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 1s;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat-button {
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 1.5rem;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.chat-button:hover {
  background-color: rgba(59, 130, 246, 0.1);
  transform: scale(1.15);
}

/* Responsive sizing for mobile */
@media (max-width: 640px) {
  .chat-button {
    font-size: 1.25rem;
    min-width: 28px;
    min-height: 28px;
  }
}

/* Larger screens get bigger icons */
@media (min-width: 1024px) {
  .chat-button {
    font-size: 1.75rem;
    min-width: 36px;
    min-height: 36px;
  }
}

/* Chat modal styling to match game font */
#chat-modal {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

#chat-modal .bg-white {
  background-color: var(--aged-paper-light);
  border: 2px solid rgba(0, 0, 0, 0.1);
}

#chat-modal h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  color: var(--typewriter-ink);
  font-weight: 600;
}

#chat-messages {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  color: var(--typewriter-ink);
  line-height: 1.6;
}

#chat-messages .text-gray-500 {
  color: #666 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.suggestion-btn, .question-btn {
  transition: all 0.2s ease;
  padding: 14px 18px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  line-height: 1.4;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.suggestion-btn:hover, .question-btn:hover:not(:disabled) {
  background: #e9ecef;
  border-color: #6c757d;
  transform: translateY(-1px);
}

.suggestion-btn:disabled, .question-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8f9fa;
}

/* Answer revelation styles */
.revealed-answer {
  background-color: #fef3c7 !important;
  font-weight: bold !important;
  color: #92400e !important;
  border: 2px solid #f59e0b !important;
}

/* Correct and incorrect answer styles */

/* Welcome overlay styles */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.welcome-modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
  overflow-y: auto;
}

.welcome-title {
  margin: 0 0 16px 0;
  color: #1f2937;
  font-size: 22px;
  font-weight: 600;
}

.welcome-content {
  text-align: left;
  color: #4b5563;
  line-height: 1.4;
  margin-bottom: 20px;
  font-size: 14px;
}

.welcome-content p {
  margin: 0 0 12px 0;
}

.welcome-overlay .typewriter-button {
  background: #1f2937;
  color: white;
  border: 2px solid #374151;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  min-width: 100px;
  min-height: 36px;
  transition: all 0.2s ease;
}

.welcome-overlay .typewriter-button:hover {
  background: #374151;
  border-color: #4b5563;
  transform: translateY(-1px);
}
.cloze-input.correct {
  background-color: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #15803d !important;
  font-weight: bold !important;
}

.cloze-input.incorrect {
  background-color: #fef2f2 !important;
  border-color: #dc2626 !important;
  color: #dc2626 !important;
  font-weight: bold !important;
}

.cloze-input:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

/* Custom typewriter color scheme */
:root {
  --aged-paper: #faf7f0;
  --aged-paper-dark: #f5f1e8;
  --aged-paper-light: #fefcf7;
  --typewriter-ink: #2c2c2c;
  --typewriter-ribbon: #8b5cf6;
  --paper-shadow: rgba(0, 0, 0, 0.08);
}

@layer base {
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--aged-paper);
    color: var(--typewriter-ink);
    line-height: 1.6;
    font-size: 16px;
    background-image: 
      radial-gradient(circle at 25% 25%, rgba(139, 92, 246, 0.02) 0%, transparent 50%),
      radial-gradient(circle at 75% 75%, rgba(139, 92, 246, 0.02) 0%, transparent 50%);
  }
}

@layer components {
  .typewriter-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: var(--typewriter-ink);
    font-weight: 600;
    line-height: 1.7;
  }

  .typewriter-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
  }

  .paper-sheet {
    background-color: var(--aged-paper-light);
    border: 1px solid rgba(139, 92, 246, 0.1);
    box-shadow: 
      0 2px 8px var(--paper-shadow),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
  }

  .paper-sheet::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 23px,
      rgba(139, 92, 246, 0.03) 23px,
      rgba(139, 92, 246, 0.03) 24px
    );
    pointer-events: none;
    z-index: 1;
  }

  .paper-content {
    position: relative;
    z-index: 2;
  }

  .cloze-input {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: transparent;
    border: none;
    border-bottom: 2px dotted black;
    color: var(--typewriter-ink);
    text-align: center;
    outline: none;
    padding: 3px 4px;
    margin: 0 1px;
    min-width: 4ch;
    width: auto;
    font-size: inherit;
    line-height: inherit;
    transition: all 0.2s ease;
  }
  
  .cloze-input:focus {
    border-bottom: 2px dotted black;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    background-color: rgba(0, 0, 0, 0.05);
  }
  
  .cloze-input.correct {
    border-bottom: 2px dotted #10b981;
    background-color: rgba(16, 185, 129, 0.1);
  }
  
  .cloze-input.incorrect {
    border-bottom: 2px dotted #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
  }

  .cloze-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
    font-style: normal;
    font-family: monospace;
    letter-spacing: 0.1em;
  }

  .typewriter-button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    min-width: 100px;
    min-height: 36px;
    padding: 8px 14px;
    background-color: var(--aged-paper-dark);
    color: var(--typewriter-ink);
    border: 2px solid black;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 
      0 3px 0 rgba(0, 0, 0, 0.3),
      0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
  }

  .typewriter-button:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    box-shadow: 
      0 4px 0 rgba(0, 0, 0, 0.3),
      0 6px 12px rgba(0, 0, 0, 0.15);
  }

  .typewriter-button:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 
      0 1px 0 rgba(0, 0, 0, 0.3),
      0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .typewriter-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(2px);
    box-shadow: 
      0 2px 0 rgba(0, 0, 0, 0.2),
      0 3px 6px rgba(0, 0, 0, 0.05);
  }

  .typewriter-button:focus {
    outline: none;
    box-shadow: 
      0 4px 0 rgba(0, 0, 0, 0.3),
      0 6px 12px rgba(0, 0, 0, 0.1),
      0 0 0 3px rgba(0, 0, 0, 0.2);
  }

  .prose {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--typewriter-ink);
    overflow-wrap: break-word;
  }
  
  .prose p {
    margin-bottom: 1.5rem;
    text-align: justify;
  }

  .biblio-info {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
  }

  .context-box {
    background-color: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .hints-box {
    background-color: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .round-badge {
    background-color: rgba(245, 158, 11, 0.1);
    color: #666;
    border: 1px solid rgba(245, 158, 11, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
  }

  /* Ensure specific game info elements use accessible font */
  #book-info, #round-info, #contextualization {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  }

  .loading-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: #666;
  }

  .result-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
  }

  /* Leaderboard button in footer */
  .leaderboard-footer-btn {
    background-color: var(--aged-paper-dark);
    color: var(--typewriter-ink);
    border: 2px solid black;
    border-radius: 0 8px 8px 0;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 60px;
    min-height: 44px;
    box-shadow:
      0 3px 0 rgba(0, 0, 0, 0.3),
      0 4px 8px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    user-select: none;
  }

  .leaderboard-footer-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    box-shadow:
      0 4px 0 rgba(0, 0, 0, 0.3),
      0 6px 12px rgba(0, 0, 0, 0.15);
  }

  .leaderboard-footer-btn:active {
    transform: translateY(2px);
    box-shadow:
      0 1px 0 rgba(0, 0, 0, 0.3),
      0 2px 4px rgba(0, 0, 0, 0.1);
  }


  /* Mobile responsive */
  @media (max-width: 768px) {
    .typewriter-subtitle {
      display: none;
    }
  }

  @media (max-width: 640px) {
    .prose {
      font-size: 1rem;
    }

    .typewriter-text {
      font-size: 1.75rem;
    }

    .typewriter-button {
      min-width: 100px;
      min-height: 38px;
      font-size: 0.9rem;
    }

    .leaderboard-footer-btn {
      font-size: 1.25rem;
      padding: 12px 10px;
      min-width: 50px;
      min-height: 48px;
    }
  }

  @media (max-width: 480px) {
    .prose {
      font-size: 0.95rem;
    }

    .typewriter-text {
      font-size: 1.5rem;
    }

    .cloze-input {
      min-width: 2.5ch;
    }

    header img {
      width: 2rem;
      height: 2rem;
    }

    .leaderboard-footer-btn {
      font-size: 1.1rem;
      padding: 12px 8px;
      min-width: 48px;
    }
  }

  /* Compact question buttons for chat interface */
  #chat-modal .question-btn {
    padding: 6px 8px;
    min-height: auto;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 400;
    transition: all 0.15s ease;
  }

  /* Mobile dropdown styling */
  #question-dropdown {
    background: var(--aged-paper-dark);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--typewriter-ink);
    transition: all 0.2s ease;
  }

  #question-dropdown:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
  }

  /* Sticky Control Panel */
  .sticky-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--aged-paper-light);
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    z-index: 1000;
    backdrop-filter: blur(8px);
  }

  .sticky-controls .controls-inner {
    position: relative;
    max-width: 1024px;
    margin: 0 auto;
    display: flex;
    gap: 1px;
    justify-content: center;
    align-items: center;
  }

  .sticky-controls .typewriter-button {
    flex: 1;
    max-width: 200px;
    min-height: 44px;
    margin: 0;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    position: relative;
  }

  .sticky-controls .typewriter-button:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
  }

  .sticky-controls .typewriter-button:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
  }

  .sticky-controls .typewriter-button:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.2);
  }

  .controls-divider {
    height: 24px;
    width: 2px;
    background: rgba(0, 0, 0, 0.3);
    margin: 0 -1px;
    z-index: 1;
  }

  /* Add bottom padding to main content to prevent overlap */
  #game-container {
    padding-bottom: 100px;
  }

  /* Mobile optimizations for sticky controls */
  @media (max-width: 640px) {
    .sticky-controls {
      padding: 10px 12px;
    }
    
    .sticky-controls .typewriter-button {
      min-height: 48px;
      font-size: 16px;
      padding: 12px 8px;
    }
    
    #game-container {
      padding-bottom: 90px;
    }
  }

  /* Ensure controls stay above mobile keyboards */
  @media (max-width: 640px) and (max-height: 500px) {
    .sticky-controls {
      position: fixed;
      bottom: 0;
    }
  }

  /* Leaderboard Overlay */
  .leaderboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
  }

  .leaderboard-overlay.visible {
    opacity: 1;
  }

  /* Leaderboard Modal */
  .leaderboard-modal {
    background: var(--aged-paper-light);
    border: 3px solid rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
  }

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

  /* Leaderboard Header */
  .leaderboard-header {
    background: linear-gradient(180deg, var(--aged-paper-dark) 0%, #d4c9b3 100%);
    padding: 20px 24px;
    border-bottom: 3px solid rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .leaderboard-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 700;
    color: var(--typewriter-ink);
    margin: 0;
    letter-spacing: 1px;
  }

  .leaderboard-close {
    background: transparent;
    color: var(--typewriter-ink);
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .leaderboard-close:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.5);
  }

  .leaderboard-close:active {
    background: rgba(0, 0, 0, 0.15);
  }

  /* Leaderboard Content */
  .leaderboard-content {
    padding: 24px;
    max-height: calc(85vh - 100px);
    overflow-y: auto;
    background: var(--aged-paper-light);
  }

  /* Leaderboard List */
  .leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
  }

  .leaderboard-entry {
    display: grid;
    grid-template-columns: 50px 80px 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--aged-paper-dark);
    border: 3px solid rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  }

  /* Rank Colors */
  .leaderboard-entry.rank-gold {
    background: linear-gradient(135deg, #fff7e6 0%, #ffd700 100%);
    border-color: #b8860b;
    border-width: 4px;
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }

  .leaderboard-entry.rank-silver {
    background: linear-gradient(135deg, #fff9f2 0%, #e6d7b8 100%);
    border-color: #a0826d;
    border-width: 3px;
    box-shadow: 0 3px 8px rgba(160, 130, 109, 0.3);
  }

  .leaderboard-entry.rank-standard {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.3);
    border-width: 2px;
  }

  .leaderboard-entry.player-entry {
    background: linear-gradient(135deg, #fff9f0 0%, #ffd89b 100%);
    border-color: #cc8800;
    border-width: 4px;
    box-shadow: 0 4px 12px rgba(204, 136, 0, 0.35);
  }

  .leaderboard-entry:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .entry-rank {
    font-size: 20px;
    font-weight: 700;
    color: var(--typewriter-ink);
    text-align: center;
  }

  .entry-initials {
    font-size: 18px;
    font-weight: 700;
    color: var(--typewriter-ink);
    letter-spacing: 2px;
    text-align: center;
    font-family: 'Courier New', monospace;
  }

  .entry-score {
    font-size: 16px;
    font-weight: 600;
    color: #666;
  }

  .entry-round {
    font-size: 14px;
    color: #999;
    font-weight: 400;
  }

  /* Empty State */
  .leaderboard-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
  }

  .leaderboard-empty p {
    margin: 8px 0;
    font-size: 16px;
  }

  /* Player Stats */
  .leaderboard-player-stats {
    margin-top: 24px;
    padding: 18px;
    background: rgba(212, 165, 116, 0.08);
    border: 2px solid rgba(212, 165, 116, 0.25);
    border-radius: 6px;
  }

  .player-best {
    font-size: 16px;
    font-weight: 600;
    color: var(--typewriter-ink);
    margin-bottom: 8px;
  }

  .player-best .highlight {
    color: #8b6914;
    font-weight: 700;
  }

  .player-stats-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: #666;
  }

  /* Initials Entry Modal */
  .initials-overlay {
    background: rgba(0, 0, 0, 0.9);
  }

  .initials-modal {
    max-width: 500px;
  }

  .initials-header {
    background: linear-gradient(180deg, #f5f1e8 0%, #e8dcc8 100%);
    padding: 24px;
    border-bottom: 3px solid rgba(0, 0, 0, 0.3);
    text-align: center;
  }

  .initials-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 26px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 12px 0;
    letter-spacing: 1px;
  }

  .initials-achievement {
    font-size: 17px;
    color: #1a1a1a;
    line-height: 1.6;
    font-weight: 500;
  }

  .initials-achievement .highlight {
    color: #7d3c00;
    font-weight: 700;
    text-decoration: underline;
  }

  .rank-text {
    font-size: 16px;
    color: #2c2c2c;
    font-weight: 600;
    font-style: normal;
  }

  .initials-content {
    padding: 32px 24px;
    text-align: center;
    background: var(--aged-paper-light);
  }

  .initials-prompt {
    font-size: 20px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 24px;
  }

  /* Initials Slots */
  .initials-slots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
  }

  .initial-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .initial-slot.active .slot-letter {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.3), 0 4px 0 rgba(0, 0, 0, 0.5);
  }

  .slot-letter {
    width: 64px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #000000;
    background: #ffffff;
    border: 3px solid #000000;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  }

  .slot-arrows {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .arrow-up, .arrow-down {
    width: 40px;
    height: 32px;
    background: var(--aged-paper-dark);
    border: 2px solid black;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .arrow-up:hover, .arrow-down:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
  }

  .arrow-up:active, .arrow-down:active {
    transform: scale(0.95);
  }

  /* Initials Instructions */
  /* Text Input Section */
  .text-input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
  }

  .initials-text-input {
    width: 120px;
    height: 64px;
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 8px;
    background: #ffffff;
    border: 3px solid #000000;
    border-radius: 8px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    margin-bottom: 8px;
  }

  .initials-text-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.3), 0 4px 0 rgba(0, 0, 0, 0.5);
  }

  .input-help {
    font-size: 12px;
    color: #666;
    margin: 0;
    font-weight: 400;
  }

  /* Divider */
  .input-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
  }

  .input-divider::before,
  .input-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
  }

  .input-divider span {
    padding: 0 16px;
  }

  .initials-instructions {
    margin-bottom: 24px;
    color: #000000;
    font-size: 15px;
    line-height: 1.7;
    font-weight: 600;
  }

  .initials-instructions p {
    margin: 6px 0;
  }

  .initials-submit {
    width: 100%;
    max-width: 200px;
    min-height: 48px;
    font-size: 17px;
    font-weight: 700;
    color: #000000 !important;
  }

  /* Success Message */
  .success-message {
    max-width: 400px;
    padding: 32px;
    text-align: center;
  }

  .success-content h2 {
    font-size: 28px;
    color: #2d5016;
    margin-bottom: 12px;
    font-family: 'Special Elite', 'Courier New', monospace;
    letter-spacing: 1px;
  }

  .success-content p {
    font-size: 16px;
    color: #666;
    font-family: 'Courier New', monospace;
  }

  /* Milestone Toast */
  .milestone-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--aged-paper-dark);
    color: var(--typewriter-ink);
    padding: 16px 24px;
    border-radius: 8px;
    border: 3px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 4px 0 rgba(0, 0, 0, 0.2);
    z-index: 3000;
    transition: transform 0.3s ease;
    font-weight: 600;
    font-size: 18px;
    font-family: 'Special Elite', 'Courier New', monospace;
    letter-spacing: 0.5px;
  }

  .milestone-toast.visible {
    transform: translateX(-50%) translateY(0);
  }

  /* Mobile Responsive */
  @media (max-width: 640px) {
    .leaderboard-modal {
      width: 95%;
      max-height: 90vh;
    }

    .leaderboard-title {
      font-size: 20px;
    }

    .leaderboard-entry {
      grid-template-columns: 40px 70px 1fr;
      gap: 8px;
      padding: 12px;
    }

    .entry-rank {
      font-size: 16px;
    }

    .entry-initials {
      font-size: 16px;
    }

    .entry-score {
      font-size: 14px;
    }

    .initials-modal {
      width: 95%;
    }

    .slot-letter {
      width: 56px;
      height: 70px;
      font-size: 40px;
    }

    .initials-slots {
      gap: 12px;
    }

    .initials-text-input {
      width: 100px;
      height: 56px;
      font-size: 28px;
      letter-spacing: 6px;
    }

    .input-divider {
      font-size: 12px;
    }

    .input-help {
      font-size: 11px;
    }
  }

  /* Print styles */
  @media print {
    body {
      background: white;
      color: black;
    }

    .paper-sheet::before {
      display: none;
    }

    .typewriter-button {
      display: none;
    }

    .sticky-controls {
      display: none;
    }

    #game-container {
      padding-bottom: 0;
    }

    .leaderboard-overlay,
    .milestone-toast {
      display: none;
    }
  }
}

/* Custom utility classes */
@layer utilities {
  .ink-ribbon-lines {
    background: repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 23px,
      rgba(139, 92, 246, 0.03) 23px,
      rgba(139, 92, 246, 0.03) 24px
    );
  }
}