body {
  font-family: "DM Sans", Arial, sans-serif;
  margin: 0;
  background: url("background.jpg") no-repeat center center fixed;
  background-size: cover;
  color: #eee;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1em;
  font-size: 16px;
  position: relative;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("image-mesh-gradient.png") no-repeat center center fixed;
  background-size: cover;
  mix-blend-mode: color-burn;
  opacity: 0.8;
  pointer-events: none;
  z-index: -1;
}

.container {
  display: flex;
  gap: 1.5em;
  width: 95%;
  max-width: 1600px;
  padding: 1em;
  max-height: 90vh;
  overflow: hidden;
  justify-content: center;
  align-items: center;
}

/* History Panel */
.history {
  background: rgba(20, 20, 20, 0.7);
  border-radius: 12px;
  padding: 1em;
  width: 350px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
}

.history::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border-radius: 12px;
  z-index: 0;
}

.history > * {
  position: relative;
  z-index: 1;
}

.history-header {
  display: flex;
  justify-content: center;
  background: rgba(10, 10, 10, 0.5);
  border-radius: 8px;
  font-weight: 400;
  font-size: 1.4em;
  font-family: "Cinzel", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #da903c;
  padding: 0.5em;
}

.history-items-wrapper {
  border-radius: 10px;
  overflow: hidden;
}

.history-items-wrapper ul:not(:empty) li:first-child {
  margin-top: 0.75em;
}

.history ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history li {
  display: flex;
  justify-content: space-between;
  margin-bottom: -1px;
  font-size: 0.95em;
  line-height: 1.4;
  padding: 0;
  background: rgba(10, 10, 10, 0.5);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  min-height: 3em;
  align-items: stretch;
}

.history li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.01) 100%
  );
  border-radius: 0;
  z-index: 0;
}

.history li > * {
  position: relative;
  z-index: 1;
}

.history li .night1-col,
.history li .night2-col,
.history li .boss-col {
  flex: 1;
  text-align: center;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5em;
}

.history li .boss-col {
  background: rgba(139, 18, 18, 0.418);
  border-radius: 0;
  margin: 0;
}

.history li:last-child {
  margin-bottom: 0;
}

/* Main Card */
.card {
  background: rgba(20, 20, 20, 0.7);
  border-radius: 12px;
  padding: 1rem;
  width: 90vw;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  display: flex;
  flex-direction: column;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border-radius: 12px;
  z-index: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-content {
  flex: 1;
  overflow-y: auto;
}

.card-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pairing-container {
  background: rgba(10, 10, 10, 0.8);
  border-radius: 12px;
  position: relative;
  border: none;
  margin-bottom: 2rem;
}

.pairing-header {
  display: flex;
  justify-content: space-between;
  font-weight: 400;
  color: #ee5858;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.8rem;
  font-family: "Cinzel", serif;
  font-weight: 500;
  height: 2.4em;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pairing-header .night1-col,
.pairing-header .night2-col {
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pairing-content {
  display: flex;
  justify-content: space-between;
  font-size: 1.2em;
  font-weight: 500;
  min-height: 3em;
  align-items: center;
}

.night1-col,
.night2-col {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2em;
}

.night1-col {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

select {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1em;
  background: rgba(30, 30, 30, 0.6);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3),
    inset 0 0 10px rgba(255, 255, 255, 0.05);
  width: 80%;
  max-width: 300px;
  cursor: pointer;
  font-family: "DM Sans", Arial, sans-serif;
  margin-left: auto;
  margin-right: auto;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

select option {
  background: #1a1a1a;
  color: #fff;
  font-family: "DM Sans", Arial, sans-serif;
}

select option:disabled {
  color: #888;
  background: rgba(12, 12, 12, 0.8);
}

select:hover {
  background: rgba(40, 40, 40, 0.7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4),
    inset 0 0 15px rgba(255, 255, 255, 0.08);
}

#submitBtn {
  margin: 0.75rem auto;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1.3em;
  font-weight: 400;
  background: linear-gradient(45deg, #9e6a26, #a56930);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 80%;
  max-width: 300px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: "VT323", monospace;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#submitBtn:hover {
  background: linear-gradient(45deg, #b87a2d, #c27937);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(255, 255, 255, 0.15);
}

#nextBtn {
  margin: 0.75rem auto;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1.2em;
  font-weight: 400;
  background: linear-gradient(45deg, #5e3939, #660c0c);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 80%;
  max-width: 300px;
  font-family: "VT323", monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#nextBtn:hover {
  background: linear-gradient(45deg, #7a4545, #8a1515);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(255, 255, 255, 0.15);
}

#result {
  min-height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin: 1rem 0;
}

#result[style*="lime"] {
  color: #4caf50;
}

#result[style*="orange"] {
  color: #ff9800;
}

#result[style*="red"] {
  color: #f44336;
}

.scoreboard-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-weight: 600;
  color: #ffffff;
  background: rgba(150, 150, 150, 0.315);
  padding: 0.5rem;
  border-radius: 12px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.scoreboard-left {
  text-align: left;
  padding-left: 0.5rem;
}

.scoreboard-center {
  text-align: center;
  flex: 1;
}

.scoreboard-right {
  text-align: right;
  white-space: nowrap;
  padding-right: 0.5rem;
}

#restartButtonContainer {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  flex-shrink: 0;
}

.restart-btn {
  margin: 0.75rem auto;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1.2em;
  font-weight: 400;
  background: linear-gradient(45deg, #5e3939, #660c0c);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 80%;
  max-width: 300px;
  font-family: "VT323", monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.restart-btn:hover {
  background: linear-gradient(45deg, #7a4545, #8a1515);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(255, 255, 255, 0.15);
}

/* Learning Panel */
.learning-panel {
  background: rgba(20, 20, 20, 0.7);
  border-radius: 12px;
  padding: 1em;
  width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
}

.learning-header {
  display: flex;
  justify-content: center;
  background: rgba(10, 10, 10, 0.5);
  border-radius: 8px;
  font-weight: 400;
  font-size: 1.4em;
  font-family: "Cinzel", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #da903c;
  padding: 0.5em;
}

.learning-content {
  border-radius: 10px;
  overflow: hidden;
}

.learning-content:has(.learning-item) {
  margin-top: 0.75em;
}

.learning-item {
  background: rgba(10, 10, 10, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 1em;
  font-size: 0.9em;
  word-break: break-word;
  margin-bottom: 0.5em;
}

.learning-item:last-child {
  margin-bottom: 0;
}

.learning-item.correct {
  border-left: 4px solid #4caf50;
}

.learning-item.incorrect {
  border-left: 4px solid #f44336;
}

.learning-item strong {
  color: #fff;
}

.learning-item .boss-name {
  color: #ee5858;
  font-weight: bold;
}

.learning-item .nightlord-name {
  color: #4caf50;
  font-weight: bold;
}

/* Animations */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes glow {
  0% {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  }
  50% {
    box-shadow: 0 0 20px lime, 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  }
  100% {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  }
}

.glow {
  animation: glow 0.7s ease-in-out;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.fade-in {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

.night1-col,
.night2-col {
  transition: opacity 0.3s ease;
}

/* Media Queries */
@media (max-width: 1400px) {
  .container {
    max-width: 1200px;
  }

  .history,
  .learning-panel {
    width: 300px;
  }
}

@media (max-width: 1200px) {
  .container {
    max-width: 1000px;
  }

  .history,
  .learning-panel {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
    align-items: center;
    max-height: 95vh;
  }

  .history {
    width: 90%;
    max-width: 500px;
    order: 2;
    max-height: 40vh;
  }

  .card {
    order: 1;
    max-width: 90%;
    padding: 1.5rem;
    max-height: 50vh;
  }

  .history,
  .pairing-content {
    flex-direction: column;
  }

  .night1-col,
  .night2-col {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
  }

  .history-header,
  .history li {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .history-header .night1-col,
  .history-header .night2-col,
  .history-header .boss-col,
  .history li .night1-col,
  .history li .night2-col,
  .history li .boss-col {
    flex: none;
    text-align: center;
  }

  #submitBtn {
    font-size: 1.2em;
  }

  select,
  #submitBtn,
  #nextBtn {
    width: 90%;
    max-width: none;
  }

  .history,
  .learning-panel,
  .card {
    width: 90%;
    max-width: 500px;
    order: 2;
    max-height: 40vh;
  }

  .card {
    order: 1;
    max-width: 90%;
    padding: 1.5rem;
    max-height: 50vh;
  }
}

.history-header,
.learning-header,
.pairing-header,
.scoreboard-container {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: default;
}
