/* ═══════════════════════════════════════════════════════
   divination.css  —  赛博算卦 · 寻物问卜
   Mystical × Cyberpunk divination overlay styles
   ═══════════════════════════════════════════════════════ */

/* ── Full-screen overlay ─────────────────────────────── */
.divination-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 10, 0.88);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  padding: var(--sp-4, 16px);
}

.divination-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Centered container (glass card) ─────────────────── */
.divination-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--glass-bg, rgba(18, 18, 32, 0.82));
  border: 1px solid var(--glass-border, rgba(255, 215, 0, 0.12));
  border-radius: var(--r-xl, 20px);
  padding: var(--sp-8, 32px) var(--sp-6, 24px);
  box-shadow:
    0 0 60px rgba(255, 215, 0, 0.06),
    0 0 120px rgba(255, 0, 110, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fadeIn 0.5s ease both;
}

/* subtle scrollbar */
.divination-container::-webkit-scrollbar {
  width: 4px;
}
.divination-container::-webkit-scrollbar-track {
  background: transparent;
}
.divination-container::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.2);
  border-radius: 4px;
}

/* close button */
.divination-close-btn {
  position: absolute;
  top: var(--sp-3, 12px);
  right: var(--sp-3, 12px);
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-full, 50%);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 2;
}
.divination-close-btn:hover {
  background: rgba(255, 0, 110, 0.15);
  border-color: var(--neon-magenta, #ff006e);
  color: var(--neon-magenta, #ff006e);
  transform: rotate(90deg);
}

/* ── Title ────────────────────────────────────────────── */
.divination-title {
  text-align: center;
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--sp-6, 24px);
  background: linear-gradient(135deg, var(--gold, #ffd700) 0%, var(--neon-magenta, #ff006e) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
  animation: breathe 4s ease-in-out infinite;
}

.divination-subtitle {
  text-align: center;
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: calc(-1 * var(--sp-4, 16px));
  margin-bottom: var(--sp-6, 24px);
  letter-spacing: 0.12em;
}

/* ── Steps ────────────────────────────────────────────── */
.divination-step {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5, 20px);
}

.divination-step.active {
  display: flex;
  animation: fadeIn 0.5s ease both;
}

/* ── Step 1 – Input ──────────────────────────────────── */
.divination-input-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4, 16px);
  align-items: center;
}

.divination-input-label {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.divination-input {
  width: 100%;
  padding: var(--sp-3, 12px) var(--sp-4, 16px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: var(--r-md, 10px);
  color: #fff;
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.divination-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.divination-input:focus {
  border-color: var(--gold, #ffd700);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.1), inset 0 0 10px rgba(255, 215, 0, 0.03);
  background: rgba(255, 255, 255, 0.06);
}

/* decorative icon row */
.divination-icons {
  display: flex;
  gap: var(--sp-3, 12px);
  font-size: 1.8rem;
  opacity: 0.35;
  user-select: none;
}

/* ── Step 2 – Shake ──────────────────────────────────── */
.divination-shake-btn {
  position: relative;
  padding: var(--sp-4, 16px) var(--sp-10, 40px);
  border: 2px solid var(--gold, #ffd700);
  border-radius: var(--r-lg, 16px);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(184, 150, 11, 0.08));
  color: var(--gold, #ffd700);
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 1.3rem;
  cursor: pointer;
  letter-spacing: 0.15em;
  overflow: hidden;
  transition: all 0.3s ease;
  animation: pulse 2.5s ease-in-out infinite;
}

.divination-shake-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--gold, #ffd700), var(--neon-magenta, #ff006e), var(--gold, #ffd700));
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.divination-shake-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.2);
}

.divination-shake-btn:hover::before {
  opacity: 0.15;
}

.divination-shake-btn:active {
  transform: scale(0.97);
}

.divination-shake-btn.shaking {
  animation: shake 0.15s ease-in-out infinite;
  border-color: var(--neon-magenta, #ff006e);
  color: var(--neon-magenta, #ff006e);
  box-shadow: 0 0 40px rgba(255, 0, 110, 0.2);
}

.divination-shake-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

/* ── Hexagram display ────────────────────────────────── */
.hexagram-display {
  display: flex;
  flex-direction: column-reverse;   /* bottom yao = first bit */
  align-items: center;
  gap: var(--sp-2, 8px);
  padding: var(--sp-5, 20px) 0;
  min-height: 280px;
  justify-content: center;
}

.yao-line {
  width: 200px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-30px) scale(0.8);
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.yao-line.revealed {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* Yang line – solid bar */
.yao-yang {
  width: 80%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-dark, #b8960b), var(--gold, #ffd700), var(--gold-dark, #b8960b));
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3), 0 0 4px rgba(255, 215, 0, 0.5);
  margin: 0 auto;
}

/* Yin line – two short bars with gap */
.yao-yin {
  width: 80%;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.yao-yin-segment {
  width: 35%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-dark, #b8960b), var(--gold, #ffd700), var(--gold-dark, #b8960b));
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3), 0 0 4px rgba(255, 215, 0, 0.5);
}

/* revealing glow pulse on each line */
.yao-line.revealing {
  animation: yaoReveal 0.6s ease both;
}

@keyframes yaoReveal {
  0% {
    opacity: 0;
    transform: translateX(-40px) scale(0.7);
    filter: brightness(2) blur(4px);
  }
  60% {
    filter: brightness(1.6) blur(0);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: brightness(1) blur(0);
  }
}

/* ── Step 3 – Result ─────────────────────────────────── */
.divination-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5, 20px);
  animation: slideUp 0.6s ease both;
}

/* Hexagram header */
.result-hexagram-header {
  text-align: center;
  padding: var(--sp-4, 16px);
  border-bottom: 1px solid rgba(255, 215, 0, 0.12);
}

.result-hexagram-symbol {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: var(--sp-2, 8px);
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.4));
}

.result-hexagram-name {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 1.5rem;
  color: var(--gold, #ffd700);
  letter-spacing: 0.2em;
}

.result-item-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: var(--sp-2, 8px);
}

.result-item-name {
  color: var(--neon-cyan, #00f5d4);
  font-weight: 600;
}

/* Scroll-aesthetic reading card */
.result-reading-card {
  position: relative;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(255, 215, 0, 0.03) 27px,
      rgba(255, 215, 0, 0.03) 28px
    ),
    linear-gradient(135deg, rgba(12, 10, 8, 0.9), rgba(20, 18, 14, 0.85));
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--r-md, 10px);
  padding: var(--sp-5, 20px);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
}

/* decorative corner marks */
.result-reading-card::before,
.result-reading-card::after {
  content: '☰';
  position: absolute;
  font-size: 0.7rem;
  color: rgba(255, 215, 0, 0.15);
}
.result-reading-card::before {
  top: 6px;
  left: 8px;
}
.result-reading-card::after {
  bottom: 6px;
  right: 8px;
}

.result-reading-label {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 0.85rem;
  color: var(--gold-dark, #b8960b);
  margin-bottom: var(--sp-3, 12px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.result-reading-text {
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
}

/* ── Direction compass ───────────────────────────────── */
.direction-section {
  display: flex;
  align-items: center;
  gap: var(--sp-5, 20px);
}

.direction-compass {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: var(--r-full, 50%);
  border: 2px solid rgba(255, 215, 0, 0.2);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 8 compass labels */
.compass-point {
  position: absolute;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
}
.compass-point.n  { top: 4px;   left: 50%; transform: translateX(-50%); }
.compass-point.s  { bottom: 4px; left: 50%; transform: translateX(-50%); }
.compass-point.e  { right: 4px; top: 50%;  transform: translateY(-50%); }
.compass-point.w  { left: 4px;  top: 50%;  transform: translateY(-50%); }
.compass-point.ne { top: 14px;  right: 12px; }
.compass-point.nw { top: 14px;  left: 12px;  }
.compass-point.se { bottom: 14px; right: 12px; }
.compass-point.sw { bottom: 14px; left: 12px;  }

/* active direction highlight */
.compass-point.active {
  color: var(--gold, #ffd700);
  font-weight: 700;
  font-size: 0.7rem;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* compass needle */
.compass-needle {
  position: absolute;
  width: 2px;
  height: 36px;
  background: linear-gradient(to top, var(--neon-magenta, #ff006e), var(--gold, #ffd700));
  border-radius: 1px;
  transform-origin: bottom center;
  bottom: 50%;
  left: calc(50% - 1px);
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.compass-center-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold, #ffd700);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  z-index: 2;
}

.direction-text {
  flex: 1;
}

.direction-label {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 0.85rem;
  color: var(--gold-dark, #b8960b);
  margin-bottom: var(--sp-2, 8px);
  letter-spacing: 0.1em;
}

.direction-value {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

/* ── Probability bar ─────────────────────────────────── */
.probability-section {
  width: 100%;
}

.probability-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-2, 8px);
}

.probability-label {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 0.85rem;
  color: var(--gold-dark, #b8960b);
  letter-spacing: 0.1em;
}

.probability-value {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 1.6rem;
  color: var(--gold, #ffd700);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.probability-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.1);
}

.probability-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--gold-dark, #b8960b), var(--gold, #ffd700), var(--neon-cyan, #00f5d4));
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
  transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
}

/* ── Advice card ─────────────────────────────────────── */
.divination-advice {
  width: 100%;
  padding: var(--sp-4, 16px);
  background: rgba(0, 245, 212, 0.04);
  border: 1px solid rgba(0, 245, 212, 0.15);
  border-radius: var(--r-md, 10px);
  border-left: 3px solid var(--neon-cyan, #00f5d4);
}

.advice-label {
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 0.8rem;
  color: var(--neon-cyan, #00f5d4);
  margin-bottom: var(--sp-2, 8px);
  letter-spacing: 0.12em;
}

.advice-text {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
}

/* ── Action buttons ──────────────────────────────────── */
.divination-actions {
  display: flex;
  gap: var(--sp-3, 12px);
  width: 100%;
  margin-top: var(--sp-2, 8px);
}

.divination-actions .btn {
  flex: 1;
  padding: var(--sp-3, 12px) var(--sp-4, 16px);
  border-radius: var(--r-md, 10px);
  font-family: var(--font-display, 'ZCOOL QingKe HuangYou', cursive);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.08em;
  border: none;
}

.btn-retry {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.3) !important;
  color: var(--gold, #ffd700);
}

.btn-retry:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.15));
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.15);
  transform: translateY(-1px);
}

.btn-close-div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.5);
}

.btn-close-div:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

/* ── Mini hexagram in result header ──────────────────── */
.result-mini-hexagram {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  margin: var(--sp-3, 12px) auto;
}

.mini-yao {
  height: 3px;
  border-radius: 2px;
}

.mini-yao-yang {
  width: 48px;
  background: var(--gold, #ffd700);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.mini-yao-yin {
  width: 48px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.mini-yao-yin-seg {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--gold, #ffd700);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 520px) {
  .divination-container {
    padding: var(--sp-5, 20px) var(--sp-4, 16px);
    border-radius: var(--r-lg, 16px);
  }

  .divination-title {
    font-size: 1.4rem;
  }

  .yao-line {
    width: 160px;
    height: 34px;
  }

  .direction-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .probability-value {
    font-size: 1.3rem;
  }

  .divination-actions {
    flex-direction: column;
  }
}

/* ── Ambient shimmer behind container ────────────────── */
.divination-container::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 180%;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 215, 0, 0.04) 0%, transparent 60%),
              radial-gradient(ellipse at 30% 80%, rgba(255, 0, 110, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  animation: breathe 6s ease-in-out infinite;
}
