/* ============================================================ */
/* === DIVINE PAGE (/divine) ================================== */
/* Owns: all divine page layout, method tabs, coin toss,       */
/*       manual selector, seed input, result section.           */
/* Does NOT own: paipan card, AI interpretation styles (style.css) */
/* ============================================================ */

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

.divine-main {
  padding-top: 80px;
  padding-bottom: 60px;
}

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

.divine-header {
  text-align: center;
  margin-bottom: 36px;
}

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

.divine-sub {
  font-size: 1rem;
  color: var(--fg-muted);
}

/* ── Method Tabs ── */
.method-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.05);
}

.method-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--fg-muted);
}

.method-tab:hover {
  background: rgba(201, 168, 76, 0.05);
  color: var(--fg);
}

.method-tab.active {
  background: var(--bg-card);
  border-color: rgba(201, 168, 76, 0.3);
  color: var(--gold);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.tab-icon {
  font-size: 1.4rem;
  font-family: var(--serif);
}

.tab-label {
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ── Method Panels ── */
.method-panel {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.method-panel.active {
  display: block;
}

/* ── Coins Method ── */
.coins-intro {
  margin-bottom: 28px;
}

.coins-intro p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}

.coin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--fg-dim);
}

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

.coin-toss-area {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  padding: 32px 28px;
  text-align: center;
}

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

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

.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 (the three coins) ── */
.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 {
  margin-top: 20px;
  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);
}

/* ── Manual Method ── */
.manual-intro {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 24px;
  line-height: 1.7;
}

.divine-line-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.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: 28px;
}

.divine-confirm-btn {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.divine-confirm-btn:hover {
  background: #d4b45a;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--gold-glow);
}

/* ── Seed Method ── */
.seed-intro {
  margin-bottom: 24px;
}

.seed-intro p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
}

.seed-input-wrap {
  margin-bottom: 24px;
}

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

.seed-input {
  width: 100%;
  max-width: 400px;
  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;
}

/* ── Result Section ── */
.divine-result {
  margin-top: 48px;
}

.result-divider {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.result-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.result-divider span {
  position: relative;
  background: var(--bg);
  padding: 0 20px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--gold);
}

.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: 20px;
  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);
}

/* ── Divine page responsive ── */
@media (max-width: 768px) {
  .divine-hex-selector {
    grid-template-columns: repeat(4, 1fr);
  }
  .method-tabs { gap: 4px; }
  .method-tab { padding: 10px 8px; }
  .tab-icon { font-size: 1.2rem; }
  .tab-label { font-size: 0.78rem; }
  .coin-display { gap: 12px; }
  .coin { width: 52px; height: 52px; font-size: 1.1rem; }
  .coin-toss-area { padding: 24px 16px; }
}

@media (max-width: 480px) {
  .divine-hex-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  .method-tab { padding: 8px 4px; }
  .coin-legend { flex-direction: column; gap: 4px; }
}
