.wordfall-page {
  background: #ffffff !important;
  color: #1f2937;
  min-height: 100vh;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* Hide SEO content from visual display while keeping it in HTML for search engines */
.seo-expansion,
.seo-columns,
.seo-responsive-grid,
.seo-faq {
  display: none !important;
}

.wordfall-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.wordfall-sidebar {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-heading {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: #6b7280;
}

.wordfall-words {
  display: grid;
  gap: 0.75rem;
  flex: 1;
  align-content: start;
}

.wordfall-turn {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.6rem;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wordfall-turn.empty {
  border-style: dashed;
  background: transparent;
  min-height: 48px;
}

.turn-tiles {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.turn-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wordfall-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.9rem;
  color: #374151;
}

.wordfall-share {
  background: #1f2937;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.wordfall-share:hover,
.wordfall-share:focus {
  background: #111827;
}

.wordfall-share:disabled {
  background: #d1d5db;
  color: #6b7280;
  cursor: not-allowed;
}

.wordfall-game {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.wordfall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.wordfall-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
}

.wordfall-status {
  font-size: 0.95rem;
  color: #4b5563;
  margin-top: 0.3rem;
}

.wordfall-help {
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.wordfall-help:hover,
.wordfall-help:focus {
  border-color: #1f2937;
  background: #f9fafb;
}

.wordfall-board {
  display: grid;
  grid-template-columns: repeat(4, clamp(60px, 16vw, 78px));
  grid-auto-rows: clamp(60px, 16vw, 78px);
  gap: 0.4rem;
  justify-content: center;
}

.wordfall-tile {
  position: relative;
  width: clamp(60px, 16vw, 78px);
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: none;
  background: linear-gradient(145deg, #f5e6d3, #e8d4b8);
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.15),
    inset 2px 2px 4px rgba(255, 255, 255, 0.7),
    2px 2px 6px rgba(0, 0, 0, 0.2);
  color: #2c1810;
  font-weight: 700;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  font-family: 'Arial Black', sans-serif;
}

.wordfall-tile .tile-points {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #2c1810;
  background: #fff;
  border-radius: 2px;
  padding: 1px 3px;
  line-height: 1;
}

.wordfall-tile:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.wordfall-tile.is-disabled {
  cursor: default;
  opacity: 0.4;
}

.wordfall-tile.is-selected {
  background: #111827;
  color: #f9fafb;
  border-color: #111827;
  transform: translateY(-3px);
}

.wordfall-tile.is-golden {
  background: linear-gradient(135deg, #fef3c7, #fbbf24);
  border-color: #f59e0b;
  color: #92400e;
}

.wordfall-tile.is-valid {
  background: #22c55e;
  border-color: #16a34a;
  color: #f8fafc;
}

.wordfall-tile.is-invalid {
  background: #9ca3af;
  border-color: #6b7280;
  color: #f8fafc;
}

@keyframes wordfall-drop-out {
  from {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(-160px, 120px) scale(0.6);
    opacity: 0;
  }
}

@keyframes wordfall-drop-in {
  from {
    transform: translateY(-160px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.wordfall-tile.is-dropping {
  animation: wordfall-drop-out 0.5s ease-in forwards;
  pointer-events: none;
}

.wordfall-tile.is-new {
  animation: wordfall-drop-in 0.45s ease-out;
}

.wordfall-current {
  margin: 1.5rem 0 1rem;
  text-align: center;
  min-height: 52px;
}

.current-word {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #111827;
  min-height: 2.5rem;
}

.wordfall-message {
  font-size: 0.95rem;
  font-weight: 600;
  color: #059669;
  margin-top: 0.4rem;
  min-height: 1.1rem;
}

.wordfall-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.wordfall-button {
  border-radius: 10px;
  padding: 0.65rem 1.8rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.wordfall-button.primary {
  background: #22c55e;
  border-color: #16a34a;
  color: #ffffff;
}

.wordfall-button.primary:hover,
.wordfall-button.primary:focus {
  transform: translateY(-2px);
  background: #16a34a;
}

.wordfall-button.secondary {
  background: #ffffff;
  border-color: #d1d5db;
  color: #1f2937;
}

.wordfall-button.secondary:hover,
.wordfall-button.secondary:focus {
  border-color: #1f2937;
}

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

.wordfall-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

/* Ensure modal is hidden when hidden attribute is present - CRITICAL for preventing auto-show */
.wordfall-modal[hidden] {
  display: none !important;
}

.modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 8px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
}

.modal-close:hover {
  color: #333;
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  margin: 0 0 0.5rem 0;
  color: #2c3e50;
  font-size: 2rem;
  font-weight: bold;
}

.modal-subtitle {
  margin: 0;
  color: #666;
  font-size: 1rem;
}

.modal-body {
  padding: 0;
}

.rules-list {
  padding-left: 1.2rem;
  margin: 0 0 2rem 0;
}

.rules-list li {
  color: #333;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.rules-examples {
  margin-top: 1.5rem;
}

.rules-examples h4 {
  color: #2c3e50;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: bold;
}

.rules-examples p {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.modal-dismiss {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: none;
  background: #111827;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

@media (min-width: 960px) {
  .wordfall-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .wordfall-sidebar {
    width: 320px;
    flex-shrink: 0;
    min-height: 100%;
  }

  .wordfall-game {
    flex: 1;
  }

  .wordfall-board {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .wordfall-board {
    grid-template-columns: repeat(4, clamp(52px, 20vw, 68px));
    grid-auto-rows: clamp(52px, 20vw, 68px);
    gap: 0.3rem;
  }

  .wordfall-tile {
    width: clamp(52px, 20vw, 68px);
    font-size: 1.35rem;
  }

  .wordfall-layout {
    padding: 1rem;
  }

  .modal-content {
    padding: 1.5rem;
  }
}
.mini-tile {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}

.mini-tile.is-golden {
  background: linear-gradient(135deg, #fef3c7, #fbbf24);
  border-color: #f59e0b;
  color: #92400e;
}

.mini-tile .tile-points {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 0.55rem;
  color: #6b7280;
  font-weight: 600;
}
.wordfall-message.is-error {
  color: #dc2626;
}

.wordfall-message.is-success {
  color: #059669;
}

.seo-expansion {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 18px;
  padding: 2.5rem;
  margin: 3rem auto;
  max-width: 960px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.seo-expansion h2 {
  font-size: 2rem;
  color: #0f172a;
  margin-bottom: 1rem;
}

.seo-expansion p {
  color: #1e293b;
  line-height: 1.75;
  margin-bottom: 1.2rem;
}

.seo-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.seo-column {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.seo-column h3 {
  color: #0f172a;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.seo-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.seo-column li {
  margin: 0.45rem 0;
  color: #334155;
  font-size: 0.98rem;
}

.seo-responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.seo-card {
  border-radius: 16px;
  padding: 1.8rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.seo-card h3 {
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.seo-card p,
.seo-card li {
  color: #1f2937;
}

.seo-faq details {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.95);
}

.seo-faq summary {
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}

.seo-faq p {
  margin-top: 0.75rem;
  color: #1e293b;
}

@media (max-width: 768px) {
  .seo-expansion {
    padding: 1.75rem;
  }

  .seo-expansion h2 {
    font-size: 1.6rem;
  }

  .seo-card {
    padding: 1.4rem;
  }
}
