#tarot-oracle-wrap {
  font-family: 'Georgia', serif;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a0533, #2d0b5a);
  border-radius: 20px;
  color: #f0d9ff !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#tarot-oracle-wrap h2 {
  font-size: 1.8em;
  color: #e8c9ff !important;
  margin-bottom: 15px;
}

#tarot-question {
  width: 90%;
  padding: 10px 15px;
  border-radius: 25px;
  border: 1px solid #9b59b6;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  margin-bottom: 10px;
  outline: none;
}

.ai-selector-wrap {
  margin-bottom: 20px;
}

#tarot-ai-model {
  width: 90%;
  padding: 10px;
  border-radius: 25px;
  border: 1px solid #9b59b6;
  background: rgba(255, 255, 255, 0.1);
  color: #e8c9ff;
  text-align: center;
  font-size: 0.95em;
  outline: none;
}

#tarot-ai-model option {
  background: #2d0b5a;
  color: #fff;
}

#card-deck-area {
  position: relative;
  height: 200px;
  margin: 20px auto;
}

.deck-card {
  position: absolute;
  width: 90px;
  height: 150px;
  background: var(--back-img, linear-gradient(135deg, #4a0080, #7b2fff));
  background-size: cover;
  background-position: center;
  border: 2px solid #c084fc;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-card::before {
  content: var(--back-img) ? '': '★';
  font-size: 2em;
  color: rgba(255, 255, 255, 0.3);
}

.deck-card:nth-child(1) {
  transform: translate(calc(-50% - 20px), -50%) rotate(-5deg);
}

.deck-card:nth-child(2) {
  transform: translate(calc(-50% - 10px), -50%) rotate(-2deg);
}

.deck-card:nth-child(3) {
  transform: translate(-50%, -50%) rotate(0deg);
}

.deck-card:nth-child(4) {
  transform: translate(calc(-50% + 10px), -50%) rotate(2deg);
}

.deck-card:nth-child(5) {
  transform: translate(calc(-50% + 20px), -50%) rotate(5deg);
}

.deck-card.shuffling {
  animation: shuffle 0.1s ease infinite alternate;
}

@keyframes shuffle {
  from {
    transform: translate(calc(-50% + var(--rx, 0px)), calc(-50% + var(--ry, 0px))) rotate(var(--rr, 0deg));
  }

  to {
    transform: translate(calc(-50% + var(--rx2, 5px)), calc(-50% + var(--ry2, 5px))) rotate(var(--rr2, 3deg));
  }
}

.tarot-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  margin: 8px;
  font-size: 1.05em;
  font-weight: bold;
}

.btn-shuffle {
  background: linear-gradient(135deg, #7b2fff, #c084fc);
  color: #fff;
}

.btn-draw {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a0533;
}

.btn-reset {
  background: rgba(255, 255, 255, 0.1);
  color: #e8c9ff;
  border: 1px solid #9b59b6;
  margin-top: 20px;
  width: 200px;
}

#shuffle-msg {
  height: 20px;
  color: #c084fc;
  font-size: 0.95em;
}

/* =======================================
   表示エリアの表示・非表示の仕組み
   ======================================= */
#result-area.is-hidden {
  display: none;
}

#result-area {
  margin-top: 20px;
}

/* めくる前のテキストやボタンは透明で高さを詰める */
#revealed-content {
  opacity: 0;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  transition: opacity 0.8s ease;
}

/* カードをめくった後（.is-open クラス付与時） */
#result-area.is-open #revealed-content {
  opacity: 1;
  visibility: visible;
  height: auto;
  overflow: visible;
  margin-top: 20px;
}

/* ======================================= */

.card-flip-container {
  perspective: 1000px;
  width: 140px;
  height: 240px;
  margin: 0 auto 20px;
  cursor: pointer;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.card-flip-container.flipped .card-flip-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 2px solid #c084fc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.card-back {
  background: var(--back-img, linear-gradient(135deg, #4a0080, #7b2fff));
  background-size: cover;
  background-position: center;
}

.card-front {
  background: #1a0533;
  transform: rotateY(180deg);
  padding: 5px;
}

.card-front.reversed {
  transform: rotateY(180deg) rotate(180deg);
}

.card-img-disp {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

#cardTextFallback {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  width: 100%;
}

#cardEmoji {
  font-size: 3.5em;
  margin: 5px 0;
  line-height: 1;
}

#result-text-area {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 15px;
  text-align: left;
}

.result-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
}

.keyword-tag {
  background: rgba(123, 47, 255, 0.3);
  padding: 3px 12px;
  border-radius: 15px;
  font-size: 0.85em;
  color: #e0b4ff;
  border: 1px solid #7b2fff;
}

.orientation-upright {
  color: #86efac;
  font-weight: bold;
}

.orientation-reversed {
  color: #fca5a5;
  font-weight: bold;
}

#resultTitle {
  text-align: center;
  color: #f0d9ff !important;
  margin: 0 0 5px 0;
}

.result-message p {
  margin-bottom: 10px;
  line-height: 1.8;
  font-size: 0.95em;
  color: #e8d5ff !important;
}

.coconala-box {
  background: linear-gradient(135deg, #fcd34d, #f97316);
  padding: 25px 15px;
  border-radius: 15px;
  margin-top: 25px;
  text-align: center;
}

.coconala-box p {
  color: #fff;
  font-weight: bold;
  margin: 0 0 15px 0;
  font-size: 1.1em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.coconala-btn {
  display: inline-block;
  background: #fff;
  color: #d97706;
  text-decoration: none;
  padding: 12px 25px;
  border-radius: 30px;
  font-weight: bold;
  font-size: 1.05em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

.coconala-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  color: #b45309;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.action-btn {
  background: transparent;
  color: #818cf8;
  border: 1px solid #818cf8;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: bold;
  transition: all 0.3s;
}

.action-btn:hover {
  background: rgba(129, 140, 248, 0.1);
}