* {
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 25%, #0e7490 50%, #1e293b 75%, #0f172a 100%);
  background-size: 300% 300%;
  animation: gradientShift 14s ease infinite;
  position: relative;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.card {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 24px 20px 32px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
}

.levels { display: flex; gap: 8px; margin-bottom: 20px; }

.lvl-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  background: #f1f5f9;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

.lvl-btn.active {
  background: #0e7490;
  border-color: #155e75;
  color: #fff;
  font-weight: 700;
}

.stats { display: flex; gap: 10px; margin-bottom: 20px; }

.stat {
  flex: 1;
  background: #e0f2fe;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.stat .label { font-size: 12px; color: #0369a1; font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 800; color: #0c4a6e; margin-top: 2px; }

.question-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 20px;
}

#prompt {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #0c4a6e;
  margin-bottom: 14px;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  max-height: 200px;
  overflow-y: auto;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
}

.secret-row {
  border-color: #f59e0b;
  background: #fffbeb;
}

.secret-label {
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  margin-left: 4px;
}

.mini-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(0, 0, 0, 0.15);
}

.marks {
  margin-left: auto;
  font-size: 13px;
}

.current-guess {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.code-slot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px dashed #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.code-slot.filled {
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.2);
}

.palette {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.swatch:hover {
  transform: scale(1.1);
}

#feedback {
  text-align: center;
  min-height: 20px;
  font-weight: 700;
  font-size: 14px;
}

.feedback-correct { color: #15803d; }
.feedback-wrong { color: #dc2626; }
.feedback-info { color: #0369a1; }

.actions { display: flex; gap: 10px; }

.action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.clear-btn { background: #e2e8f0; color: #334155; }
.clear-btn:hover { background: #cbd5e1; }
.check-btn { background: #0e7490; color: #fff; }
.check-btn:hover { background: #0c5a74; }