body {
  background-image: linear-gradient(
    rgba(32, 32, 32, 1),
    rgba(32, 32, 32, 1),
    rgba(0, 0, 0, 1)
  );
  background-repeat: no-repeat;
  color: #444850;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  padding: 0;
  padding-bottom: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

header {
  background: #1a1a1a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #33ff33;
  color: #33ff33;
  font-family: "Press Start 2P", monospace;
  padding: 4rem 1rem 1rem;
  position: relative;
  text-align: center;
  z-index: 1;
}

h1 {
  font-size: 1.25rem;
  margin-top: 1.25rem;
  text-shadow: 2px 2px 0 #000;
}

main {
  background-color: transparent;
  border-top: 2px solid #33ff33;
  color: #33ff33;
  padding: 0;
  text-align: center;
}

.logo-wrapper {
  height: 124px;
  margin: -2mm auto 0.5rem;
  position: relative;
  width: 124px;
}

.site-logo {
  background: #000;
  border: 4px solid #33ff33;
  height: 120px;
  left: 2px;
  object-fit: contain;
  position: absolute;
  top: 2px;
  width: 120px;
}

.container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  margin: 2rem auto;
  max-width: 800px;
  min-height: 600px;
  padding: 0 1rem;
  position: relative;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  margin-bottom: 2rem;
  margin-top: -3rem;
}

.progress-container {
  background-color: #e8e9ea;
  border-radius: 4px;
  height: 8px;
  margin-bottom: 1rem;
  margin-top: -4rem;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  background-color: #4b6584;
  height: 100%;
  transition: width 0.3s ease;
  width: 0%;
}

.status {
  color: #7a869a;
  font-size: 1rem;
  margin-bottom: 1rem;
  margin-top: -4rem;
  text-align: center;
}

.card-container {
  height: 400px;
  margin-bottom: 1rem;
  margin-top: -1.5rem;
  perspective: 1000px;
}

.card {
  cursor: pointer;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  width: 100%;
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  align-items: center;
  backface-visibility: hidden;
  background-color: #ffffff;
  border: 1px solid #dddfe2;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  color: #444850;
  display: flex;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  height: 100%;
  justify-content: center;
  padding: 1.5rem;
  position: absolute;
  top: -1rem;
  transform: translateZ(0);
  width: 100%;
  hyphens: manual;
  /*word-break: break-all;   <-- getting rid of this*/
  /* Ensure front/back faces don't show through */
  -webkit-backface-visibility: hidden;
}

.card-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto; /* Add scrollbar to content */
  padding: 0 1rem; 
  scroll-behavior: smooth; 
  scrollbar-width: thin; 
  width: 100%;
}

.card-front {
  z-index: 2;
}

.card-back {
  padding-top: 2rem; 
  transform: rotateY(180deg);
}

.card-face p {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0;
  overflow-wrap: break-word; /* Ensures text wraps properly */
  text-align: center;
  width: 100%;
}

.navigation {
  align-items: center;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  position: relative;
  top: -4rem;
  width: 100%;
}

.button-group {
  display: flex;
  gap: 0.5rem;
}

.button {
  background-color: #4b6584;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  transition: background-color 0.2s ease;
}

.button:hover {
  background-color: #3a5070;
}

.button-success {
  background-color: #78a56f;
}

.button-success:hover {
  background-color: #6a9462;
}

.button-danger {
  background-color: #b27474;
}

.button-danger:hover {
  background-color: #a16868;
}

.dropdown {
  background-color: #ffffff;
  border: 1px solid #dddfe2;
  border-radius: 4px;
  color: #444850;
  font-size: 0.9rem;
  padding: 0.6rem;
}

.dark-mode {
  background-color: #2a2c30;
  color: white;
}

.dark-mode .card-face {
  background-color: #383a42;
  border-color: #4a4c55;
  color: white;
}

.dark-mode .dropdown {
  background-color: #383a42;
  border-color: #4a4c55;
  color: white;
}

.dark-mode .progress-container {
  background-color: #3a3c42;
}

.mode-toggle {
  align-items: center;
  background: none;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 1.5rem;
  justify-content: center;
  padding: 0.2rem;
  position: absolute;
  right: 1rem;
  top: -7rem;
  z-index: 10;
}

.dark-mode .mode-toggle span {
  content: "🌙";
}

.hint-container {
  margin-top: 1.5rem;
  text-align: center;
  width: 100%;
}

.hint-button {
  background-color: transparent;
  border: 1px solid #7a869a;
  border-radius: 4px;
  color: #7a869a;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  transition: all 0.2s ease;
}

.hint-button:hover {
  background-color: #7a869a;
  color: white;
}

.hint-content {
  background-color: rgba(122, 134, 154, 0.1);
  border-radius: 4px;
  color: #7a869a;
  display: none;
  font-size: 0.9rem;
  margin-top: 0.8rem;
  padding: 0.8rem;
  text-align: left;
}

.hint-content.visible {
  display: block;
}

/* Hide hint container if no hint exists */
.hint-container.no-hint {
  display: none;
}

.completion-message {
  background-color: #ffffff;
  border: 1px solid #dddfe2;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  display: none; /* Hidden by default */
  margin: 2rem 0;
  padding: 2rem;
  position: absolute;
  text-align: center;
  top: 10rem;
}

.completion-message.visible {
  display: block;
}

.completion-message h2 {
  color: #78a56f;
  margin-bottom: 1rem;
  margin-top: 0;
}

.completion-message p {
  color: #383a42;
  margin-bottom: 1.5rem;
}

.card-content::-webkit-scrollbar {
  width: 8px;
}

.card-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.card-content::-webkit-scrollbar-thumb {
  background-color: #7a869a;
  border-radius: 4px;
}

.dark-mode .card-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.dark-mode .card-content::-webkit-scrollbar-thumb {
  background-color: #4a4c55;
}

.dark-mode .completion-message {
  background-color: #383a42;
  border-color: #4a4c55;
}
.dark-mode .completion-message p {
  color: #b2b5b1;
}

@media (max-width: 600px) {
  .button {
    flex-grow: 1;
  }

  .button-group {
    width: 100%;
    justify-content: center;
  }

  .card-container {
    height: 300px;
  }

  .controls {
    flex-direction: column;
  }

  .dropdown {
    width: 100%;
  }

  .navigation {
    flex-direction: column;
    gap: 1rem;
  }

  #prevBtn,
  #nextBtn {
    width: 100%;
  }
}
