:root {
  --bg: #f3ead9;
  --panel: #fffdf6;
  --accent: #a9812f;
  --text: #262626;
  --text-dim: #767676;
  --card-back: #2b2b38;
  --border: #e6dbc2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden; /* the fanned arc can bleed slightly past the viewport at zoom */
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  padding: 32px 20px 60px;
  text-align: center;
}

h1 {
  font-family: "Nanum Brush Script", "Apple SD Gothic Neo", cursive;
  font-size: 3.4rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 4px;
}

.status-text {
  color: var(--text-dim);
  min-height: 1.4em;
  margin-bottom: 28px;
  font-size: 1.05rem;
}

.status-text.loading {
  animation: status-pulse 1.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.category-screen {
  margin: 8px 0 32px;
}

.category-prompt {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-bottom: 22px;
}

.category-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-button {
  padding: 18px;
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--accent);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease, transform 0.1s ease;
}

.category-button:active {
  background: rgba(169, 129, 47, 0.12);
  transform: scale(0.98);
}

/* Decorative only — the 15 fanned cards never react to touch. */
.arc-container {
  position: relative;
  height: var(--arc-height, 195px);
  margin-bottom: 8px;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.4s ease;
  overflow: visible;
}

.arc-container.result-mode {
  opacity: 0;
  pointer-events: none;
}

.card-slot {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--card-w, 58px);
  aspect-ratio: 190 / 341;
  perspective: 800px;
  transform-origin: 50% 100%;
  transform: translateX(calc(-50% + var(--offset-x, 0px))) rotate(var(--rotate, 0deg));
  transition: transform 0.2s ease;
  z-index: var(--z, 1);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
}

.card-back {
  background: var(--card-back) url("/tarot/images/card_back_pattern.png") center / cover no-repeat;
}

/* Reveal area: cards land here, in order, once drawn — separate from the arc. */
.reveal-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(12px, 4vw, 20px);
  margin: 76px auto 28px;
}

.reveal-slot {
  position: relative;
  width: clamp(74px, 28vw, 108px);
  aspect-ratio: 190 / 341;
  perspective: 800px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-area.result-mode .reveal-slot.revealed {
  transform: scale(1.14) translateY(-4px);
  z-index: 10;
}

/* The slot whose turn it is — pulsing glow + a small tap hint underneath. */
.reveal-slot.is-current {
  cursor: pointer;
}

.reveal-slot.is-current .card-back {
  animation: slot-glow 1.5s ease-in-out infinite;
}

@keyframes slot-glow {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12), 0 0 0 0 rgba(169, 129, 47, 0.6); }
  50% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12), 0 0 16px 6px rgba(169, 129, 47, 0.6); }
}

.tap-hint {
  position: absolute;
  left: 50%;
  bottom: -32px;
  transform: translateX(-50%);
  width: max-content;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--accent);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.reveal-slot.is-current .tap-hint {
  animation: hint-pulse 1.5s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.3, 0.1, 0.2, 1);
}

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

.card-front {
  transform: rotateY(180deg);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.card-front-img {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.position-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.result-panel {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 20px;
  text-align: left;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.06);
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-panel h2 {
  font-size: 1.2rem;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 500;
}

#interpretationText {
  line-height: 1.75;
  font-size: 1.02rem;
  white-space: pre-wrap;
  color: var(--text);
}

