/* ============================================================ */
/* === DIVINE PAGE (/divine) — 3-Step Flow =================== */
/* Owns: step progress, method cards, cast panels, reveal anim,*/
/*       result layout. Does NOT own: paipan-card styles        */
/*       (style.css), interpret styles (style.css).             */
/* ============================================================ */

.divine-body {
  background: var(--bg);
  min-height: 100vh;
}

.divine-main {
  padding-top: 56px; /* nav height */
  padding-bottom: 60px;
}

.divine-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Step Progress Bar ── */
.divine-progress {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  padding: 16px 24px;
}

.divine-progress-inner {
  max-width: 500px;
  margin: 0 auto;
}

.divine-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
  transition: all 0.3s ease;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg-dim);
  transition: all 0.3s ease;
  background: transparent;
}

.step-label {
  font-size: 0.7rem;
  color: var(--fg-dim);
  font-family: var(--serif);
  transition: color 0.3s ease;
}

.step-dot.active .step-num {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
  box-shadow: 0 0 12px var(--gold-glow);
}

.step-dot.active .step-label {
  color: var(--gold);
}

.step-dot.done .step-num {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
}

.step-dot.done .step-label {
  color: var(--gold);
}

/* Connector line between dots */
.step-connector {
  width: 80px;
  height: 2px;
  background: rgba(90, 85, 72, 0.4);
  margin: 0 12px;
  margin-bottom: 20px; /* align with dot center */
  border-radius: 1px;
  overflow: hidden;
}

.step-connector-fill {
  width: 0%;
  height: 100%;
  background: var(--gold);
  transition: width 0.4s ease;
  border-radius: 1px;
}

/* ── Step Sections ── */
.divine-step {
  display: none;
  animation: divineStepIn 0.35s ease;
}

.divine-step.active {
  display: block;
}

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

.step-header {
  text-align: center;
  margin: 36px 0 32px;
}

.step-header h1 {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--fg);
  margin-bottom: 8px;
}

.step-desc {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════ */
/* STEP 1: Method Selection Cards                               */
/* ══════════════════════════════════════════════════════════════ */
.method-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.method-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  color: var(--fg);
  font-family: inherit;
  font-size: inherit;
  width: 100%;
}

.method-card:hover {
  border-color: rgba(201, 168, 76, 0.35);
  background: rgba(22, 22, 22, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(201, 168, 76, 0.15);
}

.method-card.selected {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  box-shadow: 0 0 24px var(--gold-glow);
}

.mc-icon {
  font-size: 2rem;
  font-family: var(--serif);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid rgba(201, 168, 76, 0.12);
  flex-shrink: 0;
}

.mc-body {
  flex: 1;
  min-width: 0;
}

.mc-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.mc-desc {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.mc-arrow {
  font-size: 1.3rem;
  color: var(--fg-dim);
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.method-card:hover .mc-arrow {
  color: var(--gold);
  transform: translateX(3px);
}

/* ══════════════════════════════════════════════════════════════ */
/* STEP 2: Cast Panel                                           */
/* ══════════════════════════════════════════════════════════════ */
.cast-card {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 14px;
  padding: 32px 28px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.cast-card-center {
  max-width: 480px;
}

.cast-coin-progress {
  margin-bottom: 24px;
}

#castCoinLabel {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--fg);
  display: block;
  margin-bottom: 12px;
}

.cast-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.cast-back-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg-muted);
  font-size: 0.82rem;
  font-family: var(--serif);
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.cast-back-btn:hover {
  border-color: var(--gold-dim);
  color: var(--fg);
}

/* Coin styles (reused from old divine.css) */
.coin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--fg-dim);
  margin-bottom: 24px;
}

.coin-legend strong {
  color: var(--gold);
  font-family: var(--serif);
}

.coin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.coin-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-dim);
  transition: all 0.3s;
}

.coin-dot.current {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.2);
  box-shadow: 0 0 8px var(--gold-glow);
}

.coin-dot.done {
  border-color: var(--gold);
  background: var(--gold);
}

.coin-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 24px 0 16px;
}

.coin {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--fg-dim);
  transition: all 0.15s;
}

.coin.flipping {
  border-color: var(--gold);
  color: var(--gold);
  transform: rotateY(180deg);
}

.coin.heads {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
  font-weight: 700;
}

.coin.tails {
  border-color: var(--fg-muted);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg-muted);
}

.coin-sum {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--gold);
  min-height: 24px;
  margin-bottom: 20px;
}

.toss-btn {
  background: linear-gradient(135deg, var(--gold), #d4b45a);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 14px 48px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.toss-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.3);
}

.toss-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Built lines (coin results so far) */
.built-lines {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.built-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.built-pos {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--fg-dim);
  width: 32px;
  text-align: right;
}

.built-bar {
  width: 100px;
  height: 10px;
  position: relative;
}

.built-bar.yang {
  background: var(--gold);
  border-radius: 3px;
}

.built-bar.yin {
  background: transparent;
}

.built-bar.yin::before,
.built-bar.yin::after {
  content: '';
  position: absolute;
  top: 0;
  height: 10px;
  width: 42px;
  background: var(--gold-dim);
  border-radius: 3px;
}

.built-bar.yin::before { left: 0; }
.built-bar.yin::after { right: 0; }

.built-bar.changing {
  animation: changingPulse 1.5s ease-in-out infinite;
}

@keyframes changingPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.built-val {
  font-size: 0.78rem;
  color: var(--fg-muted);
  width: 40px;
}

.coin-reset-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg-dim);
  font-size: 0.82rem;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.coin-reset-btn:hover {
  border-color: var(--fg-muted);
  color: var(--fg-muted);
}

/* Seed input */
.seed-input-wrap {
  margin-bottom: 24px;
  text-align: left;
}

.seed-label {
  display: block;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.seed-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 0.2s;
}

.seed-input:focus {
  border-color: rgba(201, 168, 76, 0.6);
}

.seed-input::placeholder {
  color: var(--fg-dim);
  font-size: 0.9rem;
  letter-spacing: 0;
}

.seed-hint {
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin-top: 6px;
}

/* Manual method */
.divine-line-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.divine-line-label {
  font-family: var(--serif);
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.divine-hex-selector {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════════════════ */
/* STEP 3: Hexagram Reveal Animation                            */
/* ══════════════════════════════════════════════════════════════ */
.hex-reveal {
  display: none;
  max-width: 200px;
  margin: 0 auto 32px;
}

.hex-reveal.playing {
  display: block;
}

.hex-reveal-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.reveal-line {
  display: flex;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.reveal-line.visible {
  opacity: 1;
  transform: scale(1);
}

.reveal-bar {
  width: 120px;
  height: 12px;
  border-radius: 3px;
}

.reveal-bar.yang {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}

.reveal-bar-half {
  width: 50px;
  height: 12px;
  border-radius: 3px;
}

.reveal-bar-half.yin {
  background: var(--gold-dim);
}

.reveal-gap {
  width: 16px;
}

/* ══════════════════════════════════════════════════════════════ */
/* Result Section                                               */
/* ══════════════════════════════════════════════════════════════ */
.divine-interpret-section {
  margin-top: 32px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.divine-again-btn {
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.divine-again-btn:hover {
  background: #d4b45a;
  transform: translateY(-1px);
}

.divine-home-link {
  display: inline-flex;
  align-items: center;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.15s;
}

.divine-home-link:hover {
  border-color: var(--gold-dim);
  color: var(--fg);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .divine-hex-selector {
    grid-template-columns: repeat(4, 1fr);
  }
  .method-card { padding: 20px 20px; gap: 16px; }
  .mc-icon { width: 48px; height: 48px; font-size: 1.6rem; }
  .mc-title { font-size: 1rem; }
  .mc-desc { font-size: 0.78rem; }
  .coin-display { gap: 12px; }
  .coin { width: 52px; height: 52px; font-size: 1.1rem; }
  .cast-card { padding: 24px 16px; }
  .step-connector { width: 50px; }
  .step-header h1 { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .divine-hex-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  .mc-arrow { display: none; }
  .step-connector { width: 30px; margin: 0 6px; }
  .step-num { width: 30px; height: 30px; font-size: 0.75rem; }
  .step-label { font-size: 0.62rem; }
}
