:root {
  --bg-deep: #0f0c29;
  --bg-panel: #1a1638;
  --accent: #d8b4fe; /* Light Purple */
  --accent-glow: #a855f7; /* Purple */
  --gold: #fcd34d;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --card-bg: #2d2a4a;
  --border: rgba(216, 180, 254, 0.2);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --radius: 1rem;
  --font-main: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.4s ease;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 50% 0%, #3b0764, transparent 50%),
    radial-gradient(circle at 0% 100%, #1e1b4b, transparent 50%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.header h1 {
  font-family: var(--font-main);
  font-size: 3rem;
  background: linear-gradient(to right, #e9d5ff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent-glow);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* Spread Selection */
.spread-selection {
  text-align: center;
}

.spread-selection h2 {
  font-family: var(--font-main);
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--gold);
}

.spread-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.spread-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.spread-card:hover {
  transform: translateY(-10px);
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.2);
}

.spread-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-glow), var(--gold));
  opacity: 0;
  transition: var(--transition);
}

.spread-card:hover::before {
  opacity: 1;
}

.spread-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.spread-card h3 {
  font-family: var(--font-main);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.spread-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.spread-preview {
  display: flex;
  justify-content: center;
  gap: 5px;
  height: 60px;
  align-items: center;
}

.mini-card {
  width: 30px;
  height: 45px;
  background: #3b0764;
  border: 1px solid #6b21a8;
  border-radius: 4px;
}

/* Question Section */
.question-section {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.question-input {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

textarea {
  width: 100%;
  height: 120px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.1rem;
  resize: none;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.shuffle-btn {
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 2rem;
  font-size: 1.2rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.shuffle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(124, 58, 237, 0.6);
}

/* Card Drawing */
.card-drawing {
  height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}

.card-deck {
  position: relative;
  width: 200px;
  height: 300px;
  cursor: pointer;
}

.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 2px solid #6366f1;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.05) 0px,
    rgba(255,255,255,0.05) 10px,
    transparent 10px,
    transparent 20px
  );
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back::after {
  content: "★";
  font-size: 3rem;
  color: rgba(255,255,255,0.2);
}

/* Reading Results */
.reading-results {
  text-align: center;
}

.reading-results h2 {
  font-family: var(--font-main);
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--accent);
}

.card-positions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 3rem;
}

.card-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drawn-card {
  width: 180px;
  height: 270px;
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.drawn-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.drawn-card img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.card-back-drawn {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border-radius: 8px;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.05) 0px,
    rgba(255,255,255,0.05) 10px,
    transparent 10px,
    transparent 20px
  );
}

.position-labels {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
  color: var(--gold);
  font-family: var(--font-main);
  font-size: 1.2rem;
}

.reading-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.flip-btn, .new-reading-btn {
  padding: 0.8rem 2rem;
  border-radius: 2rem;
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.flip-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid var(--border);
}

.new-reading-btn {
  background: var(--accent-glow);
  color: white;
}

.new-reading-btn:hover {
  background: #9333ea;
  box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  background: #1e1b4b;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(168, 85, 247, 0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 1rem;
}

.modal-header h3 {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
}

.card-display {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card-display img {
  width: 120px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.card-info h4 {
  font-family: var(--font-main);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.card-info p {
  color: var(--accent);
  font-style: italic;
}

.meaning-section {
  background: rgba(255,255,255,0.05);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.meaning-section h5 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-family: var(--font-main);
}

/* Loading */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 12, 41, 0.9);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(168, 85, 247, 0.3);
  border-top-color: var(--accent-glow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* Celtic Cross Specifics */
.celtic-cross {
  display: flex;
  justify-content: center;
  gap: 2rem;
  align-items: center;
}

.cross-center {
  position: relative;
  width: 200px;
  height: 300px;
}

.center-2 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
}

.staff-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 768px) {
  .celtic-cross {
    flex-direction: column;
  }
  
  .drawn-card {
    width: 120px;
    height: 180px;
  }
}
