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

body, html {
  height: 100vh;
  font-family: "ocr-a-std", monospace;
  font-weight: 400;
  font-style: normal;
  transition: all 0.3s ease;
}

/* Blue theme (default) */
body {
  background: #f0f8ee;
  color: #333333;
  position: relative;
}

body::before {
  content: ''; /* Ensure content is set for pseudo-element to render */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.2;
  color: #f0f0f0;
  white-space: pre;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

/* Green-Purple theme */
body.green-purple-mode {
  background: #f8fdf6;
  color: #2d4a2b;
}

body.green-purple-mode::before {
  color: #f0f5ef;
}

/* About button styles */
.about-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.9);
  color: #0000FF;
  border: 1px solid #0000FF;
  border-radius: 20px;
  padding: 8px 12px;
  font-family: "ocr-a-std", monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.about-button:hover {
  background: #0000FF;
  color: white;
  transform: scale(1.05);
}

body.green-purple-mode .about-button {
  border-color: white;
  color: white;
  background-color: #907DB9; /* To match the theme's purple */
}

body.green-purple-mode .about-button:hover {
  background: #a391c8; /* Lighter purple on hover */
}


#container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}

#top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
}

#controls {
  background: #f5f5f5;

  padding: 15px;
  border-radius: 8px;
}

body.green-purple-mode #controls {
  background: #f0f8ee;
  border-color: #9bca84;
}

#interaction {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.green-purple-mode #interaction {
  background: #f0f8ee;

}

#outcome {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  flex: 1;
  min-height: 300px;
}

body.green-purple-mode #outcome {
  background: #f0f8ee;
}

.app-title {
  text-align: center;
  font-size: 24px;
  font-weight: 400;
  font-family: "ocr-a-std", monospace;
  color: #0000FF;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

body.green-purple-mode .app-title {
  color: #907DB9;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  color: #0000FF;
  border: 1px solid #0000FF;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-family: "ocr-a-std", monospace;
  font-size: 12px;
  transition: all 0.3s ease;
  z-index: 1001;
  backdrop-filter: blur(2px);
}

.theme-toggle:hover {
  background: #0000FF;
  color: white;
  transform: scale(1.05);
}

body.green-purple-mode .theme-toggle {
  color: #907DB9;
  border-color: #907DB9;
  background: rgba(248, 253, 246, 0.9);
}

body.green-purple-mode .theme-toggle:hover {
  background: #907DB9;
  color: white;
}

.parameter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

.controls, .download-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Moved inline styles to the stylesheet and added them here */
.download-controls {
    text-align: center; 
    margin-top: 20px;
}

.parameter-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

button {
  font-family: "ocr-a-std", monospace;
  font-weight: 400;
  background-color: #0000FF;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #0000CC;
}

body.green-purple-mode button {
  background-color: #9bca84;
}

body.green-purple-mode button:hover {
  background-color: #8bb874;
}

label {
  font-family: "ocr-a-std", monospace;
  font-size: 12px;
  margin-bottom: 5px;
  color: #0000FF;
  text-align: center;
}

body.green-purple-mode label {
  color: #907DB9;
}

.download-label {
    font-family: "ocr-a-std", monospace;
    font-size: 12px;
    color: #0000FF;
    text-align: center;
    /* Added margin for spacing between the label and the buttons */
    margin-bottom: 10px;
}

body.green-purple-mode .download-label {
    color: #907DB9;
}


input {
  font-family: "ocr-a-std", monospace;
  width: 70px;
  padding: 4px;
  border: 1px solid #0000FF;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  background: #ffffff;
  color: #333333;
}

body.green-purple-mode input {
  background: #f8fdf6;
  color: #2d4a2b;
  border-color: #9bca84;
}

.card-container {
  display: flex;
  flex-direction: column;
  border: 2px solid #0000FF;
  padding: 10px;
  border-radius: 8px;
  background-color: #fff;
  max-width: 400px;
  width: 100%;
}

body.green-purple-mode .card-container {
  border-color: #9bca84;
  background-color: #f8fdf6;
}

.card-row {
  display: flex;
  justify-content: center;
}

.card-hole {
  width: 12px;
  height: 20px;
  border: 1px solid #0000FF;
  border-radius: 2px;
  margin: 2px;
  cursor: pointer;
  transition: background-color 0.2s;
}

body.green-purple-mode .card-hole {
  border-color: #9bca84;
}

.card-hole.punched {
  background-color: #000;
}

body.green-purple-mode .card-hole.punched {
  background-color: #907DB9;
}

.tabs {
  display: flex;
  margin-bottom: 10px;
  gap: 5px;
}

.tab {
  font-family: "ocr-a-std", monospace;
  padding: 8px 15px;
  cursor: pointer;
  background-color: #e0e0e0;
  color: #0000FF;
  border: 1px solid #0000FF;
  border-radius: 5px 5px 0 0;
  font-size: 12px;
  transition: all 0.2s;
}

body.green-purple-mode .tab {
  background-color: #e8f2e6;
  color: #907DB9;
  border-color: #9bca84;
}

.tab.active {
  background-color: #0000FF;
  color: white;
}

body.green-purple-mode .tab.active {
  background-color: #907DB9;
  color: white;
}

.tab-content {
  border: 1px solid #0000FF;
  padding: 15px;
  height: calc(100% - 50px);
  background-color: #ffffff;
  border-radius: 0 5px 5px 5px;
  display: none;
  overflow: auto;
}

body.green-purple-mode .tab-content {
  background-color: #f8fdf6;
  border-color: #9bca84;
}

.tab-content.active {
  display: block;
}

#ascii-output {
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  line-height: 1;
  white-space: pre;
  color: #0000FF;
  text-align: center;
  height: 100%;
  overflow-x: auto;
  word-wrap: break-word;
}

body.green-purple-mode #ascii-output {
  color: #907DB9;
}

#visual-output {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

canvas {
  border: 1px solid #ffffff;
  max-width: 100%;
  max-height: 100%;
}

body.green-purple-mode canvas {
  border-color: #9bca84;
}

.loader {
  border: 3px solid #e0e0e0;
  border-top: 3px solid #0000FF;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 10px auto;
  display: none;
}

body.green-purple-mode .loader {
  border: 3px solid #e8f2e6;
  border-top: 3px solid #9bca84;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 767px) {
  #ascii-output {
    font-size: 6px; /* Adjust font size for small screens */
  }
}

@media (min-width: 768px) {
  #top {
    flex-direction: row;
  }
  
  #controls {
    flex: 1;
    margin-right: 5px;
  }
  
  #interaction {
    flex: 1;
    margin-left: 5px;
  }

  .card-hole {
    width: 15px;
    height: 25px;
    margin: 3px;
  }
}

@media (min-width: 1024px) {
  #ascii-output {
    font-size: 10px;
  }

  .card-hole {
    width: 18px;
    height: 30px;
  }

  button {
    padding: 10px 15px;
    font-size: 14px;
  }

  label {
    font-size: 14px;
  }
    .download-label {
    font-size: 14px;
  }


  input {
    padding: 6px;
    font-size: 14px;
    width: 90px;
  }
}