/* ANCHOR:CSS_GLOBAL_START */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-2: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header & Footer */
.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
}

.logo {
  height: 44px;
}

.logo.small {
  height: 36px;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
  text-align: center;
}

/* Main Layout */
main#app {
  padding: 8px 12px;
  max-width: 600px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}

.wrap {
  width: 100%;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 500px;
  margin: 0 auto;
}

.center {
  text-align: center;
}

.title {
  margin: 8px 0 16px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.sub {
  color: var(--muted);
  margin: 8px 0 18px;
}

/* Header Bar */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 0;
}

.game-title h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.chain-info {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  transition: all 0.15s ease;
  position: relative;
  z-index: 10;
}

.btn-icon:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
}

/* Score Strip */

/* Game Board */
.board {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 2px;
  margin-bottom: 12px;
  width: fit-content;
  max-width: 100%;
  margin-left: 0;
  margin-right: auto;
  cursor: pointer;
}

/* Tap to Play */
.tap-letter {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669 !important;
}

/* Pass & Play Instruction Colors */
.instruction-yellow {
  background: #fbbf24 !important;
  color: #1f2937 !important;
  border-color: #f59e0b !important;
}

.instruction-white {
  background: #ffffff !important;
  color: #374151 !important;
  border-color: #d1d5db !important;
}

.instruction-green {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669 !important;
}

/* Mode Indicator (Like Imposter) */
.mode-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.mode-btn {
  background: #6b7280;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 4px;
}

.mode-btn:hover {
  background: #4b5563;
}

.mode-btn.selected {
  background: var(--success);
  color: white;
}

.mode-btn.selected:hover {
  background: var(--success);
}

/* Pass & Play Controls (Below Board) */
.pass-play-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.player-count-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #374151;
}

.customize-link {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.customize-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.count-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}

.count-btn:hover {
  background: var(--primary-2);
}

#playerCountDisplay {
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.player-names {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.player-name-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-name-input label {
  font-size: 0.8rem;
  color: var(--muted);
}

.player-name-input input {
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.player-name-input input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Pass & Play Complete Modal */
.complete-score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.complete-score .score-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.complete-score .score-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--success);
}

.current-scores h4,
.final-scores h4 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: var(--text);
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e7eb;
}

.score-item.completed {
  background: #f0f9ff;
  border-color: var(--primary);
}

.score-item.pending {
  background: #fef3c7;
  border-color: #f59e0b;
}

.player-name {
  font-weight: 600;
  color: var(--text);
}

.player-score {
  font-weight: bold;
  color: var(--primary);
}

.final-results-table {
  margin-top: 16px;
}

.final-header {
  display: grid;
  grid-template-columns: 2fr repeat(auto-fit, minmax(80px, 1fr)) 1fr;
  gap: 12px;
  padding: 8px 12px;
  background: var(--primary);
  color: white;
  font-weight: bold;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.final-row {
  display: grid;
  grid-template-columns: 2fr repeat(auto-fit, minmax(80px, 1fr)) 1fr;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.final-total-row {
  display: grid;
  grid-template-columns: 2fr repeat(auto-fit, minmax(80px, 1fr)) 1fr;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-top: 2px solid var(--primary);
  font-weight: bold;
}

.word-col {
  text-align: left;
  font-weight: bold;
}

.player-col {
  text-align: center;
}

.total-col {
  text-align: center;
  font-weight: bold;
}

.final-row:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.winner-declaration {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: var(--radius);
}

.winner-declaration h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.player-col.winner {
  background: #10b981;
  color: white;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

/* Feedback link styling */
.feedback-link {
  margin: 12px 0;
  text-align: center;
}

.feedback-link a {
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.feedback-link a:hover {
  color: #374151;
  text-decoration: underline;
}

/* Score table styling */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.score-table th,
.score-table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.score-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.score-table .total-row {
  background: #f3f4f6;
  font-weight: 600;
}

.score-table .total-row td {
  border-top: 2px solid #d1d5db;
}

.final-row .word {
  font-weight: 600;
  color: var(--text);
}

.final-row .player {
  color: var(--muted);
}

.final-row .score {
  font-weight: bold;
  color: var(--primary);
}

/* Pass & Play Complete Modal */
#passPlayCompleteModal {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.8) !important;
  z-index: 9999 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#passPlayCompleteModal .modal-content {
  position: relative !important;
  background: white !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 20px auto;
  padding: 16px;
  border: 3px solid red !important;
  min-height: 200px !important;
  max-height: 90vh;
  overflow-y: auto;
}

/* Tight spacing for Pass & Play modal */
#passPlayCompleteModal .modal-header {
  padding: 0 0 8px 0;
  margin-bottom: 8px;
}

#passPlayCompleteModal .modal-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

#passPlayCompleteModal .modal-body {
  padding: 0;
}

#passPlayCompleteModal .complete-score {
  margin: 8px 0;
  font-size: 0.9rem;
}

#passPlayCompleteModal .score-breakdown {
  margin: 8px 0;
}

#passPlayCompleteModal .modal-actions {
  margin-top: 12px;
  padding-top: 8px;
}

/* Current Player Display */
.current-player {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

.current-player-turn {
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  margin: 8px 0 16px 0;
  /* Remove button-like styling */
  background: none;
  border: none;
  padding: 0;
}

/* Pass & Play Styles */
.current-scores {
  margin: 20px 0;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.score-item.completed {
  background: var(--success);
  color: white;
}

.score-item.pending {
  background: #e5e7eb;
  color: var(--muted);
}

.final-scores {
  margin: 20px 0;
}

.final-score-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: white;
  border: 2px solid #e5e7eb;
}

.final-score-item.winner {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.rank {
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.player-score {
  color: var(--muted);
  font-size: 0.9rem;
}

.final-score-item.winner .player-score {
  color: rgba(255, 255, 255, 0.8);
}

.winner-badge {
  font-size: 1.5rem;
}

.row {
  display: flex;
  align-items: center;
  margin-bottom: 1px;
  padding: 2px 0px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  position: relative;
  gap: 2px;
}

.row:last-child {
  margin-bottom: 0;
}

.row.revealed {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2px solid #10b981;
}

.row.active {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid var(--primary);
  animation: pulse 2s infinite;
}

/* Mobile: Make active row clickable to reopen keyboard */
@media (max-width: 768px) {
  .row.active {
    cursor: pointer;
  }
}

.row.locked {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border: 1px solid #e5e7eb;
}

/* Row numbers removed for cleaner UX */

.word-display {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-shrink: 0;
  width: fit-content;
}

.letter-box {
  width: 42px;
  height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 2.2rem;
  font-weight: 800;
  background: #f8fafc;
  color: var(--text);
  transition: all 0.2s ease;
  user-select: none;
  tabindex: -1;
}

.letter-box:focus {
  outline: none;
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.letter-box.revealed {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.letter-box.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  animation: pulse 1.5s infinite;
}

.letter-box.current {
  border-color: var(--primary);
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  animation: none;
}

.letter-box.typing {
  border-color: var(--primary);
  background: #f0f9ff;
  color: var(--primary);
  font-weight: 700;
}

.letter-box.locked {
  background: #f1f5f9;
  color: var(--muted);
  border-color: #d1d5db;
}

.letter-box.empty {
  background: #f8fafc;
  border-color: #d1d5db;
  color: transparent;
}

.row.revealed .letter-box {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.row.locked .letter-box {
  background: #f1f5f9;
  color: var(--muted);
  border-color: #d1d5db;
}

.row-score {
  width: 24px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.row.revealed .row-score {
  color: var(--success);
}

.row.locked .row-score {
  color: var(--muted);
}

/* Instructions Section */
.instructions-section {
  margin-bottom: 16px;
  padding: 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: var(--radius-md);
  border: 1px solid #0ea5e9;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.word-input {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.word-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.word-input:disabled {
  background: #f8fafc;
  color: var(--muted);
  cursor: not-allowed;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: white;
  border: none;
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-2) 0%, #1e40af 100%);
}

.input-hint {
  font-size: 0.875rem;
  color: var(--text);
  text-align: center;
  font-weight: 500;
  line-height: 1.4;
}

/* Hidden Game Input */
.hidden-game-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* Tap to Start Overlay */
.tap-to-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.tap-to-start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.tap-to-start-content {
  text-align: center;
  color: white;
  padding: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 280px;
  animation: pulse-glow 2s infinite;
}

.tap-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: bounce 1.5s infinite;
}

.tap-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tap-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  font-weight: 400;
}

/* Animations */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Hide overlay on desktop */
@media (min-width: 769px) {
  .tap-to-start-overlay {
    display: none;
  }
}

/* Score Strip */

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

.score-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

.toast.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.toast.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

/* Screens */
.screen {
  display: none;
}

.screen.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Complete Screen */
.emoji {
  font-size: 4rem;
  margin-bottom: 16px;
}

.score-breakdown {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.score-row:last-child {
  margin-bottom: 0;
}

/* Row Layout */
.row.center {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 0 24px 24px;
}

.help-section {
  margin-bottom: 24px;
}

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

.help-section h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.help-section ul {
  margin: 0;
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Responsive Design */
@media (max-width: 480px) {
  main#app {
    padding: 8px 8px;
  }
  
  .header-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    padding: 2px 0;
  }
  
  .game-title h1 {
    font-size: 1.1rem;
  }
  
  .header-actions {
    align-self: center;
  }
  
  .mode-indicator {
    margin-bottom: 4px;
  }
  
  
  .input-wrapper {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .row.center {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Optimized letter boxes for mobile readability */
  .letter-box {
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
    font-weight: 800;
  }
  
  .word-display {
    gap: 1px;
  }
  
  .row {
    margin-bottom: 0px;
    padding: 1px 0px;
    gap: 1px;
  }
  
  .board {
    padding: 2px 1px;
    margin-bottom: 8px;
  }
  
  /* Reduce spacing even more on mobile */
  .instructions-section {
    margin-bottom: 10px;
    padding: 8px;
  }
  
}

/* Footer */
/* Inline Logo */
.inline-logo {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}

.inline-logo .logo {
  height: 48px;
  opacity: 0.7;
}

/* Archive Modal Styles */
.archive-stats {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.archive-stat {
  text-align: center;
}

.archive-stat .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.archive-stat .stat-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.archive-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.archive-item-info {
  display: flex;
  flex-direction: column;
}

.archive-item-id {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.archive-item-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.archive-item-score {
  font-weight: 700;
  color: var(--success);
  font-size: 1.1rem;
}

.archive-item-perfect {
  color: var(--warning);
  margin-left: 8px;
}

/* Hot Streak Animation */
@keyframes flamePulse {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
  }
}

.flame-animation {
  animation: flamePulse 1s ease-out;
}

/* Keyboard hint styling */
kbd {
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  color: var(--text);
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

/* Virtual Keyboard Styles */
.virtual-keyboard {
  position: relative !important;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  margin: 16px auto;
  max-width: 500px;
  user-select: none;
  -webkit-user-select: none;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
}

/* Instruction letter box colors */
.letter-box.instruction-green {
  background-color: #6aaa64;
  color: white;
}

.letter-box.instruction-blue {
  background-color: #3a7bd5;
  color: white;
}

.letter-box.instruction-gray {
  background-color: #787c7e;
  color: white;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.keyboard-key {
  width: 32px;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  touch-action: manipulation;
}

.keyboard-key:hover {
  background: #e9ecef;
}

.keyboard-key:active {
  transform: scale(0.95);
}

/* Special keys */
.keyboard-key[data-key="ENTER"],
.keyboard-key[data-key="DELETE"] {
  width: 70px;
}

/* Key states for Wordle-style coloring */
.keyboard-key[data-state="correct"] {
  background: #6aaa64;
  color: white;
}

.keyboard-key[data-state="present"] {
  background: #c9b458;
  color: white;
}

.keyboard-key[data-state="absent"] {
  background: #787c7e;
  color: white;
}

.keyboard-key[data-state="unused"] {
  background: #d3d6da;
  color: black;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .virtual-keyboard {
    padding: 6px;
  }
  
  .keyboard-key {
    width: 28px;
    height: 36px;
    font-size: 13px;
  }
  
  .keyboard-key[data-key="ENTER"],
  .keyboard-key[data-key="DELETE"] {
    width: 60px;
  }
}

/* Score Popup Animation */
.score-popup {
  position: fixed;
  z-index: 1000;
  font-size: 2rem;
  font-weight: bold;
  color: #10b981;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  transition: all 0.3s ease-out;
}

.score-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.score-popup.fade-out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.2) translateY(-20px);
}

/* ANCHOR:CSS_GLOBAL_END */
