
body {
  font-family: sans-serif;
  background: radial-gradient(circle, #3b0a28, #0b0012);
  color: white;
  text-align: center;
  margin: 0;
  padding: 20px;
}
h1, h2 {
  margin-bottom: 20px;
}
#title-screen {
  margin-top: 100px;
}
button {
  font-size: 16px;
  padding: 10px 20px;
  margin: 10px;
  border-radius: 6px;
  border: none;
  background: #a63dab;
  color: white;
  cursor: pointer;
}
button:hover {
  background: #c06ac2;
}
#shuffle-area {
  position: relative;
  width: min(86vw, 680px);
  height: 260px;
  margin: 0 auto 16px;
  border: 2px dashed #999;
  border-radius: 12px;
  overflow: hidden;
}
.card {
  position: absolute;
  width: 64px;
  cursor: pointer;
  transition: transform 0.4s ease;
  will-change: transform;
}
.shuffling .card {
  animation: shuffleFloat 1.1s ease-in-out infinite;
}
.shuffling .card:nth-child(3n) { animation-delay: .2s; }
.shuffling .card:nth-child(4n) { animation-delay: .35s; }
.shuffling .card:nth-child(5n) { animation-delay: .5s; }
.shuffling .card:nth-child(2n) { animation-delay: .12s; }

@keyframes shuffleFloat {
  0% { transform: translate(0, 0) rotate(0deg); }
  35% { transform: translate(6px, -10px) rotate(6deg); }
  70% { transform: translate(-6px, 8px) rotate(-5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.selected {
  outline: 2px solid yellow;
}
#hexagram {
  position: relative;
  width: 600px;
  height: 650px;
  margin: 20px auto;
}
.card-wrapper {
  position: absolute;
  text-align: center;
  width: 100px;
}
.card-img {
  width: 100%;
  cursor: pointer;
  transition: transform 0.6s ease;
}
.card-label {
  margin-top: 5px;
  font-size: 0.8rem;
}
.modal {
  display: none;
  position: fixed;
  z-index: 10;
  inset: 0;
  background-color: rgba(0,0,0,0.92);
}
.modal-content {
  background-color: #1c1c2a;
  margin: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  text-align: center;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  overflow: auto;
}
#modal-card {
  width: min(70vw, 320px);
  height: auto;
  margin: 6px auto 0;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
#modal-meaning {
  font-size: clamp(16px, 2.4vw, 18px);
  line-height: 1.9;
  max-width: 720px;
  margin: 0 auto;
}
#closeBtn {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 28px;
  cursor: pointer;
}
#closeModalBtn {
  margin: 12px auto 24px;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: #a63dab;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
#closeModalBtn:hover {
  background: #c06ac2;
}

@media (max-width: 600px){
  #modal-card { width: min(86vw, 360px); }
  .modal-content { padding: 18px 14px; }
}

#title-image {
  max-width: min(70vw, 520px);
  max-height: 40vh;
  height: auto;
  margin-bottom: 16px;
}


#controls {
  margin-top: 30px;
}
