@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;900&family=Outfit:wght@300;400;700&display=swap');

:root {
  --primary-accent: #FFC72C;
  --bg-dark: #0b0118; /* Deeper black-purple to prevent white flashes */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 199, 44, 0.1);
}

/* BASE RESET */
html, body {
  background-color: var(--bg-dark);
  color: white;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* MAGICAL BACKGROUND ENGINE */
.wizard-gradient {
  background: radial-gradient(circle at 50% -20%, #4D01A1 0%, #150030 50%, #000000 100%) fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* OPTIMIZED ANIMATIONS */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes orbGlow {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.5; }
}

@keyframes wizardSlide {
  0% { transform: translateX(-20vw) translateY(5px) rotate(5deg); opacity: 0; }
  10% { opacity: 0.15; }
  50% { transform: translateX(50vw) translateY(-10px) rotate(-3deg) scale(0.95); opacity: 0.25; }
  90% { opacity: 0.15; }
  100% { transform: translateX(120vw) translateY(15px) rotate(5deg) scale(1.05); opacity: 0; }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  will-change: transform, opacity;
}

.glowing-orb {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 199, 44, 0.2) 0%, transparent 70%);
  animation: orbGlow 10s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
  filter: blur(40px); /* Reduced blur for performance */
  will-change: transform, opacity;
}

.whimsical-wizard {
  position: absolute;
  top: 15%;
  left: 0;
  width: clamp(100px, 12vw, 150px);
  z-index: 50;
  pointer-events: none;
  animation: wizardSlide 25s linear infinite;
  filter: drop-shadow(0 0 10px rgba(255, 199, 44, 0.2));
  opacity: 0.15;
  will-change: transform;
}

/* UI COMPONENTS */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
}

.glass-card:hover {
  border-color: rgba(255, 199, 44, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 199, 44, 0.15);
}

.nav-link {
  position: relative;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s ease;
  text-decoration: none;
}

.nav-link:hover, .active-link {
  color: var(--primary-accent);
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 1px;
  bottom: -4px;
  left: 0;
  background-color: var(--primary-accent);
  transform-origin: bottom right;
  transition: transform 0.3s cubic-bezier(0.86, 0, 0.07, 1);
}

.nav-link:hover::after, .active-link::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* FORM ELEMENTS */
input, textarea {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 199, 44, 0.2);
  border-radius: 12px;
  padding: 16px;
  color: white;
  width: 100%;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-accent);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 15px rgba(255, 199, 44, 0.1);
}

button.primary {
  background: var(--primary-accent);
  color: var(--bg-dark);
  font-weight: 700;
  padding: 12px 32px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  cursor: pointer;
}

button.primary:hover {
  background: #ffdb70;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(255, 199, 44, 0.4);
}
/* MODE TOGGLE SWITCH */
.mode-toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  justify-content: flex-end;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid rgba(255, 199, 44, 0.2);
}

.toggle-slider:before {
  position: absolute;
  content: "🧙";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 3px;
  background-color: var(--primary-accent);
  transition: .4s;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 0 10px rgba(255, 199, 44, 0.5);
}

input:checked + .toggle-slider {
  background-color: rgba(255, 199, 44, 0.2);
}

input:checked + .toggle-slider:before {
  transform: translateX(24px);
  content: "👔";
  background-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.mode-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-accent);
}

/* COPY BUTTON */
.copy-btn {
  background: rgba(255, 199, 44, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1a0b2e;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 10px;
}

.copy-btn:hover {
  background: #fff;
  color: #1a0b2e;
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 199, 44, 0.5);
}

.copy-btn.copied {
  background: #2dd4bf; /* Teal for success */
  color: white;
}

.spell-item-copy {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.glass-card:hover .spell-item-copy {
  opacity: 1;
}

/* VISUAL MANIFESTATION (v1.4) */
.manifested-media img {
  max-height: 400px;
  width: 100%;
  object-fit: contain;
  background: rgba(0,0,0,0.4);
  transition: transform 0.3s ease;
  border-radius: 12px;
}

.manifested-media img:hover {
  transform: scale(1.02);
}

.mermaid-container {
  overflow-x: auto;
  display: flex;
  justify-content: center;
  background: rgba(255, 199, 44, 0.03);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 20px;
}

.mermaid-container svg {
  max-width: 100%;
  height: auto !important;
}
