/* puzzles.css - styling for the puzzles page */

* {
  box-sizing: border-box;
}

.puzzle-page {
  font-family: 'Rubik Wet Paint', sans-serif;
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
}

.marquee {
  position: relative;
  z-index: 60;
  margin-top: 26px;
  background: #fff58a;
  overflow: hidden;
  white-space: nowrap;
}

.marquee-inner {
  display: inline-flex;
  animation: marquee 38s linear infinite;
}

.marquee-inner span {
  display: inline-block;
  padding: 0 20px;
  font-size: 16px;
  font-weight: bold;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background-color: rgba(22, 21, 42, 0.95);
  padding: 12px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__home {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
}

.nav__links a {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  margin: 0 4px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.nav__links a:hover {
  background-color: rgba(255, 245, 138, 0.2);
}

.hero {
  text-align: center;
  padding: 40px 20px;
  margin-top: 60px;
}

.hero .title {
  font-size: 2.5em;
  margin-bottom: 20px;
  color: #16152a;
}

.hero .subtag {
  font-size: 1.1em;
  color: #555;
  max-width: 800px;
  margin: 0 auto;
}

.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.card.tilt {
  transform: rotate(-1deg);
}

.card.hidden {
  display: none;
}

.card h2 {
  font-size: 1.8em;
  margin-top: 0;
  margin-bottom: 16px;
  color: #16152a;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 8px;
}

.card p {
  font-size: 1em;
  color: #555;
  margin-bottom: 20px;
}

.puzzle-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.puzzle-item {
  background-color: #f5f5f5;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  min-height: 44px;
}

.puzzle-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.puzzle-item.solved {
  border-color: #4caf50;
  background-color: #e8f5e9;
}

.puzzle-item h3 {
  margin: 0 0 10px 0;
  font-size: 1.2em;
  color: #16152a;
}

.puzzle-item p {
  margin: 0;
  font-size: 0.9em;
  color: #666;
}

.solved-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  background-color: #4caf50;
  color: #fff;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
}

.puzzle-progress {
  margin: 20px 0;
  text-align: center;
}

.puzzle-progress-bar {
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.puzzle-progress-fill {
  height: 100%;
  background-color: #16152a;
  width: 0%;
  transition: width 0.3s ease;
}

.puzzle-hint {
  margin: 16px 0;
  padding: 12px 16px;
  background-color: #fff8e1;
  border-radius: 8px;
  border: 1px solid #ffd54f;
}

.puzzle-hint.hidden {
  display: none;
}

.hint-text {
  display: inline-block;
  margin-left: 12px;
  font-size: 0.95em;
  color: #5d4037;
  line-height: 1.5;
}

.puzzle-form {
  margin-top: 20px;
}

.puzzle-question {
  font-size: 1.2em;
  margin-bottom: 16px;
  color: #16152a;
}

.puzzle-input {
  margin-bottom: 16px;
}

.puzzle-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.puzzle-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s;
  min-height: 44px;
}

.puzzle-actions .btn-secondary {
  background-color: #e0e0e0;
  color: #16152a;
}

.puzzle-actions .btn-secondary:hover {
  background-color: #d0d0d0;
}

.puzzle-actions .btn-primary {
  background-color: #16152a;
  color: #fff;
}

.puzzle-actions .btn-primary:hover {
  background-color: #1a1932;
}

.puzzle-result {
  text-align: center;
  padding: 20px;
}

.result-card {
  font-size: 2em;
  margin: 20px 0;
  color: #16152a;
}

.result-description {
  font-size: 1.1em;
  color: #555;
  margin-bottom: 20px;
}

.result-stats {
  font-size: 0.9em;
  color: #888;
}

.controls {
  position: fixed;
  right: 12px;
  top: 74px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls button {
  font-size: 14px;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: rgba(22, 21, 42, 0.8);
  color: #fff;
  transition: background-color 0.2s;
  min-height: 44px;
}

.controls button:hover {
  background-color: rgba(22, 21, 42, 1);
}

footer {
  text-align: center;
  padding: 20px 16px 40px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.badge {
  background-color: #fff;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.9em;
  color: #555;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.badge b {
  font-weight: bold;
  color: #16152a;
}

.webring {
  font-size: 0.9em;
  color: #666;
  margin-top: 20px;
}

.webring a {
  color: #16152a;
  text-decoration: none;
}

.konami-hint {
  font-size: 0.8em;
  color: #888;
  margin-top: 10px;
  text-align: center;
}

toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #16152a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}

toast.show {
  opacity: 1;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (max-width: 768px) {
  .nav__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav__home {
    margin-bottom: 16px;
  }

  .nav__links {
    flex-direction: column;
    width: 100%;
  }

  .nav__links a {
    margin: 8px 0;
  }

  .controls {
    flex-direction: row;
    top: 20px;
    right: 20px;
  }

  .controls button {
    padding: 8px 12px;
    font-size: 12px;
  }

  .card {
    padding: 16px;
  }

  .hero .title {
    font-size: 2em;
  }

  .puzzle-actions {
    flex-direction: column;
  }

  .puzzle-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-inner {
    animation: none;
  }

  .puzzle-item:hover {
    transform: none;
  }

  .puzzle-progress-fill {
    transition: none;
  }
}

/* Anagram puzzle styles */
.anagram-display {
  text-align: center;
  margin-bottom: 24px;
}

.scrambled-word {
  font-size: 3em;
  font-weight: bold;
  letter-spacing: 0.2em;
  color: #16152a;
  font-family: 'Rubik Wet Paint', sans-serif;
  margin: 16px 0;
}

.anagram-input {
  text-align: center;
}

.anagram-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #16152a;
}

.anagram-input input {
  font-size: 1.5em;
  padding: 12px 24px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'Rubik Wet Paint', sans-serif;
  width: 100%;
  max-width: 300px;
  min-height: 44px;
}

.anagram-input input:focus {
  outline: none;
  border-color: #16152a;
  box-shadow: 0 0 0 3px rgba(22, 21, 42, 0.1);
}

/* Cryptogram styles */
.cryptogram-display {
  margin-bottom: 16px;
  font-family: monospace;
  font-size: 0.9em;
}

.cipher-text {
  color: #16152a;
  margin-bottom: 8px;
}

.original-text {
  color: #666;
}

/* Word ladder styles */
.word-ladder-display {
  margin-bottom: 16px;
}

.word-ladder-display p {
  margin: 8px 0;
}

.word-ladder-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #16152a;
}

.word-ladder-input input {
  font-size: 1.5em;
  padding: 12px 24px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Rubik Wet Paint', sans-serif;
  width: 100%;
  max-width: 200px;
  min-height: 44px;
}

.word-ladder-input input:focus {
  outline: none;
  border-color: #16152a;
  box-shadow: 0 0 0 3px rgba(22, 21, 42, 0.1);
}

/* Nonogram styles */
.nonogram-grid {
  display: inline-grid;
  grid-template-columns: auto repeat(5, 44px);
  grid-template-rows: auto repeat(5, 44px);
  gap: 2px;
}

.nonogram-corner {
  width: 60px;
  height: 30px;
}

.nonogram-clues-row {
  display: contents;
}

.nonogram-col-clue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  font-size: 0.8em;
  color: #16152a;
  font-weight: bold;
  padding: 4px;
}

.nonogram-row {
  display: contents;
}

.nonogram-row-clue {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 60px;
  height: 44px;
  padding-right: 8px;
  font-size: 0.8em;
  color: #16152a;
  font-weight: bold;
}

.nonogram-cell {
  width: 44px;
  height: 44px;
  border: 2px solid #16152a;
  background-color: #f5f5f5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  transition: background-color 0.1s;
}

.nonogram-cell.filled {
  background-color: #16152a;
  color: #fff;
}

.nonogram-cell:hover {
  background-color: #e0e0e0;
}

.nonogram-cell.filled:hover {
  background-color: #2a2942;
}

/* Sudoku styles */
.sudoku-grid {
  display: inline-grid;
  grid-template-columns: repeat(4, 44px);
  grid-template-rows: repeat(4, 44px);
  gap: 2px;
  border: 3px solid #16152a;
}

.sudoku-row {
  display: contents;
}

.sudoku-cell {
  width: 44px;
  height: 44px;
  border: 1px solid #e0e0e0;
  background-color: #fafafa;
  text-align: center;
  font-size: 1.5em;
  font-family: 'Rubik Wet Paint', sans-serif;
  color: #16152a;
  -moz-appearance: textfield;
}

.sudoku-cell::-webkit-outer-spin-button,
.sudoku-cell::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sudoku-cell.editable {
  background-color: #fff;
  border-color: #16152a;
}

.sudoku-cell:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(22, 21, 42, 0.2);
}

/* 2x2 box borders */
.sudoku-cell:nth-child(2n):not(:nth-child(4n)) {
  border-right: 3px solid #16152a;
}
.sudoku-cell:nth-child(4n) {
  border-right: 3px solid #16152a;
}
.sudoku-row:nth-child(2n) .sudoku-cell {
  border-bottom: 3px solid #16152a;
}

/* Maze styles */
.maze-grid {
  display: inline-grid;
  grid-template-columns: repeat(10, 32px);
  grid-template-rows: repeat(10, 32px);
  gap: 1px;
  background-color: #16152a;
}

.maze-row {
  display: contents;
}

.maze-cell {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: bold;
  color: #16152a;
}

.maze-cell.wall {
  background-color: #16152a;
}

.maze-cell.path {
  background-color: #f5f5f5;
  cursor: pointer;
}

.maze-cell.path:hover {
  background-color: #e8e8e8;
}

.maze-cell.start {
  background-color: #4caf50;
  color: #fff;
}

.maze-cell.end {
  background-color: #f44336;
  color: #fff;
}

.maze-cell.visited {
  background-color: #ffd54f;
}

.maze-cell.visited.success {
  background-color: #4caf50;
  color: #fff;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Logic grid styles */
.logic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.logic-constraints {
  background-color: #f5f5f5;
  padding: 16px;
  border-radius: 8px;
}

.logic-constraints h4 {
  margin-top: 0;
  color: #16152a;
}

.logic-constraints ul {
  margin: 0;
  padding-left: 20px;
}

.logic-constraints li {
  margin: 8px 0;
  font-size: 0.95em;
  color: #555;
}

.logic-grid-input h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #16152a;
}

.logic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logic-item label {
  min-width: 80px;
  font-weight: bold;
  color: #16152a;
}

.logic-item select {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  font-family: 'Rubik Wet Paint', sans-serif;
  background-color: #fff;
  color: #16152a;
  min-height: 44px;
  cursor: pointer;
}

.logic-item select:focus {
  outline: none;
  border-color: #16152a;
  box-shadow: 0 0 0 3px rgba(22, 21, 42, 0.1);
}

/* Streak display */
.puzzle-streak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 16px;
  background-color: #fff8e1;
  border-radius: 20px;
  font-size: 0.9em;
  color: #5d4037;
}

.puzzle-streak .streak-fire {
  font-size: 1.2em;
}

/* Share link toast */
.puzzle-share-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #16152a;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}