/* ============================================================ */
/* === CEREMONY PAGE (/divine/ceremony) ======================= */
/* God Mode 7-step ritual flow. Owns all ceremony-specific      */
/* layout and components. Does NOT own: paipan-card styles      */
/* (style.css), coin base styles (divine.css), interpret result */
/* (style.css).                                                 */
/* ============================================================ */

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

.ceremony-main {
  padding-top: 56px; /* nav height */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Progress bar (fixed below nav) ── */
.ceremony-progress {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  padding: 14px 24px 0;
}

.ceremony-progress-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
}

.ceremony-step-dots {
  display: flex;
  gap: 8px;
}

.ceremony-step-dots .dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--fg-dim);
  font-weight: 600;
  transition: all 0.25s ease;
}

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

.ceremony-step-dots .dot.done {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
  font-size: 0.65rem;
}

.ceremony-step-name {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.ceremony-track {
  height: 2px;
  background: rgba(201, 168, 76, 0.12);
  border-radius: 1px;
  max-width: 700px;
  margin: 0 auto;
}

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

/* ── Content area ── */
.ceremony-content {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 40px 24px 80px;
}

/* ── Step panel ── */
.cer-panel {
  max-width: 640px;
  width: 100%;
}

.cer-fade {
  animation: cerFadeIn 0.35s ease;
}

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

/* ── Step header ── */
.cer-step-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}

.cer-step-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(201, 168, 76, 0.25);
  border-radius: 14px;
  background: rgba(201, 168, 76, 0.05);
}

.cer-step-badge {
  font-size: 0.72rem;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: block;
}

.cer-step-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  color: var(--fg);
  margin-bottom: 4px;
  line-height: 1.2;
}

.cer-step-desc {
  font-size: 0.92rem;
  color: var(--fg-muted);
}

/* ── Body ── */
.cer-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cer-guidance {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.85;
  max-width: 560px;
}

/* ── Textarea ── */
.cer-input-wrap {
  max-width: 540px;
}

.cer-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

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

.cer-textarea::placeholder {
  color: var(--fg-dim);
  font-style: italic;
}

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

/* ── Buttons ── */
.cer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.cer-btn-primary {
  background: linear-gradient(135deg, var(--gold), #d4b45a);
  color: var(--bg);
}

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

.cer-btn-toss {
  background: linear-gradient(135deg, var(--gold), #d4b45a);
  color: var(--bg);
  padding: 16px 52px;
  font-size: 1.1rem;
}

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

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

.cer-btn-ghost {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--fg-dim);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--serif);
}

.cer-btn-ghost:hover {
  border-color: var(--fg-muted);
  color: var(--fg-muted);
}

.cer-btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Coin toss area ── */
.cer-coin-area {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  padding: 32px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.cer-coin-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cer-coin-progress span {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--fg);
}

.cer-coin-dots {
  display: flex;
  gap: 10px;
}

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

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

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

/* WHY separate class: .cer-coins reuses .coin from divine.css */
.cer-coins {
  display: flex;
  justify-content: center;
  gap: 20px;
}

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

.cer-coin-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.cer-built-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

/* ── Step 3: Lines review ── */
.cer-lines-review {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cer-review-line {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cer-review-pos {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--fg-dim);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.cer-review-val {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--gold);
  width: 24px;
  text-align: center;
}

.cer-review-type {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ── Question recall (steps 3 & 5) ── */
.cer-question-recall {
  background: rgba(201, 168, 76, 0.05);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.cer-question-recall strong {
  color: var(--gold);
}

/* ── Step 4: Paipan wrap ── */
.cer-paipan-wrap {
  margin-bottom: 8px;
}

/* ── Step 5: Interpret area ── */
.cer-interpret-area {
  min-height: 120px;
}

/* ── Step 6: Save card ── */
.cer-save-card {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 14px;
  padding: 36px 32px;
  text-align: center;
}

.cer-save-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 16px;
}

.cer-save-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--fg);
  margin-bottom: 16px;
}

.cer-save-details {
  text-align: left;
  max-width: 400px;
  margin: 0 auto 12px;
}

.cer-save-details p {
  font-size: 0.88rem;
  color: var(--fg-muted);
  margin: 6px 0;
  line-height: 1.5;
}

.cer-save-details strong {
  color: var(--gold);
}

/* ── Step 7: Results page ── */
.cer-results { max-width: 680px; }

.cer-results-motto {
  text-align: center;
  padding: 12px 0 8px;
}

.cer-final-text {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.4;
}

.cer-final-motto {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Results summary card */
.cer-results-summary {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 12px;
  padding: 20px 24px;
}

.cer-results-summary-top {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cer-results-hex-name {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--gold);
  font-weight: 700;
}

.cer-results-palace {
  font-size: 0.82rem;
  color: var(--fg-dim);
}

.cer-results-question {
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 6px;
}

.cer-results-question strong { color: var(--gold); }

.cer-results-time {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

/* Action bar (copy + share) */
.cer-results-actions {
  display: flex;
  gap: 10px;
}

.cer-btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--fg-muted);
  font-family: var(--serif);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}

.cer-btn-action:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 168, 76, 0.05);
}

.cer-btn-action-icon { font-size: 1rem; }

/* Tab navigation */
.cer-results-tabs {
  display: flex;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
}

.cer-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 8px;
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--fg-dim);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.cer-tab:hover { color: var(--fg-muted); }

.cer-tab.active { color: var(--gold); }

.cer-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}

/* Tab panels */
.cer-tab-panel { display: none; }
.cer-tab-panel.active {
  display: block;
  animation: cerFadeIn 0.25s ease;
}

/* Coin summary in paipan tab */
.cer-results-subsection { margin-top: 16px; }

.cer-results-subhead {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.cer-coin-summary {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cer-coin-summary-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.82rem;
}

.cer-coin-summary-pos {
  font-family: var(--serif);
  color: var(--fg-dim);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.cer-coin-summary-val {
  color: var(--gold);
  font-family: var(--serif);
  width: 20px;
  text-align: center;
}

.cer-coin-summary-type {
  color: var(--fg-muted);
  font-size: 0.78rem;
}

/* Bottom navigation */
.cer-results-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

.cer-results-nav .cer-btn { min-width: 240px; }

/* Toast notification */
.cer-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gold);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 8px;
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.cer-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .ceremony-content {
    padding: 28px 16px 60px;
  }

  .cer-step-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .cer-step-title {
    font-size: 1.5rem;
  }

  .ceremony-step-dots .dot {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .cer-coin-area {
    padding: 24px 16px;
  }

  .cer-coins {
    gap: 12px;
  }

  .cer-btn {
    width: 100%;
    text-align: center;
  }

  .cer-btn-group {
    flex-direction: column;
    width: 100%;
  }

  .cer-btn-ghost {
    width: 100%;
    text-align: center;
  }

  .cer-lines-review {
    padding: 16px 16px;
  }

  .cer-final-text {
    font-size: 1.3rem;
  }

  .cer-results-summary-top {
    flex-direction: column;
    gap: 4px;
  }

  .cer-results-hex-name {
    font-size: 1.3rem;
  }

  .cer-results-nav .cer-btn {
    min-width: unset;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .ceremony-step-dots {
    gap: 5px;
  }

  .ceremony-step-dots .dot {
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
  }

  .ceremony-step-name {
    font-size: 0.8rem;
  }
}
