/* Crossword Modal Styles — themed to Breadboard3D (dark cyan).
   Uses the global :root variables from style.css. Layout/sizing/animation are
   unchanged from the original; only colours were re-mapped to the app theme. */
.crossword-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 12, 0.6);
  z-index: 1000 !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.crossword-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.crossword-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  background: var(--bg-panel, #0e1520);
  color: var(--text-primary, #d4e8f0);
  border: 1px solid var(--border-bright, #243348);
  border-radius: 12px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55), 0 0 24px var(--accent-glow, rgba(0, 229, 255, 0.18));
  z-index: 1001;
  overflow: hidden;
  opacity: 0;
  overflow-x: hidden;
}

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

.crossword-modal-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border, #1a2535);
  background: linear-gradient(180deg, var(--bg-surface, #0c1118), var(--bg-panel, #0e1520));
  color: var(--text-primary, #d4e8f0);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}

.crossword-modal-title-container {
  flex: 1;
  min-width: 0;
}

.crossword-modal-title {
  margin: 0 0 8px 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent, #00e5ff);
  line-height: 1.3;
}

.crossword-modal-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary, #6a8fa8);
  line-height: 1.4;
  opacity: 0.9;
  text-align: center;
}

.crossword-modal-close-button {
  background: var(--bg-hover, #1a2535);
  border: 1px solid var(--border, #1a2535);
  font-size: 1.5rem;
  color: var(--text-secondary, #6a8fa8);
  cursor: pointer;
  padding: 8px;
  margin-left: 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crossword-modal-close-button:hover {
  background: var(--bg-active, #1e2e42);
  color: var(--accent, #00e5ff);
  transform: scale(1.05);
}

.crossword-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  gap: 24px;
}

.crossword-grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.crossword-stats {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary, #6a8fa8);
}

.crossword-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crossword-grid {
  display: inline-grid;
  gap: 2px;
  background: var(--bg-card, #121c28);
  padding: 2px;
  border-radius: 8px;
}

.crossword-cell {
  width: 40px;
  height: 40px;
  background: var(--bg-surface, #0c1118);
  border: 1px solid var(--border-bright, #243348);
  color: var(--text-primary, #d4e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  transition: all 150ms;
}

.crossword-cell.blocked {
  background: var(--bg-base, #080c12);
  cursor: default;
  visibility: hidden;
  /*opacity: 0;*/
}

.crossword-cell.selected {
  background: var(--accent-glow, rgba(0, 229, 255, 0.18));
  border-color: var(--accent, #00e5ff);
}

.crossword-cell.highlighted {
  background: var(--bg-hover, #1a2535);
}

.crossword-cell.correct {
  background: rgba(35, 214, 164, 0.16);
  border-color: rgba(35, 214, 164, 0.5);
  color: #3fe6b0;
}

.crossword-cell.incorrect {
  background: rgba(255, 90, 95, 0.15);
  border-color: rgba(255, 90, 95, 0.5);
  color: #ff7a7f;
  animation: shake 300ms;
}

.crossword-cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim, #3a5068);
}

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

.crossword-clues {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(90vh - 200px);
}

.crossword-clue-section {
  background: var(--bg-card, #121c28);
  border: 1px solid var(--border, #1a2535);
  padding: 16px;
  border-radius: 8px;
}

.crossword-clue-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent, #00e5ff);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.crossword-clue-item {
  display: flex;
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 150ms;
}

.crossword-clue-item:hover {
  background: var(--bg-hover, #1a2535);
}

.crossword-clue-item.active {
  background: var(--accent-glow, rgba(0, 229, 255, 0.18));
  font-weight: 500;
}

.crossword-clue-item.completed {
  opacity: 0.5;
  text-decoration: line-through;
}

.crossword-clue-number {
  font-weight: 700;
  color: var(--accent, #00e5ff);
  min-width: 20px;
}

.crossword-clue-text {
  flex: 1;
  color: var(--text-secondary, #6a8fa8);
}

.crossword-clue-item.active .crossword-clue-text {
  color: var(--text-primary, #d4e8f0);
}

.crossword-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.crossword-button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
}

.crossword-button-primary {
  background: var(--accent-dim, #007a99);
  color: #eafcff;
}

.crossword-button-primary:hover {
  background: var(--accent, #00e5ff);
  color: #06222c;
  transform: translateY(-1px);
}

.crossword-button-secondary {
  background: var(--bg-hover, #1a2535);
  color: var(--text-secondary, #6a8fa8);
  border: 1px solid var(--border, #1a2535);
}

.crossword-button-secondary:hover {
  background: var(--bg-active, #1e2e42);
  color: var(--text-primary, #d4e8f0);
}

.crossword-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.crossword-completion {
  text-align: center;
  padding: 32px;
  background: linear-gradient(135deg, var(--accent-dim, #007a99) 0%, #0b3a54 100%);
  color: #eafcff;
  border: 1px solid var(--border-bright, #243348);
  border-radius: 12px;
  margin: 16px 0;
}

.crossword-completion h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
}

.crossword-completion p {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .crossword-modal-body {
    flex-direction: column;
  }

  .crossword-clues {
    width: 100%;
    max-height: 300px;
  }

  .crossword-cell {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

