:root {
  --primary-color: #f7d08a; /* Gold/Champagne */
  --bg-dark: #0f0c29;
  --bg-mid: #302b63;
  --bg-light: #24243e;
  --text-color: #ffffff;
  --card-back-color: #1a1a2e;
}

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

body {
  font-family: 'Noto Serif KR', serif;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-mid), var(--bg-light));
  color: var(--text-color);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Stars */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 50px 160px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 120px, #fff, rgba(0,0,0,0));
  background-size: 200px 200px;
  animation: twinkling 10s infinite alternate;
  opacity: 0.3;
}

@keyframes twinkling {
  from { opacity: 0.2; }
  to { opacity: 0.6; }
}

.container {
  max-width: 800px;
  width: 90%;
  text-align: center;
  padding: 2rem;
  z-index: 1;
}

.title {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.2rem;
  background: linear-gradient(to bottom, #fff, var(--primary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(247, 208, 138, 0.4);
}

.subtitle {
  font-size: 1.1rem;
  margin-bottom: 3rem;
  font-weight: 300;
  color: rgba(255,255,255,0.7);
}

.deck-container {
  perspective: 1000px;
  margin-bottom: 2rem;
}

.deck {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.card {
  width: 160px;
  height: 280px;
  background: var(--card-back-color);
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.6s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.card:hover {
  transform: translateY(-10px) rotateY(10deg);
  box-shadow: 0 15px 30px rgba(247, 208, 138, 0.2);
}

.card-back::before {
  content: "✨";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
}

.card-back::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(247, 208, 138, 0.2);
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
  animation: fadeIn 1.5s forwards;
}

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

.result-card-display {
  perspective: 1000px;
}

.card-front {
  background: linear-gradient(to bottom, #fff, #f9f9f9);
  color: #1a1a2e;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 4px solid var(--primary-color);
  box-shadow: inset 0 0 15px rgba(247, 208, 138, 0.3);
}

.card-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(48, 43, 99, 0.2);
  padding: 1.5rem 1rem;
  width: 100%;
  background: transparent;
  position: relative;
}

.card-inner::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 1px double var(--primary-color);
  pointer-events: none;
}

.card-image-placeholder {
  height: 150px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.card-name {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  margin: 0;
  color: #302b63;
}

.result-content {
  background: rgba(0, 0, 0, 0.4);
  padding: 2rem;
  border-radius: 12px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(247, 208, 138, 0.2);
  max-width: 500px;
}

#card-status {
  font-family: 'Cinzel', serif;
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.card-meaning {
  line-height: 1.6;
  margin-bottom: 2rem;
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
}

.retry-btn {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 0.8rem 2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Noto Serif KR', serif;
}

.retry-btn:hover {
  background: var(--primary-color);
  color: var(--bg-dark);
}

@media (max-width: 600px) {
  .title { font-size: 2rem; }
  .card { width: 140px; height: 240px; }
}
