body {
  background-color: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 10px;
  max-width: 100%;
  overflow-x: hidden;
}

.header-image {
  width: 100%;
  max-width: 600px;
  display: block;
  margin: 0 auto 20px auto;
}

#buttons {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

button {
  background-color: #e62b1e;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
  min-height: 44px;
  min-width: 120px;
}

button:hover {
  background-color: #c62118;
}

.scroll-hint {
  text-align: center;
  color: #aaa;
  font-size: 12px;
  margin-bottom: 10px;
  padding: 8px;
  background-color: #1a1a1a;
  border-radius: 4px;
}

#crossword-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 30px;
  border: 2px solid #444;
  border-radius: 8px;
  background-color: #222;
  padding: 10px;
}

#crossword-container {
  display: grid;
  grid-template-columns: repeat(30, 32px);
  grid-auto-rows: 32px;
  gap: 1px;
  justify-content: flex-start;
  min-width: fit-content;
  background-color: #333;
  padding: 5px;
}

.cell {
  border: 1px solid #555;
  background-color: white;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell input {
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  border: none;
  background: transparent;
  color: #000;
  text-transform: uppercase;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
}

.cell input:focus {
  background-color: #e6f3ff;
  box-shadow: 0 0 0 2px #007bff;
}

.cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 10px;
  color: #000;
  font-weight: bold;
  z-index: 2;
  pointer-events: none;
}

.black-cell {
  background-color: #111;
  border: 1px solid #333;
}

.clue-lists {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 30px;
}

.clue-list {
  background-color: #1a1a1a;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #444;
}

.clue-list h2 {
  color: #ccc;
  border-bottom: 2px solid #444;
  padding-bottom: 8px;
  margin-top: 0;
  margin-bottom: 15px;
}

.clue-list ol {
  padding-left: 0;
  list-style-type: none;
  margin: 0;
}

.clue-list li {
  margin-bottom: 12px;
  line-height: 1.5;
  color: #ddd;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clue-list li:hover {
  background-color: #333;
}

.clue-list li.active {
  background-color: #e62b1e;
  color: white;
}

.hidden {
  display: none;
}

#completion-message {
  background-color: #143628;
  color: #a0ffb0;
  border: 1px solid #2abb43;
  padding: 15px;
  text-align: center;
  border-radius: 5px;
  font-weight: bold;
  margin-top: 20px;
}

.cell input.correct {
  background-color: #d4edda !important;
}

.cell input.incorrect {
  background-color: #f8d7da !important;
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
}

.modal-content {
  background-color: #fefefe;
  color: #333;
  margin: 15% auto;
  padding: 25px;
  border: 1px solid #777;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  border-radius: 10px;
  text-align: center;
  position: relative;
}

.modal-content h3 {
  margin-top: 0;
  color: #e62b1e;
}

.modal-content p {
  line-height: 1.6;
  margin-bottom: 15px;
}

.close-button {
  color: #888;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close-button:hover,
.close-button:focus {
  color: #000;
  text-decoration: none;
}

.reveal-date {
  font-weight: bold;
  color: #000;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  body {
    padding: 5px;
  }

  #crossword-container {
    grid-template-columns: repeat(30, 28px);
    grid-auto-rows: 28px;
  }

  .cell input {
    font-size: 14px;
  }

  .cell-number {
    font-size: 8px;
    top: 1px;
    left: 2px;
  }

  button {
    padding: 10px 12px;
    font-size: 13px;
    min-width: 100px;
  }

  .clue-lists {
    gap: 20px;
  }

  .clue-list {
    padding: 15px;
  }

  .clue-list li {
    font-size: 0.95em;
    margin-bottom: 10px;
    padding: 6px;
  }
}

@media (max-width: 480px) {
  #crossword-container {
    grid-template-columns: repeat(30, 24px);
    grid-auto-rows: 24px;
  }

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

  .cell-number {
    font-size: 7px;
  }

  button {
    padding: 8px 10px;
    font-size: 12px;
    min-width: 90px;
  }

  .scroll-hint {
    font-size: 11px;
    padding: 6px;
  }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
  body {
    max-width: 1200px;
    margin-inline: auto;
    padding: 20px;
  }

  .header-image {
    max-width: 800px;
    margin-bottom: 30px;
  }

  #crossword-container {
    grid-template-columns: repeat(30, 36px);
    grid-auto-rows: 36px;
    justify-content: center;
  }

  .cell input {
    font-size: 18px;
  }

  .cell-number {
    font-size: 12px;
    top: 3px;
    left: 4px;
  }

  .clue-lists {
    flex-direction: row;
    gap: 40px;
  }

  .clue-list {
    flex: 1;
    min-width: 300px;
  }

  .scroll-hint {
    display: none; /* Hide scroll hint on desktop */
  }
}
