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

body {
  font-family: 'Inter', sans-serif;
  color: #F8FAFC;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-cosmic {
  background: linear-gradient(135deg, #0F0F23 0%, #2D1B69 50%, #1E3A8A 100%);
  position: relative;
}

.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.app-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-bottom: 4rem;
}

.header {
  text-align: center;
  padding: 3rem 1rem 2rem;
  position: relative;
}

.title {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.tagline {
  font-size: 1.1rem;
  color: #C4B5FD;
  font-style: italic;
  margin-bottom: 1rem;
}

.history-button {
  background: rgba(139, 92, 246, 0.3);
  border: 2px solid #8B5CF6;
  color: #E0D7FF;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.history-button:hover {
  background: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.history-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.history-title {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  color: #FFD700;
}

.history-empty {
  text-align: center;
  color: #C4B5FD;
  font-style: italic;
  padding: 3rem;
}

.history-item {
  background: rgba(45, 27, 105, 0.4);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.history-item:hover {
  border-color: #8B5CF6;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.history-spread {
  font-family: 'Cinzel', serif;
  color: #FFD700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.history-question {
  color: #E0D7FF;
  margin-bottom: 0.5rem;
}

.history-date {
  color: #94A3B8;
  font-size: 0.9rem;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.input-section {
  max-width: 600px;
  margin: 0 auto 3rem;
  background: rgba(45, 27, 105, 0.4);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
}

.question-input {
  width: 100%;
  background: rgba(15, 15, 35, 0.6);
  border: 2px solid rgba(139, 92, 246, 0.5);
  border-radius: 15px;
  padding: 1rem;
  color: #F8FAFC;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  resize: none;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
}

.question-input:focus {
  outline: none;
  border-color: #8B5CF6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), inset 0 0 20px rgba(139, 92, 246, 0.2);
}

.question-input::placeholder {
  color: #94A3B8;
  font-style: italic;
}

.spread-selector {
  margin-bottom: 1.5rem;
}

.spread-label {
  display: block;
  font-family: 'Cinzel', serif;
  color: #FFD700;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.spread-select {
  width: 100%;
  background: rgba(15, 15, 35, 0.6);
  border: 2px solid rgba(139, 92, 246, 0.5);
  border-radius: 10px;
  padding: 0.75rem;
  color: #F8FAFC;
  font-size: 1rem;
  cursor: pointer;
}

.spread-select:focus {
  outline: none;
  border-color: #8B5CF6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.draw-button {
  width: 100%;
  background: linear-gradient(135deg, #8B5CF6, #6366F1);
  border: none;
  border-radius: 15px;
  padding: 1rem 2rem;
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
  font-family: 'Cinzel', serif;
}

.draw-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.8);
}

.draw-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cards-section {
  margin: 3rem 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

.card-container {
  perspective: 1000px;
  height: 420px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.card-container.revealed .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 15px;
  overflow: hidden;
}

.card-back {
  background: linear-gradient(135deg, #2D1B69, #4A2885);
  border: 3px solid #FFD700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.card-back-pattern {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.card-front {
  transform: rotateY(180deg);
  background: rgba(15, 15, 35, 0.9);
  border: 3px solid #8B5CF6;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
}

.card-image {
  width: 100%;
  height: 70%;
  object-fit: cover;
}

.card-loading {
  width: 100%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  animation: spin 2s linear infinite;
}

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

.card-label {
  font-family: 'Dancing Script', cursive;
  font-size: 1.3rem;
  color: #FFD700;
  text-align: center;
  padding: 0.5rem;
  font-weight: 700;
}

.card-description {
  font-size: 0.9rem;
  color: #C4B5FD;
  text-align: center;
  padding: 0 0.5rem 0.5rem;
  font-style: italic;
}

.interpretation-section {
  max-width: 800px;
  margin: 3rem auto;
  background: rgba(45, 27, 105, 0.4);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
  animation: fadeIn 1s;
}

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

.interpretation-title {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  text-align: center;
  color: #FFD700;
  margin-bottom: 1.5rem;
}

.interpretation-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #E0D7FF;
  margin-bottom: 2rem;
  text-align: justify;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-button {
  background: rgba(139, 92, 246, 0.3);
  border: 2px solid #8B5CF6;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  color: #E0D7FF;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.action-button:hover {
  background: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #94A3B8;
  font-size: 0.9rem;
  border-top: 1px solid rgba(139, 92, 246, 0.3);
  margin-top: 3rem;
}

.footer a {
  color: #FFD700;
  text-decoration: none;
  transition: color 0.3s;
}

.footer a:hover {
  color: #FFA500;
}

.disclaimer {
  margin-top: 0.5rem;
  font-style: italic;
  color: #C4B5FD;
}

@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .card-container {
    max-width: 400px;
    margin: 0 auto;
  }

  .interpretation-section {
    padding: 1.5rem;
  }

  .interpretation-title {
    font-size: 1.5rem;
  }

  .interpretation-text {
    font-size: 1rem;
  }
}