/* Bazi template — мобильный блок по центру, китайская тема */

:root {
  --bazi-bg: #2c2418;
  --bazi-parchment: #f4e9d8;
  --bazi-parchment-dark: #e8dcc8;
  --bazi-ink: #3d2e1e;
  --bazi-gold: #b8860b;
  --bazi-gold-light: #d4a84b;
  --bazi-border: #c4a574;
  --bazi-max: 480px;
}

* { box-sizing: border-box; }

body { margin: 0; }

.bazi-page {
  min-height: 100vh;
  background: var(--bazi-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bazi-scroll {
  width: 100%;
  max-width: var(--bazi-max);
  background-color: var(--bazi-parchment);
  color: #1a1510;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px var(--bazi-border),
    0 4px 20px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.3);
  padding: clamp(1.25rem, 4vw, 2rem);
  position: relative;
}

/* Картинка фона с прозрачностью (светлее за счёт parchment под ней) */
.bazi-scroll-bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url('../img/background.png');
  background-size: cover;
  background-position: center;
  opacity: 0.8;
  z-index: 0;
  pointer-events: none;
}
.bazi-scroll > *:not(.bazi-scroll-bg) {
  position: relative;
  z-index: 1;
}

/* Декоративные углы (опционально) */
.bazi-scroll::before,
.bazi-scroll::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--bazi-gold);
  border-style: solid;
  border-width: 0;
  opacity: 0.4;
}
.bazi-scroll::before { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; border-radius: 2px 0 0 0; }
.bazi-scroll::after { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; border-radius: 0 0 2px 0; }

/* Верхний текст как на макете: 3 строки, линии с алмазами */
.bazi-header {
  text-align: center;
  margin-bottom: 1rem;
}

.bazi-title-line1 {
  margin: 0 0 0.15em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a1510;
  line-height: 1.2;
}

.bazi-title-line2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.2em 0 0.25em;
}

.bazi-title-line {
  flex: 1;
  max-width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #1a1510 20%, #1a1510 80%, transparent);
  opacity: 0.8;
}

.bazi-title-diamond {
  font-size: 0.5rem;
  color: #1a1510;
  line-height: 1;
}

.bazi-title-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a1510;
  white-space: nowrap;
}

.bazi-title-line3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 3.5vw, 1.45rem);
  color: #1a1510;
  letter-spacing: 0.02em;
}

.bazi-intro {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.4;
  text-align: center;
  color: #1a1510;
  margin: 15px auto 25px auto;
  font-weight: 500;
  letter-spacing: 0.3px;
  max-width: 420px;
}

/* Картинка автора после intro */
.bazi-author-wrap {
  margin: 0 auto 1.25rem;
  max-width: 240px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.6),
    0 2px 12px rgba(0, 0, 0, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.12);
}
.bazi-author-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  vertical-align: middle;
}

/* Блок о консультанте (только текст под author.png) */
.bazi-consultant {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgb(255 255 255 / 40%);
  border-radius: 8px;
  text-align: left;
}
.bazi-consultant-text,
.bazi-consultant-cta {
  margin: 0 0 0.6em;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #1a1510;
}
.bazi-consultant-cta {
  font-weight: 500;
  margin-bottom: 0;
}

.bazi-form-wrap {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--bazi-border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  overflow: visible;
}

.bazi-form-title {
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1510;
  margin: 0 0 1rem;
  position: relative;
  padding: 0 2rem;
}
.bazi-form-title::before,
.bazi-form-title::after {
  content: '›';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: #1a1510;
  font-weight: 400;
}
.bazi-form-title::before { left: 0; }
.bazi-form-title::after { right: 0; transform: translateY(-50%) scaleX(-1); }

.bazi-form label:not(.bazi-gender-btn) {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: #1a1510;
}

.bazi-form input[type="text"],
.bazi-form input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #a08060;
  border-radius: 6px;
  background: linear-gradient(180deg, #faf6f0 0%, #f4e9d8 100%);
  color: #1a1510;
  margin-bottom: 1rem;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.06);
}

.bazi-form input[type="date"] {
  font-size: 16px; /* предотвращает зум на iOS */
}

.bazi-gender-wrap {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.bazi-gender-wrap input { display: none; }
.bazi-gender-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  border: 1px solid #a08060;
  border-radius: 6px;
  background: linear-gradient(180deg, #faf6f0 0%, #f4e9d8 100%);
  color: #1a1510;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.06);
}
.bazi-gender-wrap input:checked + .bazi-gender-btn {
  background: linear-gradient(180deg, #8b3a3a 0%, #6b2a2a 100%);
  border-color: #5a2020;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.2);
}

.bazi-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(180deg, #5a4030 0%, #3d2a1e 50%, #2c1f14 100%);
  border: 2px solid #b8860b;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(184, 134, 11, 0.5),
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 2px 8px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.bazi-btn::before,
.bazi-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12px;
  height: 2px;
  background: #b8860b;
  transform: translateY(-50%);
}
.bazi-btn::before { left: -14px; }
.bazi-btn::after { right: -14px; }
.bazi-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.bazi-btn:active { transform: translateY(0); }
.bazi-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.bazi-section {
  padding: 1rem 1.25rem;
  background: rgb(255 255 255 / 40%);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.bazi-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
  color: #1a1510;
}

.bazi-section p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
  color: #1a1510;
}

.bazi-medallions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.25rem;
  background: rgb(255 255 255 / 40%);
  border-radius: 8px;
}

.bazi-medallion {
  text-align: center;
}

.bazi-medallion-circle {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--bazi-parchment-dark) 0%, var(--bazi-border) 100%);
  border: 2px solid var(--bazi-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--bazi-gold);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.4), 0 2px 6px rgba(0,0,0,0.15);
}

.bazi-medallion span {
  display: block;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #1a1510;
}

.bazi-disclaimer {
  font-size: 1rem;
  color: #1a1510;
  text-align: center;
  margin: 0 auto 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ffe7a5;
}

.bazi-footer {
  font-size: calc(0.7rem + 2px);
  color: #f5f5f5;
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bazi-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1rem;
  line-height: 1.5;
}
.bazi-footer a {
  color: #f5f5f5;
  text-decoration: none;
}
.bazi-footer a:hover {
  opacity: 0.8;
}

/* Блок результата */
.bazi-result {
  display: none;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--bazi-border);
  border-radius: 6px;
}

.bazi-result.visible { display: block; }

.bazi-result h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  color: var(--bazi-gold);
}

.bazi-result .profile-text {
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: #1a1510;
}

.bazi-error {
  color: #a52a2a;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.bazi-loading { opacity: 0.7; pointer-events: none; }

/* Лоадер: шкала + анализ календарей — поверх всего, в стиле сайта */
.bazi-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(44, 36, 24, 0.88);
  backdrop-filter: blur(12px);
}
.bazi-loader-overlay[hidden] { display: none; }
.bazi-loader-card {
  max-width: 360px;
  width: 100%;
  padding: 2rem 1.5rem;
  background: linear-gradient(160deg, var(--bazi-parchment) 0%, var(--bazi-parchment-dark) 100%);
  border-radius: 20px;
  box-shadow: 0 0 0 1px var(--bazi-border), 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
}
.bazi-loader-status {
  margin: 0 0 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bazi-ink);
  line-height: 1.3;
}
.bazi-loader-bar-wrap {
  height: 8px;
  background: rgba(61, 46, 30, 0.2);
  border-radius: 4px;
  overflow: hidden;
}
.bazi-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--bazi-gold), var(--bazi-gold-light));
  border-radius: 4px;
  transition: width 0.15s ease-out;
}
.bazi-loader-error {
  margin: 0.5rem 0 0;
  color: #a63d3d;
  font-size: 0.9rem;
  display: none;
}
.bazi-loader-close {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  color: var(--bazi-ink);
  background: rgba(196, 165, 116, 0.3);
  border: 1px solid var(--bazi-border);
  border-radius: 8px;
  cursor: pointer;
}
.bazi-loader-close:hover { background: rgba(196, 165, 116, 0.5); }

/* Страница результата */
.bazi-result-page {
  position: relative;
  z-index: 1;
  padding: 0.5rem 0;
}
.bazi-result-back {
  display: inline-block;
  margin-bottom: 1rem;
  color: #1a1510;
  text-decoration: underline;
}
.bazi-result-amulet {
  display: block;
  max-width: 300px;
  height: auto;
  margin: 0 auto 1rem;
}
.bazi-result-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: #1a1510;
  text-align: center;
}
.bazi-result-profile {
  font-size: 1rem;
  line-height: 1.5;
  color: #1a1510;
  background: linear-gradient(145deg, rgb(255 255 255 / 89%) 0%, rgba(184, 134, 11, 0.1) 100%);
  padding: 1.25rem;
  border-radius: 10px;
  border: 2px solid #b8860b8c;
}
.bazi-result-profile-text {
  white-space: pre-wrap;
}
.bazi-result-profile-text strong {
  font-weight: 700;
}
.bazi-result-cta-btn {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, #c0392b 0%, #a93226 50%, #922b21 100%);
  border: 2px solid #e74c3c;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.bazi-result-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.bazi-result-cta-btn:active {
  transform: translateY(0);
}
.bazi-result-cta-btn::before,
.bazi-result-cta-btn::after {
  display: none;
}
