:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --background-color: #ecf0f1;
  --text-color: #2c3e50;
  --light-gray: #bdc3c7;
  --dark-gray: #7f8c8d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

header p {
  font-size: 1.2rem;
  color: var(--dark-gray);
}

footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  color: var(--dark-gray);
  border-top: 1px solid var(--light-gray);
}

.game-start {
  text-align: center;
  padding: 40px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-start h2 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

.game-start p {
  margin-bottom: 15px;
  font-size: 1.1rem;
}

button {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #2980b9;
}

.game-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.letter-tracker {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.letter-tracker h3 {
  margin-bottom: 15px;
  color: var(--primary-color);
}

.letter-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.letter-box {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: bold;
}

.puzzle {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.puzzle-title {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.puzzle-description {
  color: var(--dark-gray);
  margin-bottom: 20px;
  font-style: italic;
}

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

.puzzle-interactive p {
  margin-bottom: 15px;
}

.input-container {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

input[type="text"] {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  font-size: 1rem;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.option {
  padding: 15px;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.option:hover {
  background-color: #f7f7f7;
}

.option.selected {
  background-color: var(--secondary-color);
  color: white;
}

.code-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.code-digit {
  width: 50px;
  height: 50px;
  text-align: center;
  font-size: 1.5rem;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
}

.error {
  color: var(--accent-color);
  margin-top: 10px;
}

.puzzle-solved {
  background-color: #e8f7e8;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.letter-reveal {
  font-size: 3rem;
  font-weight: bold;
  color: var(--secondary-color);
  margin: 20px 0;
  animation: pulse 2s infinite;
}

.letters-reveal {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.letters-reveal .letter {
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary-color);
  animation: fadeIn 1s ease-in-out;
}

.game-finished {
  background-color: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.game-finished h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.collected-letters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.letter {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 10px 15px;
  background-color: var(--secondary-color);
  color: white;
  border-radius: 4px;
}

.solution-form {
  display: flex;
  gap: 10px;
  margin: 20px auto;
  max-width: 400px;
}

.reset-button {
  background-color: var(--light-gray);
  margin-top: 20px;
}

.step-description {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

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

.step-progress {
  margin-top: 30px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: var(--light-gray);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background-color: var(--secondary-color);
  transition: width 0.5s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

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

@media (max-width: 768px) {
  .app-container {
    padding: 10px;
  }
  
  .puzzle {
    padding: 20px;
  }
  
  .input-container {
    flex-direction: column;
  }
  
  .code-digit {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .letter-box {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
}

.word-puzzle table {
  margin: 20px auto;
  border-collapse: collapse;
}

.word-puzzle td {
  padding: 8px 12px;
  text-align: left;
}

.word-equation {
  margin: 15px 0;
}

.chain-riddle {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
}

.chain-riddle ol {
  margin-left: 20px;
  margin-bottom: 15px;
}

.hint-button {
  background-color: var(--light-gray);
  margin-top: 10px;
}

.nonogram-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.nonogram-grid {
  display: flex;
  flex-direction: column;
}

.nonogram-header {
  display: flex;
}

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

.nonogram-col-hint {
  width: 30px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  padding-bottom: 5px;
}

.nonogram-row {
  display: flex;
  align-items: center;
}

.nonogram-row-hint {
  width: 30px;
  text-align: right;
  padding-right: 5px;
}

.nonogram-cell {
  width: 30px;
  height: 30px;
  border: 1px solid var(--dark-gray);
  background-color: white;
  cursor: pointer;
}

.nonogram-cell.filled {
  background-color: var(--primary-color);
}

.nonogram-cell.marked {
  background-color: white;
  position: relative;
}

.nonogram-cell.marked::before,
.nonogram-cell.marked::after {
  content: '';
  position: absolute;
  width: 80%;
  height: 2px;
  background-color: var(--accent-color);
  top: 50%;
  left: 10%;
}

.nonogram-cell.marked::before {
  transform: rotate(45deg);
}

.nonogram-cell.marked::after {
  transform: rotate(-45deg);
}

.nonogram-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
}

.nonogram-instructions {
  font-size: 0.9rem;
  color: var(--dark-gray);
  margin: 15px 0;
  text-align: center;
}

.circuit-container {
  margin: 30px 0;
  max-width: 100%;
  overflow-x: auto;
  background-color: #f0f4f8;
  padding: 20px;
  border-radius: 10px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
}

.circuit-svg {
  width: 100%;
  max-width: 800px;  /* Vergrößert für das komplexere Layout */
  margin: 0 auto;
  display: block;
}

.circuit-node {
  fill: var(--primary-color);
  transition: fill 0.3s, stroke 0.3s;
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 1;
}

.circuit-node:first-child, .circuit-node:last-child {
  fill: var(--accent-color);  /* Start- und Endknoten hervorheben */
}

.circuit-label {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: bold;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: white;
}

.circuit-edge {
  stroke: var(--light-gray);
  stroke-width: 3;
  cursor: pointer;
  transition: stroke 0.3s, stroke-width 0.3s;
}

.circuit-edge:hover {
  stroke: #7fb3d5;
  stroke-width: 4;
}

.circuit-edge.active {
  stroke: var(--secondary-color);
  stroke-width: 4;
  filter: drop-shadow(0 0 3px rgba(52, 152, 219, 0.5));
}

.hint ul {
  margin-left: 20px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.hint ul p {
  margin: 5px 0;
}

.riddle {
  font-style: italic;
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  line-height: 1.8;
}

.hint {
  background-color: #fff4e5;
  border-left: 4px solid #ffb74d;
  padding: 10px 15px;
  margin: 15px 0;
  border-radius: 4px;
}

.puzzle-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.word-math {
  margin: 20px 0;
}

.riddle-box {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  line-height: 1.8;
}

.crypto-puzzle {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

.crypto-puzzle table {
  margin: 0 auto;
  border-collapse: collapse;
}

.crypto-puzzle td {
  padding: 8px 12px;
  border: 1px solid var(--light-gray);
  font-family: monospace;
  font-size: 1.2rem;
}

.crypto-hint {
  font-style: italic;
  margin-top: 10px;
  font-size: 0.9rem;
}

.riddle-container {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
}

.story-intro {
  text-align: left;
  margin-bottom: 25px;
  line-height: 1.7;
}

.story-intro p {
  margin-bottom: 15px;
  font-size: 1.05rem;
}

.puzzle-story {
  background-color: #f9f9f9;
  border-left: 4px solid var(--secondary-color);
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  line-height: 1.7;
}

.puzzle-story p {
  margin-bottom: 10px;
}

.solution-story {
  background-color: #f0f8ff;
  border-left: 4px solid #4caf50;
  padding: 15px 20px;
  margin: 15px 0;
  border-radius: 0 8px 8px 0;
  line-height: 1.7;
}

.solution-story p {
  margin-bottom: 10px;
  text-align: left;
}

.ending-story {
  background-color: #f9f9f9;
  border: 2px solid var(--secondary-color);
  padding: 20px;
  margin: 25px 0;
  border-radius: 8px;
  line-height: 1.7;
  text-align: left;
}

.ending-story h3 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 15px;
  font-size: 1.4rem;
}

.ending-story p {
  margin-bottom: 15px;
}

.sequence-item {
  padding: 10px 15px;
  margin: 8px 0;
  background-color: #f5f5f5;
  border: 2px solid #ccc;
  border-radius: 6px;
  cursor: grab;
  display: flex;
  align-items: center;
  transition: all 0.2s ease-in-out;
}

.sequence-item:hover {
  background-color: #e9e9e9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sequence-item:active {
  cursor: grabbing;
  transform: translateY(0);
}

.drag-icon {
  margin-right: 8px;
  color: #666;
  font-weight: bold;
}

.hint-button {
  background-color: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
}

.hint-button:hover {
  background-color: #e5e5e5;
}

.instruction {
  font-style: italic;
  color: #666;
  margin: 10px 0;
  text-align: center;
  font-weight: 500;
}

.code-sequence {
  margin: 25px auto;
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
}

.sequence-hint {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--primary-color);
}

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

.sequence-item-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 5px;
}

.sequence-position {
  font-family: 'Courier New', monospace;
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: var(--dark-gray);
}

.save-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  background-color: #f8f8f8;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.save-button, .load-button {
  background-color: var(--primary-color);
  color: white;
  padding: 8px 15px;
  font-size: 0.9rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.save-button:hover, .load-button:hover {
  background-color: #34495e;
}

.save-button::before {
  content: "💾 ";
  margin-right: 5px;
}

.load-button::before {
  content: "📂 ";
  margin-right: 5px;
}

.game-controls {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.start-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.start-button {
  background-color: var(--secondary-color);
  color: white;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.start-button:hover {
  background-color: #2980b9;
}

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

@media (max-width: 768px) {
  .save-controls {
    flex-direction: column;
  }
}

.code-value {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f0f0;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.sequence-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.maze-container {
  margin: 30px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f0f4f8;
  padding: 20px;
  border-radius: 10px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
  max-width: 750px; /* Vergrößert für das größere Labyrinth */
  overflow-x: auto; /* Ermöglicht horizontales Scrollen bei Bedarf */
}

.maze-row {
  display: flex;
}

.maze-cell {
  width: 28px; /* Etwas kleiner, damit das größere Labyrinth gut passt */
  height: 28px;
  margin: 1px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s;
}

.maze-cell.wall {
  background-color: var(--primary-color);
  border-radius: 3px;
}

.maze-cell.path {
  background-color: #f0f0f0;
  border: 1px solid #ddd;
}

.maze-cell.start {
  background-color: #4CAF50;
  position: relative;
  border: 1px solid #2E7D32;
}

.maze-cell.start::after {
  content: "S";
  color: white;
  font-weight: bold;
  position: absolute;
  font-size: 14px;
}

.maze-cell.end {
  background-color: #F44336;
  position: relative;
  border: 1px solid #C62828;
}

.maze-cell.end::after {
  content: "Z";
  color: white;
  font-weight: bold;
  position: absolute;
  font-size: 14px;
}

.maze-cell.visited {
  background-color: #BBDEFB;
  border: 1px solid #90CAF9;
}

.maze-cell.current {
  background-color: #64B5F6;
  border: 1px solid #42A5F5;
}

.player-marker {
  color: var(--accent-color);
  font-size: 20px;
  line-height: 0;
  transform: translateY(1px);
}

.maze-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
  gap: 10px;
}

.control-row {
  display: flex;
  gap: 10px;
}

.control-button {
  width: 50px;
  height: 50px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.control-button:hover {
  background-color: #2980b9;
}

.control-button:active {
  transform: scale(0.95);
}

.extra-controls {
  margin-top: 15px;
  display: flex;
  gap: 15px;
}

@media (max-width: 500px) {
  .maze-cell {
    width: 20px;
    height: 20px;
  }
  
  .control-button {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  .maze-cell {
    width: 18px;
    height: 18px;
  }
  
  .player-marker {
    font-size: 14px;
  }
}

.sequence-item-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 8px 0;
}

.sequence-controls {
  display: flex;
  flex-direction: column;
  margin-right: 10px;
}

.sequence-button {
  background-color: var(--light-gray);
  color: var(--primary-color);
  width: 30px;
  height: 24px;
  border: none;
  border-radius: 3px;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
  transition: background-color 0.2s;
}

.sequence-button:hover {
  background-color: var(--secondary-color);
  color: white;
}

.sequence-item {
  flex: 1;
  /* ...existing sequence-item styles... */
}

@media (min-width: 769px) {
  .sequence-controls {
    opacity: 0.3;
    transition: opacity 0.2s;
  }
  
  .sequence-item-wrapper:hover .sequence-controls {
    opacity: 1;
  }
}

.letter-grid-container {
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

.letter-grid {
  margin: 0 auto;
  border-collapse: collapse;
  background-color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.letter-grid td {
  width: 40px;
  height: 40px;
  border: 1px solid var(--light-gray);
  text-align: center;
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary-color);
  background-color: #f9f9f9;
  transition: background-color 0.2s;
}

.letter-grid td:hover {
  background-color: #e5f1fb;
  cursor: default;
}

.grid-hint {
  margin-top: 15px;
  font-style: italic;
  color: var(--dark-gray);
}

@media (max-width: 500px) {
  .letter-grid td {
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
  }
}
