.wizard-game {
  max-width: 720px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--card);
  border: 3px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px);
}

.panel.hidden { display: none; }

.panel h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}

.wizard-icon {
  font-size: 4rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.tagline {
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-weight: 600;
}

.row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.row select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: white;
  color: #1f1b2e;
  cursor: pointer;
}

.setup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.btn-primary {
  font: inherit;
  font-weight: 800;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); }

.btn-secondary {
  display: inline-block;
  margin-left: 0.75rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--card-border);
  font-weight: 700;
}

/* HUD */
.wiz-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 0.5rem;
}

.hud-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  font-weight: 700;
}

.hud-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

/* Wizard stage */
.wizard-stage {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.wizard {
  font-size: clamp(3.5rem, 10vw, 5rem);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  animation: bob 3s ease-in-out infinite;
  user-select: none;
  transition: transform 0.2s ease;
}

.wizard.cast    { animation: cast 0.6s ease; }
.wizard.shake   { animation: shake 0.4s ease; }

@keyframes cast {
  0%   { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 #ffd166); }
  50%  { transform: scale(1.3) rotate(-10deg); filter: drop-shadow(0 0 24px #ffd166); }
  100% { transform: scale(1) rotate(0); filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3)); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-5deg); }
  40% { transform: translateX(10px) rotate(5deg); }
  60% { transform: translateX(-8px) rotate(-3deg); }
  80% { transform: translateX(8px) rotate(3deg); }
}

.clue-card {
  background: linear-gradient(135deg, #fffbe6, #fff5d1);
  color: #4a3000;
  border-radius: 16px;
  padding: 0.75rem 1rem;
  flex: 1 1 250px;
  max-width: 380px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(255, 209, 102, 0.5);
}

.clue-emoji {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.clue-def {
  margin: 0.5rem 0 0;
  font-weight: 700;
  font-size: 1rem;
}

/* Letter slots and tiles */
.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  min-height: 70px;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  margin-bottom: 1rem;
}

.slot {
  width: 56px;
  height: 64px;
  border-radius: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-transform: uppercase;
  user-select: none;
}

.slot.filled {
  border-style: solid;
  border-color: var(--primary);
  background: white;
  color: #1f1b2e;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  animation: drop-in 0.2s ease;
}

@keyframes drop-in {
  from { transform: translateY(-12px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.slot.correct {
  border-color: #6cce85;
  background: linear-gradient(135deg, #d4f5dc, #a3e6b3);
  color: #0a3a17;
  animation: pop 0.4s ease;
}

.slot.incorrect {
  border-color: #ff5c5c;
  background: linear-gradient(135deg, #ffd5d5, #ffb3b3);
  color: #5a0a0a;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.letter-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  min-height: 64px;
  margin-bottom: 1rem;
}

.tile {
  width: 56px;
  height: 64px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font: inherit;
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.tile:hover { transform: translateY(-4px) scale(1.05); }
.tile.used  { opacity: 0; pointer-events: none; transform: scale(0); }

/* Action buttons */
.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn-action {
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease;
  font-size: 0.95rem;
}
.btn-action:hover { transform: translateY(-2px); }
.btn-action.danger { background: linear-gradient(90deg, #ff8a8a, #ff5c5c); color: white; border: none; text-shadow: 0 1px 3px rgba(0,0,0,0.2); }

.feedback {
  min-height: 1.5em;
  font-weight: 700;
  margin-top: 1rem;
  font-size: 1.1rem;
}
.feedback.good { color: #2e8b3a; }
.feedback.bad  { color: #b32b2b; }
