:root {
  --primary: #2D1B4E;
  --secondary: #8B0000;
  --accent: #4ECDC4;
  --background: #0D0D0D;
  --gold: #D4AF37;
  --parchment: #F5F5DC;
  --deep-purple: #1a0f2e;
}

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

body {
  font-family: 'Crimson Pro', serif;
  background: var(--background);
  color: var(--parchment);
  min-height: 100vh;
  overflow-x: hidden;
}

.game-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(45, 27, 78, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 0, 0, 0.2) 0%, transparent 40%),
    linear-gradient(180deg, #0a0a0a 0%, #0D0D0D 50%, #1a0f2e 100%);
}

.fog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  animation: fogDrift 20s ease-in-out infinite;
}

@keyframes fogDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-2%, 2%) scale(1.05); }
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(45, 27, 78, 0.8) 0%, transparent 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.skull-icon {
  font-size: 2.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 5px rgba(78, 205, 196, 0));
}

.skull-icon:hover {
  transform: scale(1.1);
}

.skull-icon.glowing {
  filter: drop-shadow(0 0 15px rgba(78, 205, 196, 0.8));
  animation: ghostGlow 1s ease-in-out infinite;
}

@keyframes ghostGlow {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(78, 205, 196, 0.5)); }
  50% { filter: drop-shadow(0 0 25px rgba(78, 205, 196, 1)); }
}

.main-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.subtitle {
  font-style: italic;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.act-indicator {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 1.1rem;
}

/* Player Stats */
.player-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(26, 15, 46, 0.6);
  border-bottom: 1px solid rgba(139, 0, 0, 0.3);
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.stat-icon {
  font-size: 1.2rem;
}

.sanity {
  flex: 1;
  min-width: 200px;
}

.sanity-bar {
  position: relative;
  width: 150px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 1px solid var(--secondary);
  overflow: hidden;
}

.sanity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), #ff4444);
  transition: width 0.3s ease;
}

.sanity-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  font-weight: bold;
  text-shadow: 0 0 5px black;
}

.energy {
  display: flex;
  gap: 0.3rem;
}

.candle {
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.candle.unlit {
  opacity: 0.3;
  filter: grayscale(1);
}

.madness {
  color: #ff66ff;
}

/* Game Area */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.battle-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.court-section {
  text-align: center;
}

.section-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* Enemy */
.enemy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(45, 27, 78, 0.4);
  border: 2px solid rgba(139, 0, 0, 0.5);
  border-radius: 10px;
  transition: transform 0.1s ease;
}

.enemy.shaking {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.enemy-portrait {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
}

.enemy-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.enemy-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--parchment);
}

.enemy-health-bar {
  position: relative;
  width: 120px;
  height: 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  border: 1px solid var(--secondary);
  overflow: hidden;
}

.enemy-health-fill {
  height: 100%;
  background: linear-gradient(90deg, #880000, #ff0000);
  transition: width 0.3s ease;
}

.enemy-health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: bold;
}

.enemy-intent {
  font-size: 0.9rem;
  color: var(--accent);
  padding: 0.3rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
}

/* Battle Log */
.battle-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem;
  min-height: 80px;
}

.log-entry {
  font-size: 0.9rem;
  color: var(--accent);
  text-align: center;
  animation: fadeIn 0.3s ease;
}

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

/* Cards */
.hand-section {
  padding: 1rem;
  background: linear-gradient(0deg, rgba(45, 27, 78, 0.6) 0%, transparent 100%);
}

.hand-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card {
  width: 140px;
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
  border: 2px solid;
  border-radius: 10px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.card.in-hand:hover:not(.disabled) {
  transform: translateY(-20px) scale(1.1);
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card.border-gray-500 { border-color: #6b7280; }
.card.border-purple-500 { 
  border-color: #a855f7; 
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}
.card.border-yellow-500 { 
  border-color: var(--gold); 
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.card-cost {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.9rem;
}

.card-image {
  width: 100%;
  height: 80px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

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

.card-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.3rem;
}

.card-type-icon {
  font-size: 0.8rem;
}

.card-effect {
  font-size: 0.7rem;
  color: var(--parchment);
  text-align: center;
  line-height: 1.3;
}

.card-quote {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  padding: 0.5rem;
  font-style: italic;
  font-size: 0.6rem;
  color: var(--accent);
  text-align: center;
}

.end-turn-button {
  display: block;
  margin: 0 auto;
  padding: 0.8rem 2rem;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  background: linear-gradient(180deg, var(--secondary) 0%, #550000 100%);
  color: var(--parchment);
  border: 2px solid var(--gold);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.end-turn-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.deck-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem;
  font-size: 0.9rem;
  color: rgba(245, 245, 220, 0.6);
}

/* Overlays */
.victory-overlay,
.death-overlay,
.shop-overlay,
.final-victory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn 0.5s ease;
}

.victory-container,
.death-container,
.shop-container,
.final-victory-container {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(180deg, var(--primary) 0%, var(--deep-purple) 100%);
  border: 2px solid var(--gold);
  border-radius: 20px;
  max-width: 90%;
}

.victory-title,
.shop-title,
.final-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.death-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.death-skull {
  font-size: 5rem;
  margin: 1rem 0;
  animation: float 3s ease-in-out infinite;
}

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

.death-quote,
.final-quote {
  font-style: italic;
  color: var(--accent);
  margin: 1rem 0;
}

.ducats-gained {
  font-size: 1.5rem;
  color: var(--gold);
  margin: 1rem 0;
}

.continue-button,
.restart-button,
.skip-button {
  padding: 1rem 2rem;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  background: linear-gradient(180deg, var(--primary) 0%, #1a0f2e 100%);
  color: var(--parchment);
  border: 2px solid var(--gold);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.continue-button:hover,
.restart-button:hover,
.skip-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Shop */
.shop-subtitle {
  font-style: italic;
  color: var(--accent);
  margin-bottom: 2rem;
}

.shop-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.shop-price {
  font-size: 1.1rem;
  color: var(--gold);
}

.shop-ducats {
  font-size: 1.2rem;
  color: var(--gold);
  margin: 1rem 0;
}

/* Yorick */
.yorick-dialogue {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(45, 27, 78, 0.95);
  padding: 2rem;
  border-radius: 15px;
  border: 2px solid var(--gold);
  z-index: 200;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.yorick-dialogue p {
  font-style: italic;
  font-size: 1.2rem;
  color: var(--parchment);
  margin-bottom: 1rem;
}

.yorick-dialogue img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}

/* Footer */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 2rem;
  background: rgba(13, 13, 13, 0.9);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  font-size: 0.9rem;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--gold);
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--gold);
}

/* Responsive */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
  }

  .main-title {
    font-size: 1.8rem;
    letter-spacing: 0.15em;
  }

  .player-stats {
    padding: 0.8rem 1rem;
    gap: 0.8rem;
  }

  .sanity-bar {
    width: 100px;
  }

  .enemy-portrait {
    width: 120px;
    height: 120px;
  }

  .hand-cards {
    gap: 0.3rem;
  }

  .card {
    width: 110px;
  }

  .card-image {
    height: 60px;
  }

  .card-name {
    font-size: 0.75rem;
  }

  .card-effect {
    font-size: 0.6rem;
  }

  .shop-cards {
    flex-direction: column;
  }

  .victory-container,
  .death-container,
  .shop-container,
  .final-victory-container {
    padding: 1.5rem;
  }

  .victory-title,
  .shop-title,
  .final-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .main-title {
    font-size: 1.4rem;
  }

  .card {
    width: 90px;
  }

  .card-image {
    height: 50px;
  }

  .end-turn-button {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
  }
}