:root {
  --bg-deep: #0d0015;
  --bg-mid: #1a0a2e;
  --bg-panel: #110022;
  --bg-card: #2a1040;
  --bg-input: #1e0e30;
  --accent: #7b2ff2;
  --accent-light: #9945ff;
  --accent-bright: #c74bff;
  --blood: #8b0000;
  --teal: #00ffaa;
  --text-primary: #e0d0ff;
  --text-secondary: #9080a0;
  --text-bright: #f0eaff;
  --success: #39ff14;
  --danger: #ff2244;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Nunito', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(123,47,242,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(153,69,255,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139,0,0,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.3); }
}

@keyframes sigilSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes vortexSpin {
  0% { transform: rotate(0deg) scale(1); opacity: 0.8; }
  50% { transform: rotate(180deg) scale(1.1); opacity: 1; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.8; }
}

@keyframes floatUp {
  0% { transform: translateY(0px); opacity: 0.4; }
  50% { transform: translateY(-8px); opacity: 0.7; }
  100% { transform: translateY(0px); opacity: 0.4; }
}

@keyframes borderPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(123,47,242,0.3), inset 0 0 10px rgba(123,47,242,0.1); }
  50% { box-shadow: 0 0 20px rgba(123,47,242,0.5), inset 0 0 20px rgba(123,47,242,0.2); }
}

@keyframes fogDrift {
  0% { transform: translateX(-20%) translateY(0); opacity: 0.3; }
  50% { transform: translateX(20%) translateY(-5px); opacity: 0.15; }
  100% { transform: translateX(-20%) translateY(0); opacity: 0.3; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.sigil-icon {
  animation: sigilSpin 8s linear infinite;
  display: inline-block;
}

.glow-text {
  text-shadow: 0 0 10px rgba(123,47,242,0.6), 0 0 30px rgba(123,47,242,0.3), 0 0 60px rgba(123,47,242,0.1);
}

.canvas-glow {
  animation: borderPulse 3s ease-in-out infinite;
}

.btn-arcane {
  background: linear-gradient(135deg, #1e0e30, #2a1040);
  border: 1px solid rgba(123,47,242,0.4);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.btn-arcane:hover {
  border-color: var(--accent-light);
  box-shadow: 0 0 15px rgba(123,47,242,0.4), 0 0 30px rgba(123,47,242,0.2);
  transform: translateY(-1px);
  background: linear-gradient(135deg, #2a1040, #3a1850);
}

.btn-arcane:active {
  transform: translateY(0);
}

.btn-conjure {
  background: linear-gradient(135deg, #7b2ff2, #9945ff);
  border: 2px solid var(--accent-bright);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btn-conjure:hover {
  box-shadow: 0 0 20px rgba(123,47,242,0.6), 0 0 40px rgba(153,69,255,0.3), 0 0 60px rgba(199,75,255,0.15);
  transform: translateY(-2px) scale(1.02);
  background: linear-gradient(135deg, #9945ff, #c74bff);
}

.btn-conjure:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tool-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,10,46,0.8);
  border: 1px solid rgba(123,47,242,0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 18px;
}

.tool-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(123,47,242,0.3);
}

.tool-btn.active {
  border-color: var(--accent-bright);
  color: var(--accent-bright);
  box-shadow: 0 0 12px rgba(199,75,255,0.4);
  background: rgba(123,47,242,0.15);
}

.scroll-input {
  background: linear-gradient(135deg, #1e0e30, #170a25);
  border: 1px solid rgba(123,47,242,0.3);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  resize: vertical;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.scroll-input:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 15px rgba(123,47,242,0.3);
}

.scroll-input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(123,47,242,0.3), rgba(123,47,242,0.8));
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-bright);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(199,75,255,0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-bright);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(199,75,255,0.6);
}

select {
  background: #1e0e30;
  border: 1px solid rgba(123,47,242,0.3);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

select:focus {
  outline: none;
  border-color: var(--accent-light);
}

.gallery-card {
  background: linear-gradient(145deg, #1e0e30, #2a1040);
  border: 1px solid rgba(123,47,242,0.2);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.gallery-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(123,47,242,0.3), 0 0 40px rgba(123,47,242,0.1);
  transform: translateY(-4px);
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.vortex-loader {
  width: 60px;
  height: 60px;
  border: 3px solid transparent;
  border-top: 3px solid var(--accent);
  border-right: 3px solid var(--accent-light);
  border-radius: 50%;
  animation: vortexSpin 1s linear infinite;
  position: relative;
}

.vortex-loader::before {
  content: '';
  position: absolute;
  top: 5px; left: 5px; right: 5px; bottom: 5px;
  border: 2px solid transparent;
  border-bottom: 2px solid var(--accent-bright);
  border-left: 2px solid rgba(199,75,255,0.5);
  border-radius: 50%;
  animation: vortexSpin 0.6s linear infinite reverse;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: linear-gradient(145deg, #1a0a2e, #110022);
  border: 1px solid rgba(123,47,242,0.4);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 0 40px rgba(123,47,242,0.2);
  animation: fadeIn 0.3s ease-out;
}

.fog-footer::after {
  content: '';
  position: absolute;
  bottom: 0; left: -20%; right: -20%;
  height: 30px;
  background: radial-gradient(ellipse, rgba(123,47,242,0.15) 0%, transparent 70%);
  animation: fogDrift 6s ease-in-out infinite;
  pointer-events: none;
}

/* Color swatches */
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255,255,255,0.4);
}

.color-swatch.selected {
  border-color: white;
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(13,0,21,0.5); }
::-webkit-scrollbar-thumb { background: rgba(123,47,242,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(123,47,242,0.6); }

/* Mobile adjustments */
@media (max-width: 768px) {
  .desktop-sidebar { display: none !important; }
  .mobile-drawer { display: flex !important; }
}

@media (min-width: 769px) {
  .mobile-drawer { display: none !important; }
}